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
Parse Error when trying to get this URL #20
Comments
~/Projects cat http.js var http = require('http-request');
http.get('http://www.amazon.co.uk/Toasters-Kitchen-Appliances-Home-Garden/b?ie=UTF8&node=11716951', function (err, res) {
if (err) {
console.error(err);
return;
}
console.log(res.code, res.headers);
}); ~/Projects node http.js Can't reproduce it with the URL alone. |
i use this settings: http.get({
url: url,
timeout: 20000,
maxRedirects: 10,
noUserAgent: true,
maxBody: 1000000,
noSslVerifier: true,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.37 Safari/537.36',
'Accept-Language': 'en,en-US;*',
'Accept': 'text/html,*/*;q=0.8'
}
}, function(err, result) { looks like when i set noUserAgent to false it works, why? Thank you, |
Found the issues:
This script reproduces the issue with the core HTTP client: var options = {
host: 'www.amazon.co.uk',
port: 80,
path: '/Toasters-Kitchen-Appliances-Home-Garden/b?ie=UTF8&node=11716951',
headers: {
'user-agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.37 Safari/537.36',
'accept-language': 'en,en-US;*',
accept: 'text/html,*/*;q=0.8',
'accept-encoding': 'gzip,deflate'
},
method: 'GET'
}
var events = 0;
var request = require('http').request(options, function (response) {
console.log(response.statusCode, response.headers)
response.on('data', function (data) {
events++
})
})
request.on('error', function (err) {
console.error('error after %d data events', events)
console.error(err)
})
request.end() Unfortunately the issue is unrelated to http-request. I'll try to find some more info before opening an issue on node.js' issue tracker. |
WOW! Not an easy find, great work! Thank you, |
nodejs/node-v0.x-archive#5479 - the upstream says it's not their issue. The recommendation is to use another user-agent / disable it entirely. |
Hehe, nice one :) Ok, i i will use a different user agent. Thank you, |
Hi,
sorry, today is my big testing day :)
When i try to get this URL:
http://www.amazon.co.uk/Toasters-Kitchen-Appliances-Home-Garden/b?ie=UTF8&node=11716951
i get this error-object:
{ [Error: Parse Error]
bytesParsed: 20,
code: 'HPE_INVALID_CONSTANT',
headers:
{ date: 'Wed, 03 Jul 2013 14:52:20 GMT',
server: 'Server',
'x-amz-id-1': 'A42B6F61ACC04C2EB8DE',
'x-amz-id-2': 'w/dGiH/4tTFFRtLq9QdWOm4H/6mMIGkocOA7Jwoket0cOIGKtudh1A==',
'content-type': 'text/html;charset=UTF-8',
'content-encoding': 'gzip',
vary: 'Accept-Encoding,User-Agent',
'set-cookie':
[ 'session-id=279-3003121-1937300; Domain=.amazon.co.uk; Expires=Tue, 28-Jun-2033 14:52:20 GMT; Path=/',
'session-id-time=2003583140l; Domain=.amazon.co.uk; Expires=Tue, 28-Jun-2033 14:52:20 GMT; Path=/' ],
'transfer-encoding': 'chunked' },
url: 'http://www.amazon.co.uk/Toasters-Kitchen-Appliances-Home-Garden/b?ie=UTF8&node=11716951',
method: 'GET' }
Any idea why?
Thank you,
Max
The text was updated successfully, but these errors were encountered: