node-http-mitm-proxy icon indicating copy to clipboard operation
node-http-mitm-proxy copied to clipboard

ERR_HTTP_TRAILER_INVALID

Open cooye opened this issue 3 years ago • 1 comments

Line 1074 is throwing this error when certain websites are accessed. I was able to finally see that it was this line by adding a try catch block around it so the proxy program I was using could log it otherwise an uncaughtException would occur and make it hard to debug. I propose the simple try catch block around this section to capture this error.

image

try {
        ctx.proxyToClientResponse.writeHead(ctx.serverToProxyResponse.statusCode, Proxy.filterAndCanonizeHeaders(ctx.serverToProxyResponse.headers));
        ctx.responseFilters.push(new ProxyFinalResponseFilter(self, ctx));
        var prevResponsePipeElem = ctx.serverToProxyResponse;
        ctx.responseFilters.forEach(function(filter) {
          filter.on('error', self._onError.bind(self, 'RESPONSE_FILTER_ERROR', ctx));
          prevResponsePipeElem = prevResponsePipeElem.pipe(filter);
        });	
} catch (e) {		
	return self._onError('ON_RESPONSEHEADERS_ERROR_WRITE',ctx,e);		
}

cooye avatar Oct 05 '22 13:10 cooye

Line 836 was prior to some formatting changes I believe.

cooye avatar Oct 05 '22 13:10 cooye