mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
[project @ 2004-04-02 13:51:13 by bursa]
Implement fetch_can_fetch(). svn path=/import/netsurf/; revision=699
This commit is contained in:
parent
9454b8bca1
commit
27562bf838
@ -772,6 +772,36 @@ struct curl_httppost *fetch_post_convert(struct form_successful_control *control
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a URL's scheme can be fetched.
|
||||||
|
*
|
||||||
|
* \param url URL to check
|
||||||
|
* \return true if the scheme is supported
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool fetch_can_fetch(const char *url)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
const char *semi;
|
||||||
|
unsigned int len;
|
||||||
|
curl_version_info_data *data;
|
||||||
|
|
||||||
|
semi = strchr(url, ':');
|
||||||
|
if (!semi)
|
||||||
|
return false;
|
||||||
|
len = semi - url;
|
||||||
|
|
||||||
|
data = curl_version_info(CURLVERSION_NOW);
|
||||||
|
|
||||||
|
for (i = 0; data->protocols[i]; i++)
|
||||||
|
if (strlen(data->protocols[i]) == len &&
|
||||||
|
strncasecmp(url, data->protocols[i], len) == 0)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testing framework
|
* testing framework
|
||||||
*/
|
*/
|
||||||
|
@ -51,5 +51,6 @@ void fetch_poll(void);
|
|||||||
void fetch_quit(void);
|
void fetch_quit(void);
|
||||||
const char *fetch_filetype(const char *unix_path);
|
const char *fetch_filetype(const char *unix_path);
|
||||||
char *fetch_mimetype(const char *ro_path);
|
char *fetch_mimetype(const char *ro_path);
|
||||||
|
bool fetch_can_fetch(const char *url);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user