Fixes bug 84794 (part 1) "Problem with HTTP basic authentication and cookies"

r=gagan, sr=dougt, a=chofmann
This commit is contained in:
darin%netscape.com 2001-06-22 01:42:56 +00:00
parent f56b233bda
commit 8bdc6dcede

View File

@ -377,6 +377,10 @@ nsHttpChannel::ProcessResponse()
LOG(("nsHttpChannel::ProcessResponse [this=%x httpStatus=%u]\n",
this, httpStatus));
// notify nsIHttpNotify implementations
rv = nsHttpHandler::get()->OnExamineResponse(this);
NS_ASSERTION(NS_SUCCEEDED(rv), "OnExamineResponse failed");
// handle different server response categories
switch (httpStatus) {
case 200:
@ -449,10 +453,6 @@ nsHttpChannel::ProcessNormal()
mResponseHead->SetHeader(nsHttp::Content_Encoding, nsnull);
}
// notify nsIHttpNotify implementations
rv = nsHttpHandler::get()->OnExamineResponse(this);
NS_ASSERTION(NS_SUCCEEDED(rv), "OnExamineResponse failed");
rv = mListener->OnStartRequest(this, mListenerContext);
if (NS_FAILED(rv)) return rv;
@ -505,9 +505,6 @@ nsHttpChannel::ProcessNotModified()
mPrevTransaction = mTransaction;
mTransaction = nsnull;
// notify nsIHttpNotify implementations as response headers may have changed
nsHttpHandler::get()->OnExamineResponse(this);
mCachedContentIsValid = PR_TRUE;
return ReadFromCache();
}
@ -1040,9 +1037,6 @@ nsHttpChannel::ProcessRedirection(PRUint32 redirectType)
if (!location)
return NS_ERROR_FAILURE;
// notify nsIHttpNotify implementations before this channel goes away
nsHttpHandler::get()->OnExamineResponse(this);
LOG(("redirecting to: %s\n", location));
nsresult rv;
@ -1173,6 +1167,12 @@ nsHttpChannel::ProcessAuthentication(PRUint32 httpStatus)
mPrevTransaction = mTransaction;
mTransaction = nsnull;
// notify nsIHttpNotify implementations.. the server response could
// have included cookies that must be sent with this authentication
// attempt (bug 84794).
rv = nsHttpHandler::get()->OnModifyRequest(this);
NS_ASSERTION(NS_SUCCEEDED(rv), "OnModifyRequest failed");
// and create a new one...
rv = SetupTransaction();
if (NS_FAILED(rv)) return rv;
@ -2033,9 +2033,8 @@ nsHttpChannel::SetResponseHeader(const char *header, const char *value)
return NS_ERROR_NOT_AVAILABLE;
nsresult rv = mResponseHead->SetHeader(atom, value);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
rv = nsHttpHandler::get()->OnExamineResponse(this);
}
return rv;
}