curl-users
Re: curl with 100 continue response
Date: Wed, 14 Jun 2006 13:34:11 +0530
> Sorry, but how can a server send only a "100 continue" and still work fine?
> A 100 continue header _implies_ that there is another status code coming up
> so if there's nothing more coming after the 100 continue is sounds like the
> server is messed up.
Server did send "100 continue" + "200 ok" all the time.
When curl does read on socket 100 + 200 might arrive at the same time or in
successive reads.
Look at the ltrace output for the examples i am talking about.
-------------------------------------------------------------------------------
here is the ltrace output when "100 continue" + "200 ok" were read at once by
curl_easy_perform. In this case curl_easy_perform resumed.
-------------------------------------------------------------------------------
curl_easy_perform(0x8081a08, 138, 0, 0, 0xb7f5dc37 <unfinished ...>
fwrite("HTTP/1.1 100 Continue\r\n", 1, 23, 0xb7c790e0HTTP/1.1 100 Continue
) = 23
fwrite("\r\n", 1, 2, 0xb7c790e0
) = 2
fwrite("HTTP/1.1 200 OK\r\n", 1, 17, 0xb7c790e0HTTP/1.1 200 OK
) = 17
fwrite("Age: 0 \r\n", 1, 17, 0xb7c790e0Age: 0
) = 17
fwrite("Date: Wed, 14 Jun 2006 07:30:59 "..., 1, 37, 0xb7c790e0Date: Wed, 14
Jun 2006 07:30:59 GMT
) = 37
fwrite("Cache-Control: max-age=200 "..., 1, 42, 0xb7c790e0Cache-Control:
max-age=200 ,public
) = 42
fwrite("Connection: Keep-Alive\r\n", 1, 24, 0xb7c790e0Connection: Keep-Alive
) = 24
fwrite("Content-Type: text/html\r\n", 1, 25, 0xb7c790e0Content-Type: text/html
) = 25
fwrite("Content-Length: 5\r\n", 1, 19, 0xb7c790e0Content-Length: 5
) = 19
fwrite("\r\n", 1, 2, 0xb7c790e0
) = 2
fwrite("DONE\n", 1, 5, 0xb7c790e0DONE
) = 5
<... curl_easy_perform resumed> )
= 0
-------------------------------------------------------------------------------
here is the ltrace output when "100 continue" was read in first read by
curl_easy_perform. In this case curl_easy_perform did NOT resume, if it
resumed it would have got "200 ok"
-------------------------------------------------------------------------------
curl_easy_perform(0x8081a08, 138, 0, 0, 0xb7efcc37 <unfinished ...>
fwrite("HTTP/1.1 100 Continue\r\n", 1, 23, 0xb7c180e0HTTP/1.1 100 Continue
) = 23
fwrite("\r\n", 1, 2, 0xb7c180e0
) = 2
-------------------------------------------------------------------------------
Thanks
Anil
On Wednesday 14 June 2006 12:38, Daniel Stenberg wrote:
> On Tue, 13 Jun 2006, Anil Kumar wrote:
> > Curl sent a request to server (without "Expect: 100-continue" header)
> >
> > When curl reads the buffer
> > * If "100 continue" + "200 ok" were present in buffer -> things are fine
> > * If only "100 continue" was present in buffer, curl doesnot seem to
> > resume curl_easy_opt for reading more data from server.
>
> Sorry, but how can a server send only a "100 continue" and still work fine?
> A 100 continue header _implies_ that there is another status code coming up
> so if there's nothing more coming after the 100 continue is sounds like the
> server is messed up.
>
> A HTTP/1.1 client is supposed to deal with the 100 code that way, and
> (lib)curl does!
Received on 2006-06-14