From 07309888d66c608977b31955215503dc355c7d33 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 27 Nov 2011 14:14:36 +0000 Subject: return; Fix bug #3442642: allow scheme-specific fetchers to have a say in whether an URL can be fetched. svn path=/trunk/netsurf/; revision=13182 --- content/fetchers/about.c | 6 ++++++ content/fetchers/curl.c | 6 ++++++ content/fetchers/data.c | 6 ++++++ content/fetchers/file.c | 6 ++++++ content/fetchers/resource.c | 6 ++++++ 5 files changed, 30 insertions(+) (limited to 'content/fetchers') diff --git a/content/fetchers/about.c b/content/fetchers/about.c index 402bb40bf..9b6ec88db 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -669,6 +669,11 @@ static void fetch_about_finalise(lwc_string *scheme) } } +static bool fetch_about_can_fetch(const nsurl *url) +{ + return true; +} + /** callback to set up a about fetch context. */ static void * fetch_about_setup(struct fetch *fetchh, @@ -792,6 +797,7 @@ void fetch_about_register(void) fetch_add_fetcher(scheme, fetch_about_initialise, + fetch_about_can_fetch, fetch_about_setup, fetch_about_start, fetch_about_abort, diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c index 09bfbdd00..be2b6c806 100644 --- a/content/fetchers/curl.c +++ b/content/fetchers/curl.c @@ -113,6 +113,7 @@ static char fetch_proxy_userpwd[100]; /**< Proxy authentication details. */ static bool fetch_curl_initialise(lwc_string *scheme); static void fetch_curl_finalise(lwc_string *scheme); +static bool fetch_curl_can_fetch(const nsurl *url); static void * fetch_curl_setup(struct fetch *parent_fetch, nsurl *url, bool only_2xx, const char *post_urlenc, const struct fetch_multipart_data *post_multipart, @@ -252,6 +253,7 @@ void fetch_curl_register(void) if (!fetch_add_fetcher(scheme, fetch_curl_initialise, + fetch_curl_can_fetch, fetch_curl_setup, fetch_curl_start, fetch_curl_abort, @@ -318,6 +320,10 @@ void fetch_curl_finalise(lwc_string *scheme) } } +bool fetch_curl_can_fetch(const nsurl *url) +{ + return nsurl_enquire(url, NSURL_HOST); +} /** * Start fetching data for the given URL. diff --git a/content/fetchers/data.c b/content/fetchers/data.c index bc2349733..80b48b0e4 100644 --- a/content/fetchers/data.c +++ b/content/fetchers/data.c @@ -75,6 +75,11 @@ static void fetch_data_finalise(lwc_string *scheme) curl_easy_cleanup(curl); } +static bool fetch_data_can_fetch(const nsurl *url) +{ + return true; +} + static void *fetch_data_setup(struct fetch *parent_fetch, nsurl *url, bool only_2xx, const char *post_urlenc, const struct fetch_multipart_data *post_multipart, @@ -330,6 +335,7 @@ void fetch_data_register(void) fetch_add_fetcher(scheme, fetch_data_initialise, + fetch_data_can_fetch, fetch_data_setup, fetch_data_start, fetch_data_abort, diff --git a/content/fetchers/file.c b/content/fetchers/file.c index f30637c87..e3bb63ea8 100644 --- a/content/fetchers/file.c +++ b/content/fetchers/file.c @@ -112,6 +112,11 @@ static void fetch_file_finalise(lwc_string *scheme) { } +static bool fetch_file_can_fetch(const nsurl *url) +{ + return true; +} + /** callback to set up a file fetch context. */ static void * fetch_file_setup(struct fetch *fetchh, @@ -645,6 +650,7 @@ void fetch_file_register(void) fetch_add_fetcher(scheme, fetch_file_initialise, + fetch_file_can_fetch, fetch_file_setup, fetch_file_start, fetch_file_abort, diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c index d46d377dc..dc6fd8c72 100644 --- a/content/fetchers/resource.c +++ b/content/fetchers/resource.c @@ -219,6 +219,11 @@ static void fetch_resource_finalise(lwc_string *scheme) } } +static bool fetch_resource_can_fetch(const nsurl *url) +{ + return true; +} + /** callback to set up a resource fetch context. */ static void * fetch_resource_setup(struct fetch *fetchh, @@ -350,6 +355,7 @@ void fetch_resource_register(void) fetch_add_fetcher(scheme, fetch_resource_initialise, + fetch_resource_can_fetch, fetch_resource_setup, fetch_resource_start, fetch_resource_abort, -- cgit v1.2.3