This commit is contained in:
morse%netscape.com 1999-06-29 22:34:48 +00:00
Родитель f8f7778a8e
Коммит fadb6fd4e2
3 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -75,6 +75,7 @@ static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
#define pref_cookieBehavior "network.cookie.cookieBehavior" #define pref_cookieBehavior "network.cookie.cookieBehavior"
#define pref_warnAboutCookies "network.cookie.warnAboutCookies" #define pref_warnAboutCookies "network.cookie.warnAboutCookies"
#define pref_scriptName "network.cookie.filterName" #define pref_scriptName "network.cookie.filterName"
#define pref_strictCookieDomains "network.cookie.strictDomains"
#define DEF_COOKIE_BEHAVIOR 0 #define DEF_COOKIE_BEHAVIOR 0
@ -1156,6 +1157,7 @@ net_IntSetCookieString(char * cur_url,
PRBool HG83744 is_domain=FALSE, accept=FALSE; PRBool HG83744 is_domain=FALSE, accept=FALSE;
// MWContextType type; // MWContextType type;
Bool bCookieAdded; Bool bCookieAdded;
PRBool pref_scd = PR_FALSE;
/* Only allow cookies to be set in the listed contexts. We /* Only allow cookies to be set in the listed contexts. We
* don't want cookies being set in html mail. * don't want cookies being set in html mail.
@ -1314,6 +1316,17 @@ net_IntSetCookieString(char * cur_url,
* cookies for the entire .co.nz domain. * cookies for the entire .co.nz domain.
*/ */
/*
* Although this is the right thing to do(tm), it breaks too many sites.
* So only do it if the restrictCookieDomains pref is TRUE.
*
*/
if ( PREF_GetBoolPref(pref_strictCookieDomains, &pref_scd) < 0 ) {
pref_scd = PR_FALSE;
}
if ( pref_scd == PR_TRUE ) {
cur_host[cur_host_length-domain_length] = '\0'; cur_host[cur_host_length-domain_length] = '\0';
dot = XP_STRCHR(cur_host, '.'); dot = XP_STRCHR(cur_host, '.');
cur_host[cur_host_length-domain_length] = '.'; cur_host[cur_host_length-domain_length] = '.';
@ -1327,6 +1340,7 @@ net_IntSetCookieString(char * cur_url,
net_UndeferCookies(); net_UndeferCookies();
return; return;
} }
}
/* all tests passed, copy in domain to hostname field /* all tests passed, copy in domain to hostname field
*/ */

Просмотреть файл

@ -47,6 +47,7 @@
#define pref_mailQuotedStyle "mail.quoted_style" #define pref_mailQuotedStyle "mail.quoted_style"
#define pref_cookieBehavior "network.cookie.cookieBehavior" #define pref_cookieBehavior "network.cookie.cookieBehavior"
#define pref_warnAboutCookies "network.cookie.warnAboutCookies" #define pref_warnAboutCookies "network.cookie.warnAboutCookies"
#define pref_strictCookieDomains "network.cookie.strictDomains"
#define pref_scriptName "network.cookie.filterName" #define pref_scriptName "network.cookie.filterName"
#define pref_goBrowsingEnabled "browser.goBrowsing.enabled" #define pref_goBrowsingEnabled "browser.goBrowsing.enabled"
#define pref_sendRefererHeader "network.sendRefererHeader" #define pref_sendRefererHeader "network.sendRefererHeader"

Просмотреть файл

@ -1144,6 +1144,7 @@ net_IntSetCookieString(MWContext * context,
PRBool HG83744 is_domain=FALSE, accept=FALSE; PRBool HG83744 is_domain=FALSE, accept=FALSE;
MWContextType type; MWContextType type;
Bool bCookieAdded; Bool bCookieAdded;
PRBool pref_scd = PR_FALSE;
if(!context) { if(!context) {
PR_Free(cur_path); PR_Free(cur_path);
@ -1307,6 +1308,17 @@ net_IntSetCookieString(MWContext * context,
* cookies for the entire .co.nz domain. * cookies for the entire .co.nz domain.
*/ */
/*
* Although this is the right thing to do(tm), it breaks too many sites.
* So only do it if the restrictCookieDomains pref is TRUE.
*
*/
if ( PREF_GetBoolPref(pref_strictCookieDomains, &pref_scd) < 0 ) {
pref_scd = PR_FALSE;
}
if ( pref_scd == PR_TRUE ) {
cur_host[cur_host_length-domain_length] = '\0'; cur_host[cur_host_length-domain_length] = '\0';
dot = XP_STRCHR(cur_host, '.'); dot = XP_STRCHR(cur_host, '.');
cur_host[cur_host_length-domain_length] = '.'; cur_host[cur_host_length-domain_length] = '.';
@ -1320,6 +1332,7 @@ net_IntSetCookieString(MWContext * context,
net_UndeferCookies(); net_UndeferCookies();
return; return;
} }
}
/* all tests passed, copy in domain to hostname field /* all tests passed, copy in domain to hostname field
*/ */