mikeal/request — Issue #109: parseError with certain HEAD requests
Author: jamespeerless
Created: 2011-11-23 03:23:11+00:00
State: open

Haven't had time to really dig in and figure out what's really going on here but I noticed when making certain HEAD requests the httpClient will emit a parseError and there doesn't seem to be anything you can do to stop it from crashing the thread.

Could be a node bug? It's 0.6.2. It's also possible I have no idea what I'm doing and the problem is me. Changing it to a GET request fixes the issue though.

Here's a small sample program to recreate the issue:

var request = require('request');

var options = {
url: 'http://www.aa.com/content/images/footer/footer_email.gif',
method: 'HEAD',
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Connection': 'keep-alive',
'Accept-Language': 'en-us,en;q=0.5',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110814 Firefox/6.0'
},
followRedirect: true,
maxRedirects: 10,
jar: false,
timeout: 10000,
encoding: 'utf8',
strictSSL: false,
};

request(options,function(error,response,body){
if(error){
console.log("and we're dead");
}
});