Skip to content

Commit

Permalink
Commit Curl_easy v1.1.8 - constants updated for libcurl 7.9 - tests m…
Browse files Browse the repository at this point in the history
…odularised
  • Loading branch information
Cris Bailiff committed Sep 20, 2001
1 parent ecfacfb commit 611fbfa
Show file tree
Hide file tree
Showing 19 changed files with 1,110 additions and 468 deletions.
8 changes: 8 additions & 0 deletions perl/Curl_easy/Changes
@@ -1,6 +1,14 @@
Revision history for Perl extension Curl::easy.
Check out the file README for more info.

1.1.8 Thu Sep 20 2001: - Cris Bailiff <c.bailiff@devsecure.com>
- 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 <c.bailiff@devsecure.com>
- Documentation Update only - Explicitly state that Curl_easy
is released under the MIT-X/MPL dual licence. No code changes.
Expand Down
11 changes: 10 additions & 1 deletion perl/Curl_easy/MANIFEST
Expand Up @@ -4,4 +4,13 @@ Makefile.PL
README
easy.pm
easy.xs
test.pl
curlopt-constants.c
t/00constants.t
t/01basic.t
t/02header-callback.t
t/03body-callback.t
t/04abort-test.t
t/05progress.t
t/06http-post.t
t/07ftp-upload.t
t/08ssl.t
73 changes: 73 additions & 0 deletions perl/Curl_easy/Makefile.PL
Expand Up @@ -12,3 +12,76 @@ WriteMakefile(
'INC' => '', # e.g., '-I/usr/include/other'
'clean' => {FILES => "head.out body.out"}
);

#
# This utility helper generates the constants function from curl.h
#
# It is normally only used by the maintainer, but if you're curl is older
# or missing some constants, you can delete curlopt-constants.c and re-run 'perl Makefile.PL'
#

if (!open(CONSTANTS,"<curlopt-constants.c")) {
print "Rebuilding curlopt-constants.c for your libcurl version\n";
close(CONSTANTS);

#
# You may need to specify where to find curl.h on your platform
# These are guesses only
#
my $curl_h;
HEADER: foreach my $try (qw(
curl.h
../../include/curl.h
/usr/include/curl/curl.h
/usr/local/include/curl/curl.h
C:\\INCLUDE\\CURL\\CURL.H
))
{
if (-e $try) {
$curl_h=$try;
last HEADER;
}
}

if (!defined($curl_h)) {
die "Could not rebuild curlopt-constants.c - can't find curl.h\n";
}

print "Found curl.h in $curl_h\n";
open (CURL_H,"<".$curl_h) or die "Can't open curl.h\n";
my %types;
my %codes;
while(<CURL_H>) {
if ($_ =~ m/CINIT\(/ and $_ !~ m/#/) {
my ($option,$type,$code)=m/.*CINIT\((\w*)\s*,\s*(\w+)\s*,\s*(\d+).*/;
$types{$option}=$type;
$codes{$option}=$code;
}
}
close(CURL_H);

# some things are ifdefed out...
foreach my $ifdef0 (qw(FLAGS PROGRESSMODE))
{
delete $types{$ifdef0}; delete $codes{$ifdef0};
}

open(CURL_XS,">curlopt-constants.c") or die "Can't write curlopt-constants.c\n";
foreach my $next_initial ('A'..'Z') {
print CURL_XS " case '$next_initial':\n";
my $count=0;
foreach my $option (sort keys %types) {
my $initial=substr($option,0,1);
if ($next_initial eq $initial) {
print CURL_XS " if (strEQ(name, \"$option\")) return CURLOPT_$option;\n";
$count++;
}
}
if ($count) {
print CURL_XS " break;\n";
}
}
close(CURL_XS);
}
4 changes: 3 additions & 1 deletion perl/Curl_easy/Makefile.am
@@ -1 +1,3 @@
EXTRA_DIST = Changes easy.pm easy.xs Makefile.PL MANIFEST README test.pl
SUBDIRS = t

EXTRA_DIST = Changes easy.pm easy.xs curlopt-constants.c Makefile.PL MANIFEST README
18 changes: 13 additions & 5 deletions perl/Curl_easy/README
Expand Up @@ -11,19 +11,27 @@ installed. You then may install this module via the usual way:
make test
make install

If you have an older version of libcurl, you can remove 'curlopt-constants.c'
and have it rebuilt by 'perl Makefile.PL'.

You can also do this for a later version of libcurl, except currently
you will have to update the module EXPORTS list manually.

The module provides the same functionality as libcurl provides to C programs,
please refer to the documentation of libcurl. Some examples may be found in
test.pl.
t/*.t.

This software is distributed AS IS, WITHOUT WARRANTY OF ANY KIND, either
express or implied. Send praise, patches, money, beer and pizza to the author.
Send complaints to /dev/null. ;-)

The author of this software is Georg Horn <horn@koblenz-net.de>
Parts of the callback support have been added by Cris Bailiff
<c.bailiff@awayweb.com> and Forrest Cahoon <forrest.cahoon@merrillcorp.com>
The original author of this software is Georg Horn <horn@koblenz-net.de>
Parts of the callback support, tests and documentation have been added by
Cris Bailiff <c.bailiff@devsecure.com> and Forrest Cahoon <forrest.cahoon@merrillcorp.com>

The current maintainer is Cris Bailiff <c.bailiff@devsecure.com>

The latest version can be downloaded from http://koblenz-net.de/~horn/export/
The latest version can be downloaded from http://curl.haxx.se/libcurl/perl/

Copyright (C) 2000, Daniel Stenberg, , et al.
You may opt to use, copy, modify, merge, publish, distribute and/or sell
Expand Down
125 changes: 125 additions & 0 deletions perl/Curl_easy/curlopt-constants.c
@@ -0,0 +1,125 @@
case 'A':
if (strEQ(name, "AUTOREFERER")) return CURLOPT_AUTOREFERER;
break;
case 'B':
case 'C':
if (strEQ(name, "CAINFO")) return CURLOPT_CAINFO;
if (strEQ(name, "CLOSEFUNCTION")) return CURLOPT_CLOSEFUNCTION;
if (strEQ(name, "CLOSEPOLICY")) return CURLOPT_CLOSEPOLICY;
if (strEQ(name, "CONNECTTIMEOUT")) return CURLOPT_CONNECTTIMEOUT;
if (strEQ(name, "COOKIE")) return CURLOPT_COOKIE;
if (strEQ(name, "COOKIEFILE")) return CURLOPT_COOKIEFILE;
if (strEQ(name, "COOKIEJAR")) return CURLOPT_COOKIEJAR;
if (strEQ(name, "CRLF")) return CURLOPT_CRLF;
if (strEQ(name, "CUSTOMREQUEST")) return CURLOPT_CUSTOMREQUEST;
break;
case 'D':
case 'E':
if (strEQ(name, "EGDSOCKET")) return CURLOPT_EGDSOCKET;
if (strEQ(name, "ERRORBUFFER")) return CURLOPT_ERRORBUFFER;
break;
case 'F':
if (strEQ(name, "FAILONERROR")) return CURLOPT_FAILONERROR;
if (strEQ(name, "FILE")) return CURLOPT_FILE;
if (strEQ(name, "FILETIME")) return CURLOPT_FILETIME;
if (strEQ(name, "FOLLOWLOCATION")) return CURLOPT_FOLLOWLOCATION;
if (strEQ(name, "FORBID_REUSE")) return CURLOPT_FORBID_REUSE;
if (strEQ(name, "FRESH_CONNECT")) return CURLOPT_FRESH_CONNECT;
if (strEQ(name, "FTPAPPEND")) return CURLOPT_FTPAPPEND;
if (strEQ(name, "FTPASCII")) return CURLOPT_FTPASCII;
if (strEQ(name, "FTPLISTONLY")) return CURLOPT_FTPLISTONLY;
if (strEQ(name, "FTPPORT")) return CURLOPT_FTPPORT;
break;
case 'G':
case 'H':
if (strEQ(name, "HEADER")) return CURLOPT_HEADER;
if (strEQ(name, "HEADERFUNCTION")) return CURLOPT_HEADERFUNCTION;
if (strEQ(name, "HTTPGET")) return CURLOPT_HTTPGET;
if (strEQ(name, "HTTPHEADER")) return CURLOPT_HTTPHEADER;
if (strEQ(name, "HTTPPOST")) return CURLOPT_HTTPPOST;
if (strEQ(name, "HTTPPROXYTUNNEL")) return CURLOPT_HTTPPROXYTUNNEL;
if (strEQ(name, "HTTPREQUEST")) return CURLOPT_HTTPREQUEST;
break;
case 'I':
if (strEQ(name, "INFILE")) return CURLOPT_INFILE;
if (strEQ(name, "INFILESIZE")) return CURLOPT_INFILESIZE;
if (strEQ(name, "INTERFACE")) return CURLOPT_INTERFACE;
break;
case 'J':
case 'K':
if (strEQ(name, "KRB4LEVEL")) return CURLOPT_KRB4LEVEL;
break;
case 'L':
if (strEQ(name, "LOW_SPEED_LIMIT")) return CURLOPT_LOW_SPEED_LIMIT;
if (strEQ(name, "LOW_SPEED_TIME")) return CURLOPT_LOW_SPEED_TIME;
break;
case 'M':
if (strEQ(name, "MAXCONNECTS")) return CURLOPT_MAXCONNECTS;
if (strEQ(name, "MAXREDIRS")) return CURLOPT_MAXREDIRS;
if (strEQ(name, "MUTE")) return CURLOPT_MUTE;
break;
case 'N':
if (strEQ(name, "NETRC")) return CURLOPT_NETRC;
if (strEQ(name, "NOBODY")) return CURLOPT_NOBODY;
if (strEQ(name, "NOPROGRESS")) return CURLOPT_NOPROGRESS;
if (strEQ(name, "NOTHING")) return CURLOPT_NOTHING;
break;
case 'O':
case 'P':
if (strEQ(name, "PASSWDDATA")) return CURLOPT_PASSWDDATA;
if (strEQ(name, "PASSWDFUNCTION")) return CURLOPT_PASSWDFUNCTION;
if (strEQ(name, "PORT")) return CURLOPT_PORT;
if (strEQ(name, "POST")) return CURLOPT_POST;
if (strEQ(name, "POSTFIELDS")) return CURLOPT_POSTFIELDS;
if (strEQ(name, "POSTFIELDSIZE")) return CURLOPT_POSTFIELDSIZE;
if (strEQ(name, "POSTQUOTE")) return CURLOPT_POSTQUOTE;
if (strEQ(name, "PROGRESSDATA")) return CURLOPT_PROGRESSDATA;
if (strEQ(name, "PROGRESSFUNCTION")) return CURLOPT_PROGRESSFUNCTION;
if (strEQ(name, "PROXY")) return CURLOPT_PROXY;
if (strEQ(name, "PROXYPORT")) return CURLOPT_PROXYPORT;
if (strEQ(name, "PROXYUSERPWD")) return CURLOPT_PROXYUSERPWD;
if (strEQ(name, "PUT")) return CURLOPT_PUT;
break;
case 'Q':
if (strEQ(name, "QUOTE")) return CURLOPT_QUOTE;
break;
case 'R':
if (strEQ(name, "RANDOM_FILE")) return CURLOPT_RANDOM_FILE;
if (strEQ(name, "RANGE")) return CURLOPT_RANGE;
if (strEQ(name, "READFUNCTION")) return CURLOPT_READFUNCTION;
if (strEQ(name, "REFERER")) return CURLOPT_REFERER;
if (strEQ(name, "RESUME_FROM")) return CURLOPT_RESUME_FROM;
break;
case 'S':
if (strEQ(name, "SSLCERT")) return CURLOPT_SSLCERT;
if (strEQ(name, "SSLCERTPASSWD")) return CURLOPT_SSLCERTPASSWD;
if (strEQ(name, "SSLVERSION")) return CURLOPT_SSLVERSION;
if (strEQ(name, "SSL_CIPHER_LIST")) return CURLOPT_SSL_CIPHER_LIST;
if (strEQ(name, "SSL_VERIFYHOST")) return CURLOPT_SSL_VERIFYHOST;
if (strEQ(name, "SSL_VERIFYPEER")) return CURLOPT_SSL_VERIFYPEER;
if (strEQ(name, "STDERR")) return CURLOPT_STDERR;
break;
case 'T':
if (strEQ(name, "TELNETOPTIONS")) return CURLOPT_TELNETOPTIONS;
if (strEQ(name, "TIMECONDITION")) return CURLOPT_TIMECONDITION;
if (strEQ(name, "TIMEOUT")) return CURLOPT_TIMEOUT;
if (strEQ(name, "TIMEVALUE")) return CURLOPT_TIMEVALUE;
if (strEQ(name, "TRANSFERTEXT")) return CURLOPT_TRANSFERTEXT;
break;
case 'U':
if (strEQ(name, "UPLOAD")) return CURLOPT_UPLOAD;
if (strEQ(name, "URL")) return CURLOPT_URL;
if (strEQ(name, "USERAGENT")) return CURLOPT_USERAGENT;
if (strEQ(name, "USERPWD")) return CURLOPT_USERPWD;
break;
case 'V':
if (strEQ(name, "VERBOSE")) return CURLOPT_VERBOSE;
break;
case 'W':
if (strEQ(name, "WRITEFUNCTION")) return CURLOPT_WRITEFUNCTION;
if (strEQ(name, "WRITEHEADER")) return CURLOPT_WRITEHEADER;
if (strEQ(name, "WRITEINFO")) return CURLOPT_WRITEINFO;
break;
case 'X':
case 'Y':
case 'Z':

0 comments on commit 611fbfa

Please sign in to comment.