cURL / Mailing Lists / curl-users / Single Mail

curl-users

Handling of chunked encoding

From: Shayan Pooya <shayan_at_liveve.org>
Date: Sun, 5 Jan 2014 09:57:41 -0500

I have a question regarding this answer by the author of curl:
http://stackoverflow.com/a/1848947

I have the following test web server:

while [ 1 ]; do echo "HTTP/1.1 200 OK
Content-Type: text/plain
Date: Sat, 04 Jan 2014 15:14:04 GMT
Connection: keep-alive
Transfer-Encoding: chunked

b
Hello World
0
" | nc -l -p 8000; done;

to test the behavior of a client (written with pycurl).

However, curl gives me the following error message:

$ curl -ivs localhost:8000
* Rebuilt URL to: localhost:8000/
* Adding handle: conn: 0x1f4ecc0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1f4ecc0) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8000 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.32.0
> Host: localhost:8000
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: text/plain
Content-Type: text/plain
< Date: Sat, 04 Jan 2014 15:14:04 GMT
Date: Sat, 04 Jan 2014 15:14:04 GMT
< Connection: keep-alive
Connection: keep-alive
< Transfer-Encoding: chunked
Transfer-Encoding: chunked

<
* transfer closed with outstanding read data remaining
* Closing connection 0

Firefox, links and lynx can correctly display the message.
w3m shows the size of the chunks too:
"
b
Hello World
0
"

My question is, is there something wrong with the http response (and the
clients can still handle it) or is there an issue with the handling of the
chunked requests in curl.

Thanks.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-05