Compare commits

...

4 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] 554f42cb4f Improve comment explaining tunnel agent usage for proxy scenarios
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
2026-01-16 00:17:51 +00:00
copilot-swe-agent[bot] 52de8f9588 Update mock for request-filtering-agent to validate protocols
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
2026-01-16 00:15:16 +00:00
copilot-swe-agent[bot] 9dbb84f966 Fix protocol error by using tunnel agent for httpOver proxy scenarios
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
2026-01-16 00:09:55 +00:00
copilot-swe-agent[bot] aed0f8c584 Initial plan 2026-01-16 00:04:21 +00:00
2 changed files with 12 additions and 10 deletions
@@ -9,6 +9,13 @@ function useAgent(url, options = {}) {
const parsedUrl = new URL(url);
const isHttps = parsedUrl.protocol === "https:";
// Validate that the URL protocol is supported
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
throw new TypeError(
`Protocol "${parsedUrl.protocol}" not supported. Expected "http:" or "https:"`
);
}
// Create a basic agent based on the protocol
const Agent = isHttps ? https.Agent : http.Agent;
+5 -10
View File
@@ -199,16 +199,11 @@ function buildAgent(
});
if (parsedProxyURL.tunnelMethod?.startsWith("httpOver")) {
const proxyURL = new URL(parsedProxyURL.href);
proxyURL.pathname = (parsedURL.protocol ?? "")
.concat("//")
.concat(parsedURL.host ?? "")
.concat(parsedURL.pathname + parsedURL.search);
if (parsedProxyURL.username || parsedProxyURL.password) {
proxyURL.username = parsedProxyURL.username;
proxyURL.password = parsedProxyURL.password;
}
agent = useFilteringAgent(proxyURL.toString(), filteringOptions);
// Use tunnel agent for HTTP-over-HTTP/HTTPS proxy scenarios.
// Tunnel agents properly handle protocol differences and proxy authentication
// without requiring URL manipulation, unlike useFilteringAgent which would
// fail with protocol validation errors if passed a modified proxy URL.
agent = buildTunnel(parsedProxyURL, agentOptions);
} else {
// Note request filtering agent does not support https tunneling via a proxy
agent =