Skip to content

Commit b5e625f

Browse files
committed
Bug 1052909 - Remove network.websocket.auto-follow-http-redirects pref r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D189875
1 parent d375fd9 commit b5e625f

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

modules/libpref/init/all.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,9 +1309,6 @@ pref("network.sts.pollable_event_timeout", 6);
13091309
// 2147483647 == PR_INT32_MAX == ~2 GB
13101310
pref("network.websocket.max-message-size", 2147483647);
13111311

1312-
// Should we automatically follow http 3xx redirects during handshake
1313-
pref("network.websocket.auto-follow-http-redirects", false);
1314-
13151312
// the number of seconds to wait for websocket connection to be opened
13161313
pref("network.websocket.timeout.open", 20);
13171314

netwerk/protocol/websocket/WebSocketChannel.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,6 @@ WebSocketChannel::WebSocketChannel()
11491149
mInnerWindowID(0),
11501150
mGotUpgradeOK(0),
11511151
mRecvdHttpUpgradeTransport(0),
1152-
mAutoFollowRedirects(0),
11531152
mAllowPMCE(1),
11541153
mPingOutstanding(0),
11551154
mReleaseOnTransmit(0),
@@ -3168,20 +3167,17 @@ WebSocketChannel::AsyncOnChannelRedirect(
31683167
// newuri is expected to be http or https
31693168
bool newuriIsHttps = newuri->SchemeIs("https");
31703169

3171-
if (!mAutoFollowRedirects) {
3172-
// Even if redirects configured off, still allow them for HTTP Strict
3173-
// Transport Security (from ws://FOO to https://FOO (mapped to wss://FOO)
3174-
3175-
if (!(flags & (nsIChannelEventSink::REDIRECT_INTERNAL |
3176-
nsIChannelEventSink::REDIRECT_STS_UPGRADE))) {
3177-
nsAutoCString newSpec;
3178-
rv = newuri->GetSpec(newSpec);
3179-
NS_ENSURE_SUCCESS(rv, rv);
3170+
// allow insecure->secure redirects for HTTP Strict Transport Security (from
3171+
// ws://FOO to https://FOO (mapped to wss://FOO)
3172+
if (!(flags & (nsIChannelEventSink::REDIRECT_INTERNAL |
3173+
nsIChannelEventSink::REDIRECT_STS_UPGRADE))) {
3174+
nsAutoCString newSpec;
3175+
rv = newuri->GetSpec(newSpec);
3176+
NS_ENSURE_SUCCESS(rv, rv);
31803177

3181-
LOG(("WebSocketChannel: Redirect to %s denied by configuration\n",
3182-
newSpec.get()));
3183-
return NS_ERROR_FAILURE;
3184-
}
3178+
LOG(("WebSocketChannel: Redirect to %s denied by configuration\n",
3179+
newSpec.get()));
3180+
return NS_ERROR_FAILURE;
31853181
}
31863182

31873183
if (mEncrypted && !newuriIsHttps) {
@@ -3455,11 +3451,6 @@ WebSocketChannel::AsyncOpenNative(nsIURI* aURI, const nsACString& aOrigin,
34553451
if (NS_SUCCEEDED(rv)) {
34563452
mAllowPMCE = boolpref ? 1 : 0;
34573453
}
3458-
rv = prefService->GetBoolPref(
3459-
"network.websocket.auto-follow-http-redirects", &boolpref);
3460-
if (NS_SUCCEEDED(rv)) {
3461-
mAutoFollowRedirects = boolpref ? 1 : 0;
3462-
}
34633454
rv = prefService->GetIntPref("network.websocket.max-connections", &intpref);
34643455
if (NS_SUCCEEDED(rv)) {
34653456
mMaxConcurrentConnections = clamped(intpref, 1, 0xffff);

netwerk/protocol/websocket/WebSocketChannel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ class WebSocketChannel : public BaseWebSocketChannel,
281281
// following members are accessed only on the main thread
282282
uint32_t mGotUpgradeOK : 1;
283283
uint32_t mRecvdHttpUpgradeTransport : 1;
284-
uint32_t mAutoFollowRedirects : 1;
285284
uint32_t mAllowPMCE : 1;
286285
uint32_t : 0; // ensure these aren't mixed with the next set
287286

0 commit comments

Comments
 (0)