From c9e188a4d1634d9c7d2292a8d04e02f313f37f3b Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 25 Oct 2003 19:20:13 +0000 Subject: [project @ 2003-10-25 19:20:13 by jmb] HTTP Auth login improved (greatly). Addresses all three issues in the previous version. svn path=/import/netsurf/; revision=382 --- content/fetch.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'content/fetch.c') diff --git a/content/fetch.c b/content/fetch.c index b7f48b506..391aa14d3 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -150,6 +150,7 @@ struct fetch * fetch_start(char *url, char *referer, CURLcode code; CURLMcode codem; xmlURI *uri; + struct login *li; LOG(("fetch %p, url '%s'", fetch, url)); @@ -268,12 +269,11 @@ struct fetch * fetch_start(char *url, char *referer, code = curl_easy_setopt(fetch->curl_handle, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC); assert(code == CURLE_OK); -#ifdef riscos - if (LOGIN.string != NULL) { - code = curl_easy_setopt(fetch->curl_handle, CURLOPT_USERPWD, LOGIN.string); + if ((li=login_list_get(url)) != NULL) { + code = curl_easy_setopt(fetch->curl_handle, CURLOPT_USERPWD, li->logindetails); + assert(code == CURLE_OK); } -#endif /* POST */ if (fetch->post_urlenc) { @@ -545,16 +545,11 @@ bool fetch_process_headers(struct fetch *f) return true; } -#ifdef riscos /* handle HTTP 401 (Authentication errors) */ if (http_code == 401) { - /* this shouldn't be here... */ - ro_gui_401login_open(xstrdup(f->host), xstrdup(f->realm), - xstrdup(f->url)); - f->callback(FETCH_ERROR, f->p, "",0); + f->callback(FETCH_AUTH, f->p, xstrdup(f->realm),0); return true; } -#endif /* handle HTTP errors (non 2xx response codes) */ if (f->only_2xx && strncmp(f->url, "http", 4) == 0 && -- cgit v1.2.3