fix proxy status return (#2860)

This commit is contained in:
Ciro Spaciari
2023-05-12 08:06:17 -03:00
committed by GitHub
parent f8c840aec7
commit 6070e135e9
2 changed files with 9 additions and 9 deletions

View File

@@ -2717,13 +2717,13 @@ pub fn handleResponseMetadata(
}
if (this.proxy_tunneling and this.proxy_tunnel == null) {
//proxy denied connection
if (this.state.pending_response.status_code != 200) {
return error.ConnectionRefused;
if (this.state.pending_response.status_code == 200) {
//signal to continue the proxing
return true;
}
//signal to continue the proxing
return true;
//proxy denied connection so return proxy result (407, 403 etc)
this.proxy_tunneling = false;
}
const is_redirect = this.state.pending_response.status_code >= 300 and this.state.pending_response.status_code <= 399;

View File

@@ -116,9 +116,9 @@ it("proxy non-TLS auth can fail", async () => {
{
try {
const response = await fetch(url, { verbose: true, proxy: `http://localhost:${auth_proxy.port}` });
expect(response.statusText).toBe("Proxy Authentication Required");
expect(response.status).toBe(407);
} catch (err) {
expect(err).toBe("Proxy Authentication Required");
expect(true).toBeFalsy();
}
}
@@ -128,9 +128,9 @@ it("proxy non-TLS auth can fail", async () => {
verbose: true,
proxy: `http://squid_user:asdf123@localhost:${auth_proxy.port}`,
});
expect(response.statusText).toBe("Forbidden");
expect(response.status).toBe(403);
} catch (err) {
expect(err).toBe("Forbidden");
expect(true).toBeFalsy();
}
}
});