cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

Re: Perl interface broken with curl 7.7

From: Georg Horn <horn_at_koblenz-net.de>
Date: Tue, 10 Apr 2001 14:56:20 +0200

On Tue, Apr 10, 2001 at 10:11:06PM +1000, Cris Bailiff wrote:
>
> Basically, I've integrated Forrests progress callback and the work I already
> did on the write and head function callbacks (and tidied up) - I'm just
> discussing with Daniel the best way to get the separate headers and body
> through the one 'write' callback, which Daniel has fixed up in libcurl CVS.
> I'm trying to be smart and do it compatibly with the current libcurl
> though...
>
> Then, of course, I have yet to consider the 'read function' callback, but
> just wait.

Ok, then lets see what comes up... ;-)

> open BODY, ">body.out";
> Curl::easy::curl_easy_setopt($curl, Curl::easy::CURLOPT_FILE, BODY);
>
> as usual, or, much more fun:
>
> Curl::easy::curl_easy_setopt($curl, Curl::easy::CURLOPT_FILE, sub { print "==
> chunk == ",shift } );

Uh, are you going to win an obfuscated perl contest with this
thing? ;-) I see, i'm not much of a perl hacker right now...

> > At the moment i have defined an internal write callback
> > that puts all the content retrieved from the server into a large buffer.
> > 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.
>
> This is a bit ugly for my application - I want the chunks as they come in,
> through a call back to perl, and I want the headers as soon as they arrive.
> What I've done is set up callbacks to perl for each header and each body
> chunk. Then perl can do what it likes with them...

But it's exactly what i'd need... I just want to perform a http request, and
afterwards may parse the retrieved html code, and/or save it to a file, or just
discard it... I have now added a new function internal_setopt() to my module,
that allows the user to specify whether the normal way of writing things to a
file handle, or the new way to store the content into buffers, should be used.
Maybe we could extend that function to allow more possibilities...

If anyone is interested, the latest version can be downloaded from
http://koblenz-net.de/~horn/export/Curl-1.1.0.tgz
But this is just hacked together, don't expect it to work in every case...

Bye,
Georg

_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-04-10

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET