cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: http status code early?

From: <RBramante_at_on.com>
Date: Fri, 4 Apr 2003 14:13:42 -0500

Well I guess that the " general-purpose hook to look at all headers before
processing the body" is already provided. It is the header callback.

The buffering issues can get quite unwieldy (especially with large amounts
of data) which is why I assume the design uses callbacks in the first
place.

There is a little bit more complexity for the coder here than your
suggestion of get_headers()/get_info(), but I think it provides the most
flexibility. You can effectively accomplish the same thing but have to
write a little more code.

                                                                                                                                                   
                      David Boyce
                      <dsb_at_world.std.com> To: curl-library_at_lists.sourceforge.net
                      Sent by: cc:
                      curl-library-admin_at_lists.sour Subject: Re: http status code early?
                      ceforge.net
                                                                                                                                                   
                                                                                                                                                   
                      04/04/2003 01:43 PM
                      Please respond to
                      curl-library
                                                                                                                                                   
                                                                                                                                                   

Understand that I'm pretty new to curl and no HTTP guru, so apologies if
this just doesn't make sense. But why not break the functionality of
curl_easy_perform() into two functions: curl_easy_get_headers() and
curl_easy_get_body(). The original curl_easy_perform() would become a
wrapper function calling these consecutively. Existing code and recommended
coding practice are unaffected, but people who need to can call
curl_easy_get_headers(), then do whatever they like based on what they see
there via curl_easy_getinfo(), then call curl_easy_get_body(). I suspect
this would require a little extra buffering logic as the underlying TCP
transport doesn't respect the division between headers and body but that
seems like a SMOP :-)

The above proposal would work fine too, though I'd replace "as soon as the
status was parsed" with "as soon as the headers are parsed". Any solution
should provide a general-purpose hook to look at all headers before
processing the body, IMHO. I guess the other problem with this is, can you
be sure all headers will fit in the first buffer's worth? I.e. are all
headers guaranteed to have been read by the time the first callback is
made?

David

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
Received on 2003-04-04