Author: jmb
Date: Tue Nov 3 01:03:07 2009
New Revision: 9659
URL:
http://source.netsurf-browser.org?rev=9659&view=rev
Log:
Realm may be NULL iff there's no WWW-Authenticate header served up with a 401.
Default the realm to the fetch URL in this case. Fixes #2890933
Note for new cache implementation (which is actually capable of utilising response bodies
in this situation): if there is no WWW-Authenticate header, serve up the response body
immediately -- don't present an authentication dialogue.
Modified:
trunk/netsurf/content/fetchcache.c
Modified: trunk/netsurf/content/fetchcache.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/content/fetchcache.c?rev=...
==============================================================================
--- trunk/netsurf/content/fetchcache.c (original)
+++ trunk/netsurf/content/fetchcache.c Tue Nov 3 01:03:07 2009
@@ -1147,8 +1147,12 @@
char *headers = NULL;
/* Preconditions */
- assert(c && realm);
+ assert(c);
assert(c->status == CONTENT_STATUS_TYPE_UNKNOWN);
+ /* Realm may be NULL iff there was no WWW-Authenticate header
+ * Use the content's URL as the realm in this case */
+ if (realm == NULL)
+ realm = c->url;
/* Extract fetch details */
ref = fetch_get_referer(c->fetch);
@@ -1179,7 +1183,7 @@
if (auth == NULL || c->tried_with_auth) {
/* No authentication details or we tried what we had, so ask
* our client for them. */
- c->tried_with_auth = false; /* Allow rety. */
+ c->tried_with_auth = false; /* Allow retry. */
c->status = CONTENT_STATUS_ERROR;
msg_data.auth_realm = realm;