ssr-proxy icon indicating copy to clipboard operation
ssr-proxy copied to clipboard

throw new TypeError('The header content contains invalid characters')

Open antsn opened this issue 8 years ago • 2 comments

I use node version 8.6, when running (with default settings): ssr-proxy --config config.json

Using browser Opera 12.16, enter the address, such as: http://www.imdb.com/title/tt3890160/reviews?start=10

At first, the proxy crash:

[SSR-Proxy] Request http://www.imdb.com/title/tt3890160/reviews?start=10
[SSR-Proxy] Request http://sitecheck2.opera.com/?host=www.imdb.com&hdn=7PaO23WiGu/TsGcxLWYK3w==
[Phantom] Page Created
[Phantom] Page Created
[Phantom] will open page http://www.imdb.com/title/tt3890160/reviews?start=10
[Phantom] will open page http://sitecheck2.opera.com/?host=www.imdb.com&hdn=7PaO23WiGu/TsGcxLWYK3w==
[Phantom] Resource Received http://sitecheck2.opera.com/?host=www.imdb.com&hdn=7PaO23WiGu/TsGcxLWYK3w==
_http_server.js:188
    throw new RangeError(`Invalid status code: ${originalStatusCode}`);
    ^

RangeError: Invalid status code: null
    at ServerResponse.writeHead (_http_server.js:188:11)
    at Proxy.page.on (/usr/local/n/versions/node/8.6.0/lib/node_modules/ssr-proxy/src/index.js:50:25)
    at EventEmitter.<anonymous> (/usr/local/n/versions/node/8.6.0/lib/node_modules/ssr-proxy/node_modules/phantom/lib/phantom.js:308:33)
    at emitOne (events.js:115:13)
    at EventEmitter.emit (events.js:210:7)
    at Stream.Phantom.process.stdout.pipe.on.data (/usr/local/n/versions/node/8.6.0/lib/node_modules/ssr-proxy/node_modules/phantom/lib/phantom.js:165:34)
    at emitOne (events.js:115:13)
    at Stream.emit (events.js:210:7)
    at drain (/usr/local/n/versions/node/8.6.0/lib/node_modules/ssr-proxy/node_modules/through/index.js:36:16)
    at Stream.stream.queue.stream.push (/usr/local/n/versions/node/8.6.0/lib/node_modules/ssr-proxy/node_modules/through/index.js:45:5)

I tried again, this time, it crash and show error:

[SSR-Proxy] Request http://www.imdb.com/title/tt3890160/reviews?start=10
[Phantom] Page Created
[Phantom] will open page http://www.imdb.com/title/tt3890160/reviews?start=10
[Phantom] Resource Received http://www.imdb.com/title/tt3890160/reviews?start=10
_http_outgoing.js:434
      throw new TypeError('The header content contains invalid characters');
      ^

TypeError: The header content contains invalid characters
    at storeHeader (_http_outgoing.js:434:13)
    at ServerResponse._storeHeader (_http_outgoing.js:346:7)
    at ServerResponse.writeHead (_http_server.js:251:8)
    at Proxy.page.on (/usr/local/n/versions/node/8.6.0/lib/node_modules/ssr-proxy/src/index.js:50:25)
    at EventEmitter.<anonymous> (/usr/local/n/versions/node/8.6.0/lib/node_modules/ssr-proxy/node_modules/phantom/lib/phantom.js:308:33)
    at emitOne (events.js:115:13)
    at EventEmitter.emit (events.js:210:7)
    at Stream.Phantom.process.stdout.pipe.on.data (/usr/local/n/versions/node/8.6.0/lib/node_modules/ssr-proxy/node_modules/phantom/lib/phantom.js:165:34)
    at emitOne (events.js:115:13)
    at Stream.emit (events.js:210:7)

antsn avatar Oct 12 '17 00:10 antsn

It seems that phantomjs could not handle cookies contains 'backward slash' '' character

antsn avatar Oct 27 '17 02:10 antsn

Ah maybe a new version of phantomjs can solve this issue. Or perhaps this project can be updated to use chrome headless

xiamx avatar Oct 27 '17 02:10 xiamx