-
Notifications
You must be signed in to change notification settings - Fork 0
/
global-agent+2.2.0.patch
24 lines (23 loc) · 1.12 KB
/
global-agent+2.2.0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
diff --git a/node_modules/global-agent/dist/classes/Agent.js b/node_modules/global-agent/dist/classes/Agent.js
index ba8cc1a..68258dd 100644
--- a/node_modules/global-agent/dist/classes/Agent.js
+++ b/node_modules/global-agent/dist/classes/Agent.js
@@ -40,6 +40,19 @@ class Agent {
requestUrl = this.protocol + '//' + (configuration.hostname || configuration.host) + (configuration.port === 80 || configuration.port === 443 ? '' : ':' + configuration.port) + request.path;
}
+ // If a request should go to a local socket, proxying it through an HTTP
+ // server does not make sense as the information about the target socket
+ // will be lost and the proxy won't be able to correctly handle the request.
+ if (configuration.socketPath) {
+ log.trace({
+ destination: configuration.socketPath,
+ }, "not proxying request; destination is a socket");
+
+ // @ts-expect-error seems like we are using wrong type for fallbackAgent.
+ this.fallbackAgent.addRequest(request, configuration);
+ return;
+ }
+
if (!this.isProxyConfigured()) {
log.trace({
destination: requestUrl