Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uncaughtException when clients send non-trimmed headers #996

Closed
randunel opened this issue Apr 26, 2016 · 0 comments
Closed

uncaughtException when clients send non-trimmed headers #996

randunel opened this issue Apr 26, 2016 · 0 comments

Comments

@randunel
Copy link
Contributor

randunel commented Apr 26, 2016

None of the error handlers are triggered when proxying client requests with non-trimmed headers.

I think the request shouldn't fail at all, but it's not up to http-proxy how node.js sanitizes the outgoing requests. At least an error that can be caught should be emitted, instead of terminating the process. Alternatively, http-proxy can sanitize the headers itself (see #997).

_http_outgoing.js:339
    throw new TypeError(
    ^

TypeError: Header name must be a valid HTTP Token ["cached-id "]
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:339:11)
    at /.../node_modules/http-proxy/lib/http-proxy/passes/web-o
utgoing.js:86:13
    at Array.forEach (native)
    at Array.writeHeaders (/.../node_modules/http-proxy/lib/htt
p-proxy/passes/web-outgoing.js:84:35)
    at ClientRequest.<anonymous> (/.../node_modules/http-proxy/
lib/http-proxy/passes/web-incoming.js:150:20)
    at emitOne (events.js:90:13)
    at ClientRequest.emit (events.js:182:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:469:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:103:23)
    at Socket.socketOnData (_http_client.js:359:20)
    at emitOne (events.js:90:13)
    at Socket.emit (events.js:182:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at Socket.Readable.push (_stream_readable.js:111:10)
    at TCP.onread (net.js:529:20)
randunel added a commit to randunel/node-http-proxy that referenced this issue Apr 26, 2016
jcrugzz pushed a commit that referenced this issue Apr 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant