mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 12:36:51 +03:00
Less broken WWW-Authenticate header parser
svn path=/trunk/netsurf/; revision=12542
This commit is contained in:
parent
8577895dc1
commit
a5dc6b9e66
@ -1083,18 +1083,18 @@ size_t fetch_curl_header(char *data, size_t size, size_t nmemb,
|
|||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (i < (int) size) {
|
if (i < (int) size) {
|
||||||
free(f->realm);
|
size_t end = i;
|
||||||
f->realm = malloc(size - i + 1);
|
|
||||||
if (f->realm != NULL) {
|
while (end < size && data[end] != '"')
|
||||||
strncpy(f->realm, data + i, size - i);
|
++end;
|
||||||
f->realm[size - i] = '\0';
|
|
||||||
for (i = size - i - 1; i >= 0 &&
|
if (end < size) {
|
||||||
(f->realm[i] == ' ' ||
|
free(f->realm);
|
||||||
f->realm[i] == '"' ||
|
f->realm = malloc(end - i + 1);
|
||||||
f->realm[i] == '\t' ||
|
if (f->realm != NULL) {
|
||||||
f->realm[i] == '\r' ||
|
strncpy(f->realm, data + i, end - i);
|
||||||
f->realm[i] == '\n'); --i)
|
f->realm[end - i] = '\0';
|
||||||
f->realm[i] = '\0';
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (11 < size && strncasecmp(data, "Set-Cookie:", 11) == 0) {
|
} else if (11 < size && strncasecmp(data, "Set-Cookie:", 11) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user