зеркало из https://github.com/mozilla/pjs.git
fixes bug 194708 "Redirection limit exceeded if https is left out, doesn't follow redirects" r=dougt sr=bryner
This commit is contained in:
Родитель
36ddb38d48
Коммит
f06b78dce2
|
@ -84,6 +84,9 @@ typedef PRUint8 nsHttpVersion;
|
|||
// hard upper limit on the number of requests that can be pipelined
|
||||
#define NS_HTTP_MAX_PIPELINED_REQUESTS 8
|
||||
|
||||
#define NS_HTTP_DEFAULT_PORT 80
|
||||
#define NS_HTTPS_DEFAULT_PORT 443
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// http atoms...
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -928,7 +928,7 @@ nsHttpChannel::OpenCacheEntry(PRBool offline, PRBool *delayed)
|
|||
storagePolicy = nsICache::STORE_ANYWHERE; // allow on disk
|
||||
nsCOMPtr<nsICacheSession> session;
|
||||
rv = gHttpHandler->GetCacheSession(storagePolicy,
|
||||
getter_AddRefs(session));
|
||||
getter_AddRefs(session));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Set the desired cache access mode accordingly...
|
||||
|
@ -1600,7 +1600,6 @@ nsHttpChannel::ProcessRedirection(PRUint32 redirectType)
|
|||
// close down this transaction (null if processing a cached redirect)
|
||||
if (mTransaction)
|
||||
gHttpHandler->CancelTransaction(mTransaction, NS_BINDING_REDIRECTED);
|
||||
//mTransaction->Cancel(NS_BINDING_REDIRECTED);
|
||||
|
||||
// disconnect from our listener
|
||||
mListener = 0;
|
||||
|
@ -1645,7 +1644,6 @@ nsHttpChannel::ProcessAuthentication(PRUint32 httpStatus)
|
|||
|
||||
// kill off the current transaction
|
||||
gHttpHandler->CancelTransaction(mTransaction, NS_BINDING_REDIRECTED);
|
||||
//mTransaction->Cancel(NS_BINDING_REDIRECTED);
|
||||
mPrevTransaction = mTransaction;
|
||||
mPrevTransactionPump = mTransactionPump;
|
||||
mTransaction = nsnull;
|
||||
|
@ -2998,7 +2996,7 @@ nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
|
|||
// if the request is for something we no longer reference, then simply
|
||||
// drop this event.
|
||||
if ((request != mTransactionPump) && (request != mCachePump)) {
|
||||
NS_WARNING("got stale request... why wasn't it cancelled?");
|
||||
NS_NOTREACHED("got stale request... why wasn't it cancelled?");
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ nsHttpConnectionInfo::SetOriginServer(const nsACString &host, PRInt32 port)
|
|||
nsPrintfCString(":%d", keyPort));
|
||||
|
||||
if (mUsingHttpProxy)
|
||||
mHashKey.SetCharAt(0, 'P');
|
||||
mHashKey.SetCharAt('P', 0);
|
||||
if (mUsingSSL)
|
||||
mHashKey.SetCharAt(1, 'S');
|
||||
mHashKey.SetCharAt('S', 1);
|
||||
|
||||
// NOTE: for transparent proxies (e.g., SOCKS) we need to encode the proxy
|
||||
// type in the hash key (this ensures that we will continue to speak the
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
nsIProxyInfo *ProxyInfo() { return mProxyInfo; }
|
||||
PRBool UsingHttpProxy() const { return mUsingHttpProxy; }
|
||||
PRBool UsingSSL() const { return mUsingSSL; }
|
||||
PRInt32 DefaultPort() const { return mUsingSSL ? 443 : 80; }
|
||||
PRInt32 DefaultPort() const { return mUsingSSL ? NS_HTTPS_DEFAULT_PORT : NS_HTTP_DEFAULT_PORT; }
|
||||
|
||||
private:
|
||||
nsrefcnt mRef;
|
||||
|
|
|
@ -95,6 +95,31 @@ static NS_DEFINE_CID(kSocketProviderServiceCID, NS_SOCKETPROVIDERSERVICE_CID);
|
|||
#define UA_PREF(_pref) UA_PREF_PREFIX _pref
|
||||
#define HTTP_PREF(_pref) HTTP_PREF_PREFIX _pref
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static nsresult
|
||||
NewURI(const nsACString &aSpec,
|
||||
const char *aCharset,
|
||||
nsIURI *aBaseURI,
|
||||
PRInt32 aDefaultPort,
|
||||
nsIURI **aURI)
|
||||
{
|
||||
nsStandardURL *url = new nsStandardURL();
|
||||
if (!url)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(url);
|
||||
|
||||
nsresult rv = url->Init(nsIStandardURL::URLTYPE_AUTHORITY,
|
||||
aDefaultPort, aSpec, aCharset, aBaseURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aURI = url; // no QI needed
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsHttpHandler <public>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -119,10 +144,6 @@ nsHttpHandler::nsHttpHandler()
|
|||
, mRedirectionLimit(10)
|
||||
, mLastUniqueID(NowInSeconds())
|
||||
, mSessionStartTime(0)
|
||||
//, mActiveConnections(0)
|
||||
//, mIdleConnections(0)
|
||||
//, mTransactionQ(0)
|
||||
//, mConnectionLock(nsnull)
|
||||
, mUserAgentIsDirty(PR_TRUE)
|
||||
, mUseCache(PR_TRUE)
|
||||
, mSendSecureXSiteReferrer(PR_TRUE)
|
||||
|
@ -168,10 +189,6 @@ nsHttpHandler::Init()
|
|||
return rv;
|
||||
}
|
||||
|
||||
//mConnectionLock = PR_NewLock();
|
||||
//if (!mConnectionLock)
|
||||
// return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
InitUserAgentComponents();
|
||||
|
||||
// monitor some preference changes
|
||||
|
@ -1331,7 +1348,7 @@ nsHttpHandler::GetScheme(nsACString &aScheme)
|
|||
NS_IMETHODIMP
|
||||
nsHttpHandler::GetDefaultPort(PRInt32 *result)
|
||||
{
|
||||
*result = 80;
|
||||
*result = NS_HTTP_DEFAULT_PORT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1348,24 +1365,8 @@ nsHttpHandler::NewURI(const nsACString &aSpec,
|
|||
nsIURI *aBaseURI,
|
||||
nsIURI **aURI)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
LOG(("nsHttpHandler::NewURI\n"));
|
||||
|
||||
nsCOMPtr<nsIStandardURL> url;
|
||||
NS_NEWXPCOM(url, nsStandardURL);
|
||||
if (!url)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// use the correct default port
|
||||
PRInt32 defaultPort;
|
||||
GetDefaultPort(&defaultPort);
|
||||
|
||||
rv = url->Init(nsIStandardURL::URLTYPE_AUTHORITY,
|
||||
defaultPort, aSpec, aCharset, aBaseURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return CallQueryInterface(url, aURI);
|
||||
return ::NewURI(aSpec, aCharset, aBaseURI, NS_HTTP_DEFAULT_PORT, aURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1698,7 +1699,7 @@ nsHttpsHandler::GetScheme(nsACString &aScheme)
|
|||
NS_IMETHODIMP
|
||||
nsHttpsHandler::GetDefaultPort(PRInt32 *aPort)
|
||||
{
|
||||
*aPort = 443;
|
||||
*aPort = NS_HTTPS_DEFAULT_PORT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1714,7 +1715,7 @@ nsHttpsHandler::NewURI(const nsACString &aSpec,
|
|||
nsIURI *aBaseURI,
|
||||
nsIURI **_retval)
|
||||
{
|
||||
return gHttpHandler->NewURI(aSpec, aOriginCharset, aBaseURI, _retval);
|
||||
return ::NewURI(aSpec, aOriginCharset, aBaseURI, NS_HTTPS_DEFAULT_PORT, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче