John Ruff
jcruff at gmail.com
Fri Mar 3 14:45:54 EST 2006
Here's the javascript code for setting up the XMLHttpRequest. *Note: This is not production code. [code] function getLogData() { /* Create a new XMLHttpRequest object to talk to the Web server */ /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { xmlHttp = false; } } @end @*/ if (!xmlHttp && typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); } xmlHttp.abort(); xmlHttp.onreadystatechange = handleHttpResponse; xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form- urlencoded') xmlHttp.setRequestHeader('Content-length', '0'); xmlHttp.send(null); } [/code] And here's the header information: [snippet] POST /python/adodb/pixfifo/get HTTP/1.1 Host: localhost:8880 User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv: 1.8) Gecko/20051204 Firefox/1.5 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: keep-alive Content-Type: application/x-www-form-urlencoded Pragma: no-cache Cache-Control: no-cache HTTP/1.x 411 Length Required Date: Fri, 03 Mar 2006 19:41:27 GMT Server: Apache/2.0.55 (Unix) DAV/2 mod_python/3.2.7 Python/2.3.5 PHP/ 5.1.2 mod_ssl/2.0.55 OpenSSL/0.9.8a Content-Length: 390 Connection: close Content-Type: text/html; charset=iso-8859-1 [/snippet] Thanks for reviewing. ___________________ John Ruff jcruff at gmail.com "No one can see past a choice they don't understand." --The Oracle On Mar 3, 2006, at 2:14 PM, Deron Meranda wrote: > On 3/3/06, John Ruff <jcruff at gmail.com> wrote: >> Thanks, actually I'm already using x-www-form-urlencoded originally >> as a test to confirm the header was being set with XMLHtttpRequest's >> setRequestHeader() method (which is it). But for whatever reason the >> Content-Length is not being set in the POST header. > > Are you actually sending any content? > > POST requests should almost always be sent with multipart/form-data. > > What browser/user agent are you using? Can you include a > (short) snippet of your javascript code where you are setting up > can calling the XMLHttpRequest object. > -- > Deron Meranda
|