Skip to content

Commit

Permalink
Bug 1627635 - Websocket connects to DIRECT instead of Proxy-HTTP/HTTP…
Browse files Browse the repository at this point in the history
…S with SystemProxySettings on Linux r=valentin

Fix nsUnixSystemProxySettings::GetProxyForURI() so it assigns the result to aResult instead of appending to it.

Differential Revision: https://phabricator.services.mozilla.com/D69807

--HG--
extra : moz-landing-system : lando
  • Loading branch information
vonasek committed Apr 6, 2020
1 parent 40fdcf8 commit f0ada99
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static bool IsInNoProxyList(const nsACString& aHost, int32_t aPort,

static void SetProxyResult(const char* aType, const nsACString& aHost,
int32_t aPort, nsACString& aResult) {
aResult.AppendASCII(aType);
aResult.AssignASCII(aType);
aResult.Append(' ');
aResult.Append(aHost);
if (aPort > 0) {
Expand All @@ -145,6 +145,10 @@ static void SetProxyResult(const char* aType, const nsACString& aHost,
}
}

static void SetProxyResultDirect(nsACString& aResult) {
aResult.AssignLiteral("DIRECT");
}

static nsresult GetProxyFromEnvironment(const nsACString& aScheme,
const nsACString& aHost, int32_t aPort,
nsACString& aResult) {
Expand All @@ -163,7 +167,7 @@ static nsresult GetProxyFromEnvironment(const nsACString& aScheme,

const char* noProxyVal = PR_GetEnv("no_proxy");
if (noProxyVal && IsInNoProxyList(aHost, aPort, noProxyVal)) {
aResult.AppendLiteral("DIRECT");
SetProxyResultDirect(aResult);
return NS_OK;
}

Expand Down Expand Up @@ -340,7 +344,7 @@ nsresult nsUnixSystemProxySettings::GetProxyFromGSettings(
nsCString s;
if (NS_SUCCEEDED(str->GetData(s)) && !s.IsEmpty()) {
if (HostIgnoredByProxy(s, aHost)) {
aResult.AppendLiteral("DIRECT");
SetProxyResultDirect(aResult);
return NS_OK;
}
}
Expand Down Expand Up @@ -371,7 +375,7 @@ nsresult nsUnixSystemProxySettings::GetProxyFromGSettings(
}

if (NS_FAILED(rv)) {
aResult.AppendLiteral("DIRECT");
SetProxyResultDirect(aResult);
}

return NS_OK;
Expand Down

0 comments on commit f0ada99

Please sign in to comment.