cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is it a valid behavior?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 21 Jan 2011 22:34:07 +0100 (CET)

On Fri, 21 Jan 2011, amit paliwal wrote:

> Client ----HTTP GET------------> Server
>
> Client <---------Normal data WITHOUT HTTP Header---------------------------
> Server

That's not HTTP compliant. You can't respond to a HTTP request with a status
line and still be HTTP.

> Client <------------HTTP 200 OK Response------------Server

... and you most certainly cannot respond with the status-line _after_ the
response body. That's a made-up protocol that libcurl doesn't understand.

> I have my header and write data callback's registered with the curl handle.

In this case there's no header and if you get data it is only because libcurl
makes an effort in trying to understand what's happening.

> So, i have observer that in second step, it calls my write handler and
> curl_easy_perform() is still in blocking state. So even when in step 3,
> Server sends HTTP 200 OK Response (here Connection:Keep alive, token is
> sent), even this HTTP header comes in write callback, rather than HTTP
> header callback and the curl_easy_perform() is still in blocking condition.

Headers after the data like this will be treated as data.

Since you're not really speaking HTTP when you send data without headers or
status-lnie, libcurl will assume you speak HTTP 1.0 and without any headers it
will assume the server will close the connection to signal end of data. And
until it does so, it will wait.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-21