cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: followlocation/header/file

From: jonatan <jonatan_at_cyberdude.com>
Date: Sat, 1 Sep 2001 12:38:23 +0200

>[valid code cut off, the result being *two* sets of HTTP headers stored in a
>file]
>
> > is this the correct behavior? shouldn't the file start from the last http
> > header? i'm using 7.8.1.
>
>That is the correct behaviour. libcurl outputs a stream of data, it can't go
>back and erase what has already been written.

why not? couldn't libcurl ftell() before the first header set and
fseek() there before each following header set? at least as an option.

>If you're only interested in the last set of headers, you probably add a
>header-receiving callback that filters out everything but the interesting
>parts.

i'll try that. (i see a potential problem where i wouldn't know what
was a header set and what wasn't. suppose the body contains a header
set of it's own (as if i had tried to access the file "out" from my
example thru http). how do i know it's not a real header set...
libcurl knows it internally, but i'm not sure it's possible to deduce
that afterwards. or perhaps the http spec has solved this somehow.)

> > btw, the docs/examples/*.c files seem to lack curl_global_*() calls.
>
>Yes, you're right and I'd appreciate patches that correct this!

i would if i had any idea how to make patches...

thanks.
Received on 2001-09-01