mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 796192 - A/B test HTTP Pipelining on pre-release channel. r=mcmanus
This commit is contained in:
parent
c3a4630b9e
commit
3ce8119088
@ -868,6 +868,7 @@ pref("network.http.accept-encoding", "gzip, deflate");
|
||||
|
||||
pref("network.http.pipelining" , false);
|
||||
pref("network.http.pipelining.ssl" , false); // disable pipelining over SSL
|
||||
pref("network.http.pipelining.abtest", false);
|
||||
pref("network.http.proxy.pipelining", false);
|
||||
|
||||
// Max number of requests in the pipeline
|
||||
|
@ -138,6 +138,7 @@ nsHttpHandler::nsHttpHandler()
|
||||
, mMaxRequestAttempts(10)
|
||||
, mMaxRequestDelay(10)
|
||||
, mIdleSynTimeout(250)
|
||||
, mPipeliningEnabled(false)
|
||||
, mMaxConnections(24)
|
||||
, mMaxPersistentConnectionsPerServer(2)
|
||||
, mMaxPersistentConnectionsPerProxy(4)
|
||||
@ -201,6 +202,10 @@ nsHttpHandler::~nsHttpHandler()
|
||||
// and it'll segfault. NeckoChild will get cleaned up by process exit.
|
||||
|
||||
nsHttp::DestroyAtomTable();
|
||||
if (mPipelineTestTimer) {
|
||||
mPipelineTestTimer->Cancel();
|
||||
mPipelineTestTimer = nullptr;
|
||||
}
|
||||
|
||||
gHttpHandler = nullptr;
|
||||
}
|
||||
@ -868,6 +873,7 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
||||
mCapabilities |= NS_HTTP_ALLOW_PIPELINING;
|
||||
else
|
||||
mCapabilities &= ~NS_HTTP_ALLOW_PIPELINING;
|
||||
mPipeliningEnabled = cVar;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1186,10 +1192,53 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Test HTTP Pipelining (bug796192)
|
||||
// If experiments are allowed and pipelining is Off,
|
||||
// turn it On for just 10 minutes
|
||||
//
|
||||
if (mAllowExperiments && !mPipeliningEnabled &&
|
||||
PREF_CHANGED(HTTP_PREF("pipelining.abtest"))) {
|
||||
rv = prefs->GetBoolPref(HTTP_PREF("pipelining.abtest"), &cVar);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// If option is enabled, only test for ~1% of sessions
|
||||
if (cVar && !(rand() % 128)) {
|
||||
mCapabilities |= NS_HTTP_ALLOW_PIPELINING;
|
||||
if (mPipelineTestTimer)
|
||||
mPipelineTestTimer->Cancel();
|
||||
mPipelineTestTimer =
|
||||
do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mPipelineTestTimer->InitWithFuncCallback(
|
||||
TimerCallback, this, 10*60*1000, // 10 minutes
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
} else {
|
||||
mCapabilities &= ~NS_HTTP_ALLOW_PIPELINING;
|
||||
if (mPipelineTestTimer) {
|
||||
mPipelineTestTimer->Cancel();
|
||||
mPipelineTestTimer = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef PREF_CHANGED
|
||||
#undef MULTI_PREF_CHANGED
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Static method called by mPipelineTestTimer when it expires.
|
||||
*/
|
||||
void
|
||||
nsHttpHandler::TimerCallback(nsITimer * aTimer, void * aClosure)
|
||||
{
|
||||
nsRefPtr<nsHttpHandler> thisObject = static_cast<nsHttpHandler*>(aClosure);
|
||||
if (!thisObject->mPipeliningEnabled)
|
||||
thisObject->mCapabilities &= ~NS_HTTP_ALLOW_PIPELINING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a C string into that contains a ISO 639 language list
|
||||
* notated with HTTP "q" values for output with a HTTP Accept-Language
|
||||
|
@ -255,6 +255,7 @@ private:
|
||||
|
||||
void NotifyObservers(nsIHttpChannel *chan, const char *event);
|
||||
|
||||
static void TimerCallback(nsITimer * aTimer, void * aClosure);
|
||||
private:
|
||||
|
||||
// cached services
|
||||
@ -289,6 +290,7 @@ private:
|
||||
uint16_t mMaxRequestDelay;
|
||||
uint16_t mIdleSynTimeout;
|
||||
|
||||
bool mPipeliningEnabled;
|
||||
uint16_t mMaxConnections;
|
||||
uint8_t mMaxPersistentConnectionsPerServer;
|
||||
uint8_t mMaxPersistentConnectionsPerProxy;
|
||||
@ -299,6 +301,7 @@ private:
|
||||
bool mPipelineRescheduleOnTimeout;
|
||||
PRIntervalTime mPipelineRescheduleTimeout;
|
||||
PRIntervalTime mPipelineReadTimeout;
|
||||
nsCOMPtr<nsITimer> mPipelineTestTimer;
|
||||
|
||||
uint8_t mRedirectionLimit;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user