WWW-Curl-4.15/0000755000175000017500000000000011474534004012340 5ustar balintbalintWWW-Curl-4.15/SIGNATURE0000644000175000017500000001056011474533727013641 0ustar balintbalintThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.55. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 SHA1 c23d2d3256e487cfeb2fba5d11861e6ef1f9c6dd Changes SHA1 65a31f18075b247c6d4bc38ba5fe408f3bd9b2c5 Curl.xs SHA1 94cbea5b3fb940e25cd4535d1c81bfd7d51dac3c LICENSE SHA1 7cae1c2346a6ce99ac5325cabb51b7ce4ebad209 MANIFEST SHA1 3c88c4db0ddf4624cc22454d5e1f996ef2b0988a META.yml SHA1 03e0e48557e565a4663c30bfe8f75660c1336e0f Makefile.PL SHA1 3e8bbd9aa6cd273aef05f78cfef0116a0e3d59b0 README SHA1 ed6f9f399075307a33bd02902ebbadbbbfbd8bab README.Win32 SHA1 fd5f3c4f0418efee3b9b16cf8c3902e8374909df inc/Module/Install.pm SHA1 7cd7c349afdf3f012e475507b1017bdfa796bfbd inc/Module/Install/Base.pm SHA1 ba186541bbf6439111f01fc70769cf24d22869bf inc/Module/Install/Can.pm SHA1 a9d6306080cee9c32b18f6cbd3c7636ece67e81a inc/Module/Install/External.pm SHA1 dbec1085a29a855202ee797a5bac319cf426827f inc/Module/Install/MakeMaker.pm SHA1 3e83972921d54198d1246f7278f08664006cd65d inc/Module/Install/Makefile.pm SHA1 12bf1867955480d47d5171a9e9c6a96fabe0b58f inc/Module/Install/Metadata.pm SHA1 2d3ace586b9c815af387d69d5c6645e139777775 lib/WWW/Curl.pm SHA1 7909ec25b1dfe3499fd9fab597ed958dbe1169e1 lib/WWW/Curl/Easy.pm SHA1 0f4db7cb0e4ba57e0c7869f6932322911b55d4cd lib/WWW/Curl/Form.pm SHA1 0bddc700447a50dd26d13119ee60349556ce1811 lib/WWW/Curl/Multi.pm SHA1 7dbc5c2e1144c4e4ae75d6259bc16d713913f6f5 lib/WWW/Curl/Share.pm SHA1 3874fe0b4d751149e6ede0967ccec514f3b90756 t/00constants.t SHA1 83dbfe8cf1c1c567436daa3cc2a7f92e40285139 t/01basic.t SHA1 07b63b1baca142a0e34e79633d0eb57684524bed t/02callbacks.t SHA1 905c848deb6492d539c5bdf89c49632a412af15a t/04abort-test.t SHA1 f9c842503835908a0687ab41655042a16b8b5112 t/05progress.t SHA1 6406f237b74c8b847d233e5570c2769d7445c307 t/06http-post.t SHA1 a252ca35aaf428e566e8f24bb59f3b56e4c8511d t/07ftp-upload.t SHA1 264e51909488be715566f9341ac438d5a8dc7de1 t/08ssl.t SHA1 ec62c062c627e7f52df512eae496223bd49ad2f3 t/09times.t SHA1 9499f362a6d06a19aa6bc41d3647dbd5dc5aca63 t/10errbuf.t SHA1 2c5793062538fdff6e3d837bb6c8a35c59a2b61e t/13slowleak.t SHA1 f911c90eaf0fdd2ee60f913262ee6ca3236037f0 t/14duphandle.t SHA1 62551de2e5da5df233b296b716093cea8d791d70 t/15duphandle-callback.t SHA1 785507b3fa6f414298cdcf7ceaba1f9274aa07d2 t/16formpost.t SHA1 e784a874eb36fd5b16a12fc58365cce697ecbbab t/17slist.t SHA1 9b80d6de1675261d43abea2f76cfd610f42a4494 t/18twinhandles.t SHA1 2591e39d5346fb4effca23d3ccef224322d843d7 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 SHA1 f4a3ea4777e0905d2cf0f6cdb18d04a39892c69d t/new/02header-callback.t SHA1 4aa1ab99c68aa4069a37419f439520b639fdb1e6 t/new/03body-callback.t SHA1 1470b63fda40ae09ce5faa891b6b30d804709c93 t/new/04abort.t SHA1 0d80cbde8d56c32ada4284f4738357cce1346b2b t/new/05progress.t SHA1 fda1cb27df8d45a6e00fb0f1ca664b815a5d9b47 t/new/06http-post.t SHA1 66c9b543a13c328a5b49b79d29aaa6345702ec71 t/new/07errbuf.t SHA1 63aecf6590d0d4268be8f23ba406d5b957710cde t/new/08duphandle.t SHA1 a20c28c3e06ebf836e837da4c5d1afb2998d5cc7 t/new/09duphandle-callback.t SHA1 eee30cfb57132e7c8bdd4a5dd2f32273ab222115 t/new/10multi-callback.t SHA1 20ec0bd03ff2600505d38623153a6eb3087b5814 t/new/README SHA1 ac25bfa56d36f19cbee72a968b06372e88602a61 t/pod-coverage.t SHA1 0190346d7072d458c8a10a45c19f86db641dcc48 t/pod.t SHA1 1811cc3766dbb601d0ae0aea284b6e0a642a483a t/symbols-in-versions SHA1 dc1cf787a6dec7d4e263f95a1566369f51b94746 template/Easy.pm.tmpl SHA1 f6f5d52b1d34bff9d085ac40bbc6f8b2a6269c58 template/Share.pm.tmpl SHA1 468b011caaf4d54609b421027d7c6262a9260e89 typemap -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EAREIAAYFAkzyt84ACgkQ9vEeIen/Zj4wSAD/Z0JHQVK5ie0xOBkD+4A1vAWb A0JWUq6/8e9GNyVtjJoA/20hxeygZr4zddpfZ4AakE6f9m3+g3KEKo73+26HgZYq =YZHu -----END PGP SIGNATURE----- WWW-Curl-4.15/README0000644000175000017500000000534211437534610013226 0ustar balintbalintREADME for Perl extension WWW::Curl The Perl module WWW::Curl provides an interface to the cURL library "libcurl". See http://curl.haxx.se/ for more information on cURL and libcurl. This module requires libcurl and the corresponding header files to be installed. You then may install this module via the usual way (for installation on Windows please see README.Win32): perl Makefile.PL make make test make install The Makefile.PL script will try to use the 'curl-config' command to find the correct headers and libcurl path. If curl.h can't be found, either through curl-config or the internal list of guesses, you can specify an explicit path when building the Makefile: perl Makefile.PL /home/foo/curl/include If you want to specify which curl-config to use instead of the first in path set the environment variable CURL_CONFIG to point at the curl-config to use. Minimum version requirements: This module, starting from version 4 requires at least Perl 5.6.1 and libcurl 7.10.8. These releases are more than 5 years old and they have multiple security vulnerabilities, it is advised that you upgrade as soon as possible to a more recent, secure version. Anything older than these versions of Perl and libcurl respectively is not supported. Windows specific fixes and patches are welcome as testing is mainly focused on Linux. The module provides the same functionality, except as noted in the documentation, as libcurl provides to C programs. Please refer to the documentation of libcurl for the general interface description and the WWW::Curl POD for the differences. This software is distributed AS IS, WITHOUT WARRANTY OF ANY KIND, either express or implied. History: The author of the original relase of this software is Georg Horn Parts of the callback support were added Forrest Cahoon More callback support, many tests, additional documentation, and Makefile features have been added by Cris Bailiff Curl multi support has been added by Sebastian Riedel The current maintainers are Cris Bailiff and Bálint Szilakszi The latest version is available on CPAN and can be downloaded from http://search.cpan.org/perldoc?WWW::Curl . The source code repository is available at http://github.com/szbalint/WWW--Curl/tree . Copyright (C) 2000-2005, 2008-2010 Daniel Stenberg, Cris Bailiff, Bálint Szilakszi, et al. You may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the 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. WWW-Curl-4.15/Curl.xs0000644000175000017500000010403011474516314013623 0ustar balintbalint /* * Perl interface for libcurl. Check out the file README for more info. */ /* * Copyright (C) 2000, 2001, 2002, 2005, 2008 Daniel Stenberg, Cris Bailiff, et al. * You may opt to use, copy, modify, merge, publish, distribute and/or * sell copies of the Software, and permit persons to whom the * 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" #include #include #include #define header_callback_func writeheader_callback_func /* Do a favor for older perl versions */ #ifndef Newxz # define Newxz(v,n,t) Newz(0,v,n,t) #endif typedef enum { CALLBACK_WRITE = 0, CALLBACK_READ, CALLBACK_HEADER, CALLBACK_PROGRESS, CALLBACK_DEBUG, CALLBACK_LAST } perl_curl_easy_callback_code; typedef enum { SLIST_HTTPHEADER = 0, SLIST_QUOTE, SLIST_POSTQUOTE, SLIST_LAST } perl_curl_easy_slist_code; typedef struct { /* The main curl handle */ struct CURL *curl; I32 *y; /* Lists that can be set via curl_easy_setopt() */ struct curl_slist *slist[SLIST_LAST]; SV *callback[CALLBACK_LAST]; SV *callback_ctx[CALLBACK_LAST]; /* copy of error buffer var for caller*/ char errbuf[CURL_ERROR_SIZE+1]; char *errbufvarname; I32 strings_index; char* strings[CURLOPTTYPE_FUNCTIONPOINT - 10000]; } perl_curl_easy; typedef struct { struct curl_httppost * post; struct curl_httppost * last; } perl_curl_form; typedef struct { #ifdef __CURL_MULTI_H struct CURLM *curlm; #else struct void *curlm; #endif } perl_curl_multi; typedef struct { struct CURLSH *curlsh; } perl_curl_share; /* switch from curl option codes to the relevant callback index */ static perl_curl_easy_callback_code callback_index(int option) { switch(option) { case CURLOPT_WRITEFUNCTION: case CURLOPT_FILE: return CALLBACK_WRITE; break; case CURLOPT_READFUNCTION: case CURLOPT_INFILE: return CALLBACK_READ; break; case CURLOPT_HEADERFUNCTION: case CURLOPT_WRITEHEADER: return CALLBACK_HEADER; break; case CURLOPT_PROGRESSFUNCTION: case CURLOPT_PROGRESSDATA: return CALLBACK_PROGRESS; break; case CURLOPT_DEBUGFUNCTION: case CURLOPT_DEBUGDATA: return CALLBACK_DEBUG; break; } croak("Bad callback index requested\n"); return CALLBACK_LAST; } /* switch from curl slist names to an slist index */ static perl_curl_easy_slist_code slist_index(int option) { switch(option) { case CURLOPT_HTTPHEADER: return SLIST_HTTPHEADER; break; case CURLOPT_QUOTE: return SLIST_QUOTE; break; case CURLOPT_POSTQUOTE: return SLIST_POSTQUOTE; break; } croak("Bad slist index requested\n"); return SLIST_LAST; } static perl_curl_easy * perl_curl_easy_new() { perl_curl_easy *self; Newz(1, self, 1, perl_curl_easy); self->curl=curl_easy_init(); return self; } static perl_curl_easy * perl_curl_easy_duphandle(perl_curl_easy *orig) { perl_curl_easy *self; Newz(1, self, 1, perl_curl_easy); 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; if (self->curl) curl_easy_cleanup(self->curl); *self->y = *self->y - 1; if (*self->y <= 0) { for (index=0;indexslist[index]) curl_slist_free_all(self->slist[index]); }; Safefree(self->y); } for(i=0;icallback[i]); } for(i=0;icallback_ctx[i]); } if (self->errbufvarname) free(self->errbufvarname); for (i=0;i<=self->strings_index;i++) { if (self->strings[i] != NULL) { char* ptr = self->strings[i]; Safefree(ptr); } } Safefree(self); } /* Register a callback function */ 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) { *callback = newSVsv(function); } else { SvSetSV(*callback, function); } } else { if (*callback != NULL) { sv_2mortal(*callback); *callback = NULL; } } } /* start of form functions - very un-finished! */ static perl_curl_form * perl_curl_form_new() { perl_curl_form *self; Newz(1, self, 1, perl_curl_form); self->post=NULL; self->last=NULL; return self; } static void perl_curl_form_delete(perl_curl_form *self) { if (self->post) { curl_formfree(self->post); } Safefree(self); } /* make a new multi */ static perl_curl_multi * perl_curl_multi_new() { perl_curl_multi *self; Newz(1, self, 1, perl_curl_multi); #ifdef __CURL_MULTI_H self->curlm=curl_multi_init(); #else croak("curl version too old to support curl_multi_init()"); #endif return self; } /* delete the multi */ static void perl_curl_multi_delete(perl_curl_multi *self) { #ifdef __CURL_MULTI_H if (self->curlm) curl_multi_cleanup(self->curlm); Safefree(self); #endif } /* make a new share */ static perl_curl_share * perl_curl_share_new() { perl_curl_share *self; Newz(1, self, 1, perl_curl_share); self->curlsh=curl_share_init(); return self; } /* delete the share */ static void perl_curl_share_delete(perl_curl_share *self) { if (self->curlsh) curl_share_cleanup(self->curlsh); 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 fwrite_wrapper ( const void *ptr, size_t size, size_t nmemb, perl_curl_easy *self, void *call_function, void *call_ctx) { dTHX; if (call_function) { /* We are doing a callback to perl */ dSP; int count, status; ENTER; SAVETMPS; PUSHMARK(SP); if (ptr) { XPUSHs(sv_2mortal(newSVpvn((char *)ptr, (STRLEN)(size * nmemb)))); } else { /* just in case */ XPUSHs(&PL_sv_undef); } if (call_ctx) { XPUSHs(sv_2mortal(newSVsv(call_ctx))); } else { /* should be a stdio glob ? */ XPUSHs(&PL_sv_undef); } PUTBACK; count = perl_call_sv((SV *) call_function, G_SCALAR); SPAGAIN; if (count != 1) croak("callback for CURLOPT_WRITEFUNCTION didn't return a status\n"); status = POPi; PUTBACK; FREETMPS; LEAVE; return status; } else { return write_to_ctx(aTHX_ call_ctx, ptr, size * nmemb); } } /* debug fwrite callback */ static size_t fwrite_wrapper2 ( const void *ptr, size_t size, perl_curl_easy *self, void *call_function, void *call_ctx, int curl_infotype) { dTHX; dSP; if (call_function) { /* We are doing a callback to perl */ int count, status; SV *sv; ENTER; SAVETMPS; PUSHMARK(SP); if (ptr) { XPUSHs(sv_2mortal(newSVpvn((char *)ptr, (STRLEN)(size * sizeof(char))))); } else { /* just in case */ XPUSHs(&PL_sv_undef); } if (call_ctx) { XPUSHs(sv_2mortal(newSVsv(call_ctx))); } else { /* should be a stdio glob ? */ XPUSHs(&PL_sv_undef); } XPUSHs(sv_2mortal(newSViv(curl_infotype))); PUTBACK; count = perl_call_sv((SV *) call_function, G_SCALAR); SPAGAIN; if (count != 1) croak("callback for CURLOPT_*FUNCTION didn't return a status\n"); status = POPi; PUTBACK; FREETMPS; LEAVE; return status; } else { return write_to_ctx(aTHX_ call_ctx, ptr, size * sizeof(char)); } } /* Write callback for calling a perl callback */ static size_t write_callback_func(const void *ptr, size_t size, size_t nmemb, void *stream) { perl_curl_easy *self; self=(perl_curl_easy *)stream; return fwrite_wrapper(ptr,size,nmemb,self, self->callback[CALLBACK_WRITE],self->callback_ctx[CALLBACK_WRITE]); } /* header callback for calling a perl callback */ static size_t writeheader_callback_func(const void *ptr, size_t size, size_t nmemb, void *stream) { perl_curl_easy *self; self=(perl_curl_easy *)stream; return fwrite_wrapper(ptr,size,nmemb,self, self->callback[CALLBACK_HEADER],self->callback_ctx[CALLBACK_HEADER]); } /* debug callback for calling a perl callback */ static size_t debug_callback_func(CURL* handle, int curl_infotype, const void *ptr, size_t size, void *stream) { perl_curl_easy *self; self=(perl_curl_easy *)stream; return fwrite_wrapper2(ptr,size,self, self->callback[CALLBACK_DEBUG],self->callback_ctx[CALLBACK_DEBUG],curl_infotype); } /* read callback for calling a perl callback */ static size_t read_callback_func( void *ptr, size_t size, size_t nmemb, void *stream) { dTHX; dSP ; size_t maxlen; perl_curl_easy *self; self=(perl_curl_easy *)stream; maxlen = size*nmemb; if (self->callback[CALLBACK_READ]) { /* We are doing a callback to perl */ char *data; int count; SV *sv; STRLEN len; ENTER ; SAVETMPS ; PUSHMARK(SP) ; if (self->callback_ctx[CALLBACK_READ]) { sv = self->callback_ctx[CALLBACK_READ]; } else { sv = &PL_sv_undef; } XPUSHs(sv_2mortal(newSViv(maxlen))); XPUSHs(sv_2mortal(newSVsv(sv))); PUTBACK ; count = perl_call_sv(self->callback[CALLBACK_READ], G_SCALAR); SPAGAIN; if (count != 1) croak("callback for CURLOPT_READFUNCTION didn't return any data\n"); sv = POPs; data = SvPV(sv,len); /* only allowed to return the number of bytes asked for */ len = (lencallback_ctx[CALLBACK_READ]) { /* hope its a GLOB! */ f = IoIFP(sv_2io(self->callback_ctx[CALLBACK_READ])); } else { /* punt to stdin */ f = PerlIO_stdin(); } return PerlIO_read(f,ptr,maxlen); } } /* Progress callback for calling a perl callback */ static int progress_callback_func(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { dTHX; dSP; int count; perl_curl_easy *self; self=(perl_curl_easy *)clientp; ENTER; SAVETMPS; PUSHMARK(sp); if (self->callback_ctx[CALLBACK_PROGRESS]) { XPUSHs(sv_2mortal(newSVsv(self->callback_ctx[CALLBACK_PROGRESS]))); } else { XPUSHs(&PL_sv_undef); } XPUSHs(sv_2mortal(newSVnv(dltotal))); XPUSHs(sv_2mortal(newSVnv(dlnow))); XPUSHs(sv_2mortal(newSVnv(ultotal))); XPUSHs(sv_2mortal(newSVnv(ulnow))); PUTBACK; count = perl_call_sv(self->callback[CALLBACK_PROGRESS], G_SCALAR); SPAGAIN; if (count != 1) croak("callback for CURLOPT_PROGRESSFUNCTION didn't return 1\n"); count = POPi; PUTBACK; FREETMPS; LEAVE; return count; } #if 0 /* awaiting closepolicy prototype */ int closepolicy_callback_func(void *clientp) { dSP; int argc, status; SV *pl_status; ENTER; SAVETMPS; PUSHMARK(SP); PUTBACK; argc = perl_call_sv(closepolicy_callback, G_SCALAR); SPAGAIN; if (argc != 1) { croak("Unexpected number of arguments returned from closefunction callback\n"); } pl_status = POPs; status = SvTRUE(pl_status) ? 0 : 1; PUTBACK; FREETMPS; LEAVE; return status; } #endif #include "curlopt-constants.c" typedef perl_curl_easy * WWW__Curl__Easy; typedef perl_curl_form * WWW__Curl__Form; typedef perl_curl_multi * WWW__Curl__Multi; typedef perl_curl_share * WWW__Curl__Share; MODULE = WWW::Curl PACKAGE = WWW::Curl PREFIX = curl_ void curl__global_cleanup() CODE: curl_global_cleanup(); MODULE = WWW::Curl PACKAGE = WWW::Curl::Easy PREFIX = curl_easy_ BOOT: curl_global_init(CURL_GLOBAL_ALL); /* FIXME: does this need a mutex for ithreads? */ PROTOTYPES: ENABLE int constant(name) char * name void curl_easy_init(...) ALIAS: new = 1 PREINIT: perl_curl_easy *self; char *sclass = "WWW::Curl::Easy"; PPCODE: if (items>0 && !SvROK(ST(0))) { STRLEN dummy; sclass = SvPV(ST(0),dummy); } self=perl_curl_easy_new(); /* curl handle created by this point */ ST(0) = sv_newmortal(); sv_setref_pv(ST(0), sclass, (void*)self); SvREADONLY_on(SvRV(ST(0))); Newxz(self->y,1,I32); if (!self->y) { croak ("out of memory"); } (*self->y)++; /* configure curl to always callback to the XS interface layer */ curl_easy_setopt(self->curl, CURLOPT_WRITEFUNCTION, write_callback_func); curl_easy_setopt(self->curl, CURLOPT_READFUNCTION, read_callback_func); /* set our own object as the context for all curl callbacks */ curl_easy_setopt(self->curl, CURLOPT_FILE, self); curl_easy_setopt(self->curl, CURLOPT_INFILE, self); /* we always collect this, in case it's wanted */ curl_easy_setopt(self->curl, CURLOPT_ERRORBUFFER, self->errbuf); XSRETURN(1); void curl_easy_duphandle(self) WWW::Curl::Easy self PREINIT: perl_curl_easy *clone; char *sclass = "WWW::Curl::Easy"; perl_curl_easy_callback_code i; PPCODE: clone=perl_curl_easy_duphandle(self); clone->y = self->y; (*self->y)++; ST(0) = sv_newmortal(); sv_setref_pv(ST(0), sclass, (void*)clone); SvREADONLY_on(SvRV(ST(0))); /* configure curl to always callback to the XS interface layer */ curl_easy_setopt(clone->curl, CURLOPT_WRITEFUNCTION, write_callback_func); curl_easy_setopt(clone->curl, CURLOPT_READFUNCTION, read_callback_func); if (self->callback[callback_index(CURLOPT_HEADERFUNCTION)] || self->callback_ctx[callback_index(CURLOPT_WRITEHEADER)]) { curl_easy_setopt(clone->curl, CURLOPT_HEADERFUNCTION, header_callback_func); curl_easy_setopt(clone->curl, CURLOPT_WRITEHEADER, clone); } if (self->callback[callback_index(CURLOPT_PROGRESSFUNCTION)] || self->callback_ctx[callback_index(CURLOPT_PROGRESSDATA)]) { curl_easy_setopt(clone->curl, CURLOPT_PROGRESSFUNCTION, progress_callback_func); curl_easy_setopt(clone->curl, CURLOPT_PROGRESSDATA, clone); } if (self->callback[callback_index(CURLOPT_DEBUGFUNCTION)] || self->callback_ctx[callback_index(CURLOPT_DEBUGDATA)]) { curl_easy_setopt(clone->curl, CURLOPT_DEBUGFUNCTION, debug_callback_func); curl_easy_setopt(clone->curl, CURLOPT_DEBUGDATA, clone); } /* set our own object as the context for all curl callbacks */ curl_easy_setopt(clone->curl, CURLOPT_FILE, clone); curl_easy_setopt(clone->curl, CURLOPT_INFILE, clone); curl_easy_setopt(clone->curl, CURLOPT_ERRORBUFFER, clone->errbuf); for(i=0;icallback[i]), self->callback[i]); perl_curl_easy_register_callback(clone,&(clone->callback_ctx[i]), self->callback_ctx[i]); }; for (i=0;i<=self->strings_index;i++) { if (self->strings[i] != NULL) { clone->strings[i] = savepv(self->strings[i]); curl_easy_setopt(clone->curl, 10000 + i, clone->strings[i]); } } clone->strings_index = self->strings_index; XSRETURN(1); char * curl_easy_version(...) CODE: RETVAL=curl_version(); OUTPUT: RETVAL int curl_easy_setopt(self, option, value, push=0) WWW::Curl::Easy self int option SV * value int push CODE: RETVAL=CURLE_OK; switch(option) { /* SV * to user contexts for callbacks - any SV (glob,scalar,ref) */ case CURLOPT_FILE: case CURLOPT_INFILE: perl_curl_easy_register_callback(self, &(self->callback_ctx[callback_index(option)]), value); break; case CURLOPT_WRITEHEADER: curl_easy_setopt(self->curl, CURLOPT_HEADERFUNCTION, SvOK(value) ? header_callback_func : NULL); curl_easy_setopt(self->curl, option, SvOK(value) ? self : NULL); perl_curl_easy_register_callback(self,&(self->callback_ctx[callback_index(option)]),value); break; case CURLOPT_PROGRESSDATA: curl_easy_setopt(self->curl, CURLOPT_PROGRESSFUNCTION, SvOK(value) ? progress_callback_func : NULL); curl_easy_setopt(self->curl, option, SvOK(value) ? self : NULL); perl_curl_easy_register_callback(self,&(self->callback_ctx[callback_index(option)]), value); break; case CURLOPT_DEBUGDATA: curl_easy_setopt(self->curl, CURLOPT_DEBUGFUNCTION, SvOK(value) ? debug_callback_func : NULL); curl_easy_setopt(self->curl, option, SvOK(value) ? self : NULL); perl_curl_easy_register_callback(self,&(self->callback_ctx[callback_index(option)]), value); break; /* SV * to a subroutine ref */ case CURLOPT_WRITEFUNCTION: case CURLOPT_READFUNCTION: perl_curl_easy_register_callback(self,&(self->callback[callback_index(option)]), value); break; case CURLOPT_HEADERFUNCTION: curl_easy_setopt(self->curl, option, SvOK(value) ? header_callback_func : NULL); curl_easy_setopt(self->curl, CURLOPT_WRITEHEADER, SvOK(value) ? self : NULL); perl_curl_easy_register_callback(self,&(self->callback[callback_index(option)]), value); break; case CURLOPT_PROGRESSFUNCTION: curl_easy_setopt(self->curl, option, SvOK(value) ? progress_callback_func : NULL); curl_easy_setopt(self->curl, CURLOPT_PROGRESSDATA, SvOK(value) ? self : NULL); perl_curl_easy_register_callback(self,&(self->callback[callback_index(option)]), value); break; case CURLOPT_DEBUGFUNCTION: curl_easy_setopt(self->curl, option, SvOK(value) ? debug_callback_func : NULL); curl_easy_setopt(self->curl, CURLOPT_DEBUGDATA, SvOK(value) ? self : NULL); perl_curl_easy_register_callback(self,&(self->callback[callback_index(option)]), value); break; /* slist cases */ case CURLOPT_HTTPHEADER: case CURLOPT_QUOTE: case CURLOPT_POSTQUOTE: { /* This is an option specifying a list, which we put in a curl_slist struct */ AV *array = (AV *)SvRV(value); struct curl_slist **slist = NULL; int last = av_len(array); int i; /* We have to find out which list to use... */ slist = &(self->slist[slist_index(option)]); /* free any previous list */ if (*slist && !push) { curl_slist_free_all(*slist); *slist=NULL; } /* copy perl values into this slist */ for (i=0;i<=last;i++) { SV **sv = av_fetch(array,i,0); STRLEN len = 0; char *string = SvPV(*sv, len); if (len == 0) /* FIXME: is this correct? */ break; *slist = curl_slist_append(*slist, string); } /* pass the list into curl_easy_setopt() */ RETVAL = curl_easy_setopt(self->curl, option, *slist); }; break; /* Pass in variable name for storing error messages. Yuck. */ case CURLOPT_ERRORBUFFER: { STRLEN dummy; if (self->errbufvarname) free(self->errbufvarname); self->errbufvarname = strdup((char *)SvPV(value, dummy)); }; break; /* tell curl to redirect STDERR - value should be a glob */ case CURLOPT_STDERR: RETVAL = curl_easy_setopt(self->curl, option, IoOFP(sv_2io(value)) ); break; /* not working yet... */ case CURLOPT_HTTPPOST: if (sv_derived_from(value, "WWW::Curl::Form")) { WWW__Curl__Form wrapper; IV tmp = SvIV((SV*)SvRV(value)); wrapper = INT2PTR(WWW__Curl__Form,tmp); RETVAL = curl_easy_setopt(self->curl, option, wrapper->post); } else croak("value is not of type WWW::Curl::Form"); break; /* Curl share support from Anton Fedorov */ #if (LIBCURL_VERSION_NUM>=0x070a03) case CURLOPT_SHARE: if (sv_derived_from(value, "WWW::Curl::Share")) { WWW__Curl__Share wrapper; IV tmp = SvIV((SV*)SvRV(value)); wrapper = INT2PTR(WWW__Curl__Share,tmp); RETVAL = curl_easy_setopt(self->curl, option, wrapper->curlsh); } else croak("value is not of type WWW::Curl::Share"); break; #endif /* default cases */ default: if (option < CURLOPTTYPE_OBJECTPOINT) { /* A long (integer) value */ RETVAL = curl_easy_setopt(self->curl, option, (long)SvIV(value)); } else if (option < CURLOPTTYPE_FUNCTIONPOINT) { /* An objectpoint - string */ /* FIXME: Does curl really want NULL for empty strings? */ STRLEN dummy = 0; /* Pre 7.17.0, the strings aren't copied by libcurl.*/ char* pv = SvOK(value) ? SvPV(value, dummy) : ""; I32 len = (I32)dummy; pv = savepvn(pv, len); if (self->strings[option-10000] != NULL) Safefree(self->strings[option-10000]); self->strings[option-10000] = pv; if (self->strings_index < option - 10000) self->strings_index = option - 10000; RETVAL = curl_easy_setopt(self->curl, option, SvOK(value) ? pv : NULL); } #ifdef CURLOPTTYPE_OFF_T else if (option < CURLOPTTYPE_OFF_T) { /* A function - notreached? */ croak("Unknown curl option of type function"); } else { /* A LARGE file option using curl_off_t, handling larger than 32bit sizes without 64bit integer support */ if (SvOK(value) && looks_like_number(value)) { STRLEN dummy = 0; char* pv = SvPV(value, dummy); char* pdummy; RETVAL = curl_easy_setopt(self->curl, option, (curl_off_t) strtoll(pv,&pdummy,10)); } else { RETVAL = 0; } } #endif ; break; }; OUTPUT: RETVAL int internal_setopt(self, option, value) WWW::Curl::Easy self int option int value CODE: croak("internal_setopt no longer supported - use a callback\n"); RETVAL = 0; OUTPUT: RETVAL int curl_easy_perform(self) WWW::Curl::Easy self CODE: /* perform the actual curl fetch */ RETVAL = curl_easy_perform(self->curl); if (RETVAL && self->errbufvarname) { /* If an error occurred and a varname for error messages has been specified, store the error message. */ SV *sv = perl_get_sv(self->errbufvarname, TRUE | GV_ADDMULTI); sv_setpv(sv, self->errbuf); } OUTPUT: RETVAL SV * curl_easy_getinfo(self, option, ... ) WWW::Curl::Easy self int option CODE: switch (option & CURLINFO_TYPEMASK) { case CURLINFO_STRING: { char * vchar; curl_easy_getinfo(self->curl, option, &vchar); RETVAL = newSVpv(vchar,0); break; } case CURLINFO_LONG: { long vlong; curl_easy_getinfo(self->curl, option, &vlong); RETVAL = newSViv(vlong); break; } case CURLINFO_DOUBLE: { double vdouble; curl_easy_getinfo(self->curl, option, &vdouble); RETVAL = newSVnv(vdouble); break; } #ifdef CURLINFO_SLIST case CURLINFO_SLIST: { struct curl_slist *vlist, *entry; AV *items = newAV(); curl_easy_getinfo(self->curl, option, &vlist); if (vlist != NULL) { entry = vlist; while (entry) { av_push(items, newSVpv(entry->data, 0)); entry = entry->next; } curl_slist_free_all(vlist); } RETVAL = newRV(sv_2mortal((SV *) items)); break; } #endif /* CURLINFO_SLIST */ default: { RETVAL = newSViv(CURLE_BAD_FUNCTION_ARGUMENT); break; } } if (items > 2) sv_setsv(ST(2),RETVAL); OUTPUT: RETVAL char * curl_easy_errbuf(self) WWW::Curl::Easy self CODE: RETVAL = self->errbuf; OUTPUT: RETVAL int curl_easy_cleanup(self) WWW::Curl::Easy self CODE: /* does nothing anymore - cleanup is automatic when a curl handle goes out of scope */ RETVAL = 0; OUTPUT: RETVAL void curl_easy_DESTROY(self) WWW::Curl::Easy self CODE: perl_curl_easy_delete(self); SV * curl_easy_strerror(self, errornum) WWW::Curl::Easy self int errornum CODE: { #if (LIBCURL_VERSION_NUM>=0x070C00) const char * vchar = curl_easy_strerror(errornum); #else const char * vchar = "Unknown because curl_easy_strerror function not available}"; #endif RETVAL = newSVpv(vchar,0); } OUTPUT: RETVAL MODULE = WWW::Curl PACKAGE = WWW::Curl::Form PREFIX = curl_form_ int constant(name) char * name void curl_form_new(...) PREINIT: perl_curl_form *self; char *sclass = "WWW::Curl::Form"; PPCODE: if (items>0 && !SvROK(ST(0))) { STRLEN dummy; sclass = SvPV(ST(0),dummy); } self=perl_curl_form_new(); ST(0) = sv_newmortal(); sv_setref_pv(ST(0), sclass, (void*)self); SvREADONLY_on(SvRV(ST(0))); XSRETURN(1); void curl_form_formadd(self,name,value) WWW::Curl::Form self char *name char *value CODE: curl_formadd(&(self->post),&(self->last), CURLFORM_COPYNAME,name, CURLFORM_COPYCONTENTS,value, CURLFORM_END); void curl_form_formaddfile(self,filename,description,type) WWW::Curl::Form self char *filename char *description char *type CODE: curl_formadd(&(self->post),&(self->last), CURLFORM_FILE,filename, CURLFORM_COPYNAME,description, CURLFORM_CONTENTTYPE,type, CURLFORM_END); void curl_form_DESTROY(self) WWW::Curl::Form self CODE: perl_curl_form_delete(self); MODULE = WWW::Curl PACKAGE = WWW::Curl::Multi PREFIX = curl_multi_ void curl_multi_new(...) PREINIT: perl_curl_multi *self; char *sclass = "WWW::Curl::Multi"; PPCODE: if (items>0 && !SvROK(ST(0))) { STRLEN dummy; sclass = SvPV(ST(0),dummy); } self=perl_curl_multi_new(); ST(0) = sv_newmortal(); sv_setref_pv(ST(0), sclass, (void*)self); SvREADONLY_on(SvRV(ST(0))); XSRETURN(1); void curl_multi_add_handle(curlm, curl) WWW::Curl::Multi curlm WWW::Curl::Easy curl CODE: #ifdef __CURL_MULTI_H curl_multi_add_handle(curlm->curlm, curl->curl); #endif void curl_multi_remove_handle(curlm, curl) WWW::Curl::Multi curlm WWW::Curl::Easy curl CODE: #ifdef __CURL_MULTI_H curl_multi_remove_handle(curlm->curlm, curl->curl); #endif void curl_multi_info_read(self) WWW::Curl::Multi self PREINIT: CURL *easy = NULL; CURLcode res; char *stashid; int queue; CURLMsg *msg; PPCODE: while ((msg = curl_multi_info_read(self->curlm, &queue))) { if (msg->msg == CURLMSG_DONE) { easy=msg->easy_handle; res=msg->data.result; break; } }; if (easy) { curl_easy_getinfo(easy, CURLINFO_PRIVATE, &stashid); curl_easy_setopt(easy, CURLINFO_PRIVATE, NULL); curl_multi_remove_handle(self->curlm, easy); XPUSHs(sv_2mortal(newSVpv(stashid,0))); XPUSHs(sv_2mortal(newSViv(res))); } else { XSRETURN_EMPTY; } SV * curl_multi_fdset(self) WWW::Curl::Multi self PREINIT: fd_set fdread; fd_set fdwrite; fd_set fdexcep; int maxfd; int i; AV *readset; AV *writeset; AV *excepset; PPCODE: FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); readset = newAV(); writeset = newAV(); excepset = newAV(); curl_multi_fdset(self->curlm, &fdread, &fdwrite, &fdexcep, &maxfd); if ( maxfd != -1 ) { for (i=0;i <= maxfd;i++) { if (FD_ISSET(i, &fdread)) { av_push(readset, newSViv(i)); } if (FD_ISSET(i, &fdwrite)) { av_push(writeset, newSViv(i)); } if (FD_ISSET(i, &fdexcep)) { av_push(excepset, newSViv(i)); } } } XPUSHs(sv_2mortal(newRV(sv_2mortal((SV *) readset)))); XPUSHs(sv_2mortal(newRV(sv_2mortal((SV *) writeset)))); XPUSHs(sv_2mortal(newRV(sv_2mortal((SV *) excepset)))); int curl_multi_perform(self) WWW::Curl::Multi self PREINIT: int remaining; CODE: #ifdef __CURL_MULTI_H while(CURLM_CALL_MULTI_PERFORM == curl_multi_perform(self->curlm, &remaining)); RETVAL = remaining; /* while(remaining) { struct timeval timeout; int rc; fd_set fdread; fd_set fdwrite; fd_set fdexcep; int maxfd; FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); timeout.tv_sec = 1; timeout.tv_usec = 0; curl_multi_fdset(self->curlm, &fdread, &fdwrite, &fdexcep, &maxfd); rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); switch(rc) { case -1: break; default: while(CURLM_CALL_MULTI_PERFORM == curl_multi_perform(self->curlm, &remaining)); break; } } */ #endif OUTPUT: RETVAL void curl_multi_DESTROY(self) WWW::Curl::Multi self CODE: perl_curl_multi_delete(self); SV * curl_multi_strerror(self, errornum) WWW::Curl::Multi self int errornum CODE: { #if (LIBCURL_VERSION_NUM>=0x070C00) const char * vchar = curl_multi_strerror(errornum); #else const char * vchar = "Unknown because curl_multi_strerror function not available}"; #endif RETVAL = newSVpv(vchar,0); } OUTPUT: RETVAL MODULE = WWW::Curl PACKAGE = WWW::Curl::Share PREFIX = curl_share_ PROTOTYPES: ENABLE int constant(name) char * name void curl_share_new(...) PREINIT: perl_curl_share *self; char *sclass = "WWW::Curl::Share"; PPCODE: if (items>0 && !SvROK(ST(0))) { STRLEN dummy; sclass = SvPV(ST(0),dummy); } self=perl_curl_share_new(); ST(0) = sv_newmortal(); sv_setref_pv(ST(0), sclass, (void*)self); SvREADONLY_on(SvRV(ST(0))); XSRETURN(1); void curl_share_DESTROY(self) WWW::Curl::Share self CODE: perl_curl_share_delete(self); int curl_share_setopt(self, option, value) WWW::Curl::Share self int option SV * value CODE: RETVAL=CURLE_OK; #if (LIBCURL_VERSION_NUM>=0x070a03) switch(option) { /* slist cases */ case CURLSHOPT_SHARE: case CURLSHOPT_UNSHARE: if (option < CURLOPTTYPE_OBJECTPOINT) { /* An integer value: */ RETVAL = curl_share_setopt(self->curlsh, option, (long)SvIV(value)); } else { /* A char * value: */ /* FIXME: Does curl really want NULL for empty strings? */ STRLEN dummy; char *pv = SvPV(value, dummy); RETVAL = curl_share_setopt(self->curlsh, option, *pv ? pv : NULL); }; break; }; #else croak("curl_share_setopt not supported in your libcurl version"); #endif OUTPUT: RETVAL SV * curl_share_strerror(self, errornum) WWW::Curl::Share self int errornum CODE: { #if (LIBCURL_VERSION_NUM>=0x070C00) const char * vchar = curl_share_strerror(errornum); #else const char * vchar = "Unknown because curl_share_strerror function not available}"; #endif RETVAL = newSVpv(vchar,0); } OUTPUT: RETVAL WWW-Curl-4.15/Changes0000644000175000017500000003560611474524502013647 0ustar balintbalintRevision history for the Perl binding of libcurl, WWW::Curl. 4.15 Sun Nov 28 2010: - Balint Szilakszi - Refactored constant handling and added thorough testing for it. - Fixed CURLOPT_PRIVATE, it is now a string and can be set/get accordingly. 4.14 Sun Oct 24 2010: - Balint Szilakszi - 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 - Fixed WWW::Curl::Form (again, formadd and formaddfile working now). - Made constant constant handling more robust and added tests [Fuji, Goro]. - Modernized *.pm and AUTOLOAD now throws an error on unknown method calls [Fuji, Goro]. - Fixed code depending on CURLINFO_SLIST to be optional [Fuji, Goro]. 4.12 Sun Jun 04 2010: - Balint Szilakszi - Fixed WWW::Curl::Form (patch contributed by Michael Ing). - Added CURLPROXY_* constants (patch by claes). - Added the const_string method to provide access to constants in a non-bareword way. - Fixed t/01basic.t test failure on older libcurl versions. 4.11 Fri Dec 18 2009: - Balint Szilakszi - Fixed t/19multi.t for libcurl versions compiled with asyncronous dns resolution. 4.10 Fri Dec 18 2009: - Balint Szilakszi - Added support for CURLINFO_SLIST in getinfo (patch by claes). - Merging documentation fixes upstream from the FreeBSD port (thanks Peter). - Added support for curl_multi_fdset. 4.09 Thu Jul 09 2009: - Balint Szilakszi - Fixing broken version check. 4.08 Tue Jul 07 2009: - Balint Szilakszi - Fixed a memory leak in setopt. - Added a check to Makefile.PL for the minimum libcurl version. - Mentioned WWW::Curl hosting on github. - Upgraded bundled Module::Install to 0.91. 4.07 Sun May 31 2009: - Balint Szilakszi - Fixed >32bit integer option passing to libcurl on 32bit systems. (Thanks to Peter Heuchert for the report and fix suggestion!) - The CURL_CONFIG environment variable can now be used to specify which curl-config to use (contributed by claes). - Fixed segfault when a string option with setopt was set to undef (contributed by claes). - Fixed incomplete cleanup routine at destruction time (contributed by claes). - Readded Easy.pm and Share.pm stubs so that they are indexed by CPAN, thus avoiding complications with outdated versions appearing. 4.06 Sun Apr 05 2009: - Balint Szilakszi - Fixed a setopt issue that could cause a setopt string to get corrupted with pre 7.17.0 libcurl versions. (Thanks to Andreas Marienborg for the excellent bugreport and testcase!) - Made the Makefile.PL curl.h parsing slightly more generic to detect a wider selection of constants (fixes debian bugs #519841 and #518942). This makes it possible to use CURLE_* and CURL_NETRC_* constants. - Added a clearly invalid protocol to t/18twinhandles.t (fixes RT #41425). 4.05 Sat Jul 06 2008: - Balint Szilakszi - Corrected the duphandle mechanism. - Fixed a typo (fixes RT #37253). - Added better Windows compatibility detection and separate installation instructions (thanks to Shiyu Tang). 4.04 Sat Jun 21 2008: - Balint Szilakszi - Test::More and use_ok at begin time doesn't mesh with no plan. 4.03 Sat Jun 21 2008: - Balint Szilakszi - Removing option to pass destination files as a typeglob as it is a backwards pointing magic and caused bugs. Use a filehandle or reference instead. - Fixed tests for 5.6, raised minimum Perl version to 5.6.1 due to tests. - Fixed a duphandle bug. 4.02 Thu Jun 19 2008: - Balint Szilakszi - Adding forgotten backwards compatibility with older Perl versions 4.01 Wed Jun 18 2008: - Balint Szilakszi - Reimplemented callback handling to fix several I/O issues (fixes RT #35491) - Documentation showing example WWW::Curl::Multi usage is corrected (fixes RT #35520) - Should now compile on HP-UX and OSX (fixes RT #36058 and #35349) - POD validity fix (fixes RT #15850) - Added several new tests - Upgraded to Module::Install 0.75 as it now exits correctly on build time with NA if the required libcurl isn't available. 4.00 Wed Mar 05 2008: - Balint Szilakszi - Rewritten documentation. - New test suite. - New build system: using Module::Install instead of ExtUtils::Makemaker. - New minimal requirements, Perl 5.6 and libcurl 7.10.8. - New WWW::Curl::Multi interface. - Removed WWW::Curl::easy. - Removed compatibility code for pre 7.10.8 libcurl. - Added lots of small improvements to setopt and friends. - Bugfixes, mainly for memory leaks. - SIGNATURE. 3.12 Wed Feb 27 2008: - Cris Bailiff - New Share.pm.in was missed from the MANIFEST, so was not in the distribution. Fixed. 3.11 Mon Feb 25 2008: - Cris Bailiff - Merge recent contributions. - Updates from various small bug/build reports 3.10 Fri Feb 22 2008: - Anton Fedorov - Fix documentation for multi interface - Added WWW::Curl::Share - Added strerror into Easy and Multi interfaces - Added support for CURLOPT_DEBUGFUNCTION in Easy interface 3.02_01 Tue Jan 29 2008: - Mark Hindley - Contributed CURLOPT_*_LARGE support 3.02_00 Fri Sep 16 2005: - Cris Bailiff - Workaround case-sensitive filename issues by making equivalent Easy names in easy namespace - Test scripts - Fixup ssl tests and remove leftover MUTE option - NOTE: That due to namespace changes (easy->Easy) you must change any existing code to 'use WWW::Curl::Easy' instead of 'use WWW::Curl::easy', but you can still use the WWW::Curl::easy function names until they are removed in a future release. - Tested on Redhat EL3 (curl 7.10.6) and Mandrake 10.1 (curl 7.13.1) 3.01 Thu Apr 20 2004: - Cris Bailiff - Merged Sebastians changes into CVS - Updated remaining tests to Test::Simple - Added backwards compatability to V2 names (WWW::Curl::easy etc) - Dropped backwards compatability to V1.x names 3.00 Thu Feb 12 2004: - Sebastian Riedel - Added multi support - New module names - New tests - New documentation - New examples - Big cleanup!!! - Too much to tell, it's worth an upgrade 2.00 Tue Apr 22 2003: - Cris Bailiff - New top level package name of WWW::Curl in preparation for entry to CPAN - Rename "Curl::easy" to "WWW::Curl::easy" - Add backwards compatability namespace module for existing scripts - Implement initial curl_easy_duphandle support - Started on curl_easy_form support (WWW:Curl::form) - NOT FUNCTIONAL YET - Fixup use of env vars in t/07ftp-upload.t (jellyfish at pisem.net) - Adjust IP addresses for t/08ssl.t tests due to moved https servers 1.35 Sun Sep 22 2002: - Cris Bailiff - Fixed progress function callback prototype [ curl-Bugs-612432 ], reflecting the fix made in curl-7.9.5. Tested in t/05progress.t to now return sensible values! 1.34 Wed Aug 7 2002: - Cris Bailiff - Fix off-by-one error in setting up of curl_slists from perl arrays, which was causing the last item of slists to be dropped. Added regression test case. 1.33 Mon Aug 5 2002: - Cris Bailiff - Fix serious bug in read callback support (used for POST and upload requests), introduced in 1.30, which uploaded random data (due to a reversed src/dest in a memory copy). 1.32 Thu Aug 1 2002: - Cris Bailiff - Minor Makefile.PL fixes to build cleanly with curl 7.8 as found on redhat 7.2. 1.31 Tue Jul 16 2002: - Cris Bailiff - Generate better switch() statement syntax in C code, to fix build issues on some systems with strict compilers. Reported by Ignasi Roca. 1.30 Mon Jul 15 2002: - Cris Bailiff - Testing release after complete code overhaul. Now supports cleaner object interface, supports multiple handles per process, uses PerlIO for portable I/O (which should be perl 5.8 ready) and maybe even supports ithreads. Should be fully backwards compatible, but please read the man page for change details and report any issues. - Fixed warning caused by slist functions accessing past the end of the perl array. - Fixed leak caused by consuming slist arguments without freeing. - Updates test scripts to OO style, cleaned up output. - Deprecated USE_INTERNAL_VARS. 1.21 Thu Jul 11 2002: - Cris Bailiff - Minor fixes to assist windows builds from Shawn Poulson - Allow passing curl include location on the command line when running perl Makefile.PL 1.20 Sat Feb 16 2002: - Cris Bailiff - Use standard perl module numbering syntax (valid decimal) - Skipped 1.10 in case anyone confuses it with 1.1.0 - Made every build a rebuild and removed 'pre-built' files - no point worrying about not finding curl.h - if we can't find it, we can't compile anyway. Obviates bug in 1.1.9 preventing rebuilds. - Add support for redefining CURLOPT_STDERR (file handle globs only!) 1.1.9 Sat Dec 8 2001: - Cris Bailiff - Enhance Makefile.PL to re-build easy.pm and 'constants' xs function from local installed curl.h. CURLOPT_ and CURLINFO_ Constants up-to-date for libcurl-7.9.2, but can be re-built for almost any libcurl version by removing easy.pm and curlopt-constants.c and re-running 'perl Makefile.PL' - Use curl-config to find include and library compile options - Updated test scripts to work better under 'make test' (You need to set the environment variable 'CURL_TEST_URL' though!) - Added test script to display transfer times using new time options - Merge changes in Curl_easy 1.1.2.1 by Georg Horn 1.1.8 Thu Sep 20 2001: - Cris Bailiff - Re-generate CURLOPT_ constants from curl.h and enhance makefile to allow this to be repeated in future or for older versions of libcurl. Constants up-to-date for libcurl-7.9(pre) - Split tests into t/*.t to simplify each case - Add test cases for new SSL switches. This needs ca-bundle.crt (from mod_ssl) for verifying test cases. 1.1.7 Thu Sep 13 2001: - Cris Bailiff - Documentation Update only - Explicitly state that Curl_easy is released under the MIT-X/MPL dual licence. No code changes. 1.1.6 Mon Sep 10 2001: - Cris Bailiff - Fix segfault due to changes in header callback behaviour since curl-7.8.1-pre3 1.1.5 Fri Apr 20 2001: - Cris Bailiff - Add latest CURLOPT_ and CURLINFO_ constants to the constants list 1.1.4 Fri Apr 20 2001: - Cris Bailiff - Fix case where curl_slists such as 'HTTPHEADERS' need to be re-set over persistant requests 1.1.3 Wed Apr 18 2001: - Cris Bailiff - Change/shorten module function names: Curl::easy::curl_easy_setopt becomes Curl::easy::setopt etc. This requires minor changes to existing scripts.... - Added callback function support to pass arbitrary SV * (including FILE globs) from perl through libcurl to the perl callback. - Make callbacks still work with existing scripts which use STDIO - Initial support for libcurl 7.7.2 HEADERFUNCTION callback feature - Minor API cleanups/changes in the callback function signatures - Added Curl::easy::version function to return curl version string - Callback documentation added in easy.pm - More tests in test.pl 1.1.2 Mon Apr 16 2001: - Georg Horn - Added support for callback functions. This is for the curl_easy_setopt() options WRITEFUNCTION, READFUNCTION, PROGRESSFUNCTION and PASSWDFUNCTION. Still missing, but not really neccessary: Passing a FILE * pointer, that is passed in from libcurl, on to the perl callback function. - Various cleanups, fixes and enhancements to easy.xs and test.pl. 1.1.1 Thu Apr 12 2001: - Made more options of curl_easy_setopt() work: Options that require a list of curl_slist structs to be passed in, like CURLOPT_HTTPHEADER, are now working by passing a perl array containing the list elements. As always, look at the test script test.pl for an example. 1.1.0 Wed Apr 11 2001: - tested against libcurl 7.7 - Added new function Curl::easy::internal_setopt(). By calling Curl::easy::internal_setopt(Curl::easy::USE_INTERNAL_VARS, 1); the headers and content of the fetched page are no longer stored into files (or written to stdout) but are stored into internal Variables $Curl::easy::headers and $Curl::easy::content. 1.0.2 Tue Oct 10 2000: - runs with libcurl 7.4 - modified curl_easy_getinfo(). It now calls curl_getinfo() that has been added to libcurl in version 7.4. 1.0.1 Tue Oct 10 2000: - Added some missing features of curl_easy_setopt(): - CURLOPT_ERRORBUFFER now works by passing the name of a perl variable that shall be crated and the errormessage (if any) be stored to. - Passing filehandles (Options FILE, INFILE and WRITEHEADER) now works. Have a look at test.pl to see how it works... - Added a new function, curl_easy_getinfo(), that for now always returns the number of bytes that where written to disk during the last download. If the curl_easy_getinfo() function is included in libcurl, (as promised by Daniel ;-)) i will turn this into just a call to this function. 1.0 Thu Oct 5 2000: - first released version - runs with libcurl 7.3 - some features of curl_easy_setopt() are still missing: - passing function pointers doesn't work (options WRITEFUNCTION, READFUNCTION and PROGRESSFUNCTION). - passing FILE * pointers doesn't work (options FILE, INFILE and WRITEHEADER). - passing linked lists doesn't work (options HTTPHEADER and HTTPPOST). - setting the buffer where to store error messages in doesn't work (option ERRORBUFFER). WWW-Curl-4.15/META.yml0000644000175000017500000000117711474533766013635 0ustar balintbalint--- abstract: 'Perl extension interface for libcurl' author: - 'Cris Bailiff ' - 'Balint Szilakszi ' build_requires: ExtUtils::MakeMaker: 6.42 configure_requires: ExtUtils::MakeMaker: 6.42 distribution_type: module generated_by: 'Module::Install version 0.91' license: 'MPL or MIT/X-derivate' meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 module_name: WWW::Curl name: WWW-Curl no_index: directory: - inc - t - template requires: perl: 5.6.1 resources: repository: http://github.com/szbalint/WWW--Curl version: 4.15 WWW-Curl-4.15/README.Win320000644000175000017500000000124111144657616014130 0ustar balintbalintInstallation on Windows need to be done manually, by editing Makefile.PL. 1. Specify your curl include directory on the line "my @include = qw()". 2. Specify the following parameters on the line below, where is your curl directory like this: my ($cflags,$ldflags,$lflags) = ('-I"\\include"', '-L"\\lib"','-lcurl -lcurldll'); can be for example: "E:\\Perldev\\downloader\\curl-7.18.2-devel-mingw32" (without quotes); 3. Save Makefile.PL. 4. Execute "perl Makefile.PL"; 5. Execute "nmake" ( you may need nmake from Mircosoft, which can be downloaded from http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084 ); 6. Execute "nmake install". WWW-Curl-4.15/MANIFEST0000644000175000017500000000202011474533713013471 0ustar balintbalintChanges Curl.xs inc/Module/Install.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/External.pm inc/Module/Install/Makefile.pm inc/Module/Install/MakeMaker.pm inc/Module/Install/Metadata.pm lib/WWW/Curl.pm lib/WWW/Curl/Easy.pm lib/WWW/Curl/Form.pm lib/WWW/Curl/Multi.pm lib/WWW/Curl/Share.pm LICENSE Makefile.PL MANIFEST META.yml README README.Win32 SIGNATURE t/00constants.t t/01basic.t t/02callbacks.t t/04abort-test.t t/05progress.t t/06http-post.t t/07ftp-upload.t t/08ssl.t t/09times.t t/10errbuf.t t/13slowleak.t t/14duphandle.t t/15duphandle-callback.t t/16formpost.t t/17slist.t 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 t/new/02header-callback.t t/new/03body-callback.t t/new/04abort.t t/new/05progress.t t/new/06http-post.t t/new/07errbuf.t t/new/08duphandle.t t/new/09duphandle-callback.t t/new/10multi-callback.t t/new/README t/pod-coverage.t t/pod.t t/symbols-in-versions template/Easy.pm.tmpl template/Share.pm.tmpl typemap WWW-Curl-4.15/lib/0000755000175000017500000000000011474534004013106 5ustar balintbalintWWW-Curl-4.15/lib/WWW/0000755000175000017500000000000011474534004013572 5ustar balintbalintWWW-Curl-4.15/lib/WWW/Curl.pm0000644000175000017500000003050411474526245015047 0ustar balintbalintpackage WWW::Curl; use strict; use warnings; use XSLoader; our $VERSION = '4.15'; XSLoader::load(__PACKAGE__, $VERSION); END { _global_cleanup(); } 1; __END__ =head1 NAME WWW::Curl - Perl extension interface for libcurl =head1 SYNOPSIS use WWW::Curl; print $WWW::Curl::VERSION; =head1 DESCRIPTION WWW::Curl is a Perl extension interface for libcurl. =head1 DOCUMENTATION This module provides a Perl interface to libcurl. It is not intended to be a standalone module and because of this, the main libcurl documentation should be consulted for API details at L. The documentation you're reading right now only contains the Perl specific details, some sample code and the differences between the C API and the Perl one. =head1 WWW::Curl::Easy The name might be confusing, it originates from libcurl. This is not an ::Easy module in the sense normally used on CPAN. Here is a small snippet of making a request with WWW::Curl::Easy. use strict; use warnings; use 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; $curl->setopt(CURLOPT_WRITEDATA,\$response_body); # Starts the actual request my $retcode = $curl->perform; # Looking at the results... if ($retcode == 0) { print("Transfer went ok\n"); my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE); # judge result and next action based on $response_code print("Received response: $response_body\n"); } else { # Error code, type of error, error message print("An error happened: $retcode ".$curl->strerror($retcode)." ".$curl->errbuf."\n"); } See L for details of C. =head1 WWW::Curl::Multi use strict; use warnings; use WWW::Curl::Easy; use WWW::Curl::Multi; my %easy; my $curl = WWW::Curl::Easy->new; my $curl_id = '13'; # This should be a handle unique id. $easy{$curl_id} = $curl; my $active_handles = 0; $curl->setopt(CURLOPT_PRIVATE,$curl_id); # do the usual configuration on the handle ... my $curlm = WWW::Curl::Multi->new; # Add some easy handles $curlm->add_handle($curl); $active_handles++; while ($active_handles) { my $active_transfers = $curlm->perform; if ($active_transfers != $active_handles) { while (my ($id,$return_value) = $curlm->info_read) { if ($id) { $active_handles--; my $actual_easy_handle = $easy{$id}; # do the usual result/error checking routine here ... # letting the curl handle get garbage collected, or we leak memory. delete $easy{$id}; } } } } This interface is different than what the C API does. $curlm->perform is non-blocking and performs requests in parallel. The method does a little work and then returns control, therefor it has to be called periodically to get the job done. It's return value is the number of unfinished requests. When the number of unfinished requests changes compared to the number of active handles, $curlm->info_read should be checked for finished requests. It returns one handle and it's return value at a time, or an empty list if there are no more finished requests. $curlm->info_read calls remove_handle on the given easy handle automatically, internally. The easy handle will still remain available until it goes out of scope, this action just detaches it from multi. Please make sure that the easy handle does not get garbage collected until after the multi handle finishes processing it, or bad things happen. The multi handle does not need to be cleaned up, when it goes out of scope it calls the required cleanup methods automatically. It is possible to use $curlm->add_handle to add further requests to be processed after $curlm->perform has been called. WWW::Curl::Multi doesn't care about the order. It is possible to process all requests for a multi handle and then add a new batch of easy handles for processing. =head1 WWW::Curl::Share use WWW::CURL::Share; my $curlsh = new WWW::Curl::Share; $curlsh->setopt(CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE); $curlsh->setopt(CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); $curl->setopt(CURLOPT_SHARE, $curlsh); $curlsh->setopt(CURLSHOPT_UNSHARE, CURL_LOCK_DATA_COOKIE); $curlsh->setopt(CURLSHOPT_UNSHARE, CURL_LOCK_DATA_DNS); WWW::Curl::Share is an extension to WWW::Curl::Easy which makes it possible to use a single cookies/dns cache for several Easy handles. It's usable methods are: $curlsh = new WWW::Curl::Share This method constructs a new WWW::Curl::Share object. $curlsh->setopt(CURLSHOPT_SHARE, $value ); Enables share for: CURL_LOCK_DATA_COOKIE use single cookies database CURL_LOCK_DATA_DNS use single DNS cache $curlsh->setopt(CURLSHOPT_UNSHARE, $value ); Disable share for given $value (see CURLSHOPT_SHARE) $curlsh->strerror( ErrNo ) This method returns a string describing the CURLSHcode error code passed in the argument errornum. This is how you enable sharing for a specific WWW::Curl::Easy handle: $curl->setopt(CURLOPT_SHARE, $curlsh) Attach share object to WWW::Curl::Easy instance =head1 WWW::Curl::Form use WWW::Curl::Form; my $curlf = WWW::Curl::Form->new; $curlf->formaddfile($filename, 'attachment', "multipart/form-data"); $curlf->formadd("FIELDNAME", "VALUE"); $curl->setopt(CURLOPT_HTTPPOST, $curlf); Its usable methods are: $curlf = new WWW::Curl::Form This method constructs a new WWW::Curl::Form object. $curlf->formadd(FIELDNAME, VALUE) This method adds a field with a given value, to the form that is being submitted. $curlf->formaddfile(FILENAME, DESCRIPTION, TYPE) This method will add a file to the form. The description is the name of the field that you form expects the data to be submitted in. =head1 COMPATIBILITY =over =item curl_easy_setopt Most of the options should work, however some might not. Please send reports, tests and patches to fix those. =item curl_easy_escape Not implemented. Since equivalent Perl code is easily produced, this method will only made available for interface completeness, if ever. =item curl_easy_init Used only internally. The standard Perl way of initializing an object should be used, C<< my $curl = WWW::Curl::Easy->new; >>. =item curl_easy_cleanup Used only internally. Curl object cleanup happens when the handle goes out of scope. =item curl_easy_duphandle Should be working for most cases, however do not change the value of options which accept a list/arrayref value on a duped handle, otherwise memory leaks or crashes will happen. This behaviour will be fixed in the future. =item curl_easy_pause Not implemented. =item curl_easy_reset Not implemented. =item curl_easy_unescape Not implemented. Trivial Perl replacements are available. =item curl_escape Not implemented and won't be as this method is considered deprecated. =item curl_formadd Seems to be working. =item curl_formaddfile Seems to be working. =item curl_formfree Used internally. Not exposed through the public API, as this call has no relevance to Perl code. =item curl_free Used internally. Not exposed through the public API, as this call has no relevance to Perl code. =item curl_getdate Not implemented. This function is easily replaced by Perl code and as such, most likely it won't be implemented. =item curl_global_cleanup Only used internally, not exposed through the public API. =item curl_global_init Only used internally, not exposed through the public API. =item curl_global_init_mem Not implemented. =item curl_global_cleanup Only used internally and called automatically upon exit. =item curl_slist_append Only used internally, not exposed through the public API. =item curl_slist_free_all Only used internally, not exposed through the public API. =item curl_unescape 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. =item curl_multi_* Most methods are either not exposed through the WWW::Curl::Multi API or they behave differently than it's C counterpart. Please see the section about WWW::Curl::Multi above. =item curl_multi_fdset 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 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. =head2 CURLOPT_PRIVATE Despite what the libcurl manual says, in Perl land, only string values are suitable for this option. =head1 ADDITIONAL METHODS =head2 On WWW::Curl::Easy objects =over =item pushopt Like C but instead of overriding any previously set values it adds it to the end. Can be used with C, C and C. =back =head1 USAGE CASES WWW::Curl is a thin binding on top of libcurl, to make using libcurl possible from Perl land. Because of this, the module is less like Perl and more like C in coding style. There is a new module, L, which wraps this module into a more Perlish and userfriendly package. The standard Perl WWW module, LWP should probably be used in most cases to work with HTTP or FTP from Perl. However, there are some cases where LWP doesn't perform well. One is speed and the other is parallelism. WWW::Curl is much faster, uses much less CPU cycles and it's capable of non-blocking parallel requests. In some cases, for example when building a web crawler, cpu usage and parallel downloads are important considerations. It can be desirable to use WWW::Curl to do the heavy-lifting of a large number of downloads and wrap the resulting data into a Perl-friendly structure by HTTP::Response or use WWW::Curl::Simple to do that for you. =head1 CHANGES Version 4.01 - 4.07 adds several bugfixes and extends functionality coverage. See Changes file. Version 4.00 added new documentation, the build system changed to Module::Install, the test suite was rewritten to use Test::More, a new calling syntax for WWW::Curl::Multi was added, memory leak and other bugfixes added, Perl 5.6 and libcurl 7.10.8 as minimum requirements for this module were set. Version 3.12 is a bugfix for a missing Share.pm.in file in the release. Version 3.11 added WWW::Curl::Share. Version 3.10 adds the WWW::Curl::Share interface by Anton Federov and large file options after a contribution from Mark Hindley. Version 3.02 adds some backwards compatibility for scripts still using 'WWW::Curl::easy' names. Version 3.01 added some support for pre-multi versions of libcurl. Version 3.00 adds WWW::Curl::Multi interface, and new module names following perl conventions (WWW::Curl::Easy rather than WWW::Curl::easy), by Sebastian Riedel . Version 2.00 of WWW::Curl::easy is a renaming of the previous version (named Curl::easy), to follow CPAN naming guidelines, by Cris Bailiff. Versions 1.30, a (hopefully) threadable, object-oriented, multiple-callback compatible version of Curl::easy was substantially reworked from the previous Curl::easy release (1.21) by Cris Bailiff. =head1 AUTHORS Currently maintained by Cris Bailiff and Balint Szilakszi . Original Author Georg Horn , with additional callback, pod and test work by Cris Bailiff and Forrest Cahoon . Sebastian Riedel added ::Multi and Anton Fedorov (datacompboy mail.ru) added ::Share. Balint Szilakszi repackaged the module into a more modern form. =head1 COPYRIGHT Copyright (C) 2000-2005,2008-2010 Daniel Stenberg, Cris Bailiff, Sebastian Riedel, Balint Szilakszi et al. You may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the 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. =head1 SEE ALSO L L L The development source code is also available: L WWW-Curl-4.15/lib/WWW/Curl/0000755000175000017500000000000011474534004014477 5ustar balintbalintWWW-Curl-4.15/lib/WWW/Curl/Easy.pm0000644000175000017500000000252711474533775015762 0ustar balintbalintpackage WWW::Curl::Easy; use strict; use warnings; use Carp; our $VERSION = '4.15'; use WWW::Curl (); use Exporter (); our @ISA = qw(Exporter); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. our @EXPORT = qw( ); $WWW::Curl::Easy::headers = ""; $WWW::Curl::Easy::content = ""; sub const_string { my ($self, $constant) = @_; return constant($constant); } sub AUTOLOAD { our $AUTOLOAD; # This AUTOLOAD is used to 'autoload' constants from the constant() # XS function. ( my $constname = $AUTOLOAD ) =~ s/.*:://; my $value = constant( $constname ); if($!) { croak("Undefined subroutine &$AUTOLOAD called"); } { no strict 'refs'; *{$AUTOLOAD} = sub { $value }; } return $value; } sub pushopt { my ($self, $option, $value) = @_; $self->setopt($option, $value, 1); } 1; __END__ Copyright (C) 2000-2005,2008 Daniel Stenberg, Cris Bailiff, Sebastian Riedel, et al. You may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the 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. WWW-Curl-4.15/lib/WWW/Curl/Multi.pm0000644000175000017500000000057511414205151016126 0ustar balintbalintpackage WWW::Curl::Multi; use strict; use warnings; use WWW::Curl; 1; __END__ Copyright (C) 2004 Sebastian Riedel, et al. You may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the 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. WWW-Curl-4.15/lib/WWW/Curl/Form.pm0000644000175000017500000000116311474526320015743 0ustar balintbalintpackage WWW::Curl::Form; use strict; use warnings; use Carp; our $VERSION = '4.15'; use WWW::Curl (); use Exporter (); our @ISA = qw(Exporter); our @EXPORT = qw( CURLFORM_FILE CURLFORM_COPYNAME CURLFORM_CONTENTTYPE ); sub AUTOLOAD { our $AUTOLOAD; # This AUTOLOAD is used to 'autoload' constants from the constant() # XS function. ( my $constname = $AUTOLOAD ) =~ s/.*:://; my $value = constant( $constname ); if($!) { croak("Undefined subroutine &$AUTOLOAD caclled"); } { no strict 'refs'; *{$AUTOLOAD} = sub { $value }; } return $value; } 1; __END__ WWW-Curl-4.15/lib/WWW/Curl/Share.pm0000644000175000017500000000164411474533775016122 0ustar balintbalintpackage WWW::Curl::Share; use strict; use warnings; use Carp; use WWW::Curl (); use Exporter (); our @ISA = qw(Exporter); our @EXPORT = qw( ); sub AUTOLOAD { our $AUTOLOAD; # This AUTOLOAD is used to 'autoload' constants from the constant() # XS function. ( my $constname = $AUTOLOAD ) =~ s/.*:://; my $value = constant( $constname ); if ($!) { croak("Undefined subroutine &$AUTOLOAD failed for reasons of $!, constname was $constname, value was: $value"); } { no strict 'refs'; *{$AUTOLOAD} = sub { $value }; } return $value; } 1; __END__ Copyright (C) 2008, Anton Fedorov (datacompboy mail.ru) You may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the 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. WWW-Curl-4.15/t/0000755000175000017500000000000011474534004012603 5ustar balintbalintWWW-Curl-4.15/t/16formpost.t0000644000175000017500000000377311144657616015033 0ustar balintbalint#!perl use Test::More skip_all => "Not performing POST"; ######################### We start with some black magic to print on failure. # Change 1..1 below to 1..last_test_to_print . use strict; END {print "not ok 1\n" unless $::loaded;} use WWW::Curl::Easy; $::loaded = 1; ######################### End of black magic. my $count=0; use ExtUtils::MakeMaker qw(prompt); # Read URL to get, defaulting to environment variable if supplied my $defurl=$ENV{CURL_TEST_URL} || "http://www.google.com/"; my $url = prompt("# Please enter an URL to fetch",$defurl); if (!$url) { print "1..0 # No test URL supplied - skipping test\n"; exit; } print "1..6\n"; print "ok ".++$count."\n"; # Init the curl session my $curl = WWW::Curl::Easy->new(); if ($curl == 0) { print "not "; } print "ok ".++$count."\n"; $curl->setopt(CURLOPT_NOPROGRESS, 1); $curl->setopt(CURLOPT_FOLLOWLOCATION, 1); $curl->setopt(CURLOPT_TIMEOUT, 30); open HEAD, ">head.out"; $curl->setopt(CURLOPT_WRITEHEADER, *HEAD); print "ok ".++$count."\n"; open BODY, ">body.out"; $curl->setopt(CURLOPT_FILE,*BODY); print "ok ".++$count."\n"; $curl->setopt(CURLOPT_URL, $url); print "ok ".++$count."\n"; my $read_max=1000; sub read_callb { my ($maxlen,$sv)=@_; # print STDERR "\nperl read_callback has been called!\n"; # print STDERR "max data size: $maxlen - need $read_max bytes\n"; if ($read_max > 0) { my $len=int($read_max/3)+1; my $data = chr(ord('A')+rand(26))x$len; # print STDERR "generated max/3=", int($read_max/3)+1, " characters to be uploaded - $data.\n"; $read_max=$read_max-length($data); return $data; } else { return ""; } } # # test post/read callback functions - requires a url which accepts posts, or it fails! # $curl->setopt(CURLOPT_READFUNCTION,\&read_callb); $curl->setopt(CURLOPT_INFILESIZE,$read_max ); $curl->setopt(CURLOPT_UPLOAD,1 ); $curl->setopt(CURLOPT_CUSTOMREQUEST,"POST" ); if ($curl->perform() != 0) { print "not "; }; print "ok ".++$count."\n"; WWW-Curl-4.15/t/meta.t0000644000175000017500000000020611144657616013725 0ustar balintbalintuse Test::More; eval "use Test::CPAN::Meta"; plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@; meta_yaml_ok(); WWW-Curl-4.15/t/15duphandle-callback.t0000644000175000017500000000612111144657616016645 0ustar balintbalint#!perl use strict; use warnings; use lib 'inc'; use lib 'blib/lib'; use lib 'blib/arch'; use Test::More tests => 25; use File::Temp qw/tempfile/; use WWW::Curl::Easy; my $url = $ENV{CURL_TEST_URL} || "http://www.google.com"; my $other_handle; my $head = tempfile(); my $hcall; my $body_called = 0; my $head_called = 0; { # Init the curl session my $curl = WWW::Curl::Easy->new(); ok($curl, 'Curl session initialize returns something'); #1 ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); #2 ok(! $curl->setopt(CURLOPT_NOPROGRESS, 1), "Setting CURLOPT_NOPROGRESS"); #3 ok(! $curl->setopt(CURLOPT_FOLLOWLOCATION, 1), "Setting CURLOPT_FOLLOWLOCATION"); #4 ok(! $curl->setopt(CURLOPT_TIMEOUT, 30), "Setting CURLOPT_TIMEOUT"); #5 ok(! $curl->setopt(CURLOPT_WRITEHEADER, $head), "Setting CURLOPT_WRITEHEADER"); #6 my $body = tempfile(); ok(! $curl->setopt(CURLOPT_FILE, $body), "Setting CURLOPT_FILE"); #7 my @myheaders; $myheaders[0] = "Server: www"; $myheaders[1] = "User-Agent: Perl interface for libcURL"; ok(! $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders), "Setting CURLOPT_HTTPHEADER"); #8 sub body_callback { my ($chunk,$handle)=@_; $body_called++; return length($chunk); # OK } sub head_callback { my ($chunk,$handle)=@_; $head_called++; return length($chunk); # OK } $hcall = \&head_callback; ok(! $curl->setopt(CURLOPT_WRITEFUNCTION, \&body_callback), "Setting CURLOPT_WRITEFUNCTION callback"); #9 ok(! $curl->setopt(CURLOPT_HEADERFUNCTION, $hcall), "Setting CURLOPT_HEADERFUNCTION callback"); #10 ok(! $curl->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); #11 # duplicate the handle $other_handle = $curl->duphandle(); ok($other_handle, 'duphandle seems to return something'); #12 ok(ref($other_handle) eq 'WWW::Curl::Easy', 'Dup handle looks like an object from the WWW::Curl::Easy module'); #13 foreach my $x ($curl,$other_handle) { my $retcode=$x->perform(); ok(!$retcode, "Handle return code check"); #14-15 if ($retcode == 0) { my $bytes = $x->getinfo(CURLINFO_SIZE_DOWNLOAD); my $realurl = $x->getinfo(CURLINFO_EFFECTIVE_URL); my $httpcode = $x->getinfo(CURLINFO_HTTP_CODE); } } ok( $head_called >= 2, "Header callback seems to have worked"); #16 ok( $body_called >= 2, "Body callback seems to have worked"); #17 } ok(! $other_handle->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); #18 my $retcode=$other_handle->perform(); ok(!$retcode, "Handle return code check"); ok( 1, "We survive DESTROY time for the original handle"); ok( head_callback('1',undef), "We can still access the callbacks"); my $third = $other_handle->duphandle(); ok($third, 'duphandle seems to return something again'); ok(ref($third) eq 'WWW::Curl::Easy', 'Dup handle looks like an object from the WWW::Curl::Easy module'); foreach my $x ($other_handle,$third) { my $retcode=$x->perform(); ok(!$retcode, "Handle return code check"); if ($retcode == 0) { my $bytes = $x->getinfo(CURLINFO_SIZE_DOWNLOAD); my $realurl = $x->getinfo(CURLINFO_EFFECTIVE_URL); my $httpcode = $x->getinfo(CURLINFO_HTTP_CODE); } } WWW-Curl-4.15/t/20undefined_subs.t0000644000175000017500000000072611437531020016126 0ustar balintbalint#!perl -w use strict; use Test::More tests => 4; use WWW::Curl::Easy; use WWW::Curl::Share; use WWW::Curl::Multi; use WWW::Curl::Form; eval { WWW::Curl::Easy->no_such_method0 }; like $@, qr/\b no_such_method0 \b/xms; eval { WWW::Curl::Share->no_such_method1 }; like $@, qr/\b no_such_method1 \b/xms; eval { WWW::Curl::Multi->no_such_method2 }; like $@, qr/\b no_such_method2 \b/xms; eval { WWW::Curl::Form->no_such_method3 }; like $@, qr/\b no_such_method3 \b/xms; WWW-Curl-4.15/t/04abort-test.t0000644000175000017500000000203111144657616015225 0ustar balintbalint#!perl use strict; use warnings; use Test::More tests => 8; use File::Temp qw/tempfile/; BEGIN { use_ok( '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, 'Curl session initialize returns something'); ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); $curl->setopt(CURLOPT_NOPROGRESS, 1); $curl->setopt(CURLOPT_FOLLOWLOCATION, 1); $curl->setopt(CURLOPT_TIMEOUT, 30); my $head = tempfile(); ok(! $curl->setopt(CURLOPT_WRITEHEADER, $head), "Setting CURLOPT_WRITEHEADER"); my $body = tempfile(); ok(! $curl->setopt(CURLOPT_FILE,$body), "Setting CURLOPT_FILE"); ok(! $curl->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); my $body_abort_called = 0; sub body_abort_callback { $body_abort_called++; return -1 }; $curl->setopt(CURLOPT_WRITEFUNCTION, \&body_abort_callback); ok( $curl->perform(), "Request fails, Abort succeeds"); ok( $body_abort_called, "Abort function was invoked"); WWW-Curl-4.15/t/01basic.t0000644000175000017500000000456511472440463014227 0ustar balintbalint#!perl use strict; use warnings; use Test::More tests => 19; use File::Temp qw/tempfile/; BEGIN { use_ok( '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, 'Curl session initialize returns something'); ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); 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 = tempfile(); ok(! $curl->setopt(CURLOPT_WRITEHEADER, $head), "Setting CURLOPT_WRITEHEADER"); my $body = tempfile(); ok(! $curl->setopt(CURLOPT_WRITEDATA,$body), "Setting CURLOPT_WRITEDATA"); ok(! $curl->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); my @myheaders; $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(); ok(! $retcode, "Curl return code ok"); diag("An error happened: $retcode ".$curl->strerror($retcode)." ".$curl->errbuf."\n") if ($retcode); 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"); SKIP: { skip "Only testing cookies against google.com", 2 unless $url eq "http://www.google.com"; my $cookielist_const = $curl->const_string("CURLINFO_COOKIELIST"); skip "libcurl doesn't have the CURLINFO_COOKIELIST constant", 2 unless $cookielist_const; my $cookies = $curl->getinfo($cookielist_const); is(ref $cookies, "ARRAY", "Returned array reference"); ok(@$cookies > 0, "Got 1 or more cookies"); } #diag ("Bytes: $bytes"); #diag ("realurl: $realurl"); #diag ("httpcode: $httpcode"); WWW-Curl-4.15/t/pod-coverage.t0000644000175000017500000000035011144657616015352 0ustar balintbalint#!perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; plan tests => 1; pod_coverage_ok('WWW::Curl','WWW::Curl has proper POD coverage'); WWW-Curl-4.15/t/21write-to-scalar.t0000644000175000017500000000253111456426526016162 0ustar balintbalint#!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"); WWW-Curl-4.15/t/05progress.t0000644000175000017500000000326411144657616015017 0ustar balintbalint#!perl use strict; use warnings; use Test::More tests => 16; use File::Temp qw/tempfile/; BEGIN { use_ok( '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, 'Curl session initialize returns something'); ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); ok(! $curl->setopt(CURLOPT_NOPROGRESS, 0), "Setting CURLOPT_NOPROGRESS"); ok(! $curl->setopt(CURLOPT_FOLLOWLOCATION, 1), "Setting CURLOPT_FOLLOWLOCATION"); ok(! $curl->setopt(CURLOPT_TIMEOUT, 30), "Setting CURLOPT_TIMEOUT"); my $head = tempfile(); ok(! $curl->setopt(CURLOPT_WRITEHEADER, $head), "Setting CURLOPT_WRITEHEADER"); my $body = tempfile(); ok(! $curl->setopt(CURLOPT_FILE,$body), "Setting CURLOPT_FILE"); ok(! $curl->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); my @myheaders; $myheaders[0] = "Server: www"; $myheaders[1] = "User-Agent: Perl interface for libcURL"; ok(! $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders), "Setting CURLOPT_HTTPHEADER"); ok(! $curl->setopt(CURLOPT_PROGRESSDATA,"making progress!"), "Setting CURLOPT_PROGRESSDATA"); my $progress_called = 0; my $last_dlnow = 0; sub prog_callb { my ($clientp,$dltotal,$dlnow,$ultotal,$ulnow)=@_; $last_dlnow=$dlnow; $progress_called++; return 0; } ok (! $curl->setopt(CURLOPT_PROGRESSFUNCTION, \&prog_callb), "Setting CURLOPT_PROGRESSFUNCTION"); ok (! $curl->setopt(CURLOPT_NOPROGRESS, 0), "Turning progress meter back on"); ok (! $curl->perform(), "Performing perform"); ok ($progress_called, "Progress callback called"); ok ($last_dlnow, "Last downloaded chunk non-zero"); WWW-Curl-4.15/t/17slist.t0000644000175000017500000000427411144657616014316 0ustar balintbalint#!perl use Test::More skip_all => "Not performing printenv cgi tests"; ######################### We start with some black magic to print on failure. # Change 1..1 below to 1..last_test_to_print . use strict; use WWW::Curl::Easy; ######################### End of black magic. my $count=0; use ExtUtils::MakeMaker qw(prompt); # Read URL to get, defaulting to environment variable if supplied my $defurl=$ENV{CURL_TEST_URL} || "http://www.google.com/"; my $url = prompt("# Please enter an URL to fetch",$defurl); if (!$url) { print "1..0 # No test URL supplied - skipping test\n"; exit; } # we need the real printenv cgi for these tests, so skip if # our test URL is not a printenv variant (or test.cgi from # mdk apache2). We basically need something which will echo # back sent headers in the output # if ($url !~ m/printenv|test.cgi/) { print "1..0 # need a real 'printenv' cgi script for this test"; exit; } print "1..5\n"; # Init the curl session my $curl = WWW::Curl::Easy->new(); if ($curl == 0) { print "not "; } print "ok ".++$count."\n"; $curl->setopt(CURLOPT_NOPROGRESS, 1); $curl->setopt(CURLOPT_FOLLOWLOCATION, 1); $curl->setopt(CURLOPT_TIMEOUT, 30); open HEAD, ">head.out"; $curl->setopt(CURLOPT_WRITEHEADER, \*HEAD); print "ok ".++$count."\n"; sub body_callback { my ($chunk,$handle)=@_; ${$handle}.=$chunk; return length($chunk); # OK } $curl->setopt(CURLOPT_WRITEFUNCTION, \&body_callback); my $body=""; $curl->setopt(CURLOPT_FILE,\$body); print "ok ".++$count."\n"; $curl->setopt(CURLOPT_URL, $url); print "ok ".++$count."\n"; # Add some additional headers to the http-request: # Check that the printenv script sends back FOO=bar somewhere # This checks that all headers were sent. my @myheaders; $myheaders[0] = "Baz: xyzzy"; $myheaders[1] = "Foo: bar"; $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders); # Go get it my $retcode=$curl->perform(); if ($retcode == 0) { if ($body !~ m/FOO\s*=\s*"?bar"?/) { print "not "; } } else { # We can acces the error message in $errbuf here # print STDERR "$retcode / ".$curl->errbuf."\n"; print "not "; } print "ok ".++$count."\n"; exit; WWW-Curl-4.15/t/00constants.t0000644000175000017500000000270211474533565015160 0ustar balintbalint#!perl use strict; use warnings; use Test::More; use WWW::Curl::Easy; my $ver_num_raw = WWW::Curl::Easy::version(); my ($ver_num) = $ver_num_raw =~ m!libcurl/(\d\.\d+\.\d+)!; my ($major, $minor, $bugfix) = split(/\./, $ver_num); open(my $fh, '<', 't/symbols-in-versions') or die($!); my @consts; for my $row (<$fh>) { chomp($row); next if ($row =~ m/^#/); my ($name, $intro, $dep, $remov) = split(/\s+/, $row); push @consts, [$name, $intro, $dep, $remov]; } # In case we can't use cpp to extract symbols, skipping the multi constant tests for now. my $skip_multi; my $value = WWW::Curl::Easy::constant('CURL_LAST'); $skip_multi++ if (! $!); my @checklist; for my $row (@consts) { my ($name, $intro, $depr, $outro) = @{$row}; my $check = 0; if (!$outro && $intro) { my ($maj_in, $min_in, $bf_in) = split(/\./, $intro); if ($maj_in eq '-' || $major > $maj_in) { $check = 1; } elsif ($major == $maj_in) { if ($minor > $min_in) { $check = 1 } elsif ($minor == $min_in ) { if ($bugfix > $bf_in) { $check = 1; } elsif ($bugfix == $bf_in) { $check = 1; } else { next } } else { next; } } else { next; } } if ($check) { next if ($skip_multi && $name =~ m/^CURLM/); push @checklist, [$name, $depr]; } } plan tests => scalar(@checklist); for my $row (@checklist) { my $value = WWW::Curl::Easy::constant($row->[0]); ok(!$! && (defined($value) || $row->[1]), "$row->[0] is defined alright - $!"); } WWW-Curl-4.15/t/10errbuf.t0000644000175000017500000000240411144657616014427 0ustar balintbalint#!perl use strict; use warnings; use Test::More tests => 12; use File::Temp qw/tempfile/; BEGIN { use_ok( '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, 'Curl session initialize returns something'); ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); 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"); my $head = tempfile(); ok(! $curl->setopt(CURLOPT_WRITEHEADER, $head), "Setting CURLOPT_WRITEHEADER"); my $body = tempfile(); ok(! $curl->setopt(CURLOPT_FILE, $body), "Setting CURLOPT_FILE"); ok(! $curl->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); my $new_error = tempfile(); ok(! $curl->setopt(CURLOPT_STDERR, $new_error), "Setting CURLOPT_STDERR"); # create a (hopefully) bad URL, so we get an error ok(! $curl->setopt(CURLOPT_URL, "badprotocol://127.0.0.1:2"), "Setting CURLOPT_URL succeeds, even with a bad protocol"); my $retcode = $curl->perform(); ok($retcode, "Non-zero return code indicates the expected failure"); exit; WWW-Curl-4.15/t/08ssl.t0000644000175000017500000000564111312702244013741 0ustar balintbalint#!perl use strict; use warnings; use Test::More; use File::Temp qw/tempfile/; use WWW::Curl::Easy; # list of tests # site-url, verifypeer(0,1), verifyhost(0,2), result(0=ok, 1=fail), result-openssl0.9.5 my $url_list=[ [ 'https://www.microsoft.com/', 0, 0, 0 , 0 ], [ 'https://www.microsoft.com/', 0, 0, 0 , 0 ], [ 'https://www.verisign.com/', 1, 2, 0 , 0 ], # verisign have had broken ssl - do this first [ 'https://www.verisign.com/', 0, 0, 0 , 0 ], [ 'https://www.verisign.com/', 0, 0, 0 , 0 ], [ 'https://www.verisign.com/', 0, 2, 0 , 0 ], [ 'https://www.thawte.com/', 0, 0, 0 , 0 ], [ 'https://www.thawte.com/', 0, 2, 0 , 0 ], # libcurl < 7.9.3 crashes with more than 5 ssl hosts per handle. [ 'https://www.rapidssl.com/', 0, 0, 0 , 0], [ 'https://www.rapidssl.com/', 0, 2, 0 , 0], [ 'https://www.rapidssl.com/', 1, 0, 1 , 0], [ 'https://www.rapidssl.com/', 1, 2, 1 , 0], ]; if (&WWW::Curl::Easy::version() !~ /ssl|nss/i) { plan skip_all => 'libcurl was compiled without ssl support, skipping ssl tests'; } else { plan tests => scalar(@{$url_list})+7; } # Init the curl session my $curl = WWW::Curl::Easy->new(); ok($curl, 'Curl session initialize returns something'); #1 ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); #2 ok(! $curl->setopt(CURLOPT_NOPROGRESS, 1), "Setting CURLOPT_NOPROGRESS"); #3 ok(! $curl->setopt(CURLOPT_FOLLOWLOCATION, 1), "Setting CURLOPT_FOLLOWLOCATION"); #4 ok(! $curl->setopt(CURLOPT_TIMEOUT, 30), "Setting CURLOPT_TIMEOUT"); #5 my $head = tempfile(); ok(! $curl->setopt(CURLOPT_WRITEHEADER, $head), "Setting CURLOPT_WRITEHEADER"); #6 my $body = tempfile(); ok(! $curl->setopt(CURLOPT_FILE, $body), "Setting CURLOPT_FILE"); #7 my @myheaders; $myheaders[0] = "User-Agent: Verifying SSL functions in WWW::Curl perl interface for libcURL"; $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders); $curl->setopt(CURLOPT_FORBID_REUSE, 1); $curl->setopt(CURLOPT_FRESH_CONNECT, 1); #$curl->setopt(CURLOPT_SSL_CIPHER_LIST, "HIGH:MEDIUM"); $curl->setopt(CURLOPT_CAINFO,"ca-bundle.crt"); $curl->setopt(CURLOPT_DEBUGFUNCTION, \&silence); sub silence { return 0 } my $count = 1; my $sslversion95 = 0; $sslversion95++ if (&WWW::Curl::Easy::version() =~ m/SSL 0.9.5/); # 0.9.5 has buggy connect with some ssl sites my $haveca = 0; if (-f "ca-bundle.crt") { $haveca = 1; } for my $test_list (@$url_list) { my ($url,$verifypeer,$verifyhost,$result,$result95)=@{$test_list}; if ($verifypeer && !$haveca) { $result = 1 } # expect to fail if no ca-bundle file if ($sslversion95) { $result=$result95 }; # change expectation $curl->setopt(CURLOPT_SSL_VERIFYPEER,$verifypeer); # do verify $curl->setopt(CURLOPT_SSL_VERIFYHOST,$verifyhost); # check name my $retcode; $curl->setopt(CURLOPT_URL, $url); $retcode = $curl->perform(); ok(($retcode != 0) == $result, "$url ssl test succeeds"); } WWW-Curl-4.15/t/06http-post.t0000644000175000017500000000344311144657616015115 0ustar balintbalint#!perl use strict; use warnings; use Test::More skip_all => "Not performing http POST/upload tests"; use File::Temp qw/tempfile/; BEGIN { use_ok( '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, 'Curl session initialize returns something'); ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); 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"); my $head = tempfile(); ok(! $curl->setopt(CURLOPT_WRITEHEADER, $head), "Setting CURLOPT_WRITEHEADER"); my $body = tempfile(); ok(! $curl->setopt(CURLOPT_FILE, $body), "Setting CURLOPT_FILE"); ok(! $curl->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); my @myheaders; $myheaders[0] = "Server: www"; $myheaders[1] = "User-Agent: Perl interface for libcURL"; ok(! $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders), "Setting CURLOPT_HTTPHEADER"); my $read_max=1000; sub read_callb { my ($maxlen,$sv)=@_; if ($read_max > 0) { my $len=int($read_max/3)+1; my $data = chr(ord('A')+rand(26))x$len; $read_max=$read_max-length($data); return $data; } else { return ""; } } # # XXX - Outdated POST mechanism! # ok(! $curl->setopt(CURLOPT_READFUNCTION,\&read_callb), "Setting CURLOPT_READFUNCTION"); ok(! $curl->setopt(CURLOPT_INFILESIZE,$read_max ), "Setting CURLOPT_INFILESIZE"); ok(! $curl->setopt(CURLOPT_UPLOAD,1 ), "Setting CURLOPT_UPLOAD"); ok(! $curl->setopt(CURLOPT_CUSTOMREQUEST,"POST" ), "Setting CURLOPT_CUSTOMREQUEST"); ok(! $curl->perform(), "Performing perform"); WWW-Curl-4.15/t/13slowleak.t0000644000175000017500000000210611210531764014752 0ustar balintbalint#!perl use strict; use warnings; #use Test::More tests => 214; use Test::More skip_all => "Not performing slow leakage regression test"; BEGIN { use_ok( 'WWW::Curl::Easy' ); } my $url = $ENV{CURL_TEST_URL} || "http://www.google.com"; # There was a slow leak per curl handle init/cleanup. Hopefully fixed. foreach my $j (1..200) { # Init the curl session my $curl = WWW::Curl::Easy->new() or die "cannot curl"; $curl->setopt(CURLOPT_NOPROGRESS, 1); $curl->setopt(CURLOPT_FOLLOWLOCATION, 1); $curl->setopt(CURLOPT_TIMEOUT, 30); open (HEAD, "+>",undef); WWW::Curl::Easy::setopt($curl, CURLOPT_WRITEHEADER, \*HEAD); open (BODY, "+>, undef); WWW::Curl::Easy::setopt($curl, CURLOPT_FILE, \*BODY); $curl->setopt(CURLOPT_URL, $url); my $httpcode = 0; my $retcode=$curl->perform(); if ($retcode == 0) { my bytes=$curl->getinfo(CURLINFO_SIZE_DOWNLOAD); my $realurl=$curl->getinfo(CURLINFO_EFFECTIVE_URL); my $httpcode=$curl->getinfo(CURLINFO_HTTP_CODE); } else { print "not ok $retcode / ".$curl->errbuf."\n"; } } WWW-Curl-4.15/t/new/0000755000175000017500000000000011474534004013374 5ustar balintbalintWWW-Curl-4.15/t/new/04abort.t0000644000175000017500000000064611144657616015053 0ustar balintbalintuse strict; use Test::More tests => 1; use WWW::Curl::Easy; sub body_callback { my ( $chunk, $handle ) = @_; return -1; } SKIP: { skip 'You need to set CURL_TEST_URL', 1 unless $ENV{CURL_TEST_URL}; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); $curl->setopt( CURLOPT_WRITEFUNCTION, \&body_callback ); my $code = $curl->perform; ok($code); } WWW-Curl-4.15/t/new/README0000644000175000017500000000057511144657616014274 0ustar balintbalintThese test scripts have been updated by Sebastian Riedel to use modern features of the Test::Harness suite, such as Test::Simple and Test::More, which makes them cleaner and more maintainable, but which are unfortunately not natively supported by older perl versions. They are placed here reference, and will become the standard test scripts once we drop support for perl5.005. WWW-Curl-4.15/t/new/07errbuf.t0000644000175000017500000000031511144657616015225 0ustar balintbalintuse strict; use Test::Simple tests => 1; use WWW::Curl::Easy; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, 'badprotocol://127.0.0.1:2' ); $curl->perform; my $err = $curl->errbuf; ok($err); WWW-Curl-4.15/t/new/01basic.t0000644000175000017500000000062711144657616015021 0ustar balintbalintuse strict; use Test::More tests => 1; use WWW::Curl::Easy; SKIP: { skip 'You need to set CURL_TEST_URL', 1 unless $ENV{CURL_TEST_URL}; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); my @headers = ( 'Server: cURL', 'User-Agent: WWW::Curl/3.00' ); $curl->setopt( CURLOPT_HTTPHEADER, \@headers ); my $code = $curl->perform; ok( $code == 0 ); } WWW-Curl-4.15/t/new/03body-callback.t0000644000175000017500000000070611144657616016427 0ustar balintbalintuse strict; use Test::More tests => 1; use WWW::Curl::Easy; my $body; sub body_callback { my ( $chunk, $handle ) = @_; $body .= $chunk; return length $chunk; } SKIP: { skip 'You need to set CURL_TEST_URL', 1 unless $ENV{CURL_TEST_URL}; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); $curl->setopt( CURLOPT_WRITEFUNCTION, \&body_callback ); $curl->perform; ok($body); } WWW-Curl-4.15/t/new/05progress.t0000644000175000017500000000123411144657616015603 0ustar balintbalintuse strict; use Test::More tests => 3; use WWW::Curl::Easy; my ( $progress, $last ); sub progress_callback { my ( $clientp, $dltotal, $dlnow, $ultotal, $ulnow ) = @_; $last = $dlnow; $progress++; return 0; } SKIP: { skip 'You need to set CURL_TEST_URL', 3 unless $ENV{CURL_TEST_URL}; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); $curl->setopt( CURLOPT_NOPROGRESS, 1 ); $curl->setopt( CURLOPT_NOPROGRESS, 0 ); $curl->setopt( CURLOPT_PROGRESSFUNCTION, \&progress_callback ); my $code = $curl->perform; ok( $code == 0 ); ok($progress); ok($last); } WWW-Curl-4.15/t/new/00constants.t0000644000175000017500000000013711144657616015747 0ustar balintbalintuse strict; use Test::Simple tests => 1; use WWW::Curl::Easy; ok( CURLOPT_URL == 10000 + 2 ); WWW-Curl-4.15/t/new/06http-post.t0000644000175000017500000000132711144657616015705 0ustar balintbalintuse strict; use Test::More tests => 1; use WWW::Curl::Easy; my $max = 1000; sub read_callback { my ( $maxlen, $sv ) = @_; # Create some random data my $data = chr( ord('A') + rand(26) ) x ( int( $max / 3 ) + 1 ); $max = $max - length $data; return $data; } SKIP: { skip 'You need to set CURL_TEST_URL', 1 unless $ENV{CURL_TEST_URL}; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); $curl->setopt( CURLOPT_READFUNCTION, \&read_callback ); $curl->setopt( CURLOPT_INFILESIZE, $max ); $curl->setopt( CURLOPT_UPLOAD, 1 ); $curl->setopt( CURLOPT_CUSTOMREQUEST, 'POST' ); my $code = $curl->perform; ok( $code == 0 ); } WWW-Curl-4.15/t/new/10multi-callback.t0000644000175000017500000000236511144657616016625 0ustar balintbalintuse strict; use Test::More tests => 4; use WWW::Curl::Easy; use WWW::Curl::Multi; my ( $header, $body, $header2, $body2 ); sub header_callback { my $chunk = shift; $header .= $chunk; return length($chunk); } sub body_callback { my ( $chunk, $handle ) = @_; $body .= $chunk; return length($chunk); } sub header_callback2 { my $chunk = shift; $header2 .= $chunk; return length($chunk); } sub body_callback2 { my ( $chunk, $handle ) = @_; $body2 .= $chunk; return length($chunk); } SKIP: { skip 'You need to set CURL_TEST_URL', 4 unless $ENV{CURL_TEST_URL}; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); $curl->setopt( CURLOPT_HEADERFUNCTION, \&header_callback ); $curl->setopt( CURLOPT_WRITEFUNCTION, \&body_callback ); my $curl2 = new WWW::Curl::Easy; $curl2->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); $curl2->setopt( CURLOPT_HEADERFUNCTION, \&header_callback2 ); $curl2->setopt( CURLOPT_WRITEFUNCTION, \&body_callback2 ); my $curlm = new WWW::Curl::Multi; $curlm->add_handle($curl); $curlm->add_handle($curl2); $curlm->perform; ok($header); ok($body); ok($header2); ok($body2); } WWW-Curl-4.15/t/new/02header-callback.t0000644000175000017500000000071011144657616016714 0ustar balintbalintuse strict; use Test::More tests => 1; use WWW::Curl::Easy; my $header; sub header_callback { my $chunk = shift; $header .= $chunk; return length $chunk; } SKIP: { skip 'You need to set CURL_TEST_URL', 1 unless $ENV{CURL_TEST_URL}; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); $curl->setopt( CURLOPT_HEADERFUNCTION, \&header_callback ); $curl->perform; ok($header); } WWW-Curl-4.15/t/new/09duphandle-callback.t0000644000175000017500000000075111144657616017444 0ustar balintbalintuse strict; use Test::More tests => 1; use WWW::Curl::Easy; my $body; sub body_callback { my ( $chunk, $handle ) = @_; $body .= $chunk; return length $chunk; } SKIP: { skip 'You need to set CURL_TEST_URL', 1 unless $ENV{CURL_TEST_URL}; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); $curl->setopt( CURLOPT_WRITEFUNCTION, \&body_callback ); my $curl2 = $curl->duphandle; $curl2->perform; ok($body); } WWW-Curl-4.15/t/new/08duphandle.t0000644000175000017500000000067311144657616015714 0ustar balintbalintuse strict; use Test::More tests => 1; use WWW::Curl::Easy; SKIP: { skip 'You need to set CURL_TEST_URL', 1 unless $ENV{CURL_TEST_URL}; my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); my @headers = ( 'Server: cURL', 'User-Agent: WWW::Curl/3.00' ); $curl->setopt( CURLOPT_HTTPHEADER, \@headers ); my $curl2 = $curl->duphandle; my $code = $curl2->perform; ok( $code == 0 ); } WWW-Curl-4.15/t/14duphandle.t0000644000175000017500000000420211144657616015110 0ustar balintbalint#!perl use strict; use warnings; use lib 'inc'; use lib 'blib/lib'; use lib 'blib/arch'; use Test::More tests => 17; use File::Temp qw/tempfile/; BEGIN { use_ok( 'WWW::Curl::Easy' ); } my $url = $ENV{CURL_TEST_URL} || "http://www.google.com"; { my $other_handle; my $head = tempfile(); my $body = tempfile(); { # Init the curl session my $curl = WWW::Curl::Easy->new(); ok($curl, 'Curl session initialize returns something'); ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); 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_WRITEHEADER, $head), "Setting CURLOPT_WRITEHEADER"); ok(! $curl->setopt(CURLOPT_FILE, $body), "Setting CURLOPT_FILE"); ok(! $curl->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); my @myheaders; $myheaders[0] = "Server: www"; $myheaders[1] = "User-Agent: Perl interface for libcURL"; ok(! $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders), "Setting CURLOPT_HTTPHEADER"); # duplicate the handle $other_handle = $curl->duphandle(); ok ($other_handle && ref($other_handle) eq 'WWW::Curl::Easy', "Duplicated handle seems to be an object in the right namespace"); foreach my $x ($other_handle,$curl) { my $retcode = $x->perform(); ok(!$retcode, "Perform returns without an error"); if ($retcode == 0) { my $bytes = $x->getinfo(CURLINFO_SIZE_DOWNLOAD); my $realurl = $x->getinfo(CURLINFO_EFFECTIVE_URL); my $httpcode = $x->getinfo(CURLINFO_HTTP_CODE); } } } ok(1, "Survived original curl handle DESTROY"); ok(! $other_handle->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); my $retcode = $other_handle->perform(); ok(!$retcode, "Perform returns without an error"); if ($retcode == 0) { my $bytes=$other_handle->getinfo(CURLINFO_SIZE_DOWNLOAD); my $realurl=$other_handle->getinfo(CURLINFO_EFFECTIVE_URL); my $httpcode=$other_handle->getinfo(CURLINFO_HTTP_CODE); } } ok(1, "Survived dup curl handle DESTROY"); exit; WWW-Curl-4.15/t/pod.t0000644000175000017500000000021411144657616013560 0ustar balintbalint#!perl -T use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); WWW-Curl-4.15/t/07ftp-upload.t0000644000175000017500000000406711144657616015232 0ustar balintbalint#!perl use strict; use warnings; use Test::More skip_all => "Not performing ftp upload tests"; BEGIN { use_ok( 'WWW::Curl::Easy' ); } my $count=1; # Read URL to get, defaulting to environment variable if supplied my $url=$ENV{CURL_TEST_URL_FTP} || ""; if (!$url) { print "1..0 # No test ftp URL supplied - skipping test\n"; exit; } print "1..8\n"; # Init the curl session my $curl = WWW::Curl::Easy->new(); if ($curl == 0) { print "not "; } print "ok ".++$count."\n"; $curl->setopt(CURLOPT_NOPROGRESS, 1); $curl->setopt(CURLOPT_FOLLOWLOCATION, 1); $curl->setopt(CURLOPT_TIMEOUT, 30); open HEAD, ">head.out"; $curl->setopt(CURLOPT_WRITEHEADER, \*HEAD); print "ok ".++$count."\n"; open BODY, ">body.out"; $curl->setopt(CURLOPT_FILE, \*body); print "ok ".++$count."\n"; $curl->setopt(CURLOPT_URL, $url); print "ok ".++$count."\n"; # Now do an ftp upload: $curl->setopt(CURLOPT_UPLOAD, 1); my $read_max=1000; $curl->setopt(CURLOPT_INFILESIZE,$read_max ); print "ok ".++$count."\n"; sub read_callb { my ($maxlen,$sv)=@_; print "# perl read_callback has been called!\n"; print "# max data size: $maxlen - $read_max bytes needed\n"; if ($read_max > 0) { my $len=int($read_max/3)+1; my $data = chr(ord('A')+rand(26))x$len; print "# generated max/3=", int($read_max/3)+1, " characters to be uploaded - $data.\n"; $read_max=$read_max-length($data); return $data; } else { return ""; } } # Use perl read callback to read data to be uploaded $curl->setopt(CURLOPT_READFUNCTION, \&read_callb); # Use perl passwd callback to read password for login to ftp server $curl->setopt(CURLOPT_USERPWD, "ftp\@"); print "ok ".++$count."\n"; # Go get it my $code; if (($code=$curl->perform()) == 0) { my $bytes=$curl->getinfo(CURLINFO_SIZE_UPLOAD); print "ok ".++$count." $bytes bytes transferred\n"; } else { # We can acces the error message in $errbuf here print "not ok ".++$count." ftpcode= $code, errbuf=".$curl->errbuf."\n"; } WWW-Curl-4.15/t/symbols-in-versions0000644000175000017500000006314611474530576016514 0ustar balintbalint# _ _ ____ _ # ___| | | | _ \| | # / __| | | | |_) | | # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # # This document lists defines and other symbols present in libcurl, together # with exact information about the first libcurl version that provides the # symbol, the first version in which the symbol was marked as deprecated and # for a few symbols the last version that featured it. The names appear in # alphabetical order. # # Name Introduced Deprecated Removed # CURLAUTH_ANY 7.10.6 CURLAUTH_ANYSAFE 7.10.6 CURLAUTH_BASIC 7.10.6 CURLAUTH_DIGEST 7.10.6 CURLAUTH_DIGEST_IE 7.19.3 CURLAUTH_GSSNEGOTIATE 7.10.6 CURLAUTH_NONE 7.10.6 CURLAUTH_NTLM 7.10.6 CURLAUTH_ONLY 7.21.3 CURLCLOSEPOLICY_CALLBACK 7.7 CURLCLOSEPOLICY_LEAST_RECENTLY_USED 7.7 CURLCLOSEPOLICY_LEAST_TRAFFIC 7.7 CURLCLOSEPOLICY_NONE 7.7 CURLCLOSEPOLICY_OLDEST 7.7 CURLCLOSEPOLICY_SLOWEST 7.7 CURLE_ABORTED_BY_CALLBACK 7.1 CURLE_AGAIN 7.18.2 CURLE_ALREADY_COMPLETE 7.7.2 CURLE_BAD_CALLING_ORDER 7.1 7.17.0 CURLE_BAD_CONTENT_ENCODING 7.10 CURLE_BAD_DOWNLOAD_RESUME 7.10 CURLE_BAD_FUNCTION_ARGUMENT 7.1 CURLE_BAD_PASSWORD_ENTERED - 7.17.0 CURLE_CHUNK_FAILED 7.20.1 CURLE_CONV_FAILED 7.15.4 CURLE_CONV_REQD 7.15.4 CURLE_COULDNT_CONNECT 7.1 CURLE_COULDNT_RESOLVE_HOST 7.1 CURLE_COULDNT_RESOLVE_PROXY 7.1 CURLE_FAILED_INIT 7.1 CURLE_FILESIZE_EXCEEDED 7.10.8 CURLE_FILE_COULDNT_READ_FILE 7.1 CURLE_FTP_ACCESS_DENIED 7.1 CURLE_FTP_BAD_DOWNLOAD_RESUME 7.1 CURLE_FTP_BAD_DOWNLOAD_RESUME 7.1 7.1 CURLE_FTP_BAD_FILE_LIST 7.20.1 CURLE_FTP_CANT_GET_HOST 7.1 CURLE_FTP_CANT_RECONNECT 7.1 7.17.0 CURLE_FTP_COULDNT_GET_SIZE 7.1 7.17.0 CURLE_FTP_COULDNT_RETR_FILE 7.1 CURLE_FTP_COULDNT_SET_ASCII 7.1 7.17.0 CURLE_FTP_COULDNT_SET_BINARY 7.1 7.17.0 CURLE_FTP_COULDNT_SET_TYPE 7.17.0 CURLE_FTP_COULDNT_STOR_FILE 7.1 CURLE_FTP_COULDNT_USE_REST 7.1 CURLE_FTP_PARTIAL_FILE 7.1 7.1 CURLE_FTP_PORT_FAILED 7.1 CURLE_FTP_PRET_FAILED 7.20.0 CURLE_FTP_QUOTE_ERROR 7.1 7.17.0 CURLE_FTP_SSL_FAILED - 7.17.0 CURLE_FTP_USER_PASSWORD_INCORRECT 7.1 7.17.0 CURLE_FTP_WEIRD_227_FORMAT 7.1 CURLE_FTP_WEIRD_PASS_REPLY 7.1 CURLE_FTP_WEIRD_PASV_REPLY 7.1 CURLE_FTP_WEIRD_SERVER_REPLY 7.1 CURLE_FTP_WEIRD_USER_REPLY 7.1 7.17.0 CURLE_FTP_WRITE_ERROR 7.1 7.17.0 CURLE_FUNCTION_NOT_FOUND 7.1 CURLE_GOT_NOTHING 7.9.1 CURLE_HTTP_NOT_FOUND 7.1 CURLE_HTTP_PORT_FAILED - 7.12.0 CURLE_HTTP_POST_ERROR 7.1 CURLE_HTTP_RANGE_ERROR 7.1 7.17.0 CURLE_HTTP_RETURNED_ERROR 7.10.3 CURLE_INTERFACE_FAILED 7.12.0 CURLE_LDAP_CANNOT_BIND 7.1 CURLE_LDAP_INVALID_URL 7.10.8 CURLE_LDAP_SEARCH_FAILED 7.1 CURLE_LIBRARY_NOT_FOUND 7.1 7.17.0 CURLE_LOGIN_DENIED 7.13.1 CURLE_MALFORMAT_USER 7.1 7.17.0 CURLE_OK 7.1 CURLE_OPERATION_TIMEDOUT 7.17.0 CURLE_OPERATION_TIMEOUTED 7.1 7.17.0 CURLE_OUT_OF_MEMORY 7.1 CURLE_PARTIAL_FILE 7.1 CURLE_PEER_FAILED_VERIFICATION 7.17.1 CURLE_QUOTE_ERROR 7.17.0 CURLE_RANGE_ERROR 7.17.0 CURLE_READ_ERROR 7.1 CURLE_RECV_ERROR 7.13.0 CURLE_REMOTE_ACCESS_DENIED 7.17.0 CURLE_REMOTE_DISK_FULL 7.17.0 CURLE_REMOTE_FILE_EXISTS 7.17.0 CURLE_REMOTE_FILE_NOT_FOUND 7.16.1 CURLE_RTSP_CSEQ_ERROR 7.20.0 CURLE_RTSP_SESSION_ERROR 7.20.0 CURLE_SEND_ERROR 7.13.0 CURLE_SEND_FAIL_REWIND 7.12.3 CURLE_SHARE_IN_USE - 7.17.0 CURLE_SSH 7.16.1 CURLE_SSL_CACERT 7.10 CURLE_SSL_CACERT_BADFILE 7.16.0 CURLE_SSL_CERTPROBLEM 7.10 CURLE_SSL_CIPHER 7.10 CURLE_SSL_CONNECT_ERROR 7.1 CURLE_SSL_CRL_BADFILE 7.19.0 CURLE_SSL_ENGINE_INITFAILED 7.13.0 CURLE_SSL_ENGINE_NOTFOUND 7.9.3 CURLE_SSL_ENGINE_SETFAILED 7.9.3 CURLE_SSL_ISSUER_ERROR 7.19.0 CURLE_SSL_PEER_CERTIFICATE - 7.17.1 CURLE_SSL_SHUTDOWN_FAILED 7.16.1 CURLE_TELNET_OPTION_SYNTAX 7.7 CURLE_TFTP_DISKFULL 7.15.0 7.17.0 CURLE_TFTP_EXISTS 7.15.0 7.17.0 CURLE_TFTP_ILLEGAL 7.15.0 CURLE_TFTP_NOSUCHUSER 7.15.0 CURLE_TFTP_NOTFOUND 7.15.0 CURLE_TFTP_PERM 7.15.0 CURLE_TFTP_UNKNOWNID 7.15.0 CURLE_TOO_MANY_REDIRECTS 7.5 CURLE_UNKNOWN_TELNET_OPTION 7.7 CURLE_UNSUPPORTED_PROTOCOL 7.1 CURLE_UPLOAD_FAILED 7.16.3 CURLE_URL_MALFORMAT 7.1 CURLE_URL_MALFORMAT_USER 7.1 7.17.0 CURLE_USE_SSL_FAILED 7.17.0 CURLE_WRITE_ERROR 7.1 CURLFILETYPE_DEVICE_BLOCK 7.21.0 CURLFILETYPE_DEVICE_CHAR 7.21.0 CURLFILETYPE_DIRECTORY 7.21.0 CURLFILETYPE_DOOR 7.21.0 CURLFILETYPE_FILE 7.21.0 CURLFILETYPE_NAMEDPIPE 7.21.0 CURLFILETYPE_SOCKET 7.21.0 CURLFILETYPE_SYMLINK 7.21.0 CURLFILETYPE_UNKNOWN 7.21.0 CURLFINFOFLAG_KNOWN_FILENAME 7.21.0 CURLFINFOFLAG_KNOWN_FILETYPE 7.21.0 CURLFINFOFLAG_KNOWN_GID 7.21.0 CURLFINFOFLAG_KNOWN_HLINKCOUNT 7.21.0 CURLFINFOFLAG_KNOWN_PERM 7.21.0 CURLFINFOFLAG_KNOWN_SIZE 7.21.0 CURLFINFOFLAG_KNOWN_TIME 7.21.0 CURLFINFOFLAG_KNOWN_UID 7.21.0 CURLFORM_ARRAY 7.9.1 CURLFORM_BUFFER 7.9.8 CURLFORM_BUFFERLENGTH 7.9.8 CURLFORM_BUFFERPTR 7.9.8 CURLFORM_CONTENTHEADER 7.9.3 CURLFORM_CONTENTSLENGTH 7.9.1 CURLFORM_CONTENTTYPE 7.9.1 CURLFORM_COPYCONTENTS 7.9.1 CURLFORM_COPYNAME 7.9.1 CURLFORM_END 7.9.1 CURLFORM_FILE 7.9.1 CURLFORM_FILECONTENT 7.9.1 CURLFORM_FILENAME 7.9.6 CURLFORM_NAMELENGTH 7.9.1 CURLFORM_NOTHING 7.9.1 CURLFORM_PTRCONTENTS 7.9.1 CURLFORM_PTRNAME 7.9.1 CURLFORM_STREAM 7.18.2 CURLFTPAUTH_DEFAULT 7.12.2 CURLFTPAUTH_DEFAULT 7.12.2 CURLFTPAUTH_SSL 7.12.2 CURLFTPAUTH_SSL 7.12.2 CURLFTPAUTH_TLS 7.12.2 CURLFTPAUTH_TLS 7.12.2 CURLFTPMETHOD_DEFAULT 7.15.1 CURLFTPMETHOD_MULTICWD 7.15.1 CURLFTPMETHOD_NOCWD 7.15.1 CURLFTPMETHOD_SINGLECWD 7.15.1 CURLFTPSSL_ALL - 7.17.0 CURLFTPSSL_CCC_ACTIVE 7.16.1 CURLFTPSSL_CCC_NONE 7.16.1 CURLFTPSSL_CCC_PASSIVE 7.16.1 CURLFTPSSL_CONTROL 7.11.0 7.17.0 CURLFTPSSL_NONE 7.11.0 7.17.0 CURLFTPSSL_TRY 7.11.0 7.17.0 CURLFTP_CREATE_DIR 7.19.4 CURLFTP_CREATE_DIR_NONE 7.19.4 CURLFTP_CREATE_DIR_RETRY 7.19.4 CURLINFO_APPCONNECT_TIME 7.19.0 CURLINFO_CERTINFO 7.19.1 CURLINFO_CONDITION_UNMET 7.19.4 CURLINFO_CONNECT_TIME 7.4.1 CURLINFO_CONTENT_LENGTH_DOWNLOAD 7.6.1 CURLINFO_CONTENT_LENGTH_UPLOAD 7.6.1 CURLINFO_CONTENT_TYPE 7.9.4 CURLINFO_COOKIELIST 7.14.1 CURLINFO_DATA_IN 7.9.6 CURLINFO_DATA_OUT 7.9.6 CURLINFO_DOUBLE 7.4.1 CURLINFO_EFFECTIVE_URL 7.3 CURLINFO_END 7.4.1 CURLINFO_FILETIME 7.5 CURLINFO_FTP_ENTRY_PATH 7.15.4 CURLINFO_HEADER_IN 7.9.6 CURLINFO_HEADER_OUT 7.9.6 CURLINFO_HEADER_SIZE 7.4.1 CURLINFO_HTTPAUTH_AVAIL 7.10.8 CURLINFO_HTTP_CODE 7.4.1 7.10.8 CURLINFO_HTTP_CONNECTCODE 7.10.7 CURLINFO_LASTONE 7.4.1 CURLINFO_LASTSOCKET 7.15.2 CURLINFO_LOCAL_IP 7.21.0 CURLINFO_LOCAL_PORT 7.21.0 CURLINFO_LONG 7.4.1 CURLINFO_MASK 7.4.1 CURLINFO_NAMELOOKUP_TIME 7.4.1 CURLINFO_NONE 7.4.1 CURLINFO_NUM_CONNECTS 7.12.3 CURLINFO_OS_ERRNO 7.12.2 CURLINFO_PRETRANSFER_TIME 7.4.1 CURLINFO_PRIMARY_IP 7.19.0 CURLINFO_PRIMARY_PORT 7.21.0 CURLINFO_PRIVATE 7.10.3 CURLINFO_PRIVATE 7.10.3 CURLINFO_PROXYAUTH_AVAIL 7.10.8 CURLINFO_REDIRECT_COUNT 7.9.7 CURLINFO_REDIRECT_TIME 7.9.7 CURLINFO_REDIRECT_URL 7.18.2 CURLINFO_REQUEST_SIZE 7.4.1 CURLINFO_RESPONSE_CODE 7.10.8 CURLINFO_RTSP_CLIENT_CSEQ 7.20.0 CURLINFO_RTSP_CSEQ_RECV 7.20.0 CURLINFO_RTSP_SERVER_CSEQ 7.20.0 CURLINFO_RTSP_SESSION_ID 7.20.0 CURLINFO_SIZE_DOWNLOAD 7.4.1 CURLINFO_SIZE_UPLOAD 7.4.1 CURLINFO_SLIST 7.12.3 CURLINFO_SPEED_DOWNLOAD 7.4.1 CURLINFO_SPEED_UPLOAD 7.4.1 CURLINFO_SSL_DATA_IN 7.12.1 CURLINFO_SSL_DATA_OUT 7.12.1 CURLINFO_SSL_ENGINES 7.12.3 CURLINFO_SSL_VERIFYRESULT 7.5 CURLINFO_STARTTRANSFER_TIME 7.9.2 CURLINFO_STRING 7.4.1 CURLINFO_TEXT 7.9.6 CURLINFO_TOTAL_TIME 7.4.1 CURLINFO_TYPEMASK 7.4.1 CURLIOCMD_NOP 7.12.3 CURLIOCMD_RESTARTREAD 7.12.3 CURLIOE_FAILRESTART 7.12.3 CURLIOE_OK 7.12.3 CURLIOE_UNKNOWNCMD 7.12.3 CURLKHMATCH_MISMATCH 7.19.6 CURLKHMATCH_MISSING 7.19.6 CURLKHMATCH_OK 7.19.6 CURLKHSTAT_DEFER 7.19.6 CURLKHSTAT_FINE 7.19.6 CURLKHSTAT_FINE_ADD_TO_FILE 7.19.6 CURLKHSTAT_REJECT 7.19.6 CURLKHTYPE_DSS 7.19.6 CURLKHTYPE_RSA 7.19.6 CURLKHTYPE_RSA1 7.19.6 CURLKHTYPE_UNKNOWN 7.19.6 CURLMOPT_MAXCONNECTS 7.16.3 CURLMOPT_PIPELINING 7.16.0 CURLMOPT_SOCKETDATA 7.15.4 CURLMOPT_SOCKETFUNCTION 7.15.4 CURLMOPT_TIMERDATA 7.16.0 CURLMOPT_TIMERFUNCTION 7.16.0 CURLMSG_DONE 7.9.6 CURLMSG_NONE 7.9.6 CURLM_BAD_EASY_HANDLE 7.9.6 CURLM_BAD_HANDLE 7.9.6 CURLM_BAD_SOCKET 7.15.4 CURLM_CALL_MULTI_PERFORM 7.9.6 CURLM_INTERNAL_ERROR 7.9.6 CURLM_OK 7.9.6 CURLM_OUT_OF_MEMORY 7.9.6 CURLM_UNKNOWN_OPTION 7.15.4 CURLOPTTYPE_FUNCTIONPOINT 7.1 CURLOPTTYPE_LONG 7.1 CURLOPTTYPE_OBJECTPOINT 7.1 CURLOPTTYPE_OFF_T 7.11.0 CURLOPT_ADDRESS_SCOPE 7.19.0 CURLOPT_APPEND 7.16.4 CURLOPT_AUTOREFERER 7.1 CURLOPT_BUFFERSIZE 7.10 CURLOPT_CAINFO 7.4.2 CURLOPT_CAPATH 7.9.8 CURLOPT_CERTINFO 7.19.1 CURLOPT_CHUNK_BGN_FUNCTION 7.21.0 CURLOPT_CHUNK_DATA 7.21.0 CURLOPT_CHUNK_END_FUNCTION 7.21.0 CURLOPT_CLOSEFUNCTION 7.7 7.11.1 7.15.4 CURLOPT_CLOSEPOLICY 7.7 7.16.1 CURLOPT_CONNECTTIMEOUT 7.7 CURLOPT_CONNECTTIMEOUT_MS 7.16.2 CURLOPT_CONNECT_ONLY 7.15.2 CURLOPT_CONV_FROM_NETWORK_FUNCTION 7.15.4 CURLOPT_CONV_FROM_UTF8_FUNCTION 7.15.4 CURLOPT_CONV_TO_NETWORK_FUNCTION 7.15.4 CURLOPT_COOKIE 7.1 CURLOPT_COOKIEFILE 7.1 CURLOPT_COOKIEJAR 7.9 CURLOPT_COOKIELIST 7.17.1 CURLOPT_COOKIESESSION 7.9.7 CURLOPT_COPYPOSTFIELDS 7.17.1 CURLOPT_CRLF 7.1 CURLOPT_CRLFILE 7.19.0 CURLOPT_CUSTOMREQUEST 7.1 CURLOPT_DEBUGDATA 7.9.6 CURLOPT_DEBUGFUNCTION 7.9.6 CURLOPT_DIRLISTONLY 7.16.4 CURLOPT_DNS_CACHE_TIMEOUT 7.9.3 CURLOPT_DNS_USE_GLOBAL_CACHE 7.9.3 7.11.1 CURLOPT_EGDSOCKET 7.7 CURLOPT_ENCODING 7.12.2 CURLOPT_ERRORBUFFER 7.1 CURLOPT_FAILONERROR 7.1 CURLOPT_FILE 7.1 7.9.7 CURLOPT_FILETIME 7.5 CURLOPT_FLAGS 7.1 - 7.9.2 CURLOPT_FNMATCH_DATA 7.21.0 CURLOPT_FNMATCH_FUNCTION 7.21.0 CURLOPT_FOLLOWLOCATION 7.1 CURLOPT_FORBID_REUSE 7.7 CURLOPT_FRESH_CONNECT 7.7 CURLOPT_FTPAPPEND 7.1 7.16.4 CURLOPT_FTPASCII 7.1 7.11.1 7.15.4 CURLOPT_FTPLISTONLY 7.1 7.16.4 CURLOPT_FTPPORT 7.1 CURLOPT_FTPSSLAUTH 7.12.2 CURLOPT_FTP_ACCOUNT 7.13.1 CURLOPT_FTP_ALTERNATIVE_TO_USER 7.15.5 CURLOPT_FTP_CREATE_MISSING_DIRS 7.10.7 CURLOPT_FTP_FILEMETHOD 7.15.1 CURLOPT_FTP_RESPONSE_TIMEOUT 7.10.8 CURLOPT_FTP_SKIP_PASV_IP 7.15.0 CURLOPT_FTP_SSL 7.11.0 7.16.4 CURLOPT_FTP_SSL_CCC 7.16.1 CURLOPT_FTP_USE_EPRT 7.10.5 CURLOPT_FTP_USE_EPSV 7.9.2 CURLOPT_FTP_USE_PRET 7.20.0 CURLOPT_HEADER 7.1 CURLOPT_HEADERDATA 7.10 CURLOPT_HEADERFUNCTION 7.7.2 CURLOPT_HTTP200ALIASES 7.10.3 CURLOPT_HTTPAUTH 7.10.6 CURLOPT_HTTPGET 7.8.1 CURLOPT_HTTPHEADER 7.1 CURLOPT_HTTPPOST 7.1 CURLOPT_HTTPPROXYTUNNEL 7.3 CURLOPT_HTTPREQUEST 7.1 - 7.15.4 CURLOPT_HTTP_CONTENT_DECODING 7.16.2 CURLOPT_HTTP_TRANSFER_DECODING 7.16.2 CURLOPT_HTTP_VERSION 7.9.1 CURLOPT_IGNORE_CONTENT_LENGTH 7.14.1 CURLOPT_INFILE 7.1 7.9.7 CURLOPT_INFILESIZE 7.1 CURLOPT_INFILESIZE_LARGE 7.11.0 CURLOPT_INTERFACE 7.3 CURLOPT_INTERLEAVEDATA 7.20.0 CURLOPT_INTERLEAVEFUNCTION 7.20.0 CURLOPT_IOCTLDATA 7.12.3 CURLOPT_IOCTLFUNCTION 7.12.3 CURLOPT_IPRESOLVE 7.10.8 CURLOPT_ISSUERCERT 7.19.0 CURLOPT_KEYPASSWD 7.17.0 CURLOPT_KRB4LEVEL 7.3 7.17.0 CURLOPT_KRBLEVEL 7.17.0 CURLOPT_LOCALPORT 7.15.2 CURLOPT_LOCALPORTRANGE 7.15.2 CURLOPT_LOW_SPEED_LIMIT 7.1 CURLOPT_LOW_SPEED_TIME 7.1 CURLOPT_MAIL_FROM 7.20.0 CURLOPT_MAIL_RCPT 7.20.0 CURLOPT_MAXCONNECTS 7.7 CURLOPT_MAXFILESIZE 7.10.8 CURLOPT_MAXFILESIZE_LARGE 7.11.0 CURLOPT_MAXREDIRS 7.5 CURLOPT_MAX_RECV_SPEED_LARGE 7.15.5 CURLOPT_MAX_SEND_SPEED_LARGE 7.15.5 CURLOPT_MUTE 7.1 7.8 7.15.4 CURLOPT_NETRC 7.1 CURLOPT_NETRC_FILE 7.11.0 CURLOPT_NEW_DIRECTORY_PERMS 7.16.4 CURLOPT_NEW_FILE_PERMS 7.16.4 CURLOPT_NOBODY 7.1 CURLOPT_NOPROGRESS 7.1 CURLOPT_NOPROXY 7.19.4 CURLOPT_NOSIGNAL 7.10 CURLOPT_OPENSOCKETDATA 7.17.1 CURLOPT_OPENSOCKETFUNCTION 7.17.1 CURLOPT_PASSWDDATA 7.1 7.11.1 7.15.4 CURLOPT_PASSWDFUNCTION 7.1 7.11.1 7.15.4 CURLOPT_PASSWORD 7.19.1 CURLOPT_PASV_POST 7.12.1 - 7.13.0 CURLOPT_PORT 7.1 CURLOPT_POST 7.1 CURLOPT_POST301 7.17.1 7.19.1 CURLOPT_POSTFIELDS 7.1 CURLOPT_POSTFIELDSIZE 7.2 CURLOPT_POSTFIELDSIZE_LARGE 7.11.1 CURLOPT_POSTQUOTE 7.1 CURLOPT_POSTREDIR 7.19.1 CURLOPT_PREQUOTE 7.9.5 CURLOPT_PRIVATE 7.10.3 CURLOPT_PROGRESSDATA 7.1 CURLOPT_PROGRESSFUNCTION 7.1 CURLOPT_PROGRESSMODE 7.1 - 7.9.2 CURLOPT_PROTOCOLS 7.19.4 CURLOPT_PROXY 7.1 CURLOPT_PROXYAUTH 7.10.7 CURLOPT_PROXYPASSWORD 7.19.1 CURLOPT_PROXYPORT 7.1 CURLOPT_PROXYTYPE 7.10 CURLOPT_PROXYUSERNAME 7.19.1 CURLOPT_PROXYUSERPWD 7.1 CURLOPT_PROXY_TRANSFER_MODE 7.18.0 CURLOPT_PUT 7.1 CURLOPT_QUOTE 7.1 CURLOPT_RANDOM_FILE 7.7 CURLOPT_RANGE 7.1 CURLOPT_READDATA 7.9.7 CURLOPT_READFUNCTION 7.1 CURLOPT_REDIR_PROTOCOLS 7.19.4 CURLOPT_REFERER 7.1 CURLOPT_RESOLVE 7.21.3 CURLOPT_RESUME_FROM 7.1 CURLOPT_RESUME_FROM_LARGE 7.11.0 CURLOPT_RTSPHEADER 7.20.0 CURLOPT_RTSP_CLIENT_CSEQ 7.20.0 CURLOPT_RTSP_REQUEST 7.20.0 CURLOPT_RTSP_SERVER_CSEQ 7.20.0 CURLOPT_RTSP_SESSION_ID 7.20.0 CURLOPT_RTSP_STREAM_URI 7.20.0 CURLOPT_RTSP_TRANSPORT 7.20.0 CURLOPT_SEEKDATA 7.18.1 CURLOPT_SEEKFUNCTION 7.18.1 CURLOPT_SERVER_RESPONSE_TIMEOUT 7.20.0 CURLOPT_SHARE 7.10 CURLOPT_SOCKOPTDATA 7.16.0 CURLOPT_SOCKOPTFUNCTION 7.16.0 CURLOPT_SOCKS5_GSSAPI_NEC 7.19.4 CURLOPT_SOCKS5_GSSAPI_SERVICE 7.19.4 CURLOPT_SOURCE_HOST 7.12.1 - 7.13.0 CURLOPT_SOURCE_PATH 7.12.1 - 7.13.0 CURLOPT_SOURCE_PORT 7.12.1 - 7.13.0 CURLOPT_SOURCE_POSTQUOTE 7.12.1 - 7.15.4 CURLOPT_SOURCE_PREQUOTE 7.12.1 - 7.15.4 CURLOPT_SOURCE_QUOTE 7.13.0 - 7.15.4 CURLOPT_SOURCE_URL 7.13.0 - 7.15.4 CURLOPT_SOURCE_USERPWD 7.12.1 - 7.15.4 CURLOPT_SSH_AUTH_TYPES 7.16.1 CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 7.17.1 CURLOPT_SSH_KEYDATA 7.19.6 CURLOPT_SSH_KEYFUNCTION 7.19.6 CURLOPT_SSH_KNOWNHOSTS 7.19.6 CURLOPT_SSH_PRIVATE_KEYFILE 7.16.1 CURLOPT_SSH_PUBLIC_KEYFILE 7.16.1 CURLOPT_SSLCERT 7.1 CURLOPT_SSLCERTPASSWD 7.17.0 CURLOPT_SSLCERTTYPE 7.9.3 CURLOPT_SSLENGINE 7.9.3 CURLOPT_SSLENGINE_DEFAULT 7.9.3 CURLOPT_SSLKEY 7.9.3 CURLOPT_SSLKEYPASSWD 7.17.0 CURLOPT_SSLKEYPASSWD 7.17.0 CURLOPT_SSLKEYTYPE 7.9.3 CURLOPT_SSLVERSION 7.1 CURLOPT_SSL_CIPHER_LIST 7.9 CURLOPT_SSL_CTX_DATA 7.10.6 CURLOPT_SSL_CTX_FUNCTION 7.10.6 CURLOPT_SSL_SESSIONID_CACHE 7.16.0 CURLOPT_SSL_VERIFYHOST 7.8.1 CURLOPT_SSL_VERIFYPEER 7.4.2 CURLOPT_STDERR 7.1 CURLOPT_TCP_NODELAY 7.11.2 CURLOPT_TELNETOPTIONS 7.7 CURLOPT_TFTP_BLKSIZE 7.19.4 CURLOPT_TIMECONDITION 7.1 CURLOPT_TIMEOUT 7.1 CURLOPT_TIMEOUT_MS 7.16.2 CURLOPT_TIMEVALUE 7.1 CURLOPT_TRANSFERTEXT 7.11.1 CURLOPT_UNRESTRICTED_AUTH 7.10.4 CURLOPT_UPLOAD 7.1 CURLOPT_URL 7.1 CURLOPT_USERAGENT 7.1 CURLOPT_USERNAME 7.19.1 CURLOPT_USERPWD 7.1 CURLOPT_USE_SSL 7.17.0 CURLOPT_VERBOSE 7.1 CURLOPT_WILDCARDMATCH 7.21.0 CURLOPT_WRITEDATA 7.9.7 CURLOPT_WRITEFUNCTION 7.1 CURLOPT_WRITEHEADER 7.1 CURLOPT_WRITEINFO 7.1 CURLPAUSE_ALL 7.18.0 CURLPAUSE_CONT 7.18.0 CURLPAUSE_RECV 7.18.0 CURLPAUSE_RECV_CONT 7.18.0 CURLPAUSE_SEND 7.18.0 CURLPAUSE_SEND_CONT 7.18.0 CURLPROTO_ALL 7.19.4 CURLPROTO_DICT 7.19.4 CURLPROTO_FILE 7.19.4 CURLPROTO_FTP 7.19.4 CURLPROTO_FTPS 7.19.4 CURLPROTO_GOPHER 7.21.2 CURLPROTO_HTTP 7.19.4 CURLPROTO_HTTPS 7.19.4 CURLPROTO_IMAP 7.20.0 CURLPROTO_IMAPS 7.20.0 CURLPROTO_LDAP 7.19.4 CURLPROTO_LDAPS 7.19.4 CURLPROTO_POP3 7.20.0 CURLPROTO_POP3S 7.20.0 CURLPROTO_RTMP 7.21.0 CURLPROTO_RTMPE 7.21.0 CURLPROTO_RTMPS 7.21.0 CURLPROTO_RTMPT 7.21.0 CURLPROTO_RTMPTE 7.21.0 CURLPROTO_RTMPTS 7.21.0 CURLPROTO_RTSP 7.20.0 CURLPROTO_SCP 7.19.4 CURLPROTO_SFTP 7.19.4 CURLPROTO_SMTP 7.20.0 CURLPROTO_SMTPS 7.20.0 CURLPROTO_TELNET 7.19.4 CURLPROTO_TFTP 7.19.4 CURLPROXY_HTTP 7.10 CURLPROXY_HTTP_1_0 7.19.4 CURLPROXY_SOCKS4 7.10 CURLPROXY_SOCKS4A 7.18.0 CURLPROXY_SOCKS5 7.10 CURLPROXY_SOCKS5_HOSTNAME 7.18.0 CURLSHE_BAD_OPTION 7.10.3 CURLSHE_INVALID 7.10.3 CURLSHE_IN_USE 7.10.3 CURLSHE_NOMEM 7.10.3 CURLSHE_OK 7.10.3 CURLSHOPT_LOCKFUNC 7.10.3 CURLSHOPT_NONE 7.10.3 CURLSHOPT_SHARE 7.10.3 CURLSHOPT_UNLOCKFUNC 7.10.3 CURLSHOPT_UNSHARE 7.10.3 CURLSHOPT_USERDATA 7.10.3 CURLSOCKTYPE_IPCXN 7.15.6 CURLSSH_AUTH_ANY 7.16.1 CURLSSH_AUTH_DEFAULT 7.16.1 CURLSSH_AUTH_HOST 7.16.1 CURLSSH_AUTH_KEYBOARD 7.16.1 CURLSSH_AUTH_NONE 7.16.1 CURLSSH_AUTH_PASSWORD 7.16.1 CURLSSH_AUTH_PUBLICKEY 7.16.1 CURLUSESSL_ALL 7.17.0 CURLUSESSL_ALL 7.17.0 CURLUSESSL_CONTROL 7.17.0 CURLUSESSL_CONTROL 7.17.0 CURLUSESSL_NONE 7.17.0 CURLUSESSL_NONE 7.17.0 CURLUSESSL_TRY 7.17.0 CURLUSESSL_TRY 7.17.0 CURLVERSION_FIRST 7.10 CURLVERSION_FOURTH 7.16.1 CURLVERSION_NOW 7.10 CURLVERSION_SECOND 7.11.1 CURLVERSION_THIRD 7.12.0 CURL_CHUNK_BGN_FUNC_FAIL 7.21.0 CURL_CHUNK_BGN_FUNC_OK 7.21.0 CURL_CHUNK_BGN_FUNC_SKIP 7.21.0 CURL_CHUNK_END_FUNC_FAIL 7.21.0 CURL_CHUNK_END_FUNC_OK 7.21.0 CURL_ERROR_SIZE 7.1 CURL_FNMATCHFUNC_FAIL 7.21.0 CURL_FNMATCHFUNC_MATCH 7.21.0 CURL_FNMATCHFUNC_NOMATCH 7.21.0 CURL_FORMADD_DISABLED 7.12.1 CURL_FORMADD_ILLEGAL_ARRAY 7.9.8 CURL_FORMADD_INCOMPLETE 7.9.8 CURL_FORMADD_MEMORY 7.9.8 CURL_FORMADD_NULL 7.9.8 CURL_FORMADD_OK 7.9.8 CURL_FORMADD_OPTION_TWICE 7.9.8 CURL_FORMADD_UNKNOWN_OPTION 7.9.8 CURL_GLOBAL_ALL 7.8 CURL_GLOBAL_DEFAULT 7.8 CURL_GLOBAL_NOTHING 7.8 CURL_GLOBAL_SSL 7.8 CURL_GLOBAL_WIN32 7.8.1 CURL_HTTP_VERSION_1_0 7.9.1 CURL_HTTP_VERSION_1_1 7.9.1 CURL_HTTP_VERSION_NONE 7.9.1 CURL_IPRESOLVE_V4 7.10.8 CURL_IPRESOLVE_V6 7.10.8 CURL_IPRESOLVE_WHATEVER 7.10.8 CURL_LOCK_ACCESS_NONE 7.10.3 CURL_LOCK_ACCESS_SHARED 7.10.3 CURL_LOCK_ACCESS_SINGLE 7.10.3 CURL_LOCK_DATA_CONNECT 7.10.3 CURL_LOCK_DATA_COOKIE 7.10.3 CURL_LOCK_DATA_DNS 7.10.3 CURL_LOCK_DATA_NONE 7.10.3 CURL_LOCK_DATA_SHARE 7.10.4 CURL_LOCK_DATA_SSL_SESSION 7.10.3 CURL_MAX_HTTP_HEADER 7.19.7 CURL_MAX_WRITE_SIZE 7.9.7 CURL_NETRC_IGNORED 7.9.8 CURL_NETRC_OPTIONAL 7.9.8 CURL_NETRC_REQUIRED 7.9.8 CURL_READFUNC_ABORT 7.12.1 CURL_READFUNC_PAUSE 7.18.0 CURL_REDIR_GET_ALL 7.19.1 CURL_REDIR_POST_301 7.19.1 CURL_REDIR_POST_302 7.19.1 CURL_REDIR_POST_ALL 7.19.1 CURL_RTSPREQ_ANNOUNCE 7.20.0 CURL_RTSPREQ_DESCRIBE 7.20.0 CURL_RTSPREQ_GET_PARAMETER 7.20.0 CURL_RTSPREQ_NONE 7.20.0 CURL_RTSPREQ_OPTIONS 7.20.0 CURL_RTSPREQ_PAUSE 7.20.0 CURL_RTSPREQ_PLAY 7.20.0 CURL_RTSPREQ_RECEIVE 7.20.0 CURL_RTSPREQ_RECORD 7.20.0 CURL_RTSPREQ_SETUP 7.20.0 CURL_RTSPREQ_SET_PARAMETER 7.20.0 CURL_RTSPREQ_TEARDOWN 7.20.0 CURL_SEEKFUNC_CANTSEEK 7.19.5 CURL_SEEKFUNC_FAIL 7.19.5 CURL_SEEKFUNC_OK 7.19.5 CURL_SOCKET_BAD 7.14.0 CURL_SSLVERSION_DEFAULT 7.9.2 CURL_SSLVERSION_SSLv2 7.9.2 CURL_SSLVERSION_SSLv3 7.9.2 CURL_SSLVERSION_TLSv1 7.9.2 CURL_TIMECOND_IFMODSINCE 7.9.7 CURL_TIMECOND_IFUNMODSINCE 7.9.7 CURL_TIMECOND_LASTMOD 7.9.7 CURL_TIMECOND_NONE 7.9.7 CURL_VERSION_ASYNCHDNS 7.10.7 CURL_VERSION_CONV 7.15.4 CURL_VERSION_CURLDEBUG 7.19.6 CURL_VERSION_DEBUG 7.10.6 CURL_VERSION_GSSNEGOTIATE 7.10.6 CURL_VERSION_IDN 7.12.0 CURL_VERSION_IPV6 7.10 CURL_VERSION_KERBEROS4 7.10 CURL_VERSION_LARGEFILE 7.11.1 CURL_VERSION_LIBZ 7.10 CURL_VERSION_NTLM 7.10.6 CURL_VERSION_SPNEGO 7.10.8 CURL_VERSION_SSL 7.10 CURL_VERSION_SSPI 7.13.2 CURL_WRITEFUNC_PAUSE 7.18.0 WWW-Curl-4.15/t/19multi.t0000644000175000017500000000571611474521305014305 0ustar balintbalint#!perl use strict; use warnings; use Test::More tests => 20; use WWW::Curl::Easy; use WWW::Curl::Multi; use File::Temp qw/tempfile/; my $header = tempfile(); my $header2 = tempfile(); my $body = tempfile(); my $body2 = tempfile(); my $url = $ENV{CURL_TEST_URL} || "http://www.google.com"; sub fhbits { my $fhlist = shift; my $bits = ''; for (@{$fhlist}) { vec($bits,$_,1) = 1; } return $bits; } sub action_wait { my $curlm = shift; my ($re, $wr, $err) = $curlm->fdset; my ($rin, $win, $ein, $rout, $wout, $eout); $rin = $win = $ein = ''; $rin = fhbits($re); $win = fhbits($wr); $ein = $rin | $win; my ($nfound,$timeleft) = select($rin, $win, $ein, 1); } my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $url); ok(! $curl->setopt(CURLOPT_WRITEHEADER, $header), "Setting CURLOPT_WRITEHEADER"); ok(! $curl->setopt(CURLOPT_WRITEDATA,$body), "Setting CURLOPT_WRITEDATA"); ok(! $curl->setopt(CURLOPT_PRIVATE,"foo"), "Setting CURLOPT_PRIVATE"); my $curl2 = new WWW::Curl::Easy; $curl2->setopt( CURLOPT_URL, $url); ok(! $curl2->setopt(CURLOPT_WRITEHEADER, $header2), "Setting CURLOPT_WRITEHEADER"); ok(! $curl2->setopt(CURLOPT_WRITEDATA,$body2), "Setting CURLOPT_WRITEDATA"); ok(! $curl2->setopt(CURLOPT_PRIVATE,42), "Setting CURLOPT_PRIVATE"); my $curlm = new WWW::Curl::Multi; my @fds = $curlm->fdset; ok( @fds == 3 && ref($fds[0]) && ref($fds[1]) && ref($fds[2]), "fdset returns 3 references"); ok( ! @{$fds[0]} && ! @{$fds[1]} && !@{$fds[2]} , "The three returned arrayrefs are empty"); $curlm->perform; @fds = $curlm->fdset; ok( ! @{$fds[0]} && ! @{$fds[1]} && !@{$fds[2]} , "The three returned arrayrefs are still empty after perform"); $curlm->add_handle($curl); @fds = $curlm->fdset; ok( ! @{$fds[0]} && ! @{$fds[1]} && !@{$fds[2]} , "The three returned arrayrefs are still empty after perform and add_handle"); $curlm->perform; @fds = $curlm->fdset; ok( @{$fds[0]} == 1 || @{$fds[1]} == 1, "The read or write fdset contains one fd"); $curlm->add_handle($curl2); @fds = $curlm->fdset; 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]} + @{$fds[1]} == 2, "The read or write fdset contains two fds"); my $active = 2; while ($active != 0) { my $ret = $curlm->perform; if ($ret != $active) { while (my ($id,$value) = $curlm->info_read) { ok($id eq "foo" || $id == 42, "The stored private value matches what we set"); } $active = $ret; } action_wait($curlm); } @fds = $curlm->fdset; ok( ! @{$fds[0]} && ! @{$fds[1]} && !@{$fds[2]} , "The three returned arrayrefs are empty after we have no active transfers"); ok($header, "Header reply exists from first handle"); ok($body, "Body reply exists from second handle"); ok($header2, "Header reply exists from second handle"); ok($body2, "Body reply exists from second handle"); WWW-Curl-4.15/t/18twinhandles.t0000644000175000017500000000314711172733541015470 0ustar balintbalint#!perl use strict; use warnings; use Test::More tests => 12; BEGIN { use_ok( 'WWW::Curl::Easy' ); } my $url = $ENV{CURL_TEST_URL} || "http://www.google.com"; my $header_called = 0; sub header_callback { $header_called++; return length($_[0]) }; my $body_called = 0; sub body_callback { my ($chunk,$handle)=@_; $body_called++; return length($chunk); # OK } # Init the curl session my $curl1 = WWW::Curl::Easy->new(); ok($curl1, 'Curl1 session initialize returns something'); ok(ref($curl1) eq 'WWW::Curl::Easy', 'Curl1 session looks like an object from the WWW::Curl::Easy module'); my $curl2 = WWW::Curl::Easy->new(); ok($curl2, 'Curl2 session initialize returns something'); ok(ref($curl2) eq 'WWW::Curl::Easy', 'Curl2 session looks like an object from the WWW::Curl::Easy module'); for my $handle ($curl1,$curl2) { $handle->setopt(CURLOPT_NOPROGRESS, 1); $handle->setopt(CURLOPT_FOLLOWLOCATION, 1); $handle->setopt(CURLOPT_TIMEOUT, 30); my $body_ref=\&body_callback; $handle->setopt(CURLOPT_WRITEFUNCTION, $body_ref); $handle->setopt(CURLOPT_HEADERFUNCTION, \&header_callback); } ok(! $curl1->setopt(CURLOPT_URL, "zxxypz://whoa"), "Setting deliberately bad protocol succeeds - should return error on perform"); # deliberate error ok(! $curl2->setopt(CURLOPT_URL, $url), "Setting OK url"); my $code1=$curl1->perform(); ok($code1 != 0, "Curl1 handle fails as expected"); ok($code1 == CURLE_UNSUPPORTED_PROTOCOL, "Curl1 handle fails with the correct error"); my $code2=$curl2->perform(); ok($code2 == 0, "Curl2 handle succeeds"); ok($header_called, "Header callback works"); ok($body_called, "Body callback works"); WWW-Curl-4.15/t/02callbacks.t0000644000175000017500000000225011144657616015061 0ustar balintbalint#!perl use strict; use warnings; use Test::More tests => 7; use File::Temp qw/tempfile/; BEGIN { use_ok( '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, 'Curl session initialize returns something'); ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); $curl->setopt(CURLOPT_NOPROGRESS, 1); $curl->setopt(CURLOPT_FOLLOWLOCATION, 1); $curl->setopt(CURLOPT_TIMEOUT, 30); my $head = tempfile(); $curl->setopt(CURLOPT_WRITEHEADER, $head); my $body = tempfile(); $curl->setopt(CURLOPT_FILE,$body); $curl->setopt(CURLOPT_URL, $url); my $header_called = 0; sub header_callback { $header_called = 1; return length($_[0]) }; my $body_called = 0; sub body_callback { $body_called++;return length($_[0]) }; ok (! $curl->setopt(CURLOPT_HEADERFUNCTION, \&header_callback), "CURLOPT_HEADERFUNCTION set"); ok (! $curl->setopt(CURLOPT_WRITEFUNCTION, \&body_callback), "CURLOPT_WRITEFUNCTION set"); $curl->perform(); ok($header_called, "CURLOPT_HEADERFUNCTION callback was used"); ok($body_called, "CURLOPT_WRITEFUNCTION callback was used"); WWW-Curl-4.15/t/09times.t0000644000175000017500000000367211144657616014303 0ustar balintbalint#!perl use strict; use warnings; use Test::More tests => 19; use File::Temp qw/tempfile/; BEGIN { use_ok( '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, 'Curl session initialize returns something'); ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the WWW::Curl::Easy module'); 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"); my $head = tempfile(); ok(! $curl->setopt(CURLOPT_WRITEHEADER, $head), "Setting CURLOPT_WRITEHEADER"); my $body = tempfile(); ok(! $curl->setopt(CURLOPT_FILE, $body), "Setting CURLOPT_FILE"); ok(! $curl->setopt(CURLOPT_URL, $url), "Setting CURLOPT_URL"); my @myheaders; $myheaders[0] = "Server: www"; $myheaders[1] = "User-Agent: Perl interface for libcURL"; ok(! $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders), "Setting CURLOPT_HTTPHEADER"); my $retcode; $retcode = $curl->perform(); ok(! $retcode,"Checking perform return code"); if ($retcode == 0) { my $bytes = $curl->getinfo(CURLINFO_SIZE_DOWNLOAD); ok($bytes, "Non-zero bytesize check"); my $realurl = $curl->getinfo(CURLINFO_EFFECTIVE_URL); ok($realurl, "URL definedness check"); my $httpcode = $curl->getinfo(CURLINFO_HTTP_CODE); ok($httpcode, "HTTP status code check"); } my $start = $curl->getinfo(CURLINFO_STARTTRANSFER_TIME); ok ($start, "Valid transfer start time"); my $total = $curl->getinfo(CURLINFO_TOTAL_TIME); ok ($total, "defined total transfer time"); my $dns = $curl->getinfo(CURLINFO_NAMELOOKUP_TIME); ok ($dns, "NSLOOKUP time is defined"); my $conn = $curl->getinfo(CURLINFO_CONNECT_TIME); ok ($conn, "Connect time defined"); my $pre = $curl->getinfo(CURLINFO_PRETRANSFER_TIME); ok ($pre, "Pre-transfer time nonzero, defined"); exit; WWW-Curl-4.15/Makefile.PL0000644000175000017500000001702211474527544014327 0ustar balintbalint# Makefile.PL for Perl module WWW::Curl # Check out the README file for more information. use inc::Module::Install; name 'WWW-Curl'; abstract 'Perl extension interface for libcurl'; author 'Cris Bailiff '; license 'MPL or MIT/X-derivate'; perl_version '5.006001'; no_index directory => 'template'; repository 'http://github.com/szbalint/WWW--Curl'; # This is a hack. If you have libcurl installed, just specify curl.h below # and comment out this line. if ($^O ne 'MSWin32') { if (!$ENV{CURL_CONFIG}) { requires_external_bin 'curl-config'; } } else { print "Sorry, no automated install is available on Windows,\n". "please see the README.Win32 file on instructions for a manual install.\n"; exit(0); } my $curl_config = $ENV{CURL_CONFIG} || 'curl-config'; my $vernum = `${curl_config} --vernum`; chomp $vernum; my $version = `${curl_config} --version`; chomp $version; my $minimum_ver = hex("070a08"); if ($vernum && hex($vernum) <= $minimum_ver) { print "Your currently installed libcurl version - $version - is too old.\n". "This module doesn't seek compatibility with versions older than 7.10.8\n". "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) = ('','',''); # You may need to specify where to find curl.h on your platform # These are guesses only, in case curl-config is not telling us. if ($^O ne 'MSWin32') { push @includes, qw( /usr/include /usr/local/curl/include /usr/local/include/curl ../../include ../curl/include ); } # # Get curl to tell us where it is, if we can. # if ($^O ne 'MSWin32') { $cflags = `${curl_config} --cflags`; $lflags = `${curl_config} --libs`; } # can't find link flags, make some guesses if (!defined($lflags)) { $lflags="-lcurl"; print "Guessing your linker flags as: $lflags\n"; } my ($flag) = ($cflags =~ m/-I(\S+)/); if (defined $flag) { unshift @includes, $flag; # first guess } # try the path given on the command line, if any if (defined($ARGV[0])) { unshift @includes, $ARGV[0]; }; my $curl_d = ""; my $curl_h; # otherwise try a list of common locations foreach my $try (@includes) { if (-f $try . "/curl/curl.h") { $curl_d = $try; $curl_h = $try . "/curl/curl.h"; last; } } if (!defined($curl_h)) { die "Cannot find curl.h - cannot build constants files - see Makefile.PL"; } else { my %constants; $curl_d = "-I" . $curl_d; print "Found curl.h in $curl_h\n"; my @syms; my $has_cpp = 0; open(H_IN, "-|", "cpp", $curl_h) and $has_cpp++; unless ($has_cpp) { open(H_IN, "<", $curl_h) or die("Can't open curl.h at path $curl_h, because: ".$!); } while ( ) { if ( /enum\s+(\S+\s+)?{/ .. /}/ ) { s/^\s+//; next unless /^CURL/; chomp; s/[,\s].*//; s/=.*$//; next unless /^\w+$/; push @syms, $_; } } close H_IN; open (H, "<", $curl_h) or die ("Cannot open $curl_h: ".$!); while() { if (/^#define (CURL[A-Za-z0-9_]*)/) { push @syms, $1; } } close H; for my $e (sort @syms) { if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) { next; } my ($group) = $e =~ m/^([^_]+_)/; $constants{$group}->{$e} = $e; } unless ($has_cpp) { open(CURL_H, "<" . $curl_h) or die "Can't open curl.h\n"; while () { if ($_ =~ m/CINIT\(/ and $_ !~ m/#/) { my ($option, $type, $code) = m/.*CINIT\((\w*)\s*,\s*(\w+)\s*,\s*(\d+).*/; $constants{"CURLOPT_"}->{"CURLOPT_".$option} = "CURLOPT_".$option; } elsif ($_ =~ m/^#define CURLOPT_\w+\s+CURLOPT_\w+/) { my ($option, $value) = m/^#define CURLOPT_(\w+)\s+CURLOPT_(\w+)/; $constants{"CURLOPT_"}->{"CURLOPT_".$option} = "CURLOPT_".$value; } elsif ($_ =~ m/^\s*((CURLINFO_|CURLSHOPT_|CURLE_)\w+)/) { $constants{$2}->{$1}= $1; } elsif ($_ =~ m/^\s*((CURL_)(?:\w+))(?:[,\s]*)(?:\/\*.*)?$/) { $constants{$2}->{$1} = $1; } elsif ($_ =~ m/^\s*((CURLPROXY_)(?:\w+))\s*=\s*\d+/) { $constants{$2}->{$1} = $1; } elsif ($_ =~ m/CFINIT\(/ and $_ !~ m/#/) { my ($option) = m/.*CFINIT\((\w*)\s*.*/; $constants{"CURLFORM_"}->{"CURLFORM_".$option} = "CURLFORM_".$option; } } close(CURL_H); } print "Building curlopt-constants.c for your libcurl version\n"; open(CURL_XS, ">curlopt-constants.c") or die "Can't write curlopt-constants.c\n"; # boilerplate xs constant function here print CURL_XS <{$option};\n"; $count++; } } if ($count or $next_initial eq 'Z') { print CURL_XS " break;\n"; } } print CURL_XS " };\n"; print CURL_XS " }\n"; } print CURL_XS <lib/WWW/Curl/Easy.pm") or die "Can't create lib/WWW/Curl/Easy.pm\n"; open(EASY_PM_IN, "template/Easy.pm.tmpl") or die "Can't read template/Easy.pm.tmpl\n"; while (my $line = ) { if ($line !~ m/^\@CURLOPT_INCLUDE\@/) { print EASY_PM $line; } else { for my $group (reverse sort keys %constants) { for my $option (sort keys %{$constants{$group}}) { next unless $option; print EASY_PM $option."\n"; } } } } close(EASY_PM); close(EASY_PM_IN); print "Building Share.pm constants for your libcurl version\n"; open(SHARE_PM, ">lib/WWW/Curl/Share.pm") or die "Can't create lib/WWW/Curl/Share.pm\n"; open(SHARE_PM_IN, "template/Share.pm.tmpl") or die "Can't read template/Share.pm.tmpl\n"; while (my $line = ) { if ($line !~ m/^(.*?)\@CURLSHOPT_INCLUDE\@/) { print SHARE_PM $line; } else { foreach my $option (sort keys %{$constants{CURLSHOPT_}}) { print SHARE_PM $1 . $option . "\n"; } foreach my $option (sort keys %{$constants{CURL_LOCK_}}) { print SHARE_PM $1 . $option . "\n"; } } } close(SHARE_PM); close(SHARE_PM_IN); } # Let Module::Install generate META.yml and other necessary files. WriteMakefile( 'NAME' => 'WWW::Curl', 'VERSION_FROM' => 'lib/WWW/Curl.pm', # finds $VERSION 'LIBS' => "$ldflags $lflags", # e.g., '-lm' 'INC' => $curl_d, # e.g., '-I/usr/include/other' 'clean' => { FILES => "curlopt-constants.c head.out body.out" } ); WWW-Curl-4.15/inc/0000755000175000017500000000000011474534004013111 5ustar balintbalintWWW-Curl-4.15/inc/Module/0000755000175000017500000000000011474534004014336 5ustar balintbalintWWW-Curl-4.15/inc/Module/Install/0000755000175000017500000000000011474534004015744 5ustar balintbalintWWW-Curl-4.15/inc/Module/Install/External.pm0000644000175000017500000000277511474533755020113 0ustar balintbalint#line 1 package Module::Install::External; # Provides dependency declarations for external non-Perl things use strict; use Module::Install::Base (); use vars qw{$VERSION $ISCORE @ISA}; BEGIN { $VERSION = '0.91'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } sub requires_external_cc { my $self = shift; # We need a C compiler, use the can_cc method for this unless ( $self->can_cc ) { print "Unresolvable missing external dependency.\n"; print "This package requires a C compiler.\n"; print STDERR "NA: Unable to build distribution on this platform.\n"; exit(0); } # Unlike some of the other modules, while we need to specify a # C compiler as a dep, it needs to be a build-time dependency. 1; } sub requires_external_bin { my ($self, $bin, $version) = @_; if ( $version ) { die "requires_external_bin does not support versions yet"; } # Load the package containing can_run early, # to avoid breaking the message below. $self->load('can_run'); # Locate the bin print "Locating required external dependency bin:$bin..."; my $found_bin = $self->can_run( $bin ); if ( $found_bin ) { print " found at $found_bin.\n"; } else { print " missing.\n"; print "Unresolvable missing external dependency.\n"; print "Please install '$bin' seperately and try again.\n"; print STDERR "NA: Unable to build distribution on this platform.\n"; exit(0); } # Once we have some way to specify external deps, do it here. # In the mean time, continue as normal. 1; } 1; __END__ #line 138 WWW-Curl-4.15/inc/Module/Install/Can.pm0000644000175000017500000000333311474533755017021 0ustar balintbalint#line 1 package Module::Install::Can; use strict; use Config (); use File::Spec (); use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '0.91'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } # check if we can load some module ### Upgrade this to not have to load the module if possible sub can_use { my ($self, $mod, $ver) = @_; $mod =~ s{::|\\}{/}g; $mod .= '.pm' unless $mod =~ /\.pm$/i; my $pkg = $mod; $pkg =~ s{/}{::}g; $pkg =~ s{\.pm$}{}i; local $@; eval { require $mod; $pkg->VERSION($ver || 0); 1 }; } # check if we can run some command sub can_run { my ($self, $cmd) = @_; my $_cmd = $cmd; return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { next if $dir eq ''; my $abs = File::Spec->catfile($dir, $_[1]); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } return; } # can we locate a (the) C compiler sub can_cc { my $self = shift; my @chunks = split(/ /, $Config::Config{cc}) or return; # $Config{cc} may contain args; try to find out the program part while (@chunks) { return $self->can_run("@chunks") || (pop(@chunks), next); } return; } # Fix Cygwin bug on maybe_command(); if ( $^O eq 'cygwin' ) { require ExtUtils::MM_Cygwin; require ExtUtils::MM_Win32; if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) { *ExtUtils::MM_Cygwin::maybe_command = sub { my ($self, $file) = @_; if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) { ExtUtils::MM_Win32->maybe_command($file); } else { ExtUtils::MM_Unix->maybe_command($file); } } } } 1; __END__ #line 156 WWW-Curl-4.15/inc/Module/Install/Base.pm0000644000175000017500000000176611474533755017202 0ustar balintbalint#line 1 package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { $VERSION = '0.91'; } # Suspend handler for "redefined" warnings BEGIN { my $w = $SIG{__WARN__}; $SIG{__WARN__} = sub { $w }; } #line 42 sub new { my $class = shift; unless ( defined &{"${class}::call"} ) { *{"${class}::call"} = sub { shift->_top->call(@_) }; } unless ( defined &{"${class}::load"} ) { *{"${class}::load"} = sub { shift->_top->load(@_) }; } bless { @_ }, $class; } #line 61 sub AUTOLOAD { local $@; my $func = eval { shift->_top->autoload } or return; goto &$func; } #line 75 sub _top { $_[0]->{_top}; } #line 90 sub admin { $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new; } #line 106 sub is_admin { $_[0]->admin->VERSION; } sub DESTROY {} package Module::Install::Base::FakeAdmin; my $fake; sub new { $fake ||= bless(\@_, $_[0]); } sub AUTOLOAD {} sub DESTROY {} # Restore warning handler BEGIN { $SIG{__WARN__} = $SIG{__WARN__}->(); } 1; #line 154 WWW-Curl-4.15/inc/Module/Install/Metadata.pm0000644000175000017500000003530411474533755020043 0ustar balintbalint#line 1 package Module::Install::Metadata; use strict 'vars'; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '0.91'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } my @boolean_keys = qw{ sign }; my @scalar_keys = qw{ name module_name abstract author version distribution_type tests installdirs }; my @tuple_keys = qw{ configure_requires build_requires requires recommends bundles resources }; my @resource_keys = qw{ homepage bugtracker repository }; my @array_keys = qw{ keywords }; sub Meta { shift } sub Meta_BooleanKeys { @boolean_keys } sub Meta_ScalarKeys { @scalar_keys } sub Meta_TupleKeys { @tuple_keys } sub Meta_ResourceKeys { @resource_keys } sub Meta_ArrayKeys { @array_keys } foreach my $key ( @boolean_keys ) { *$key = sub { my $self = shift; if ( defined wantarray and not @_ ) { return $self->{values}->{$key}; } $self->{values}->{$key} = ( @_ ? $_[0] : 1 ); return $self; }; } foreach my $key ( @scalar_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} = shift; return $self; }; } foreach my $key ( @array_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} ||= []; push @{$self->{values}->{$key}}, @_; return $self; }; } foreach my $key ( @resource_keys ) { *$key = sub { my $self = shift; unless ( @_ ) { return () unless $self->{values}->{resources}; return map { $_->[1] } grep { $_->[0] eq $key } @{ $self->{values}->{resources} }; } return $self->{values}->{resources}->{$key} unless @_; my $uri = shift or die( "Did not provide a value to $key()" ); $self->resources( $key => $uri ); return 1; }; } foreach my $key ( grep { $_ ne "resources" } @tuple_keys) { *$key = sub { my $self = shift; return $self->{values}->{$key} unless @_; my @added; while ( @_ ) { my $module = shift or last; my $version = shift || 0; push @added, [ $module, $version ]; } push @{ $self->{values}->{$key} }, @added; return map {@$_} @added; }; } # Resource handling my %lc_resource = map { $_ => 1 } qw{ homepage license bugtracker repository }; sub resources { my $self = shift; while ( @_ ) { my $name = shift or last; my $value = shift or next; if ( $name eq lc $name and ! $lc_resource{$name} ) { die("Unsupported reserved lowercase resource '$name'"); } $self->{values}->{resources} ||= []; push @{ $self->{values}->{resources} }, [ $name, $value ]; } $self->{values}->{resources}; } # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. sub test_requires { shift->build_requires(@_) } sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } sub install_as_cpan { $_[0]->installdirs('site') } sub install_as_site { $_[0]->installdirs('site') } sub install_as_vendor { $_[0]->installdirs('vendor') } sub dynamic_config { my $self = shift; unless ( @_ ) { warn "You MUST provide an explicit true/false value to dynamic_config\n"; return $self; } $self->{values}->{dynamic_config} = $_[0] ? 1 : 0; return 1; } sub perl_version { my $self = shift; return $self->{values}->{perl_version} unless @_; my $version = shift or die( "Did not provide a value to perl_version()" ); # Normalize the version $version = $self->_perl_version($version); # We don't support the reall old versions unless ( $version >= 5.005 ) { die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n"; } $self->{values}->{perl_version} = $version; } #Stolen from M::B my %license_urls = ( perl => 'http://dev.perl.org/licenses/', apache => 'http://apache.org/licenses/LICENSE-2.0', artistic => 'http://opensource.org/licenses/artistic-license.php', artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php', lgpl => 'http://opensource.org/licenses/lgpl-license.php', lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php', lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html', bsd => 'http://opensource.org/licenses/bsd-license.php', gpl => 'http://opensource.org/licenses/gpl-license.php', gpl2 => 'http://opensource.org/licenses/gpl-2.0.php', gpl3 => 'http://opensource.org/licenses/gpl-3.0.html', mit => 'http://opensource.org/licenses/mit-license.php', mozilla => 'http://opensource.org/licenses/mozilla1.1.php', open_source => undef, unrestricted => undef, restrictive => undef, unknown => undef, ); sub license { my $self = shift; return $self->{values}->{license} unless @_; my $license = shift or die( 'Did not provide a value to license()' ); $self->{values}->{license} = $license; # Automatically fill in license URLs if ( $license_urls{$license} ) { $self->resources( license => $license_urls{$license} ); } return 1; } sub all_from { my ( $self, $file ) = @_; unless ( defined($file) ) { my $name = $self->name or die( "all_from called with no args without setting name() first" ); $file = join('/', 'lib', split(/-/, $name)) . '.pm'; $file =~ s{.*/}{} unless -e $file; unless ( -e $file ) { die("all_from cannot find $file from $name"); } } unless ( -f $file ) { die("The path '$file' does not exist, or is not a file"); } # Some methods pull from POD instead of code. # If there is a matching .pod, use that instead my $pod = $file; $pod =~ s/\.pm$/.pod/i; $pod = $file unless -e $pod; # Pull the different values $self->name_from($file) unless $self->name; $self->version_from($file) unless $self->version; $self->perl_version_from($file) unless $self->perl_version; $self->author_from($pod) unless $self->author; $self->license_from($pod) unless $self->license; $self->abstract_from($pod) unless $self->abstract; return 1; } sub provides { my $self = shift; my $provides = ( $self->{values}->{provides} ||= {} ); %$provides = (%$provides, @_) if @_; return $provides; } sub auto_provides { my $self = shift; return $self unless $self->is_admin; unless (-e 'MANIFEST') { warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; return $self; } # Avoid spurious warnings as we are not checking manifest here. local $SIG{__WARN__} = sub {1}; require ExtUtils::Manifest; local *ExtUtils::Manifest::manicheck = sub { return }; require Module::Build; my $build = Module::Build->new( dist_name => $self->name, dist_version => $self->version, license => $self->license, ); $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { my $self = shift; my $name = shift; my $features = ( $self->{values}->{features} ||= [] ); my $mods; if ( @_ == 1 and ref( $_[0] ) ) { # The user used ->feature like ->features by passing in the second # argument as a reference. Accomodate for that. $mods = $_[0]; } else { $mods = \@_; } my $count = 0; push @$features, ( $name => [ map { ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ } @$mods ] ); return @$features; } sub features { my $self = shift; while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { $self->feature( $name, @$mods ); } return $self->{values}->{features} ? @{ $self->{values}->{features} } : (); } sub no_index { my $self = shift; my $type = shift; push @{ $self->{values}->{no_index}->{$type} }, @_ if $type; return $self->{values}->{no_index}; } sub read { my $self = shift; $self->include_deps( 'YAML::Tiny', 0 ); require YAML::Tiny; my $data = YAML::Tiny::LoadFile('META.yml'); # Call methods explicitly in case user has already set some values. while ( my ( $key, $value ) = each %$data ) { next unless $self->can($key); if ( ref $value eq 'HASH' ) { while ( my ( $module, $version ) = each %$value ) { $self->can($key)->($self, $module => $version ); } } else { $self->can($key)->($self, $value); } } return $self; } sub write { my $self = shift; return $self unless $self->is_admin; $self->admin->write_meta; return $self; } sub version_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->version( ExtUtils::MM_Unix->parse_version($file) ); } sub abstract_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->abstract( bless( { DISTNAME => $self->name }, 'ExtUtils::MM_Unix' )->parse_abstract($file) ); } # Add both distribution and module name sub name_from { my ($self, $file) = @_; if ( Module::Install::_read($file) =~ m/ ^ \s* package \s* ([\w:]+) \s* ; /ixms ) { my ($name, $module_name) = ($1, $1); $name =~ s{::}{-}g; $self->name($name); unless ( $self->module_name ) { $self->module_name($module_name); } } else { die("Cannot determine name from $file\n"); } } sub perl_version_from { my $self = shift; if ( Module::Install::_read($_[0]) =~ m/ ^ (?:use|require) \s* v? ([\d_\.]+) \s* ; /ixms ) { my $perl_version = $1; $perl_version =~ s{_}{}g; $self->perl_version($perl_version); } else { warn "Cannot determine perl version info from $_[0]\n"; return; } } sub author_from { my $self = shift; my $content = Module::Install::_read($_[0]); if ($content =~ m/ =head \d \s+ (?:authors?)\b \s* ([^\n]*) | =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* ([^\n]*) /ixms) { my $author = $1 || $2; $author =~ s{E}{<}g; $author =~ s{E}{>}g; $self->author($author); } else { warn "Cannot determine author info from $_[0]\n"; } } sub license_from { my $self = shift; if ( Module::Install::_read($_[0]) =~ m/ ( =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b .*? ) (=head\\d.*|=cut.*|) \z /ixms ) { my $license_text = $1; my @phrases = ( 'under the same (?:terms|license) as (?:perl|the perl programming language) itself' => 'perl', 1, 'GNU general public license' => 'gpl', 1, 'GNU public license' => 'gpl', 1, 'GNU lesser general public license' => 'lgpl', 1, 'GNU lesser public license' => 'lgpl', 1, 'GNU library general public license' => 'lgpl', 1, 'GNU library public license' => 'lgpl', 1, 'BSD license' => 'bsd', 1, 'Artistic license' => 'artistic', 1, 'GPL' => 'gpl', 1, 'LGPL' => 'lgpl', 1, 'BSD' => 'bsd', 1, 'Artistic' => 'artistic', 1, 'MIT' => 'mit', 1, 'proprietary' => 'proprietary', 0, ); while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { $pattern =~ s{\s+}{\\s+}g; if ( $license_text =~ /\b$pattern\b/i ) { $self->license($license); return 1; } } } warn "Cannot determine license info from $_[0]\n"; return 'unknown'; } sub _extract_bugtracker { my @links = $_[0] =~ m#L<(\Qhttp://rt.cpan.org/\E[^>]+)>#g; my %links; @links{@links}=(); @links=keys %links; return @links; } sub bugtracker_from { my $self = shift; my $content = Module::Install::_read($_[0]); my @links = _extract_bugtracker($content); unless ( @links ) { warn "Cannot determine bugtracker info from $_[0]\n"; return 0; } if ( @links > 1 ) { warn "Found more than on rt.cpan.org link in $_[0]\n"; return 0; } # Set the bugtracker bugtracker( $links[0] ); return 1; } sub requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->requires( $module => $version ); } } sub test_requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->test_requires( $module => $version ); } } # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to # numbers (eg, 5.006001 or 5.008009). # Also, convert double-part versions (eg, 5.8) sub _perl_version { my $v = $_[-1]; $v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e; $v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e; $v =~ s/(\.\d\d\d)000$/$1/; $v =~ s/_.+$//; if ( ref($v) ) { # Numify $v = $v + 0; } return $v; } ###################################################################### # MYMETA Support sub WriteMyMeta { die "WriteMyMeta has been deprecated"; } sub write_mymeta_yaml { my $self = shift; # We need YAML::Tiny to write the MYMETA.yml file unless ( eval { require YAML::Tiny; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.yml\n"; YAML::Tiny::DumpFile('MYMETA.yml', $meta); } sub write_mymeta_json { my $self = shift; # We need JSON to write the MYMETA.json file unless ( eval { require JSON; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.json\n"; Module::Install::_write( 'MYMETA.json', JSON->new->pretty(1)->canonical->encode($meta), ); } sub _write_mymeta_data { my $self = shift; # If there's no existing META.yml there is nothing we can do return undef unless -f 'META.yml'; # We need Parse::CPAN::Meta to load the file unless ( eval { require Parse::CPAN::Meta; 1; } ) { return undef; } # Merge the perl version into the dependencies my $val = $self->Meta->{values}; my $perl = delete $val->{perl_version}; if ( $perl ) { $val->{requires} ||= []; my $requires = $val->{requires}; # Canonize to three-dot version after Perl 5.6 if ( $perl >= 5.006 ) { $perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e } unshift @$requires, [ perl => $perl ]; } # Load the advisory META.yml file my @yaml = Parse::CPAN::Meta::LoadFile('META.yml'); my $meta = $yaml[0]; # Overwrite the non-configure dependency hashs delete $meta->{requires}; delete $meta->{build_requires}; delete $meta->{recommends}; if ( exists $val->{requires} ) { $meta->{requires} = { map { @$_ } @{ $val->{requires} } }; } if ( exists $val->{build_requires} ) { $meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } }; } return $meta; } 1; WWW-Curl-4.15/inc/Module/Install/Makefile.pm0000644000175000017500000001600311474533755020033 0ustar balintbalint#line 1 package Module::Install::Makefile; use strict 'vars'; use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '0.91'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub Makefile { $_[0] } my %seen = (); sub prompt { shift; # Infinite loop protection my @c = caller(); if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) { die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])"; } # In automated testing, always use defaults if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) { local $ENV{PERL_MM_USE_DEFAULT} = 1; goto &ExtUtils::MakeMaker::prompt; } else { goto &ExtUtils::MakeMaker::prompt; } } sub makemaker_args { my $self = shift; my $args = ( $self->{makemaker_args} ||= {} ); %$args = ( %$args, @_ ); return $args; } # For mm args that take multiple space-seperated args, # append an argument to the current list. sub makemaker_append { my $self = sShift; my $name = shift; my $args = $self->makemaker_args; $args->{name} = defined $args->{$name} ? join( ' ', $args->{name}, @_ ) : join( ' ', @_ ); } sub build_subdirs { my $self = shift; my $subdirs = $self->makemaker_args->{DIR} ||= []; for my $subdir (@_) { push @$subdirs, $subdir; } } sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; %$clean = ( %$clean, FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; %$realclean = ( %$realclean, FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } sub libs { my $self = shift; my $libs = ref $_[0] ? shift : [ shift ]; $self->makemaker_args( LIBS => $libs ); } sub inc { my $self = shift; $self->makemaker_args( INC => shift ); } my %test_dir = (); sub _wanted_t { /\.t$/ and -f $_ and $test_dir{$File::Find::dir} = 1; } sub tests_recursive { my $self = shift; if ( $self->tests ) { die "tests_recursive will not work if tests are already defined"; } my $dir = shift || 't'; unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } %test_dir = (); require File::Find; File::Find::find( \&_wanted_t, $dir ); $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); } sub write { my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; # Check the current Perl version my $perl_version = $self->perl_version; if ( $perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; } # Make sure we have a new enough MakeMaker require ExtUtils::MakeMaker; if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) { # MakeMaker can complain about module versions that include # an underscore, even though its own version may contain one! # Hence the funny regexp to get rid of it. See RT #35800 # for details. $self->build_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ ); $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ ); } else { # Allow legacy-compatibility with 5.005 by depending on the # most recent EU:MM that supported 5.005. $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 ); } # Generate the MakeMaker params my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; $args->{NAME} = $self->module_name || $self->name; $args->{VERSION} = $self->version; $args->{NAME} =~ s/-/::/g; if ( $self->tests ) { $args->{test} = { TESTS => $self->tests }; } if ( $] >= 5.005 ) { $args->{ABSTRACT} = $self->abstract; $args->{AUTHOR} = $self->author; } if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) { $args->{NO_META} = 1; } if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) { $args->{SIGN} = 1; } unless ( $self->is_admin ) { delete $args->{SIGN}; } # Merge both kinds of requires into prereq_pm my $prereq = ($args->{PREREQ_PM} ||= {}); %$prereq = ( %$prereq, map { @$_ } map { @$_ } grep $_, ($self->configure_requires, $self->build_requires, $self->requires) ); # Remove any reference to perl, PREREQ_PM doesn't support it delete $args->{PREREQ_PM}->{perl}; # merge both kinds of requires into prereq_pm my $subdirs = ($args->{DIR} ||= []); if ($self->bundles) { foreach my $bundle (@{ $self->bundles }) { my ($file, $dir) = @$bundle; push @$subdirs, $dir if -d $dir; delete $prereq->{$file}; } } if ( my $perl_version = $self->perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; } $args->{INSTALLDIRS} = $self->installdirs; my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args; my $user_preop = delete $args{dist}->{PREOP}; if (my $preop = $self->admin->preop($user_preop)) { foreach my $key ( keys %$preop ) { $args{dist}->{$key} = $preop->{$key}; } } my $mm = ExtUtils::MakeMaker::WriteMakefile(%args); $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile'); } sub fix_up_makefile { my $self = shift; my $makefile_name = shift; my $top_class = ref($self->_top) || ''; my $top_version = $self->_top->VERSION || ''; my $preamble = $self->preamble ? "# Preamble by $top_class $top_version\n" . $self->preamble : ''; my $postamble = "# Postamble by $top_class $top_version\n" . ($self->postamble || ''); local *MAKEFILE; open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; my $makefile = do { local $/; }; close MAKEFILE or die $!; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; # Module::Install will never be used to build the Core Perl # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m; #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; print MAKEFILE "$preamble$makefile$postamble" or die $!; close MAKEFILE or die $!; 1; } sub preamble { my ($self, $text) = @_; $self->{preamble} = $text . $self->{preamble} if defined $text; $self->{preamble}; } sub postamble { my ($self, $text) = @_; $self->{postamble} ||= $self->admin->postamble; $self->{postamble} .= $text if defined $text; $self->{postamble} } 1; __END__ #line 394 WWW-Curl-4.15/inc/Module/Install/MakeMaker.pm0000644000175000017500000000211111474533755020146 0ustar balintbalint#line 1 package Module::Install::MakeMaker; use strict; use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '0.91'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } my $makefile; sub WriteMakefile { my ($self, %args) = @_; $makefile = $self->load('Makefile'); # mapping between MakeMaker and META.yml keys $args{MODULE_NAME} = $args{NAME}; unless ( $args{NAME} = $args{DISTNAME} or ! $args{MODULE_NAME} ) { $args{NAME} = $args{MODULE_NAME}; $args{NAME} =~ s/::/-/g; } foreach my $key ( qw{name module_name version version_from abstract author installdirs} ) { my $value = delete($args{uc($key)}) or next; $self->$key($value); } if (my $prereq = delete($args{PREREQ_PM})) { while (my($k,$v) = each %$prereq) { $self->requires($k,$v); } } # put the remaining args to makemaker_args $self->makemaker_args(%args); } END { if ( $makefile ) { $makefile->write; $makefile->Meta->write; } } 1; WWW-Curl-4.15/inc/Module/Install.pm0000644000175000017500000002411411474533754016317 0ustar balintbalint#line 1 package Module::Install; # For any maintainers: # The load order for Module::Install is a bit magic. # It goes something like this... # # IF ( host has Module::Install installed, creating author mode ) { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install # 3. The installed version of inc::Module::Install loads # 4. inc::Module::Install calls "require Module::Install" # 5. The ./inc/ version of Module::Install loads # } ELSE { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install # 3. The ./inc/ version of Module::Install loads # } use 5.005; use strict 'vars'; use vars qw{$VERSION $MAIN}; BEGIN { # All Module::Install core packages now require synchronised versions. # This will be used to ensure we don't accidentally load old or # different versions of modules. # This is not enforced yet, but will be some time in the next few # releases once we can make sure it won't clash with custom # Module::Install extensions. $VERSION = '0.91'; # Storage for the pseudo-singleton $MAIN = undef; *inc::Module::Install::VERSION = *VERSION; @inc::Module::Install::ISA = __PACKAGE__; } # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. # If not set, the caller may NOT have loaded the bundled version, and thus # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; unless ( $INC{$file} ) { die <<"END_DIE" } Please invoke ${\__PACKAGE__} with: use inc::${\__PACKAGE__}; not: use ${\__PACKAGE__}; END_DIE # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. if ( -f $0 ) { my $s = (stat($0))[9]; # If the modification time is only slightly in the future, # sleep briefly to remove the problem. my $a = $s - time; if ( $a > 0 and $a < 5 ) { sleep 5 } # Too far in the future, throw an error. my $t = time; if ( $s > $t ) { die <<"END_DIE" } Your installer $0 has a modification time in the future ($s > $t). This is known to create infinite loops in make. Please correct this, then run $0 again. END_DIE } # Build.PL was formerly supported, but no longer is due to excessive # difficulty in implementing every single feature twice. if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } Module::Install no longer supports Build.PL. It was impossible to maintain duel backends, and has been deprecated. Please remove all Build.PL files and only use the Makefile.PL installer. END_DIE # To save some more typing in Module::Install installers, every... # use inc::Module::Install # ...also acts as an implicit use strict. $^H |= strict::bits(qw(refs subs vars)); use Cwd (); use File::Find (); use File::Path (); use FindBin; sub autoload { my $self = shift; my $who = $self->_caller; my $cwd = Cwd::cwd(); my $sym = "${who}::AUTOLOAD"; $sym->{$cwd} = sub { my $pwd = Cwd::cwd(); if ( my $code = $sym->{$pwd} ) { # Delegate back to parent dirs goto &$code unless $cwd eq $pwd; } $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; my $method = $1; if ( uc($method) eq $method ) { # Do nothing return; } elsif ( $method =~ /^_/ and $self->can($method) ) { # Dispatch to the root M:I class return $self->$method(@_); } # Dispatch to the appropriate plugin unshift @_, ( $self, $1 ); goto &{$self->can('call')}; }; } sub import { my $class = shift; my $self = $class->new(@_); my $who = $self->_caller; unless ( -f $self->{file} ) { require "$self->{path}/$self->{dispatch}.pm"; File::Path::mkpath("$self->{prefix}/$self->{author}"); $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); $self->{admin}->init; @_ = ($class, _self => $self); goto &{"$self->{name}::import"}; } *{"${who}::AUTOLOAD"} = $self->autoload; $self->preload; # Unregister loader and worker packages so subdirs can use them again delete $INC{"$self->{file}"}; delete $INC{"$self->{path}.pm"}; # Save to the singleton $MAIN = $self; return 1; } sub preload { my $self = shift; unless ( $self->{extensions} ) { $self->load_extensions( "$self->{prefix}/$self->{path}", $self ); } my @exts = @{$self->{extensions}}; unless ( @exts ) { @exts = $self->{admin}->load_all_extensions; } my %seen; foreach my $obj ( @exts ) { while (my ($method, $glob) = each %{ref($obj) . '::'}) { next unless $obj->can($method); next if $method =~ /^_/; next if $method eq uc($method); $seen{$method}++; } } my $who = $self->_caller; foreach my $name ( sort keys %seen ) { *{"${who}::$name"} = sub { ${"${who}::AUTOLOAD"} = "${who}::$name"; goto &{"${who}::AUTOLOAD"}; }; } } sub new { my ($class, %args) = @_; # ignore the prefix on extension modules built from top level. my $base_path = Cwd::abs_path($FindBin::Bin); unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { delete $args{prefix}; } return $args{_self} if $args{_self}; $args{dispatch} ||= 'Admin'; $args{prefix} ||= 'inc'; $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); $args{bundle} ||= 'inc/BUNDLES'; $args{base} ||= $base_path; $class =~ s/^\Q$args{prefix}\E:://; $args{name} ||= $class; $args{version} ||= $class->VERSION; unless ( $args{path} ) { $args{path} = $args{name}; $args{path} =~ s!::!/!g; } $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; $args{wrote} = 0; bless( \%args, $class ); } sub call { my ($self, $method) = @_; my $obj = $self->load($method) or return; splice(@_, 0, 2, $obj); goto &{$obj->can($method)}; } sub load { my ($self, $method) = @_; $self->load_extensions( "$self->{prefix}/$self->{path}", $self ) unless $self->{extensions}; foreach my $obj (@{$self->{extensions}}) { return $obj if $obj->can($method); } my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE my $obj = $admin->load($method, 1); push @{$self->{extensions}}, $obj; $obj; } sub load_extensions { my ($self, $path, $top) = @_; unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { unshift @INC, $self->{prefix}; } foreach my $rv ( $self->find_extensions($path) ) { my ($file, $pkg) = @{$rv}; next if $self->{pathnames}{$pkg}; local $@; my $new = eval { require $file; $pkg->can('new') }; unless ( $new ) { warn $@ if $@; next; } $self->{pathnames}{$pkg} = delete $INC{$file}; push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); } $self->{extensions} ||= []; } sub find_extensions { my ($self, $path) = @_; my @found; File::Find::find( sub { my $file = $File::Find::name; return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; my $subpath = $1; return if lc($subpath) eq lc($self->{dispatch}); $file = "$self->{path}/$subpath.pm"; my $pkg = "$self->{name}::$subpath"; $pkg =~ s!/!::!g; # If we have a mixed-case package name, assume case has been preserved # correctly. Otherwise, root through the file to locate the case-preserved # version of the package name. if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { my $content = Module::Install::_read($subpath . '.pm'); my $in_pod = 0; foreach ( split //, $content ) { $in_pod = 1 if /^=\w/; $in_pod = 0 if /^=cut/; next if ($in_pod || /^=cut/); # skip pod text next if /^\s*#/; # and comments if ( m/^\s*package\s+($pkg)\s*;/i ) { $pkg = $1; last; } } } push @found, [ $file, $pkg ]; }, $path ) if -d $path; @found; } ##################################################################### # Common Utility Functions sub _caller { my $depth = 0; my $call = caller($depth); while ( $call eq __PACKAGE__ ) { $depth++; $call = caller($depth); } return $call; } sub _read { local *FH; if ( $] >= 5.006 ) { open( FH, '<', $_[0] ) or die "open($_[0]): $!"; } else { open( FH, "< $_[0]" ) or die "open($_[0]): $!"; } my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } sub _readperl { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s; $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg; return $string; } sub _readpod { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; return $string if $_[0] =~ /\.pod\z/; $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg; $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg; $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg; $string =~ s/^\n+//s; return $string; } sub _write { local *FH; if ( $] >= 5.006 ) { open( FH, '>', $_[0] ) or die "open($_[0]): $!"; } else { open( FH, "> $_[0]" ) or die "open($_[0]): $!"; } foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } # _version is for processing module versions (eg, 1.03_05) not # Perl versions (eg, 5.8.1). sub _version ($) { my $s = shift || 0; my $d =()= $s =~ /(\.)/g; if ( $d >= 2 ) { # Normalise multipart versions $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg; } $s =~ s/^(\d+)\.?//; my $l = $1 || 0; my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; $l = $l . '.' . join '', @v if @v; return $l + 0; } sub _cmp ($$) { _version($_[0]) <=> _version($_[1]); } # Cloned from Params::Util::_CLASS sub _CLASS ($) { ( defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s ) ? $_[0] : undef; } 1; # Copyright 2008 - 2009 Adam Kennedy. WWW-Curl-4.15/template/0000755000175000017500000000000011474534004014153 5ustar balintbalintWWW-Curl-4.15/template/Easy.pm.tmpl0000644000175000017500000000255111474526261016376 0ustar balintbalintpackage WWW::Curl::Easy; use strict; use warnings; use Carp; our $VERSION = '4.15'; use WWW::Curl (); use Exporter (); our @ISA = qw(Exporter); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. our @EXPORT = qw( @CURLOPT_INCLUDE@ ); $WWW::Curl::Easy::headers = ""; $WWW::Curl::Easy::content = ""; sub const_string { my ($self, $constant) = @_; return constant($constant); } sub AUTOLOAD { our $AUTOLOAD; # This AUTOLOAD is used to 'autoload' constants from the constant() # XS function. ( my $constname = $AUTOLOAD ) =~ s/.*:://; my $value = constant( $constname ); if($!) { croak("Undefined subroutine &$AUTOLOAD called"); } { no strict 'refs'; *{$AUTOLOAD} = sub { $value }; } return $value; } sub pushopt { my ($self, $option, $value) = @_; $self->setopt($option, $value, 1); } 1; __END__ Copyright (C) 2000-2005,2008 Daniel Stenberg, Cris Bailiff, Sebastian Riedel, et al. You may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the 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. WWW-Curl-4.15/template/Share.pm.tmpl0000644000175000017500000000167011472440463016535 0ustar balintbalintpackage WWW::Curl::Share; use strict; use warnings; use Carp; use WWW::Curl (); use Exporter (); our @ISA = qw(Exporter); our @EXPORT = qw( @CURLSHOPT_INCLUDE@ ); sub AUTOLOAD { our $AUTOLOAD; # This AUTOLOAD is used to 'autoload' constants from the constant() # XS function. ( my $constname = $AUTOLOAD ) =~ s/.*:://; my $value = constant( $constname ); if ($!) { croak("Undefined subroutine &$AUTOLOAD failed for reasons of $!, constname was $constname, value was: $value"); } { no strict 'refs'; *{$AUTOLOAD} = sub { $value }; } return $value; } 1; __END__ Copyright (C) 2008, Anton Fedorov (datacompboy mail.ru) You may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the 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. WWW-Curl-4.15/LICENSE0000644000175000017500000000037711144657616013365 0ustar balintbalintYou may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the 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. WWW-Curl-4.15/typemap0000644000175000017500000000015611144657616013755 0ustar balintbalintTYPEMAP WWW::Curl::Easy T_PTROBJ WWW::Curl::Form T_PTROBJ WWW::Curl::Multi T_PTROBJ WWW::Curl::Share T_PTROBJ