Hi there,
I'm working in XUL, so I'm not dealing with cross-domain security
issues. I am issuing a request using the following code:
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
if(req.readyState == 4 && req.status == 200) {
try {
// do some stuff
} catch(e) {
// don't really care
}
}
}
req.open('POST','
http://twitter.com/statuses/update.json');
req.setRequestHeader("Authorization", "Basic " + encodedAuth);
req.setRequestHeader("Connection", "close");
req.send("status=" + escape("foo"));
Using NetCat, I am comparing this request with a successful one (using
LWP), and it seems fine, but it's returning a 500 error from Twitter.
Here's the POST:
POST /statuses/update.json HTTP/1.1
Host:
twitter.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:
1.8.1.17) Gecko/20080829 Firefox/
2.0.0.17
Accept: text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: close
Authorization: Basic [base64 encoded user/pass, i've checked it's
good]
Content-Length: 10
Content-Type: application/xml
Pragma: no-cache
Cache-Control: no-cache
status=foo
I tried it with the original "Connection: keep-alive" to no avail. Is
it obvious what's going wrong here?
Thanks in advance!
John