Hi,
I've been playing with Rook and I noticed that it inserts a bad header line in the response whenever you provide a list with only one element to "headers", when building the response.
Using the "Hello" example from
http://cran.r-project.org/web/packages/Rook/README.htmlWhen I call the Rook app I get the following:
$ curl -v
http://localhost:20430/custom/hello* About to connect() to localhost port 20430 (#0)
* Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 20430 (#0)
> GET /custom/hello HTTP/1.1
> User-Agent: curl/7.27.0
> Host: localhost:20430
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-type: text/html
< :
< Content-length: 42
<
* Connection #0 to host localhost left intact
<h1>Hello World! This is Rook 1.0-9 .</h1>* Closing connection #0
As you can see, there's a empty header between Content-type and Content-length (a line with just the ":"). To be honest, i would never have
noticed it it the Python requests library wouldn't choke on this response.
If I change the "headers" list to have 2 elements instead of one, adding a fake header:
headers = list(
'Content-Type' = 'text/html',
'X-FAKE-HEADER' = ''
),
I get rid of the bad header:
$ curl -v
http://localhost:20430/custom/hello* About to connect() to localhost port 20430 (#0)
* Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 20430 (#0)
> GET /custom/hello HTTP/1.1
> User-Agent: curl/7.27.0
> Host: localhost:20430
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-type: text/html
< X-FAKE-HEADER:
< Content-length: 42
<
* Connection #0 to host localhost left intact
<h1>Hello World! This is Rook 1.0-9 .</h1>* Closing connection #0
OK, I think python "requests" shouldn't just hang when this happens, but still that header line doesn't look right and might cause problems with other libraries...
Is this a known issue?
Thanks,
Nuno