diff options
Diffstat (limited to 'content/fetch.c')
-rw-r--r-- | content/fetch.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/content/fetch.c b/content/fetch.c index 5f6f0015c..bc6b8acc2 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -772,6 +772,36 @@ struct curl_httppost *fetch_post_convert(struct form_successful_control *control } #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 */ |