r64223 - in /branches/upstream/libwww-curl-perl/current: Changes Curl.xs MANIFEST META.yml Makefile.PL SIGNATURE lib/WWW/Curl.pm lib/WWW/Curl/Easy.pm lib/WWW/Curl/Form.pm t/01basic.t t/19multi.t t/21write-to-scalar.t template/Easy.pm.tmpl
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Mon Oct 25 06:29:31 UTC 2010
Author: carnil
Date: Mon Oct 25 06:28:57 2010
New Revision: 64223
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=64223
Log:
[svn-upgrade] new version libwww-curl-perl (4.14)
Added:
branches/upstream/libwww-curl-perl/current/t/21write-to-scalar.t
Modified:
branches/upstream/libwww-curl-perl/current/Changes
branches/upstream/libwww-curl-perl/current/Curl.xs
branches/upstream/libwww-curl-perl/current/MANIFEST
branches/upstream/libwww-curl-perl/current/META.yml
branches/upstream/libwww-curl-perl/current/Makefile.PL
branches/upstream/libwww-curl-perl/current/SIGNATURE
branches/upstream/libwww-curl-perl/current/lib/WWW/Curl.pm
branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Easy.pm
branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Form.pm
branches/upstream/libwww-curl-perl/current/t/01basic.t
branches/upstream/libwww-curl-perl/current/t/19multi.t
branches/upstream/libwww-curl-perl/current/template/Easy.pm.tmpl
Modified: branches/upstream/libwww-curl-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/Changes?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/Changes (original)
+++ branches/upstream/libwww-curl-perl/current/Changes Mon Oct 25 06:28:57 2010
@@ -1,4 +1,12 @@
Revision history for the Perl binding of libcurl, WWW::Curl.
+4.14 Sun Oct 24 2010: - Balint Szilakszi <szbalint at cpan.org>
+
+ - Scalar references can now be used to receive body/header data [gfx].
+ - Speed optimizations for threaded perl. [gfx, szbalint].
+ - Added a more generic libcurl constant detection.
+ - Added the pushopt method for appending strings to array options.
+ - Documentation improvements.
+
4.13 Wed Sep 01 2010: - Balint Szilakszi <szbalint at cpan.org>
- Fixed WWW::Curl::Form (again, formadd and formaddfile working now).
Modified: branches/upstream/libwww-curl-perl/current/Curl.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/Curl.xs?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/Curl.xs (original)
+++ branches/upstream/libwww-curl-perl/current/Curl.xs Mon Oct 25 06:28:57 2010
@@ -10,7 +10,7 @@
* Software is furnished to do so, under the terms of the MPL or
* the MIT/X-derivate licenses. You may pick one of these licenses.
*/
-
+#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
@@ -81,7 +81,8 @@
/* switch from curl option codes to the relevant callback index */
-static perl_curl_easy_callback_code callback_index(int option)
+static perl_curl_easy_callback_code
+callback_index(int option)
{
switch(option) {
case CURLOPT_WRITEFUNCTION:
@@ -113,7 +114,8 @@
}
/* switch from curl slist names to an slist index */
-static perl_curl_easy_slist_code slist_index(int option)
+static perl_curl_easy_slist_code
+slist_index(int option)
{
switch(option) {
case CURLOPT_HTTPHEADER:
@@ -134,8 +136,6 @@
{
perl_curl_easy *self;
Newz(1, self, 1, perl_curl_easy);
- if (!self)
- croak("out of memory");
self->curl=curl_easy_init();
return self;
}
@@ -144,14 +144,13 @@
{
perl_curl_easy *self;
Newz(1, self, 1, perl_curl_easy);
- if (!self)
- croak("out of memory");
self->curl=curl_easy_duphandle(orig->curl);
return self;
}
static void perl_curl_easy_delete(perl_curl_easy *self)
{
+ dTHX;
perl_curl_easy_slist_code index;
perl_curl_easy_callback_code i;
@@ -189,6 +188,7 @@
static void perl_curl_easy_register_callback(perl_curl_easy *self, SV **callback, SV *function)
{
+ dTHX;
if (function && SvOK(function)) {
/* FIXME: need to check the ref-counts here */
if (*callback == NULL) {
@@ -209,8 +209,6 @@
{
perl_curl_form *self;
Newz(1, self, 1, perl_curl_form);
- if (!self)
- croak("out of memory");
self->post=NULL;
self->last=NULL;
return self;
@@ -229,8 +227,6 @@
{
perl_curl_multi *self;
Newz(1, self, 1, perl_curl_multi);
- if (!self)
- croak("out of memory");
#ifdef __CURL_MULTI_H
self->curlm=curl_multi_init();
#else
@@ -255,8 +251,6 @@
{
perl_curl_share *self;
Newz(1, self, 1, perl_curl_share);
- if (!self)
- croak("out of memory");
self->curlsh=curl_share_init();
return self;
}
@@ -269,6 +263,30 @@
Safefree(self);
}
+static size_t
+write_to_ctx(pTHX_ SV* const call_ctx, const char* const ptr, size_t const n) {
+ PerlIO *handle;
+ SV* out_str;
+ if (call_ctx) { /* a GLOB or a SCALAR ref */
+ if(SvROK(call_ctx) && SvTYPE(SvRV(call_ctx)) <= SVt_PVMG) {
+ /* write to a scalar ref */
+ out_str = SvRV(call_ctx);
+ if (SvOK(out_str)) {
+ sv_catpvn(out_str, ptr, n);
+ } else {
+ sv_setpvn(out_str, ptr, n);
+ }
+ return n;
+ }
+ else {
+ /* write to a filehandle */
+ handle = IoOFP(sv_2io(call_ctx));
+ }
+ } else { /* punt to stdout */
+ handle = PerlIO_stdout();
+ }
+ return PerlIO_write(handle, ptr, n);
+}
/* generic fwrite callback, which decides which callback to call */
static size_t
@@ -280,6 +298,7 @@
void *call_function,
void *call_ctx)
{
+ dTHX;
if (call_function) { /* We are doing a callback to perl */
dSP;
int count, status;
@@ -315,16 +334,7 @@
return status;
} else {
- /* perform write directly, via PerlIO */
-
- PerlIO *handle;
- if (call_ctx) { /* Assume the context is a GLOB */
- handle = IoOFP(sv_2io(call_ctx));
-
- } else { /* punt to stdout */
- handle = PerlIO_stdout();
- }
- return PerlIO_write(handle,ptr,size*nmemb);
+ return write_to_ctx(aTHX_ call_ctx, ptr, size * nmemb);
}
}
@@ -338,6 +348,7 @@
void *call_ctx,
int curl_infotype)
{
+ dTHX;
dSP;
if (call_function) { /* We are doing a callback to perl */
@@ -378,21 +389,12 @@
return status;
} else {
- /* perform write directly, via PerlIO */
-
- PerlIO *handle;
- if (call_ctx) { /* Assume the context is a GLOB */
- handle = IoOFP(sv_2io(call_ctx));
-
- } else { /* punt to stdout */
- handle = PerlIO_stdout();
- }
- return PerlIO_write(handle,ptr,size*sizeof(char));
+ return write_to_ctx(aTHX_ call_ctx, ptr, size * sizeof(char));
}
}
/* Write callback for calling a perl callback */
-size_t
+static size_t
write_callback_func(const void *ptr, size_t size, size_t nmemb, void *stream)
{
perl_curl_easy *self;
@@ -402,7 +404,7 @@
}
/* header callback for calling a perl callback */
-size_t
+static size_t
writeheader_callback_func(const void *ptr, size_t size, size_t nmemb, void *stream)
{
perl_curl_easy *self;
@@ -413,7 +415,7 @@
}
/* debug callback for calling a perl callback */
-size_t
+static size_t
debug_callback_func(CURL* handle, int curl_infotype, const void *ptr, size_t size, void *stream)
{
perl_curl_easy *self;
@@ -424,9 +426,10 @@
}
/* read callback for calling a perl callback */
-size_t
+static size_t
read_callback_func( void *ptr, size_t size, size_t nmemb, void *stream)
{
+ dTHX;
dSP ;
size_t maxlen;
@@ -492,6 +495,7 @@
static int progress_callback_func(void *clientp, double dltotal, double dlnow,
double ultotal, double ulnow)
{
+ dTHX;
dSP;
int count;
@@ -688,10 +692,11 @@
RETVAL
int
-curl_easy_setopt(self, option, value)
+curl_easy_setopt(self, option, value, push=0)
WWW::Curl::Easy self
int option
SV * value
+ int push
CODE:
RETVAL=CURLE_OK;
switch(option) {
@@ -753,7 +758,7 @@
slist = &(self->slist[slist_index(option)]);
/* free any previous list */
- if (*slist) {
+ if (*slist && !push) {
curl_slist_free_all(*slist);
*slist=NULL;
}
@@ -1103,13 +1108,17 @@
fd_set fdexcep;
int maxfd;
int i;
+ AV *readset;
+ AV *writeset;
+ AV *excepset;
PPCODE:
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
FD_ZERO(&fdexcep);
- AV *readset = newAV();
- AV *writeset = newAV();
- AV *excepset = newAV();
+
+ readset = newAV();
+ writeset = newAV();
+ excepset = newAV();
curl_multi_fdset(self->curlm, &fdread, &fdwrite, &fdexcep, &maxfd);
if ( maxfd != -1 ) {
for (i=0;i <= maxfd;i++) {
Modified: branches/upstream/libwww-curl-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/MANIFEST?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/MANIFEST (original)
+++ branches/upstream/libwww-curl-perl/current/MANIFEST Mon Oct 25 06:28:57 2010
@@ -37,6 +37,7 @@
t/18twinhandles.t
t/19multi.t
t/20undefined_subs.t
+t/21write-to-scalar.t
t/meta.t
t/new/00constants.t
t/new/01basic.t
Modified: branches/upstream/libwww-curl-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/META.yml?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/META.yml (original)
+++ branches/upstream/libwww-curl-perl/current/META.yml Mon Oct 25 06:28:57 2010
@@ -24,4 +24,4 @@
perl: 5.6.1
resources:
repository: http://github.com/szbalint/WWW--Curl
-version: 4.13
+version: 4.14
Modified: branches/upstream/libwww-curl-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/Makefile.PL?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/Makefile.PL (original)
+++ branches/upstream/libwww-curl-perl/current/Makefile.PL Mon Oct 25 06:28:57 2010
@@ -35,6 +35,8 @@
"Proceed manually if you know what you're doing.\n";
exit(0);
}
+
+print "The version is $version\n";
my @includes = qw();
my ($cflags,$lflags, $ldflags) = ('','','');
@@ -109,7 +111,9 @@
my ($option, $value) =
m/^#define CURLOPT_(\w+)\s+CURLOPT_(\w+)/;
$constants{CURLOPT_}->{$option} = $value;
- } elsif ($_ =~ m/^\s*(CURLINFO_|CURLSHOPT_|CURL_LOCK_DATA_|CURLE_|CURL_NETRC_)(\w+)/) {
+ } elsif ($_ =~ m/^\s*(CURLINFO_|CURLSHOPT_|CURLE_|CURL_LOCK_)(\w+)/) {
+ $constants{$1}->{$2} = $2;
+ } elsif ($_ =~ m/^\s*(CURL_)(\w+)(?:[,\s]*)(?:\/\*.*)?$/) {
$constants{$1}->{$2} = $2;
} elsif ($_ =~ m/^\s*CURLPROXY_(\w+)\s*=\s*\d+/) {
$constants{CURLPROXY_}->{$1} = $1;
@@ -188,7 +192,7 @@
if ($line !~ m/^\@CURLOPT_INCLUDE\@/) {
print EASY_PM $line;
} else {
- for my $group (qw/CURLOPT_ CURLINFO_ CURLE_ CURL_NETRC_ CURLPROXY_/) {
+ for my $group (qw/CURLOPT_ CURLINFO_ CURLE_ CURL_ CURLPROXY_/) {
for my $option (sort keys %{$constants{$group}}) {
next unless $option;
print EASY_PM $group.$option."\n";
@@ -210,8 +214,8 @@
foreach my $option (sort keys %{$constants{CURLSHOPT_}}) {
print SHARE_PM $1 . "CURLSHOPT_".$option . "\n";
}
- foreach my $option (sort keys %{$constants{CURL_LOCK_DATA_}}) {
- print SHARE_PM $1 . "CURL_LOCK_DATA_".$option . "\n";
+ foreach my $option (sort keys %{$constants{CURL_LOCK_}}) {
+ print SHARE_PM $1 . "CURL_LOCK_".$option . "\n";
}
}
}
Modified: branches/upstream/libwww-curl-perl/current/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/SIGNATURE?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/SIGNATURE (original)
+++ branches/upstream/libwww-curl-perl/current/SIGNATURE Mon Oct 25 06:28:57 2010
@@ -14,12 +14,12 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
-SHA1 57dd37a044ec3932167e144e5c6243530c659c8e Changes
-SHA1 a5b3c8d879c0a839e1950c9f6f46d82ebe806e4f Curl.xs
+SHA1 fcabd943225c88f9aa1039761a0e43f8ef01b40a Changes
+SHA1 478b1942dc6fe9dcbc10c3f1849dfa46446370de Curl.xs
SHA1 94cbea5b3fb940e25cd4535d1c81bfd7d51dac3c LICENSE
-SHA1 8685dd652f68b7283809bf28a6d5478ed6f6c19a MANIFEST
-SHA1 929ba34ad51060a0aac41ce7f2114bc68b444988 META.yml
-SHA1 754b95eb93ec7fb5d0922e7030742fc0de1f196b Makefile.PL
+SHA1 9dc4200fb6a801473e78843217a2835ee7c390a4 MANIFEST
+SHA1 5c2c13c7cc93ee8e882221d2d40e9f5aee954abd META.yml
+SHA1 b6eaa6b551f80e0b2520a654e7a3ea897603e6d4 Makefile.PL
SHA1 3e8bbd9aa6cd273aef05f78cfef0116a0e3d59b0 README
SHA1 ed6f9f399075307a33bd02902ebbadbbbfbd8bab README.Win32
SHA1 fd5f3c4f0418efee3b9b16cf8c3902e8374909df inc/Module/Install.pm
@@ -29,13 +29,13 @@
SHA1 dbec1085a29a855202ee797a5bac319cf426827f inc/Module/Install/MakeMaker.pm
SHA1 3e83972921d54198d1246f7278f08664006cd65d inc/Module/Install/Makefile.pm
SHA1 12bf1867955480d47d5171a9e9c6a96fabe0b58f inc/Module/Install/Metadata.pm
-SHA1 2080f924fe9ec9c2852fcb9657967ff98b2bb78f lib/WWW/Curl.pm
-SHA1 d6a5f950e177856a7d4e93484652784f15cb303a lib/WWW/Curl/Easy.pm
-SHA1 e1693d1264812c85800b61a2131f1822ec7c54a7 lib/WWW/Curl/Form.pm
+SHA1 dbda7543f5ce9a1a6c900e00a87916932fe639d0 lib/WWW/Curl.pm
+SHA1 1c83271333d4d6f9766352b09a73b45e79bf5ec1 lib/WWW/Curl/Easy.pm
+SHA1 84564a68236d7458d8cf82319efadc02621c51d8 lib/WWW/Curl/Form.pm
SHA1 0bddc700447a50dd26d13119ee60349556ce1811 lib/WWW/Curl/Multi.pm
SHA1 08df49894fc724e358676a80ca7cd3895bc30b9a lib/WWW/Curl/Share.pm
SHA1 802cb1fcd35fe78e4cdb10164a05e54ce1427543 t/00constants.t
-SHA1 88c7780f18aab350318bd8c6d887558a4ce17519 t/01basic.t
+SHA1 a6bd16e0cd3ad3923e71955b98eb08ddcde07bd5 t/01basic.t
SHA1 07b63b1baca142a0e34e79633d0eb57684524bed t/02callbacks.t
SHA1 905c848deb6492d539c5bdf89c49632a412af15a t/04abort-test.t
SHA1 f9c842503835908a0687ab41655042a16b8b5112 t/05progress.t
@@ -50,8 +50,9 @@
SHA1 785507b3fa6f414298cdcf7ceaba1f9274aa07d2 t/16formpost.t
SHA1 e784a874eb36fd5b16a12fc58365cce697ecbbab t/17slist.t
SHA1 9b80d6de1675261d43abea2f76cfd610f42a4494 t/18twinhandles.t
-SHA1 7c7e12a6a5afa9afaec967958e1396d41f2697c8 t/19multi.t
+SHA1 7daab9e7051396cef5f2a37b52cc6ee1c99be98e t/19multi.t
SHA1 42f7f35d7ac8b38838cc71fdc7a89402b63e01b7 t/20undefined_subs.t
+SHA1 c0daf235a136f623fc29ae5c2c2ce6cfc68a9b5f t/21write-to-scalar.t
SHA1 2924361d0713031b92c6b888f11e860d357837f7 t/meta.t
SHA1 3cd20c1711b43058550922404f53a844fb2695e6 t/new/00constants.t
SHA1 d9863d2e71f618a58d419534867cda8bd97dcfbf t/new/01basic.t
@@ -67,13 +68,13 @@
SHA1 20ec0bd03ff2600505d38623153a6eb3087b5814 t/new/README
SHA1 ac25bfa56d36f19cbee72a968b06372e88602a61 t/pod-coverage.t
SHA1 0190346d7072d458c8a10a45c19f86db641dcc48 t/pod.t
-SHA1 79c2627afc7d7671fbd545527a19a9622fcd8f11 template/Easy.pm.tmpl
+SHA1 a04ab9054821da678e0f43da2c4f6da7177adc53 template/Easy.pm.tmpl
SHA1 f690cca3adf6c17840985fe40c22ee56fdfb999f template/Share.pm.tmpl
SHA1 468b011caaf4d54609b421027d7c6262a9260e89 typemap
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
-iF4EAREIAAYFAkx+x+0ACgkQ9vEeIen/Zj6WxwD/VfQCOWg+9egne6NNWMllAE0j
-i+i7r/CAEaQWywuXU7YBAIJnxLu9qN0XUqm/Xuxj6cd4YBofXhsQseXjAHMPc82d
-=0s0r
+iF4EAREIAAYFAkzEhrYACgkQ9vEeIen/Zj4XIwD/cdSn+iaFq7Y62i8WGCfGDQjT
+3g3L10PbxmuoMT1bRcUA/0a+JO8OxUrQNOXmOe4zzEVYjdSc8Aq9ypVwdwuVESkV
+=iums
-----END PGP SIGNATURE-----
Modified: branches/upstream/libwww-curl-perl/current/lib/WWW/Curl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/lib/WWW/Curl.pm?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/lib/WWW/Curl.pm (original)
+++ branches/upstream/libwww-curl-perl/current/lib/WWW/Curl.pm Mon Oct 25 06:28:57 2010
@@ -4,7 +4,7 @@
use warnings;
use XSLoader;
-our $VERSION = '4.13';
+our $VERSION = '4.14';
XSLoader::load(__PACKAGE__, $VERSION);
END {
@@ -47,16 +47,14 @@
use warnings;
use WWW::Curl::Easy;
- # Setting the options
- my $curl = new WWW::Curl::Easy;
+ my $curl = WWW::Curl::Easy->new;
$curl->setopt(CURLOPT_HEADER,1);
$curl->setopt(CURLOPT_URL, 'http://example.com');
+
+ # A filehandle, reference to a scalar or reference to a typeglob can be used here.
my $response_body;
-
- # NOTE - do not use a typeglob here. A reference to a typeglob is okay though.
- open (my $fileb, ">", \$response_body);
- $curl->setopt(CURLOPT_WRITEDATA,$fileb);
+ $curl->setopt(CURLOPT_WRITEDATA,\$response_body);
# Starts the actual request
my $retcode = $curl->perform;
@@ -68,7 +66,8 @@
# judge result and next action based on $response_code
print("Received response: $response_body\n");
} else {
- print("An error happened: ".$curl->strerror($retcode)." ($retcode)\n");
+ # Error code, type of error, error message
+ print("An error happened: $retcode ".$curl->strerror($retcode)." ".$curl->errbuf."\n");
}
@@ -282,6 +281,10 @@
Not implemented and won't be, as this method is considered deprecated.
+=item curl_version
+
+Seems to work.
+
=item curl_version_info
Not yet implemented.
@@ -295,6 +298,28 @@
This method returns three arrayrefs: the read, write and exception fds libcurl knows about.
In the case of no file descriptors in the given set, an empty array is returned.
+
+=back
+
+=head1 NUANCES
+
+=head2 Header output for redirects
+
+It might be surprising that if C<CURLOPT_FOLLOWLOCATION> is set and header output was enabled, headers show up for all http responses.
+The reasoning behind that and possible code adjustments are outlined here: L<https://rt.cpan.org/Ticket/Display.html?id=61569>.
+
+=head1 ADDITIONAL METHODS
+
+=head2 On WWW::Curl::Easy objects
+
+=over
+
+=item pushopt
+
+Like C<setopt> but instead of overriding any previously set values it adds it
+to the end. Can be used with C<CURLOPT_HTTPHEADER>, C<CURLOPT_QUOTE> and
+C<CURLOPT_POSTQUOTE>.
+
=back
Modified: branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Easy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Easy.pm?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Easy.pm (original)
+++ branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Easy.pm Mon Oct 25 06:28:57 2010
@@ -4,7 +4,7 @@
use warnings;
use Carp;
-our $VERSION = '4.13';
+our $VERSION = '4.14';
use WWW::Curl ();
use Exporter ();
@@ -44,6 +44,11 @@
return $value;
}
+sub pushopt {
+ my ($self, $option, $value) = @_;
+ $self->setopt($option, $value, 1);
+}
+
1;
__END__
Modified: branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Form.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Form.pm?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Form.pm (original)
+++ branches/upstream/libwww-curl-perl/current/lib/WWW/Curl/Form.pm Mon Oct 25 06:28:57 2010
@@ -3,7 +3,7 @@
use warnings;
use Carp;
-our $VERSION = '4.13';
+our $VERSION = '4.14';
use WWW::Curl ();
use Exporter ();
Modified: branches/upstream/libwww-curl-perl/current/t/01basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/t/01basic.t?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/t/01basic.t (original)
+++ branches/upstream/libwww-curl-perl/current/t/01basic.t Mon Oct 25 06:28:57 2010
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 18;
+use Test::More tests => 19;
use File::Temp qw/tempfile/;
BEGIN { use_ok( 'WWW::Curl::Easy' ); }
@@ -34,6 +34,7 @@
$myheaders[0] = "Server: www";
$myheaders[1] = "User-Agent: Perl interface for libcURL";
ok(! $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders), "Setting CURLOPT_HTTPHEADER");
+ok(! $curl->pushopt(CURLOPT_HTTPHEADER, ["Random: header"]));
$curl->setopt(CURLOPT_COOKIEFILE, "");
my $retcode = $curl->perform();
Modified: branches/upstream/libwww-curl-perl/current/t/19multi.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/t/19multi.t?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/t/19multi.t (original)
+++ branches/upstream/libwww-curl-perl/current/t/19multi.t Mon Oct 25 06:28:57 2010
@@ -62,7 +62,7 @@
ok(@{$fds[0]} == 1 || @{$fds[1]} == 1, "The read or write fdset still only contains one fd");
$curlm->perform;
@fds = $curlm->fdset;
- ok( @{$fds[0]} == 2 || @{$fds[1]} == 2, "The read or write fdset contains two fds");
+ ok( @{$fds[0]} + @{$fds[1]} == 2, "The read or write fdset contains two fds");
while ($curlm->perform) {
action_wait($curlm);
}
Added: branches/upstream/libwww-curl-perl/current/t/21write-to-scalar.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/t/21write-to-scalar.t?rev=64223&op=file
==============================================================================
--- branches/upstream/libwww-curl-perl/current/t/21write-to-scalar.t (added)
+++ branches/upstream/libwww-curl-perl/current/t/21write-to-scalar.t Mon Oct 25 06:28:57 2010
@@ -1,0 +1,41 @@
+#!perl
+use strict;
+use warnings;
+use Test::More 'no_plan';
+
+use WWW::Curl::Easy;
+
+my $url = $ENV{CURL_TEST_URL} || "http://www.google.com";
+
+# Init the curl session
+my $curl = WWW::Curl::Easy->new();
+
+ok(! $curl->setopt(CURLOPT_NOPROGRESS, 1), "Setting CURLOPT_NOPROGRESS");
+ok(! $curl->setopt(CURLOPT_FOLLOWLOCATION, 1), "Setting CURLOPT_FOLLOWLOCATION");
+ok(! $curl->setopt(CURLOPT_TIMEOUT, 30), "Setting CURLOPT_TIMEOUT");
+ok(! $curl->setopt(CURLOPT_ENCODING, undef), "Setting CURLOPT_ENCODING to undef");
+ok(! $curl->setopt(CURLOPT_RESUME_FROM_LARGE, 0), "Setting CURLOPT_RESUME_FROM_LARGE to 0");
+$curl->setopt(CURLOPT_HEADER, 1);
+
+my $head = '';
+ok(! $curl->setopt(CURLOPT_WRITEHEADER, \$head), "Setting CURLOPT_WRITEHEADER");
+
+my $body = '';
+ok(! $curl->setopt(CURLOPT_WRITEDATA, \$body), "Setting CURLOPT_WRITEDATA");
+
+ok(! $curl->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL");
+
+my $retcode = $curl->perform();
+
+ok(! $retcode, "Curl return code ok");
+
+my $bytes = $curl->getinfo(CURLINFO_SIZE_DOWNLOAD);
+ok( $bytes, "getinfo returns non-zero number of bytes");
+my $realurl = $curl->getinfo(CURLINFO_EFFECTIVE_URL);
+ok( $realurl, "getinfo returns CURLINFO_EFFECTIVE_URL");
+my $httpcode = $curl->getinfo(CURLINFO_HTTP_CODE);
+ok( $httpcode, "getinfo returns CURLINFO_HTTP_CODE");
+
+note("Bytes: $bytes");
+note("realurl: $realurl");
+note("httpcode: $httpcode");
Modified: branches/upstream/libwww-curl-perl/current/template/Easy.pm.tmpl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-curl-perl/current/template/Easy.pm.tmpl?rev=64223&op=diff
==============================================================================
--- branches/upstream/libwww-curl-perl/current/template/Easy.pm.tmpl (original)
+++ branches/upstream/libwww-curl-perl/current/template/Easy.pm.tmpl Mon Oct 25 06:28:57 2010
@@ -4,7 +4,7 @@
use warnings;
use Carp;
-our $VERSION = '4.13';
+our $VERSION = '4.14';
use WWW::Curl ();
use Exporter ();
@@ -45,6 +45,11 @@
return $value;
}
+sub pushopt {
+ my ($self, $option, $value) = @_;
+ $self->setopt($option, $value, 1);
+}
+
1;
__END__
More information about the Pkg-perl-cvs-commits
mailing list