curl-library
Re: Is it a valid behavior?
Date: Fri, 21 Jan 2011 16:42:10 -0500
On Fri, Jan 21, 2011 at 4:34 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> 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.
>
*Reply:* Thanks for the inputs Daniel, so as you said, it will be waiting
for Server to send Connection:Close token??? so in my sequence diagram
rather than sending HTTP OK Response with "Connection:KeepAlive" if I send
HTTP OK Response with "Connection:Close" token, will it come out of the
waiting state?????? If not, then how will it wait for the connection close
from the server.
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
-- Regards, Amit
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-21