Bug 195996 unable to login to Schwab account

patch by dwitte@stanford.edu r=danm sr=darin
This commit is contained in:
timeless%mozdev.org 2003-03-07 02:54:09 +00:00
Родитель 94da3c6af6
Коммит 405417d01c
1 изменённых файлов: 21 добавлений и 16 удалений

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

@ -218,14 +218,8 @@ cookie_LogFailure(PRBool set_cookie, nsIURI * curURL, const char *cookieString,
PR_LOG(gCookieLog, PR_LOG_WARNING,("\n")); PR_LOG(gCookieLog, PR_LOG_WARNING,("\n"));
} }
// inline wrapper to make passing in nsAStrings easier
PRIVATE inline void
cookie_LogFailure(PRBool set_cookie, nsIURI * curURL, const nsAFlatCString &cookieString, const char *reason) {
cookie_LogFailure(set_cookie, curURL, cookieString.get(), reason);
}
PRIVATE void PRIVATE void
cookie_LogSuccess(PRBool set_cookie, nsIURI * curURL, const nsAFlatCString &cookieString, cookie_CookieStruct * cookie) { cookie_LogSuccess(PRBool set_cookie, nsIURI * curURL, const char *cookieString, cookie_CookieStruct * cookie) {
if (!gCookieLog) { if (!gCookieLog) {
gCookieLog = PR_NewLogModule("cookie"); gCookieLog = PR_NewLogModule("cookie");
} }
@ -235,7 +229,7 @@ cookie_LogSuccess(PRBool set_cookie, nsIURI * curURL, const nsAFlatCString &cook
PR_LOG(gCookieLog, PR_LOG_DEBUG, PR_LOG(gCookieLog, PR_LOG_DEBUG,
("%s%s%s\n", "===== ", set_cookie ? "COOKIE ACCEPTED" : "COOKIE SENT", " =====")); ("%s%s%s\n", "===== ", set_cookie ? "COOKIE ACCEPTED" : "COOKIE SENT", " ====="));
PR_LOG(gCookieLog, PR_LOG_DEBUG,("request URL: %s\n", spec.get())); PR_LOG(gCookieLog, PR_LOG_DEBUG,("request URL: %s\n", spec.get()));
PR_LOG(gCookieLog, PR_LOG_DEBUG,("cookie string: %s\n", cookieString.get())); PR_LOG(gCookieLog, PR_LOG_DEBUG,("cookie string: %s\n", cookieString));
time_t curTime = get_current_time(); time_t curTime = get_current_time();
PR_LOG(gCookieLog, PR_LOG_DEBUG,("current time (gmt): %s", asctime(gmtime(&curTime)))); PR_LOG(gCookieLog, PR_LOG_DEBUG,("current time (gmt): %s", asctime(gmtime(&curTime))));
@ -251,6 +245,17 @@ cookie_LogSuccess(PRBool set_cookie, nsIURI * curURL, const nsAFlatCString &cook
} }
PR_LOG(gCookieLog, PR_LOG_DEBUG,("\n")); PR_LOG(gCookieLog, PR_LOG_DEBUG,("\n"));
} }
// inline wrappers to make passing in nsAStrings easier
PRIVATE inline void
cookie_LogFailure(PRBool set_cookie, nsIURI * curURL, const nsAFlatCString &cookieString, const char *reason) {
cookie_LogFailure(set_cookie, curURL, cookieString.get(), reason);
}
PRIVATE inline void
cookie_LogSuccess(PRBool set_cookie, nsIURI * curURL, const nsAFlatCString &cookieString, cookie_CookieStruct * cookie) {
cookie_LogSuccess(set_cookie, curURL, cookieString.get(), cookie);
}
#else #else
#define COOKIE_LOGFAILURE(a, b, c, d) /* nothing */ #define COOKIE_LOGFAILURE(a, b, c, d) /* nothing */
#define COOKIE_LOGSUCCESS(a, b, c, d) /* nothing */ #define COOKIE_LOGSUCCESS(a, b, c, d) /* nothing */
@ -1153,10 +1158,16 @@ cookie_Count(const nsAFlatCString &host) {
* this via COOKIE_SetCookieStringFromHttp. * this via COOKIE_SetCookieStringFromHttp.
*/ */
PRIVATE void PRIVATE void
cookie_SetCookieString(nsIURI *curURL, nsIPrompt *aPrompter, const nsAFlatCString &setCookieHeader, cookie_SetCookieString(nsIURI *curURL, nsIPrompt *aPrompter, const char *setCookieHeader,
cookie_CookieStruct *aCookie, time_t timeToExpire, nsIHttpChannel *aHttpChannel, cookie_CookieStruct *aCookie, time_t timeToExpire, nsIHttpChannel *aHttpChannel,
nsCookieStatus status) nsCookieStatus status)
{ {
// reject cookie if it's over the size limit, per RFC2109
if ((aCookie->name.Length() + aCookie->cookie.Length()) > MAX_BYTES_PER_COOKIE) {
COOKIE_LOGFAILURE(SET_COOKIE, curURL, setCookieHeader, "cookie too big (> 4kb)");
return;
}
nsCAutoString cur_host, cur_path; nsCAutoString cur_host, cur_path;
nsresult rv; nsresult rv;
rv = curURL->GetHost(cur_host); rv = curURL->GetHost(cur_host);
@ -1580,12 +1591,6 @@ COOKIE_SetCookieStringFromHttp(nsIURI * curURL, nsIURI * firstURL, nsIPrompt *aP
// switch to a nice string type now // switch to a nice string type now
nsDependentCString cookieHeader(setCookieHeader); nsDependentCString cookieHeader(setCookieHeader);
// reject cookie if it's over the size limit, per RFC2109
if (cookieHeader.Length() > MAX_BYTES_PER_COOKIE) {
COOKIE_LOGFAILURE(SET_COOKIE, curURL, setCookieHeader, "cookie too big (> 4kb)");
return;
}
/* If the outputFormat is not PRESENT (the url is not going to the screen), and not /* If the outputFormat is not PRESENT (the url is not going to the screen), and not
* SAVE AS (shift-click) then * SAVE AS (shift-click) then
* the cookie being set is defined as inline so we need to do what the user wants us * the cookie being set is defined as inline so we need to do what the user wants us
@ -1680,7 +1685,7 @@ COOKIE_SetCookieStringFromHttp(nsIURI * curURL, nsIURI * firstURL, nsIPrompt *aP
} }
// call the main cookie processing function // call the main cookie processing function
cookie_SetCookieString(curURL, aPrompter, cookieHeader, cookieAttributes, cookie_SetCookieString(curURL, aPrompter, setCookieHeader, cookieAttributes,
gmtCookieExpires, aHttpChannel, status); gmtCookieExpires, aHttpChannel, status);
// we're finished with attributes - data has been copied, if required // we're finished with attributes - data has been copied, if required