Tuesday, August 20, 2013

Node.js incorrectly parses HTTP methods (chmod777self.com)

First, however, let's modify our server script just a bit so we can see what the Node.js server's view of the request method received is:
  http.createServer(function(request, response) {
    response.writeHead(200, {"Content-Type": "text/plain"});
    response.write("Hello World " + request.method);
Start it up:
bash-3.2$ node server.js
Now do:
bash-3.2$ telnet 8888
Connected to localhost.
Escape character is '^]'.
GEM / HTTP/1.1
Host: example.org

HTTP/1.1 200 OK
Content-Type: text/plain
Date: Mon, 19 Aug 2013 20:48:04 GMT
Connection: keep-alive
Transfer-Encoding: chunked

Hello World GET

Read more

No comments:

Post a Comment