Less broken WWW-Authenticate header parser

svn path=/trunk/netsurf/; revision=12542
This commit is contained in:
John Mark Bell 2011-06-29 23:32:53 +00:00
parent 8577895dc1
commit a5dc6b9e66

View File

@ -1083,18 +1083,18 @@ size_t fetch_curl_header(char *data, size_t size, size_t nmemb,
i++;
if (i < (int) size) {
size_t end = i;
while (end < size && data[end] != '"')
++end;
if (end < size) {
free(f->realm);
f->realm = malloc(size - i + 1);
f->realm = malloc(end - i + 1);
if (f->realm != NULL) {
strncpy(f->realm, data + i, size - i);
f->realm[size - i] = '\0';
for (i = size - i - 1; i >= 0 &&
(f->realm[i] == ' ' ||
f->realm[i] == '"' ||
f->realm[i] == '\t' ||
f->realm[i] == '\r' ||
f->realm[i] == '\n'); --i)
f->realm[i] = '\0';
strncpy(f->realm, data + i, end - i);
f->realm[end - i] = '\0';
}
}
}
} else if (11 < size && strncasecmp(data, "Set-Cookie:", 11) == 0) {