cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: cURL behavior with streaming server ...

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 11 Feb 2013 23:39:23 +0100 (CET)

On Mon, 11 Feb 2013, kedar mhaswade wrote:

> I am testing a HTTP streaming server and trying to understand how streaming
> works, which sends the following [1] headers. When cURL receives the
> response, as expected, it waits there for some time for the server to send
> some more data. I have two questions in this regard:
>
> 1- As you can see, there is no Transfer-Encoding: chunked header in the
> response. It, as expected, lacks the Content-Length header. Is that the hint
> for cURL to assume a streamed data? It's not clear from the Wikipedia page
> <http://en.wikipedia.org/wiki/Chunked_transfer_encoding> when the client
> should assume chunked data to come from server.

The hint is that there's no Content-Length, no chunked-encoding _and_ there's
a "Connection: close". It means the server will send the data and close the
connection to signal the end of it. So as long as the connection stays open
there is potentially more data coming...

> 2- What is the value of the timeout that cURL uses in this case before
> closing the connection? Is that configurable?

By default, curl won't timeout at all. It'll sit there waiting forever. You'll
have to use one of the timeout options to make it stop at some point if the
server doesn't close the connection...

--
  / daniel.haxx.se
-------------------------------------------------------------------
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 2013-02-11