apify / proxy-chain

Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.
https://www.npmjs.com/package/proxy-chain
Apache License 2.0
843 stars 143 forks source link

Fix "The header content contains invalid characters" error #20

Closed jancurn closed 3 years ago

jancurn commented 6 years ago

The stack trace is below. Also, it seems that ProxyChain server is emitting connectionClosed event for this connection, although prepareRequestFunction is never called for the connection.

Aug 17 02:43:32 ip-172-31-92-139 proxy@prod.log ERROR {"level":"ERROR","msg":"Unexpected error in ProxyChain server","url":"http://www.acmetools.com/shop/tools/router-tables","exception":{"name":"TypeError","message":"The header content contains invalid characters","stack":"TypeError: The header content contains invalid characters\n at validateHeader (_http_outgoing.js:494:11)\n at ClientRequest.setHeader (_http_outgoing.js:498:3)\n at new ClientRequest (_http_client.js:173:14)\n at Object.request (http.js:38:10)\n at HandlerForward.run (/home/apifier/proxy/node_modules/proxy-chain/build/handler_forward.js:125:46)\n at Server.handlerRun (/home/apifier/proxy/node_modules/proxy-chain/build/server.js:411:21)\n at /home/apifier/proxy/node_modules/proxy-chain/build/server.js:208:24\n at tryCatcher (/home/apifier/proxy/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/home/apifier/proxy/node_modules/bluebird/js/release/promise.js:512:31)\n at Promise._settlePromise (/home/apifier/proxy/node_modules/bluebird/js/release/promise.js:569:18)\n at Promise._settlePromise0 (/home/apifier/proxy/node_modules/bluebird/js/release/promise.js:614:10)\n at Promise._settlePromises (/home/apifier/proxy/node_modules/bluebird/js/release/promise.js:693:18)\n at Async._drainQueue (/home/apifier/proxy/node_modules/bluebird/js/release/async.js:133:16)\n at Async._drainQueues (/home/apifier/proxy/node_modules/bluebird/js/release/async.js:143:10)\n at Immediate.Async.drainQueues (/home/apifier/proxy/node_modules/bluebird/js/release/async.js:17:14)\n at runCallback (timers.js:810:20)\n at tryOnImmediate (timers.js:768:5)\n at processImmediate [as _immediateCallback] (timers.js:745:5)"}}

jancurn commented 5 years ago

Quite likely the new version fixes this, need to test it.