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: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 10 Apr 2001 14:14:16 +0200 (MET DST)

On Tue, 10 Apr 2001, Georg Horn wrote:

(CC'ed back onto the libcurl list, from an off-list thread)

> I also started playing around with libcurl and the perl module last week.
> The basic question is, how do we want the interface to be.

My opinion is now quite clear: as low-level as possible. If you want
abstraction layers, we do that in the language itself. I think that gives the
maximum flexibility and freedom.

> 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?

> 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.

> 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).

> > Well, you can pass a different 'opaque pointer' to be used when writing
> > headers, and if you set that to something sensible, you can pretty easily
> > extract headers-only.
>
> That's exectly the point. What's that 'opaque pointer' thing?

The 'FILE *' field. It isn't used by libcurl internally, only by the write
function. And if *you* author the write function, you can have that pointer
point to whatever you please.

> Ok, you might build an oo interface if you like to, but can we please
> leave a non-oo-interface for me? I'm not an oo fan... ;-)

The lowest layer interface couldn't possibly be OO since libcurl's C
interface isn't. OO stuff should IMHO be written in perl ontop of the
curl::easy interface...

I'll use that approach for the Java interface and Sterling Hughes has used it
for the PHP interface successfully.

-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
_______________________________________________
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