Author: sparky
Date: Mon Sep 21 14:47:56 2009
New Revision: 10624

Modified:
   toys/rsget.pl/RSGet/Curl.pm
Log:
- allow adding headers (required for crypt-it)
- pass POSTFIELDSIZE or else post will be cut at first \0


Modified: toys/rsget.pl/RSGet/Curl.pm
==============================================================================
--- toys/rsget.pl/RSGet/Curl.pm (original)
+++ toys/rsget.pl/RSGet/Curl.pm Mon Sep 21 14:47:56 2009
@@ -57,7 +57,13 @@
        $curl->setopt( CURLOPT_WRITEHEADER, \$supercurl->{head} );
        $curl->setopt( CURLOPT_MAXREDIRS, 10 );
        $curl->setopt( CURLOPT_FOLLOWLOCATION, 1 );
-       $curl->setopt( CURLOPT_HTTPHEADER, $curl_headers );
+       if ( $opts{headers} ) {
+               my @h = @$curl_headers;
+               push @h, @{ $opts{headers} };
+               $curl->setopt( CURLOPT_HTTPHEADER, \...@h );
+       } else {
+               $curl->setopt( CURLOPT_HTTPHEADER, $curl_headers );
+       }
        $curl->setopt( CURLOPT_URL, $uri );
        $curl->setopt( CURLOPT_REFERER, $get_obj->{_referer} )
                if defined $get_obj->{_referer};
@@ -73,6 +79,7 @@
                                sort keys %$post;
                }
                $curl->setopt( CURLOPT_POSTFIELDS, $post );
+               $curl->setopt( CURLOPT_POSTFIELDSIZE, length $post );
        }
 
        if ( $opts{save} ) {
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to