joshua655 / v8cgi

Automatically exported from code.google.com/p/v8cgi
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

HTTP client POST has extra CRLF pairs at end #107

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When POSTing from v8cgi to node.js on Linux the request is ignored.  It turn 
out that the reason is because the request is padded with two extra CRLF pairs 
(http.js 306-315)

    /* build request */
    var data = this.method + " " + url + " HTTP/1.1\r\n";
    for (var p in this._headers) {
        data += p+": "+this._headers[p]+"\r\n";
    }
    data += "\r\n";
    if (post) {
        data += post+"\r\n";          // <-- extra padding
        data += "\r\n";               // <-- extra padding
    }

This works on Windows which seems to ignore the extra bytes after the content 
length but Wireshark isn't happy with these packets and complains "continuation 
or non-http traffic"

Deleting these extra bytes from http.js restores the expected operation on 
Linux and doesn't seem to break anything on Windows.

Original issue reported on code.google.com by andy.bis...@gmail.com on 8 Dec 2011 at 10:56

GoogleCodeExporter commented 9 years ago
Fixed in rev. 957.

Original comment by ondrej.zara on 8 Dec 2011 at 3:17