MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / proxyHttp

Function proxyHttp

scripts/proxy-utils.mjs:90–111  ·  view source on GitHub ↗
(req, res, target)

Source from the content-addressed store, hash-verified

88 });
89
90 function proxyHttp(req, res, target) {
91 metrics.activeHttpRequests += 1;
92 metrics.totalHttpRequests += 1;
93 const finish = once(() => {
94 metrics.activeHttpRequests = Math.max(0, metrics.activeHttpRequests - 1);
95 });
96 res.on("close", finish);
97 res.on("finish", finish);
98 res.on("error", finish);
99
100 proxy.web(req, res, { target }).catch((err) => {
101 metrics.totalErrors += 1;
102 if (!isBenignSocketError(err)) {
103 console.error(
104 `[${label}] Proxy error for ${req.url} -> ${target}:`,
105 err,
106 );
107 }
108 writeProxyError(res, err instanceof Error ? err.message : String(err));
109 finish();
110 });
111 }
112
113 function proxyWebSocket(req, socket, head, target) {
114 metrics.activeWebSockets += 1;

Callers

nothing calls this directly

Calls 5

onceFunction · 0.85
isBenignSocketErrorFunction · 0.85
writeProxyErrorFunction · 0.85
errorMethod · 0.80
finishFunction · 0.70

Tested by

no test coverage detected