bug 790321 - dont coalesce spdy hosts with socks proxy r=honzab

This commit is contained in:
Patrick McManus 2012-10-27 15:24:19 -04:00
Родитель 41cc79266e
Коммит e9c52b0e32
6 изменённых файлов: 62 добавлений и 9 удалений

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

@ -643,13 +643,17 @@ nsProtocolProxyService::CanUseProxy(nsIURI *aURI, int32_t defaultPort)
return true;
}
static const char kProxyType_HTTP[] = "http";
static const char kProxyType_PROXY[] = "proxy";
static const char kProxyType_SOCKS[] = "socks";
static const char kProxyType_SOCKS4[] = "socks4";
static const char kProxyType_SOCKS5[] = "socks5";
static const char kProxyType_DIRECT[] = "direct";
static const char kProxyType_UNKNOWN[] = "unknown";
// kProxyType\* may be referred to externally in
// nsProxyInfo in order to compare by string pointer
namespace mozilla {
const char *kProxyType_HTTP = "http";
const char *kProxyType_PROXY = "proxy";
const char *kProxyType_SOCKS = "socks";
const char *kProxyType_SOCKS4 = "socks4";
const char *kProxyType_SOCKS5 = "socks5";
const char *kProxyType_DIRECT = "direct";
const char *kProxyType_UNKNOWN = "unknown";
}
const char *
nsProtocolProxyService::ExtractProxyInfo(const char *start,

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

@ -10,6 +10,8 @@
// Yes, we support QI to nsProxyInfo
NS_IMPL_THREADSAFE_ISUPPORTS2(nsProxyInfo, nsProxyInfo, nsIProxyInfo)
using namespace mozilla;
NS_IMETHODIMP
nsProxyInfo::GetHost(nsACString &result)
{
@ -68,3 +70,35 @@ nsProxyInfo::SetFailoverProxy(nsIProxyInfo *proxy)
pi.swap(mNext);
return NS_OK;
}
// These pointers are declared in nsProtocolProxyService.cpp and
// comparison of mType by string pointer is valid within necko
namespace mozilla {
extern const char *kProxyType_HTTP;
extern const char *kProxyType_SOCKS;
extern const char *kProxyType_SOCKS4;
extern const char *kProxyType_SOCKS5;
extern const char *kProxyType_DIRECT;
}
bool
nsProxyInfo::IsDirect()
{
if (!mType)
return true;
return mType == kProxyType_DIRECT;
}
bool
nsProxyInfo::IsHTTP()
{
return mType == kProxyType_HTTP;
}
bool
nsProxyInfo::IsSOCKS()
{
return mType == kProxyType_SOCKS ||
mType == kProxyType_SOCKS4 || mType == kProxyType_SOCKS5;
}

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

@ -36,6 +36,10 @@ public:
const char *Type() { return mType; }
uint32_t Flags() { return mFlags; }
bool IsDirect();
bool IsHTTP();
bool IsSOCKS();
private:
friend class nsProtocolProxyService;

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

@ -77,3 +77,11 @@ nsHttpConnectionInfo::Clone() const
return clone;
}
bool
nsHttpConnectionInfo::UsingProxy()
{
if (!mProxyInfo)
return false;
return !mProxyInfo->IsDirect();
}

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

@ -32,7 +32,7 @@ public:
{
LOG(("Creating nsHttpConnectionInfo @%x\n", this));
mUsingHttpProxy = (proxyInfo && !nsCRT::strcmp(proxyInfo->Type(), "http"));
mUsingHttpProxy = (proxyInfo && proxyInfo->IsHTTP());
if (mUsingHttpProxy) {
mUsingConnect = mUsingSSL; // SSL always uses CONNECT
@ -110,6 +110,9 @@ public:
const nsCString &GetHost() { return mHost; }
// Returns true for any kind of proxy (http, socks, etc..)
bool UsingProxy();
private:
nsrefcnt mRef;
nsCString mHashKey;

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

@ -2766,7 +2766,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::OnTransportStatus(nsITransport *trans,
gHttpHandler->IsSpdyEnabled() &&
gHttpHandler->CoalesceSpdy() &&
mEnt && mEnt->mConnInfo && mEnt->mConnInfo->UsingSSL() &&
!mEnt->mConnInfo->UsingHttpProxy() &&
!mEnt->mConnInfo->UsingProxy() &&
mEnt->mCoalescingKey.IsEmpty()) {
PRNetAddr addr;