diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-06-24 10:31:13 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-06-24 10:31:13 +0100 |
commit | 73e45ff0246c2624b890bbbec0367eb1c450eec3 (patch) | |
tree | 644cbeeabe43a3b86c82bbbe8b722084c1c8f856 /content/fetch.c | |
parent | 5bd7606103182a824b530a24a1f4753e04c145ec (diff) | |
download | netsurf-73e45ff0246c2624b890bbbec0367eb1c450eec3.tar.gz netsurf-73e45ff0246c2624b890bbbec0367eb1c450eec3.tar.bz2 |
Fix error reporting from fetch_start
Any fetch start error was being reported as "out of memory" which was
clearly insufficient. Foe example bad urls (reported was file:// with
a missing /) were causing a warn_user with out of memory. This change
now at least causes a "bad url" message.
Diffstat (limited to 'content/fetch.c')
-rw-r--r-- | content/fetch.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/content/fetch.c b/content/fetch.c index 9e0bb255e..2307676d3 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -437,7 +437,7 @@ nserror fetcher_fdset(fd_set *read_fd_set, } /* exported interface documented in content/fetch.h */ -struct fetch * +nserror fetch_start(nsurl *url, nsurl *referer, fetch_callback callback, @@ -447,7 +447,8 @@ fetch_start(nsurl *url, const struct fetch_multipart_data *post_multipart, bool verifiable, bool downgrade_tls, - const char *headers[]) + const char *headers[], + struct fetch **fetch_out) { struct fetch *fetch; lwc_string *scheme; @@ -455,7 +456,7 @@ fetch_start(nsurl *url, fetch = malloc(sizeof (*fetch)); if (fetch == NULL) { - return NULL; + return NSERROR_NOMEM; } /* The URL we're fetching must have a scheme */ @@ -467,7 +468,7 @@ fetch_start(nsurl *url, if (fetch->fetcherd == -1) { lwc_string_unref(scheme); free(fetch); - return NULL; + return NSERROR_NO_FETCH_HANDLER; } FETCH_LOG("fetch %p, url '%s'", fetch, nsurl_access(url)); @@ -547,7 +548,11 @@ fetch_start(nsurl *url, free(fetch); - return NULL; + + /** \todo The fetchers setup should return nserror and that be + * passed back rather than assuming a bad url + */ + return NSERROR_BAD_URL; } /* Rah, got it, so ref the fetcher. */ @@ -563,7 +568,8 @@ fetch_start(nsurl *url, guit->browser->schedule(10, fetcher_poll, NULL); } - return fetch; + *fetch_out = fetch; + return NSERROR_OK; } /* exported interface documented in content/fetch.h */ |