api/stream: add Estimated-Content-Length header to tunnels

present where Content-Length cannot be accurately calculated,
pure proxy streams do not have this header and instead have
the accurate Content-Length one.
This commit is contained in:
jj
2024-12-16 17:07:30 +00:00
parent 11388cb418
commit 05e0f031ed
5 changed files with 163 additions and 9 deletions

View File

@@ -72,6 +72,16 @@ export function getInternalTunnel(id) {
return internalStreamCache.get(id);
}
export function getInternalTunnelFromURL(url) {
url = new URL(url);
if (url.hostname !== '127.0.0.1') {
return;
}
const id = url.searchParams.get('id');
return getInternalTunnel(id);
}
export function createInternalStream(url, obj = {}) {
assert(typeof url === 'string');