зеркало из https://github.com/mozilla/gecko-dev.git
bug 138489, allow for space in cookie domain attribute, r=sgehani, sr=alecf
This commit is contained in:
Родитель
a035ec8c53
Коммит
cdf7b04f26
|
@ -1195,17 +1195,23 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCook
|
||||||
/* look for a domain */
|
/* look for a domain */
|
||||||
ptr = PL_strcasestr(semi_colon, "domain=");
|
ptr = PL_strcasestr(semi_colon, "domain=");
|
||||||
if(ptr) {
|
if(ptr) {
|
||||||
|
ptr += 7; // get past the "domain="
|
||||||
char *domain_from_header=nsnull;
|
char *domain_from_header=nsnull;
|
||||||
char *dot, *colon;
|
char *dot, *colon;
|
||||||
int domain_length, cur_host_length;
|
int domain_length, cur_host_length;
|
||||||
|
|
||||||
|
/* remove leading spaces, else the dot-forcing below will put a dot before the space */
|
||||||
|
while (nsString::IsSpace(*ptr)) {
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate more than we need */
|
/* allocate more than we need */
|
||||||
nsCAutoString domain;
|
nsCAutoString domain;
|
||||||
if (*(ptr+7) != '.' && !cookie_IsIPAddress(cur_host.get())) {
|
if (*ptr != '.' && !cookie_IsIPAddress(cur_host.get())) {
|
||||||
// if host is not an IP address, force domain name to start with a dot
|
// if host is not an IP address, force domain name to start with a dot
|
||||||
domain = '.';
|
domain = '.';
|
||||||
}
|
}
|
||||||
domain.Append(ptr+7);
|
domain.Append(ptr);
|
||||||
|
|
||||||
domain.CompressWhitespace();
|
domain.CompressWhitespace();
|
||||||
CKutil_StrAllocCopy(domain_from_header, domain.get());
|
CKutil_StrAllocCopy(domain_from_header, domain.get());
|
||||||
|
|
Загрузка…
Ссылка в новой задаче