cURL / Mailing Lists / curl-library / Single Mail


Re: Perl interface broken with curl 7.7

From: Georg Horn <>
Date: Tue, 10 Apr 2001 14:38:44 +0200

On Tue, Apr 10, 2001 at 02:14:16PM +0200, Daniel Stenberg wrote:
> On Tue, 10 Apr 2001, Georg Horn wrote:
> > At the moment i have defined an internal write callback that puts all the
> > content retrieved from the server into a large buffer.
> This callback append-to-a-buffer stuff should probably be perl code. Right?

No, it's in C right now...

> > After curl_easy_perform() finishes, i scan that buffer for '\r\n\r\n'
> > (end of headers) an put the headers and the content into two perl
> > variables. One could split these two buffers into arrays of lines
> > afterwards.
> You can do this more efficently.


> > Unfortunately, to make libcurl call the write callback function for the
> > header data too, i need to pass in a file handle:
> No, you need to pass a non-zero value, it doesn't have to be a file handle.

Yes, sorry, i didn't rtfm. Of course you can just use
curl_easy_setopt(curl, CURLOPT_HEADER, 1);

> > open HEAD, ">head.out";
> > Curl::easy::curl_easy_setopt($curl, Curl::easy::CURLOPT_WRITEHEADER, HEAD);
> >
> > This always creates an empty file "head.out". Can this be done in another
> > way?
> Yes, just pass anything that isn't zero (or rather a NULL pointer).

I tried this but perl complains about invalid filehandles or something...
But with CURLOPT_HEADER it works.


Curl-library mailing list
Received on 2001-04-10