http: escape unsafe characters in request path
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 12 Apr 2013 13:54:31 +0000 (15:54 +0200)
committerisaacs <i@izs.me>
Fri, 12 Apr 2013 23:27:50 +0000 (16:27 -0700)
commit38149bb048d9833cc3cf9a13cbff5300fbed36ef
tree672d6ed175fb30127285f8bb6f28cefb94aa8c50
parent881ef7cc5fc897cca2f2f0a512e59111ff5a6cd8
http: escape unsafe characters in request path

Make http.request() and friends escape unsafe characters in the request
path. That is, a request for '/foo bar' is now escaped as '/foo%20bar'.

Before this commit, the path was used as-is in the request status line,
creating an invalid HTTP request ("GET /foo bar HTTP/1.1").

Fixes #4381.
lib/http.js
test/simple/test-http-client-escape-path.js [new file with mode: 0644]