Compare commits
	
		
			41 Commits
		
	
	
		
			Curl_easy_
			...
			curl-7_9
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 4d2cb8b32a | ||
|   | d5001a3f0b | ||
|   | 91f5ac4d5c | ||
|   | f9977df50d | ||
|   | 711650b178 | ||
|   | c9adbc9f1c | ||
|   | 611fbfa917 | ||
|   | ecfacfb334 | ||
|   | 645413f5ef | ||
|   | 5becdc38b3 | ||
|   | f36cea67fe | ||
|   | b556d6caee | ||
|   | a17a78c477 | ||
|   | 146413a53c | ||
|   | 437fd064c9 | ||
|   | 28dd4e4f1f | ||
|   | f92dc70beb | ||
|   | 6d8f1328bf | ||
|   | 8d1d93d56d | ||
|   | f8e102c485 | ||
|   | d816fcc965 | ||
|   | e30dcd0501 | ||
|   | 24dc7cffbd | ||
|   | 3bc83926ce | ||
|   | c5cca4d059 | ||
|   | 0db04c4f56 | ||
|   | 5c566c9aa3 | ||
|   | 822f02313d | ||
|   | d934890c1e | ||
|   | 0e25cf41c4 | ||
|   | 5214dbbd02 | ||
|   | 0c716d51ad | ||
|   | 86367d675a | ||
|   | bd8cef5a70 | ||
|   | 708431e2ea | ||
|   | db5c1c61e5 | ||
|   | aa4ff6d8b9 | ||
|   | 6d5b8b50e1 | ||
|   | 600d7b11e6 | ||
|   | afa7648be6 | ||
|   | 5c344fc23a | 
							
								
								
									
										50
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								CHANGES
									
									
									
									
									
								
							| @@ -6,6 +6,56 @@ | ||||
|  | ||||
|                                History of Changes | ||||
|  | ||||
| Daniel (23 September 2001) | ||||
| - Found and removed a 'socket leak' that would occur on IPv6 enabled hosts | ||||
|   when FTP RETR failed. | ||||
|  | ||||
| - Made the FTP upload tests run fine on machines with IPv6 enabled. | ||||
|  | ||||
| Version 7.9-pre8 | ||||
|  | ||||
| Daniel (19 September 2001) | ||||
| - Vojtech Minarik set up a special-purpose test server and provided me with | ||||
|   test certificates in order for me to repeat the bug reports #440068 and | ||||
|   #440373. It turned out we didn't check all the error codes properly. We do | ||||
|   now, and connecting with a unacceptable certificate will make libcurl fail | ||||
|   to connect with an error code returned. | ||||
|  | ||||
| - Ramana Mokkapati found a case when the Location: following code did wrong. | ||||
|   I wrote a test case for this (45). | ||||
|  | ||||
| Version 7.9-pre7 | ||||
|  | ||||
| Daniel (17 September 2001) | ||||
| - Linus Nielsen Feltzing fixed telnet for win32. It makes libcurl require | ||||
|   winsock 2.0. | ||||
|  | ||||
| Version 7.9-pre6 | ||||
|  | ||||
| - libtool 1.4.2 is now in use! | ||||
|  | ||||
| Version 7.9-pre5 | ||||
|  | ||||
| Daniel (14 September 2001) | ||||
| - Added another 14 ftp tests. | ||||
|  | ||||
| Daniel (13 September 2001) | ||||
| - Added curl_easy_duphandle() to the easy.h header file. It has now been | ||||
|   tested and proved to work in a real-world tests by T Bharath. We still need | ||||
|   to write up some docs for this function. | ||||
|  | ||||
| - Added four more ftp tests to the test suite. | ||||
|  | ||||
| Daniel (12 September 2001) | ||||
| - CURLOPT_SSL_CIPHER_LIST was added, and the curl tool option is named | ||||
|   --ciphers. Use them to specify a list of ciphers to use in the SSL | ||||
|   connection. | ||||
|  | ||||
| - T. Bharath found a memory leak in libcurl's windows version. It turned out | ||||
|   to be the new duphandle() that didn't quite work yet. | ||||
|  | ||||
| Version 7.9-pre4 | ||||
|  | ||||
| Daniel (11 September 2001) | ||||
| - Added verbose output for SSL connections that output the server | ||||
|   certificate's start and expire dates. As suggested by Paul Harrington. | ||||
|   | ||||
							
								
								
									
										20
									
								
								config.guess
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								config.guess
									
									
									
									
										vendored
									
									
								
							| @@ -3,7 +3,7 @@ | ||||
| #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 | ||||
| #   Free Software Foundation, Inc. | ||||
|  | ||||
| timestamp='2001-08-23' | ||||
| timestamp='2001-09-04' | ||||
|  | ||||
| # This file is free software; you can redistribute it and/or modify it | ||||
| # under the terms of the GNU General Public License as published by | ||||
| @@ -393,6 +393,7 @@ EOF | ||||
| 	echo clipper-intergraph-clix${UNAME_RELEASE} | ||||
| 	exit 0 ;; | ||||
|     mips:*:*:UMIPS | mips:*:*:RISCos) | ||||
| 	eval $set_cc_for_build | ||||
| 	sed 's/^	//' << EOF >$dummy.c | ||||
| #ifdef __cplusplus | ||||
| #include <stdio.h>  /* for printf() prototype */ | ||||
| @@ -414,7 +415,6 @@ EOF | ||||
| 	  exit (-1); | ||||
| 	} | ||||
| EOF | ||||
| 	eval $set_cc_for_build | ||||
| 	$CC_FOR_BUILD $dummy.c -o $dummy \ | ||||
| 	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ | ||||
| 	  && rm -f $dummy.c $dummy && exit 0 | ||||
| @@ -484,6 +484,7 @@ EOF | ||||
| 	exit 0 ;; | ||||
|     *:AIX:2:3) | ||||
| 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then | ||||
| 		eval $set_cc_for_build | ||||
| 		sed 's/^		//' << EOF >$dummy.c | ||||
| 		#include <sys/systemcfg.h> | ||||
|  | ||||
| @@ -495,7 +496,6 @@ EOF | ||||
| 			exit(0); | ||||
| 			} | ||||
| EOF | ||||
| 		eval $set_cc_for_build | ||||
| 		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 | ||||
| 		rm -f $dummy.c $dummy | ||||
| 		echo rs6000-ibm-aix3.2.5 | ||||
| @@ -563,6 +563,7 @@ EOF | ||||
|                   fi ;; | ||||
|               esac | ||||
|               if [ "${HP_ARCH}" = "" ]; then | ||||
| 	      eval $set_cc_for_build | ||||
|               sed 's/^              //' << EOF >$dummy.c | ||||
|  | ||||
|               #define _HPUX_SOURCE | ||||
| @@ -596,10 +597,9 @@ EOF | ||||
|                   exit (0); | ||||
|               } | ||||
| EOF | ||||
| 	eval $set_cc_for_build | ||||
| 	(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` | ||||
| 	if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi | ||||
| 	rm -f $dummy.c $dummy | ||||
| 	    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` | ||||
| 	    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi | ||||
| 	    rm -f $dummy.c $dummy | ||||
| 	fi ;; | ||||
| 	esac | ||||
| 	echo ${HP_ARCH}-hp-hpux${HPUX_REV} | ||||
| @@ -609,6 +609,7 @@ EOF | ||||
| 	echo ia64-hp-hpux${HPUX_REV} | ||||
| 	exit 0 ;; | ||||
|     3050*:HI-UX:*:*) | ||||
| 	eval $set_cc_for_build | ||||
| 	sed 's/^	//' << EOF >$dummy.c | ||||
| 	#include <unistd.h> | ||||
| 	int | ||||
| @@ -634,7 +635,6 @@ EOF | ||||
| 	  exit (0); | ||||
| 	} | ||||
| EOF | ||||
| 	eval $set_cc_for_build | ||||
| 	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 | ||||
| 	rm -f $dummy.c $dummy | ||||
| 	echo unknown-hitachi-hiuxwe2 | ||||
| @@ -851,6 +851,7 @@ EOF | ||||
| 		exit 0 ;; | ||||
| 	esac | ||||
| 	# Determine whether the default compiler is a.out or elf | ||||
| 	eval $set_cc_for_build | ||||
| 	cat >$dummy.c <<EOF | ||||
| #include <features.h> | ||||
| #ifdef __cplusplus | ||||
| @@ -875,7 +876,6 @@ EOF | ||||
|   return 0; | ||||
| } | ||||
| EOF | ||||
| 	eval $set_cc_for_build | ||||
| 	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 | ||||
| 	rm -f $dummy.c $dummy | ||||
| 	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 | ||||
| @@ -1122,6 +1122,7 @@ esac | ||||
| #echo '(No uname command or uname output not recognized.)' 1>&2 | ||||
| #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 | ||||
|  | ||||
| eval $set_cc_for_build | ||||
| cat >$dummy.c <<EOF | ||||
| #ifdef _SEQUENT_ | ||||
| # include <sys/types.h> | ||||
| @@ -1236,7 +1237,6 @@ main () | ||||
| } | ||||
| EOF | ||||
|  | ||||
| eval $set_cc_for_build | ||||
| $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 | ||||
| rm -f $dummy.c $dummy | ||||
|  | ||||
|   | ||||
							
								
								
									
										9
									
								
								config.sub
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								config.sub
									
									
									
									
										vendored
									
									
								
							| @@ -3,7 +3,7 @@ | ||||
| #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 | ||||
| #   Free Software Foundation, Inc. | ||||
|  | ||||
| timestamp='2001-08-23' | ||||
| timestamp='2001-09-07' | ||||
|  | ||||
| # This file is (in principle) common to ALL GNU software. | ||||
| # The presence of a machine in this file suggests that SOME GNU software | ||||
| @@ -236,7 +236,8 @@ case $basic_machine in | ||||
| 	| mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | ||||
| 	| mips64vr4100 | mips64vr4100el | mips64vr4300 \ | ||||
| 	| mips64vr4300el | mips64vr5000 | mips64vr5000el \ | ||||
| 	| mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \ | ||||
| 	| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ | ||||
| 	| mipsisa32 \ | ||||
| 	| mn10200 | mn10300 \ | ||||
| 	| ns16k | ns32k \ | ||||
| 	| openrisc \ | ||||
| @@ -293,8 +294,8 @@ case $basic_machine in | ||||
| 	| m88110-* | m88k-* | mcore-* \ | ||||
| 	| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | ||||
| 	| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ | ||||
| 	| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \ | ||||
| 	| mipsle-* | mipstx39-* | mipstx39el-* \ | ||||
| 	| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ | ||||
| 	| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ | ||||
| 	| none-* | np1-* | ns16k-* | ns32k-* \ | ||||
| 	| orion-* \ | ||||
| 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | ||||
|   | ||||
| @@ -12,6 +12,7 @@ man_MANS = \ | ||||
| 	curl_easy_init.3 \ | ||||
| 	curl_easy_perform.3 \ | ||||
| 	curl_easy_setopt.3 \ | ||||
| 	curl_easy_duphandle.3 \ | ||||
| 	curl_formparse.3 \ | ||||
| 	curl_formadd.3 \ | ||||
| 	curl_formfree.3 \ | ||||
| @@ -39,6 +40,7 @@ HTMLPAGES = \ | ||||
| 	curl_easy_init.html \ | ||||
| 	curl_easy_perform.html \ | ||||
| 	curl_easy_setopt.html \ | ||||
| 	curl_easy_duphandle.html \ | ||||
| 	curl_formadd.html \ | ||||
| 	curl_formparse.html \ | ||||
| 	curl_formfree.html \ | ||||
|   | ||||
| @@ -24,8 +24,9 @@ To do in a future release (random order): | ||||
|  * Consider an interface to libcurl that allows applications to easier get to | ||||
|    know what cookies that are sent back in the response headers. | ||||
|  | ||||
|  * HTTP PUT for files passed on stdin. Requires libcurl to send the file | ||||
|    with chunked content encoding. http://curl.haxx.se/dev/HTTP-PUT-stdin.txt | ||||
|  * HTTP PUT for files passed on stdin *OR* when the --crlf option is | ||||
|    used. Requires libcurl to send the file with chunked content | ||||
|    encoding. http://curl.haxx.se/dev/HTTP-PUT-stdin.txt | ||||
|  | ||||
|  * Introduce another callback interface for upload/download that makes one | ||||
|    less copy of data and thus a faster operation. | ||||
|   | ||||
							
								
								
									
										37
									
								
								docs/curl_easy_duphandle.3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								docs/curl_easy_duphandle.3
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| .\" You can view this file with: | ||||
| .\" nroff -man [file] | ||||
| .\" $Id$ | ||||
| .\" | ||||
| .TH curl_easy_duphandle 3 "18 September 2001" "libcurl 7.9" "libcurl Manual" | ||||
| .SH NAME | ||||
| curl_easy_duphandle - Clone a libcurl session handle | ||||
| .SH SYNOPSIS | ||||
| .B #include <curl/curl.h> | ||||
| .sp | ||||
| .BI "CURL *curl_easy_duphandle(CURL *"handle ");" | ||||
| .ad | ||||
| .SH DESCRIPTION | ||||
| This function will return a new curl handle, a duplicate, using all the | ||||
| options previously set in the input curl \fIhandle\fP. Both handles can | ||||
| subsequently be used independently and they must both be freed with | ||||
| \fIcurl_easy_cleanup()\fP. | ||||
|  | ||||
| All strings that the input handle has been told to point to (as opposed to | ||||
| copy) with previous calls to \fIcurl_easy_setopt\fP using char * inputs, will | ||||
| be pointed to by the new handle as well. You must therefore make sure to keep | ||||
| the data around until both handles have been cleaned up. | ||||
|  | ||||
| The new handle will \fBnot\fP inherit any state information, no connections, | ||||
| no SSL sessions and no cookies. | ||||
|  | ||||
| \fBNote\fP that even in multi-threaded programs, this function must be called | ||||
| in a synchronous way, the input handle may not be in use when cloned. | ||||
|  | ||||
| This function was added in libcurl 7.9. | ||||
| .SH RETURN VALUE | ||||
| If this function returns NULL, something went wrong and no valid handle was | ||||
| returned. | ||||
| .SH "SEE ALSO" | ||||
| .BR curl_easy_init "(3)," curl_easy_cleanup "(3)," curl_global_init "(3) | ||||
| .SH BUGS | ||||
| Surely there are some, you tell me! | ||||
| @@ -6,7 +6,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies | ||||
|  | ||||
| EXTRA_DIST = README curlgtk.c sepheaders.c simple.c postit.c postit2.c \ | ||||
| 	     win32sockets.c persistant.c ftpget.c Makefile.example \ | ||||
| 	     multithread.c getinmemory.c ftpupload.c | ||||
| 	     multithread.c getinmemory.c ftpupload.c httpput.c | ||||
|  | ||||
| all: | ||||
| 	@echo "done" | ||||
|   | ||||
							
								
								
									
										100
									
								
								docs/examples/httpput.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								docs/examples/httpput.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,100 @@ | ||||
| /***************************************************************************** | ||||
|  *                                  _   _ ____  _      | ||||
|  *  Project                     ___| | | |  _ \| |     | ||||
|  *                             / __| | | | |_) | |     | ||||
|  *                            | (__| |_| |  _ <| |___  | ||||
|  *                             \___|\___/|_| \_\_____| | ||||
|  * | ||||
|  * $Id$ | ||||
|  */ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <fcntl.h> | ||||
| #include <sys/stat.h> | ||||
|  | ||||
| #include <curl/curl.h> | ||||
|  | ||||
| /* | ||||
|  * This example shows a HTTP PUT operation. PUTs a file given as a command | ||||
|  * line argument to the URL also given on the command line. | ||||
|  * | ||||
|  * This example also uses its own read callback. | ||||
|  */ | ||||
|  | ||||
| size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) | ||||
| { | ||||
|   size_t retcode; | ||||
|  | ||||
|   /* in real-world cases, this would probably get this data differently | ||||
|      as this fread() stuff is exactly what the library already would do | ||||
|      by default internally */ | ||||
|   retcode = fread(ptr, size, nmemb, stream); | ||||
|  | ||||
|   fprintf(stderr, "*** We read %d bytes from file\n", retcode); | ||||
|  | ||||
|   return retcode; | ||||
| } | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
|   CURL *curl; | ||||
|   CURLcode res; | ||||
|   FILE *ftpfile; | ||||
|   FILE * hd_src ; | ||||
|   int hd ; | ||||
|   struct stat file_info; | ||||
|  | ||||
|   char *file; | ||||
|   char *url; | ||||
|  | ||||
|   if(argc < 3) | ||||
|     return 1; | ||||
|   | ||||
|   file= argv[1]; | ||||
|   url = argv[2]; | ||||
|    | ||||
|   /* get the file size of the local file */ | ||||
|   hd = open(file, O_RDONLY) ; | ||||
|   fstat(hd, &file_info); | ||||
|   close(hd) ; | ||||
|  | ||||
|   /* get a FILE * of the same file, could also be made with | ||||
|      fdopen() from the previous descriptor, but hey this is just  | ||||
|      an example! */ | ||||
|   hd_src = fopen(file, "rb"); | ||||
|  | ||||
|   /* In windows, this will init the winsock stuff */ | ||||
|   curl_global_init(CURL_GLOBAL_ALL); | ||||
|  | ||||
|   /* get a curl handle */ | ||||
|   curl = curl_easy_init(); | ||||
|   if(curl) { | ||||
|     /* we want to use our own read function */ | ||||
|     curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); | ||||
|  | ||||
|     /* enable uploading */ | ||||
|     curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ; | ||||
|  | ||||
|     /* HTTP PUT please */ | ||||
|     curl_easy_setopt(curl, CURLOPT_PUT, TRUE); | ||||
|  | ||||
|     /* specify target */ | ||||
|     curl_easy_setopt(curl,CURLOPT_URL, url); | ||||
|  | ||||
|     /* now specify which file to upload */ | ||||
|     curl_easy_setopt(curl, CURLOPT_INFILE, hd_src); | ||||
|  | ||||
|     /* and give the size of the upload (optional) */ | ||||
|     curl_easy_setopt(curl, CURLOPT_INFILESIZE, file_info.st_size); | ||||
|  | ||||
|     /* Now run off and do what you've been told! */ | ||||
|     res = curl_easy_perform(curl); | ||||
|  | ||||
|     /* always cleanup */ | ||||
|     curl_easy_cleanup(curl); | ||||
|   } | ||||
|   fclose(hd_src); /* close the local file */ | ||||
|  | ||||
|   curl_global_cleanup(); | ||||
|   return 0; | ||||
| } | ||||
| @@ -548,8 +548,8 @@ CURLcode curl_global_init(long flags); | ||||
| void curl_global_cleanup(void); | ||||
|  | ||||
| /* This is the version number */ | ||||
| #define LIBCURL_VERSION "7.8.2-pre1" | ||||
| #define LIBCURL_VERSION_NUM 0x070802 | ||||
| #define LIBCURL_VERSION "7.9" | ||||
| #define LIBCURL_VERSION_NUM 0x070900 | ||||
|  | ||||
| /* linked-list structure for the CURLOPT_QUOTE option (and other) */ | ||||
| struct curl_slist { | ||||
|   | ||||
| @@ -46,6 +46,21 @@ void curl_easy_cleanup(CURL *curl); | ||||
|  */ | ||||
| CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * NAME curl_easy_duphandle() | ||||
|  * | ||||
|  * DESCRIPTION | ||||
|  * | ||||
|  * Creates a new curl session handle with the same options set for the handle | ||||
|  * passed in. Duplicating a handle could only be a matter of cloning data and | ||||
|  * options, internal state info and things like persistant connections cannot | ||||
|  * be transfered. It is useful in multithreaded applications when you can run | ||||
|  * curl_easy_duphandle() for each new thread to avoid a series of identical | ||||
|  * curl_easy_setopt() invokes in every thread. | ||||
|  */ | ||||
| CURL* curl_easy_duphandle(CURL *curl); | ||||
|  | ||||
| #ifdef  __cplusplus | ||||
| } | ||||
| #endif | ||||
|   | ||||
| @@ -29,7 +29,7 @@ LINKRS = link.exe -lib /out:$(PROGRAM_NAME) /LIBPATH:$(OPENSSL_PATH)/out32dll | ||||
|  | ||||
| CFLAGS = /I "../include" /nologo /W3 /GX /D "WIN32" /D "VC6" /D "_MBCS" /D "_LIB" /YX /FD /c /D "MSDOS" | ||||
| LFLAGS = /nologo | ||||
| LINKLIBS = wsock32.lib | ||||
| LINKLIBS = ws2_32.lib | ||||
| LINKSLIBS = libeay32.lib ssleay32.lib RSAglue.lib | ||||
|  | ||||
| RELEASE_OBJS= \ | ||||
|   | ||||
							
								
								
									
										12
									
								
								lib/easy.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								lib/easy.c
									
									
									
									
									
								
							| @@ -94,7 +94,7 @@ static CURLcode win32_init(void) | ||||
|   WORD wVersionRequested;   | ||||
|   WSADATA wsaData;  | ||||
|   int err;  | ||||
|   wVersionRequested = MAKEWORD(1, 1);  | ||||
|   wVersionRequested = MAKEWORD(2, 0);  | ||||
|      | ||||
|   err = WSAStartup(wVersionRequested, &wsaData);  | ||||
|      | ||||
| @@ -103,14 +103,14 @@ static CURLcode win32_init(void) | ||||
|     /* winsock.dll.     */  | ||||
|     return CURLE_FAILED_INIT;  | ||||
|      | ||||
|   /* Confirm that the Windows Sockets DLL supports 1.1.*/  | ||||
|   /* Confirm that the Windows Sockets DLL supports 2.0.*/  | ||||
|   /* Note that if the DLL supports versions greater */  | ||||
|   /* than 1.1 in addition to 1.1, it will still return */  | ||||
|   /* 1.1 in wVersion since that is the version we */  | ||||
|   /* than 2.0 in addition to 2.0, it will still return */  | ||||
|   /* 2.0 in wVersion since that is the version we */  | ||||
|   /* requested. */  | ||||
|      | ||||
|   if ( LOBYTE( wsaData.wVersion ) != 1 ||  | ||||
|        HIBYTE( wsaData.wVersion ) != 1 ) {  | ||||
|   if ( LOBYTE( wsaData.wVersion ) != 2 ||  | ||||
|        HIBYTE( wsaData.wVersion ) != 0 ) {  | ||||
|     /* Tell the user that we couldn't find a useable */  | ||||
|  | ||||
|     /* winsock.dll. */  | ||||
|   | ||||
							
								
								
									
										14
									
								
								lib/ftp.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								lib/ftp.c
									
									
									
									
									
								
							| @@ -546,7 +546,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn) | ||||
|   else { | ||||
|     if((-1 != conn->size) && (conn->size != *ftp->bytecountp) && | ||||
|        (conn->maxdownload != *ftp->bytecountp)) { | ||||
|       failf(data, "Received only partial file"); | ||||
|       failf(data, "Received only partial file: %d bytes", *ftp->bytecountp); | ||||
|       return CURLE_PARTIAL_FILE; | ||||
|     } | ||||
|     else if(!conn->bits.resume_done && | ||||
| @@ -632,7 +632,7 @@ CURLcode _ftp_cwd(struct connectdata *conn, char *path) | ||||
|     return CURLE_OPERATION_TIMEOUTED; | ||||
|  | ||||
|   if (ftpcode != 250) { | ||||
|     failf(conn->data, "Couldn't change back to directory %s", path); | ||||
|     failf(conn->data, "Couldn't cd to %s", path); | ||||
|     return CURLE_FTP_ACCESS_DENIED; | ||||
|   } | ||||
|  | ||||
| @@ -1005,6 +1005,10 @@ CURLcode _ftp(struct connectdata *conn) | ||||
|       freeaddrinfo(res); | ||||
|       return CURLE_FTP_PORT_FAILED; | ||||
|     } | ||||
|     /* we set the secondary socket variable to this for now, it | ||||
|        is only so that the cleanup function will close it in case | ||||
|        we fail before the true secondary stuff is made */ | ||||
|     conn->secondarysocket = portsock; | ||||
|  | ||||
| #else | ||||
|     struct sockaddr_in sa; | ||||
| @@ -1569,7 +1573,7 @@ CURLcode _ftp(struct connectdata *conn) | ||||
|         result = _ftp_getsize(conn, ftp->file, &foundsize); | ||||
|  | ||||
|         if(CURLE_OK != result) { | ||||
|           infof(data, "ftp server doesn't support SIZE"); | ||||
|           infof(data, "ftp server doesn't support SIZE\n"); | ||||
|           /* We couldn't get the size and therefore we can't know if there | ||||
|              really is a part of the file left to get, although the server | ||||
|              will just close the connection when we start the connection so it | ||||
| @@ -1706,8 +1710,8 @@ CURLcode _ftp(struct connectdata *conn) | ||||
|  | ||||
|       /* FTP download: */ | ||||
|       result=Curl_Transfer(conn, conn->secondarysocket, size, FALSE, | ||||
|                       bytecountp, | ||||
|                       -1, NULL); /* no upload here */ | ||||
|                            bytecountp, | ||||
|                            -1, NULL); /* no upload here */ | ||||
|       if(result) | ||||
|         return result; | ||||
|     } | ||||
|   | ||||
							
								
								
									
										31
									
								
								lib/http.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								lib/http.c
									
									
									
									
									
								
							| @@ -204,31 +204,18 @@ CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size) | ||||
|  */ | ||||
|  | ||||
| static | ||||
| int GetLine(int sockfd, char *buf, struct connectdata *conn) | ||||
| int GetLine(int sockfd, char *ptr, struct connectdata *conn) | ||||
| { | ||||
|   ssize_t nread; | ||||
|   int read_rc=1; | ||||
|   char *ptr; | ||||
|   struct SessionHandle *data=conn->data; | ||||
|  | ||||
|   ptr=buf; | ||||
|  | ||||
|   /* get us a full line, terminated with a newline */ | ||||
|   for(nread=0; | ||||
|       (nread<BUFSIZE) && read_rc; | ||||
|       nread++, ptr++) { | ||||
|   for(nread=0; (nread<BUFSIZE); nread++, ptr++) { | ||||
|     if((CURLE_OK != Curl_read(conn, sockfd, ptr, 1, &nread)) || | ||||
|        (nread <= 0) || | ||||
|        (*ptr == '\n')) | ||||
|        (nread <= 0) || (*ptr == '\n')) | ||||
|       break; | ||||
|   } | ||||
|   *ptr=0; /* zero terminate */ | ||||
|    | ||||
|   if(data->set.verbose) { | ||||
|     fputs("< ", data->set.err); | ||||
|     fwrite(buf, 1, nread, data->set.err); | ||||
|     fputs("\n", data->set.err); | ||||
|   } | ||||
|   return nread>0?nread:0; | ||||
| } | ||||
|  | ||||
| @@ -282,6 +269,9 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, | ||||
|   while(GetLine(tunnelsocket, data->state.buffer, conn)) { | ||||
|     if('\r' == data->state.buffer[0]) | ||||
|       break; /* end of headers */ | ||||
|     if(data->set.verbose) | ||||
|       fprintf(data->set.err, "< %s\n", data->state.buffer); | ||||
|  | ||||
|     if(2 == sscanf(data->state.buffer, "HTTP/1.%d %d", | ||||
|                    &subversion, | ||||
|                    &httperror)) { | ||||
| @@ -341,15 +331,6 @@ CURLcode Curl_http_connect(struct connectdata *conn) | ||||
|   return CURLE_OK; | ||||
| } | ||||
|  | ||||
| /* called from curl_close() when this struct is about to get wasted, free | ||||
|    protocol-specific resources */ | ||||
| CURLcode Curl_http_close(struct connectdata *conn) | ||||
| { | ||||
|   if(conn->data->state.auth_host) | ||||
|     free(conn->data->state.auth_host); | ||||
|   return CURLE_OK; | ||||
| } | ||||
|  | ||||
| CURLcode Curl_http_done(struct connectdata *conn) | ||||
| { | ||||
|   struct SessionHandle *data; | ||||
|   | ||||
| @@ -33,7 +33,6 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, | ||||
| CURLcode Curl_http(struct connectdata *conn); | ||||
| CURLcode Curl_http_done(struct connectdata *conn); | ||||
| CURLcode Curl_http_connect(struct connectdata *conn); | ||||
| CURLcode Curl_http_close(struct connectdata *conn); | ||||
|  | ||||
| /* The following functions are defined in http_chunks.c */ | ||||
| void Curl_httpchunk_init(struct connectdata *conn); | ||||
|   | ||||
| @@ -31,4 +31,5 @@ EXPORTS | ||||
|  	curl_mvfprintf @ 22 ; | ||||
| 	curl_strequal @ 23 ; | ||||
| 	curl_strnequal @ 24 ; | ||||
|         curl_easy_duphandle @ 25 ; | ||||
|  | ||||
|   | ||||
| @@ -200,7 +200,7 @@ int cert_stuff(struct connectdata *conn, | ||||
|  | ||||
|     if (SSL_CTX_use_certificate_file(conn->ssl.ctx, | ||||
| 				     cert_file, | ||||
| 				     SSL_FILETYPE_PEM) <= 0) { | ||||
| 				     SSL_FILETYPE_PEM) != 1) { | ||||
|       failf(data, "unable to set certificate file (wrong password?)\n"); | ||||
|       return(0); | ||||
|     } | ||||
| @@ -209,7 +209,7 @@ int cert_stuff(struct connectdata *conn, | ||||
|  | ||||
|     if (SSL_CTX_use_PrivateKey_file(conn->ssl.ctx, | ||||
| 				    key_file, | ||||
| 				    SSL_FILETYPE_PEM) <= 0) { | ||||
| 				    SSL_FILETYPE_PEM) != 1) { | ||||
|       failf(data, "unable to set public key file\n"); | ||||
|       return(0); | ||||
|     } | ||||
| @@ -612,7 +612,10 @@ Curl_SSLConnect(struct connectdata *conn) | ||||
|   SSL_set_fd (conn->ssl.handle, conn->firstsocket); | ||||
|   err = SSL_connect (conn->ssl.handle); | ||||
|  | ||||
|   if (-1 == err) { | ||||
|   /* 1  is fine | ||||
|      0  is "not successful but was shut down controlled" | ||||
|      <0 is "handshake was not successful, because a fatal error occurred" */ | ||||
|   if (err <= 0) { | ||||
|     err = ERR_get_error();  | ||||
|     failf(data, "SSL: %s", ERR_error_string(err, NULL)); | ||||
|     return CURLE_SSL_CONNECT_ERROR; | ||||
|   | ||||
							
								
								
									
										104
									
								
								lib/telnet.c
									
									
									
									
									
								
							
							
						
						
									
										104
									
								
								lib/telnet.c
									
									
									
									
									
								
							| @@ -35,7 +35,7 @@ | ||||
| #include <errno.h> | ||||
|  | ||||
| #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) | ||||
| #include <winsock.h> | ||||
| #include <winsock2.h> | ||||
| #include <time.h> | ||||
| #include <io.h> | ||||
| #else | ||||
| @@ -152,8 +152,8 @@ struct TELNET { | ||||
|   int him[256];  | ||||
|   int himq[256];  | ||||
|   int him_preferred[256];  | ||||
|   char *subopt_ttype;             /* Set with suboption TTYPE */ | ||||
|   char *subopt_xdisploc;          /* Set with suboption XDISPLOC */ | ||||
|   char subopt_ttype[32];             /* Set with suboption TTYPE */ | ||||
|   char subopt_xdisploc[128];          /* Set with suboption XDISPLOC */ | ||||
|   struct curl_slist *telnet_vars; /* Environment variables */ | ||||
|  | ||||
|   /* suboptions */ | ||||
| @@ -765,14 +765,16 @@ static int check_telnet_options(struct connectdata *conn) | ||||
|  | ||||
|       /* Terminal type */ | ||||
|       if(strequal(option_keyword, "TTYPE")) { | ||||
|         tn->subopt_ttype = option_arg; | ||||
|         strncpy(tn->subopt_ttype, option_arg, 31); | ||||
|         tn->subopt_ttype[31] = 0; /* String termination */ | ||||
|         tn->us_preferred[TELOPT_TTYPE] = YES; | ||||
|         continue; | ||||
|       } | ||||
|  | ||||
|       /* Display variable */ | ||||
|       if(strequal(option_keyword, "XDISPLOC")) { | ||||
|         tn->subopt_xdisploc = option_arg; | ||||
|         strncpy(tn->subopt_xdisploc, option_arg, 127); | ||||
|         tn->subopt_xdisploc[127] = 0; /* String termination */ | ||||
|         tn->us_preferred[TELOPT_XDISPLOC] = YES; | ||||
|         continue; | ||||
|       } | ||||
| @@ -1033,9 +1035,16 @@ CURLcode Curl_telnet(struct connectdata *conn) | ||||
|   CURLcode code; | ||||
|   struct SessionHandle *data = conn->data; | ||||
|   int sockfd = conn->firstsocket; | ||||
| #ifdef WIN32 | ||||
|   WSAEVENT event_handle; | ||||
|   WSANETWORKEVENTS events; | ||||
|   HANDLE stdin_handle; | ||||
|   HANDLE objs[2]; | ||||
|   DWORD waitret; | ||||
| #else | ||||
|   fd_set readfd; | ||||
|   fd_set keepfd; | ||||
|  | ||||
| #endif | ||||
|   bool keepon = TRUE; | ||||
|   char *buf = data->state.buffer; | ||||
|   ssize_t nread; | ||||
| @@ -1050,7 +1059,87 @@ CURLcode Curl_telnet(struct connectdata *conn) | ||||
|   code = check_telnet_options(conn); | ||||
|   if(code) | ||||
|     return code; | ||||
|    | ||||
|  | ||||
| #ifdef WIN32 | ||||
|   /* We want to wait for both stdin and the socket. Since | ||||
|   ** the select() function in winsock only works on sockets | ||||
|   ** we have to use the WaitForMultipleObjects() call. | ||||
|   */ | ||||
|  | ||||
|   /* First, create a sockets event object */ | ||||
|   event_handle = WSACreateEvent(); | ||||
|  | ||||
|   /* The get the Windows file handle for stdin */ | ||||
|   stdin_handle = GetStdHandle(STD_INPUT_HANDLE); | ||||
|  | ||||
|   /* Create the list of objects to wait for */ | ||||
|   objs[0] = stdin_handle; | ||||
|   objs[1] = event_handle; | ||||
|  | ||||
|   /* Tell winsock what events we want to listen to */ | ||||
|   if(WSAEventSelect(sockfd, event_handle, FD_READ|FD_CLOSE) == SOCKET_ERROR) { | ||||
|     return 0; | ||||
|   } | ||||
|  | ||||
|   /* Keep on listening and act on events */ | ||||
|   while(keepon) { | ||||
|     waitret = WaitForMultipleObjects(2, objs, FALSE, INFINITE); | ||||
|     switch(waitret - WAIT_OBJECT_0) | ||||
|     { | ||||
|       case 0: | ||||
|       { | ||||
|         unsigned char outbuf[2]; | ||||
|         int out_count = 0; | ||||
|         size_t bytes_written; | ||||
|         char *buffer = buf; | ||||
|                | ||||
|         if(!ReadFile(stdin_handle, buf, 255, &nread, NULL)) { | ||||
|           keepon = FALSE; | ||||
|           break; | ||||
|         } | ||||
|          | ||||
|         while(nread--) { | ||||
|           outbuf[0] = *buffer++; | ||||
|           out_count = 1; | ||||
|           if(outbuf[0] == IAC) | ||||
|             outbuf[out_count++] = IAC; | ||||
|            | ||||
|           Curl_write(conn, conn->firstsocket, outbuf, | ||||
|                      out_count, &bytes_written); | ||||
|         } | ||||
|       } | ||||
|       break; | ||||
|        | ||||
|       case 1: | ||||
|         if(WSAEnumNetworkEvents(sockfd, event_handle, &events) | ||||
|            != SOCKET_ERROR) | ||||
|         { | ||||
|           if(events.lNetworkEvents & FD_READ) | ||||
|           { | ||||
|             Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); | ||||
|              | ||||
|             telrcv(conn, (unsigned char *)buf, nread); | ||||
|              | ||||
|             fflush(stdout); | ||||
|              | ||||
|             /* Negotiate if the peer has started negotiating, | ||||
|                otherwise don't. We don't want to speak telnet with | ||||
|                non-telnet servers, like POP or SMTP. */ | ||||
|             if(tn->please_negotiate && !tn->already_negotiated) { | ||||
|               negotiate(conn); | ||||
|               tn->already_negotiated = 1; | ||||
|             } | ||||
|           } | ||||
|            | ||||
|           if(events.lNetworkEvents & FD_CLOSE) | ||||
|           { | ||||
|             keepon = FALSE; | ||||
|           } | ||||
|         } | ||||
|         break; | ||||
|     } | ||||
|   } | ||||
| #else | ||||
|   FD_ZERO (&readfd);		/* clear it */ | ||||
|   FD_SET (sockfd, &readfd); | ||||
|   FD_SET (1, &readfd); | ||||
| @@ -1108,6 +1197,7 @@ CURLcode Curl_telnet(struct connectdata *conn) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| #endif | ||||
|   /* mark this as "no further transfer wanted" */ | ||||
|   return Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL); | ||||
| } | ||||
|   | ||||
							
								
								
									
										20
									
								
								lib/url.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								lib/url.c
									
									
									
									
									
								
							| @@ -153,17 +153,21 @@ CURLcode Curl_close(struct SessionHandle *data) | ||||
|   Curl_SSL_Close_All(data); | ||||
| #endif | ||||
|  | ||||
|   if(data->state.auth_host) | ||||
|     free(data->state.auth_host); | ||||
|  | ||||
|   if(data->change.proxy_alloc) | ||||
|     free(data->change.proxy); | ||||
|  | ||||
|   if(data->change.referer_alloc) | ||||
|     free(data->change.referer); | ||||
|  | ||||
|   if(data->change.url_alloc) | ||||
|     free(data->change.url); | ||||
|  | ||||
|   if(data->state.headerbuff) | ||||
|     free(data->state.headerbuff); | ||||
|  | ||||
|  | ||||
|   if(data->set.cookiejar) | ||||
|     /* we have a "destination" for all the cookies to get dumped to */ | ||||
|     Curl_cookie_output(data->cookies, data->set.cookiejar); | ||||
| @@ -1700,12 +1704,12 @@ static CURLcode Connect(struct SessionHandle *data, | ||||
|   } /* if not using proxy */ | ||||
|  | ||||
|   /************************************************************* | ||||
|    * No protocol but proxy usage needs attention | ||||
|    * No protocol part in URL was used, add it! | ||||
|    *************************************************************/ | ||||
|   if((conn->protocol&PROT_MISSING) && data->change.proxy ) { | ||||
|     /* We're guessing prefixes here and since we're told to use a proxy, we | ||||
|        need to add the protocol prefix to the URL string before we continue! | ||||
|        */ | ||||
|   if(conn->protocol&PROT_MISSING) { | ||||
|     /* We're guessing prefixes here and if we're told to use a proxy or if | ||||
|        we're gonna follow a Location: later or... then we need the protocol | ||||
|        part added so that we have a valid URL. */ | ||||
|     char *reurl; | ||||
|  | ||||
|     reurl = aprintf("%s://%s", conn->protostr, data->change.url); | ||||
| @@ -1762,7 +1766,6 @@ static CURLcode Connect(struct SessionHandle *data, | ||||
|     conn->protocol |= PROT_HTTP; | ||||
|     conn->curl_do = Curl_http; | ||||
|     conn->curl_done = Curl_http_done; | ||||
|     conn->curl_close = Curl_http_close; | ||||
|   } | ||||
|   else if (strequal(conn->protostr, "HTTPS")) { | ||||
| #ifdef USE_SSLEAY | ||||
| @@ -1775,7 +1778,6 @@ static CURLcode Connect(struct SessionHandle *data, | ||||
|     conn->curl_do = Curl_http; | ||||
|     conn->curl_done = Curl_http_done; | ||||
|     conn->curl_connect = Curl_http_connect; | ||||
|     conn->curl_close = Curl_http_close; | ||||
|  | ||||
| #else /* USE_SSLEAY */ | ||||
|     failf(data, LIBCURL_NAME | ||||
| @@ -1795,7 +1797,6 @@ static CURLcode Connect(struct SessionHandle *data, | ||||
|     conn->protocol |= PROT_GOPHER; | ||||
|     conn->curl_do = Curl_http; | ||||
|     conn->curl_done = Curl_http_done; | ||||
|     conn->curl_close = Curl_http_close; | ||||
|   } | ||||
|   else if(strequal(conn->protostr, "FTP") || | ||||
|           strequal(conn->protostr, "FTPS")) { | ||||
| @@ -1827,7 +1828,6 @@ static CURLcode Connect(struct SessionHandle *data, | ||||
|       } | ||||
|       conn->curl_do = Curl_http; | ||||
|       conn->curl_done = Curl_http_done; | ||||
|       conn->curl_close = Curl_http_close; | ||||
|     } | ||||
|     else { | ||||
|       conn->curl_do = Curl_ftp; | ||||
|   | ||||
							
								
								
									
										42
									
								
								ltmain.sh
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								ltmain.sh
									
									
									
									
									
								
							| @@ -55,8 +55,8 @@ modename="$progname" | ||||
| # Constants. | ||||
| PROGRAM=ltmain.sh | ||||
| PACKAGE=libtool | ||||
| VERSION=1.4.1 | ||||
| TIMESTAMP=" (1.922.2.34 2001/09/03 01:22:13)" | ||||
| VERSION=1.4.2 | ||||
| TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)" | ||||
|  | ||||
| default_mode= | ||||
| help="Try \`$progname --help' for more information." | ||||
| @@ -84,6 +84,9 @@ if test "${LANG+set}" = set; then | ||||
|   save_LANG="$LANG"; LANG=C; export LANG | ||||
| fi | ||||
|  | ||||
| # Make sure IFS has a sensible default | ||||
| : ${IFS=" 	"} | ||||
|  | ||||
| if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then | ||||
|   echo "$modename: not configured to build any kind of library" 1>&2 | ||||
|   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2 | ||||
| @@ -334,7 +337,7 @@ if test -z "$show_help"; then | ||||
|       -Wc,*) | ||||
| 	args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` | ||||
| 	lastarg= | ||||
| 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=',' | ||||
| 	save_ifs="$IFS"; IFS=',' | ||||
| 	for arg in $args; do | ||||
| 	  IFS="$save_ifs" | ||||
|  | ||||
| @@ -1045,8 +1048,7 @@ compiler." | ||||
| 	    test "X$arg" = "X-lc" && continue | ||||
| 	    ;; | ||||
| 	  esac | ||||
| 	 fi | ||||
| 	 if test "X$arg" = "X-lc_r"; then | ||||
| 	 elif test "X$arg" = "X-lc_r"; then | ||||
| 	  case $host in | ||||
| 	  *-*-openbsd*) | ||||
| 	    # Do not include libc_r directly, use -pthread flag. | ||||
| @@ -1143,7 +1145,7 @@ compiler." | ||||
|       -Wc,*) | ||||
| 	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` | ||||
| 	arg= | ||||
| 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=',' | ||||
| 	save_ifs="$IFS"; IFS=',' | ||||
| 	for flag in $args; do | ||||
| 	  IFS="$save_ifs" | ||||
| 	  case $flag in | ||||
| @@ -1161,7 +1163,7 @@ compiler." | ||||
|       -Wl,*) | ||||
| 	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` | ||||
| 	arg= | ||||
| 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=',' | ||||
| 	save_ifs="$IFS"; IFS=',' | ||||
| 	for flag in $args; do | ||||
| 	  IFS="$save_ifs" | ||||
| 	  case $flag in | ||||
| @@ -1771,7 +1773,7 @@ compiler." | ||||
| 	    if test -f "$output_objdir/$soname-def"; then : | ||||
| 	    else | ||||
| 	      $show "extracting exported symbol list from \`$soname'" | ||||
| 	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
| 	      save_ifs="$IFS"; IFS='~' | ||||
| 	      eval cmds=\"$extract_expsyms_cmds\" | ||||
| 	      for cmd in $cmds; do | ||||
| 		IFS="$save_ifs" | ||||
| @@ -1784,7 +1786,7 @@ compiler." | ||||
| 	    # Create $newlib | ||||
| 	    if test -f "$output_objdir/$newlib"; then :; else | ||||
| 	      $show "generating import library for \`$soname'" | ||||
| 	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
| 	      save_ifs="$IFS"; IFS='~' | ||||
| 	      eval cmds=\"$old_archive_from_expsyms_cmds\" | ||||
| 	      for cmd in $cmds; do | ||||
| 		IFS="$save_ifs" | ||||
| @@ -2196,7 +2198,7 @@ compiler." | ||||
|       else | ||||
|  | ||||
| 	# Parse the version information argument. | ||||
| 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=':' | ||||
| 	save_ifs="$IFS"; IFS=':' | ||||
| 	set dummy $vinfo 0 0 0 | ||||
| 	IFS="$save_ifs" | ||||
|  | ||||
| @@ -2818,7 +2820,7 @@ EOF | ||||
| 	    export_symbols="$output_objdir/$libname.exp" | ||||
| 	    $run $rm $export_symbols | ||||
| 	    eval cmds=\"$export_symbols_cmds\" | ||||
| 	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
| 	    save_ifs="$IFS"; IFS='~' | ||||
| 	    for cmd in $cmds; do | ||||
| 	      IFS="$save_ifs" | ||||
| 	      $show "$cmd" | ||||
| @@ -2894,7 +2896,7 @@ EOF | ||||
| 	else | ||||
| 	  eval cmds=\"$archive_cmds\" | ||||
| 	fi | ||||
| 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
| 	save_ifs="$IFS"; IFS='~' | ||||
| 	for cmd in $cmds; do | ||||
| 	  IFS="$save_ifs" | ||||
| 	  $show "$cmd" | ||||
| @@ -3022,7 +3024,7 @@ EOF | ||||
|  | ||||
|       output="$obj" | ||||
|       eval cmds=\"$reload_cmds\" | ||||
|       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
|       save_ifs="$IFS"; IFS='~' | ||||
|       for cmd in $cmds; do | ||||
| 	IFS="$save_ifs" | ||||
| 	$show "$cmd" | ||||
| @@ -3058,7 +3060,7 @@ EOF | ||||
| 	reload_objs="$libobjs $reload_conv_objs" | ||||
| 	output="$libobj" | ||||
| 	eval cmds=\"$reload_cmds\" | ||||
| 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
| 	save_ifs="$IFS"; IFS='~' | ||||
| 	for cmd in $cmds; do | ||||
| 	  IFS="$save_ifs" | ||||
| 	  $show "$cmd" | ||||
| @@ -3823,7 +3825,7 @@ fi\ | ||||
|  | ||||
| 	eval cmds=\"$old_archive_cmds\" | ||||
|       fi | ||||
|       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
|       save_ifs="$IFS"; IFS='~' | ||||
|       for cmd in $cmds; do | ||||
| 	IFS="$save_ifs" | ||||
| 	$show "$cmd" | ||||
| @@ -4198,7 +4200,7 @@ relink_command=\"$relink_command\"" | ||||
| 	  # Do each command in the postinstall commands. | ||||
| 	  lib="$destdir/$realname" | ||||
| 	  eval cmds=\"$postinstall_cmds\" | ||||
| 	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
| 	  save_ifs="$IFS"; IFS='~' | ||||
| 	  for cmd in $cmds; do | ||||
| 	    IFS="$save_ifs" | ||||
| 	    $show "$cmd" | ||||
| @@ -4385,7 +4387,7 @@ relink_command=\"$relink_command\"" | ||||
|  | ||||
|       # Do each command in the postinstall commands. | ||||
|       eval cmds=\"$old_postinstall_cmds\" | ||||
|       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
|       save_ifs="$IFS"; IFS='~' | ||||
|       for cmd in $cmds; do | ||||
| 	IFS="$save_ifs" | ||||
| 	$show "$cmd" | ||||
| @@ -4423,7 +4425,7 @@ relink_command=\"$relink_command\"" | ||||
| 	if test -n "$finish_cmds"; then | ||||
| 	  # Do each command in the finish commands. | ||||
| 	  eval cmds=\"$finish_cmds\" | ||||
| 	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
| 	  save_ifs="$IFS"; IFS='~' | ||||
| 	  for cmd in $cmds; do | ||||
| 	    IFS="$save_ifs" | ||||
| 	    $show "$cmd" | ||||
| @@ -4699,7 +4701,7 @@ relink_command=\"$relink_command\"" | ||||
| 	    if test -n "$library_names"; then | ||||
| 	      # Do each command in the postuninstall commands. | ||||
| 	      eval cmds=\"$postuninstall_cmds\" | ||||
| 	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
| 	      save_ifs="$IFS"; IFS='~' | ||||
| 	      for cmd in $cmds; do | ||||
| 		IFS="$save_ifs" | ||||
| 		$show "$cmd" | ||||
| @@ -4714,7 +4716,7 @@ relink_command=\"$relink_command\"" | ||||
| 	    if test -n "$old_library"; then | ||||
| 	      # Do each command in the old_postuninstall commands. | ||||
| 	      eval cmds=\"$old_postuninstall_cmds\" | ||||
| 	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~' | ||||
| 	      save_ifs="$IFS"; IFS='~' | ||||
| 	      for cmd in $cmds; do | ||||
| 		IFS="$save_ifs" | ||||
| 		$show "$cmd" | ||||
|   | ||||
| @@ -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. | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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); | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 latest version can be downloaded from http://koblenz-net.de/~horn/export/ | ||||
| The current maintainer is Cris Bailiff <c.bailiff@devsecure.com> | ||||
|  | ||||
| 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 | ||||
|   | ||||
							
								
								
									
										125
									
								
								perl/Curl_easy/curlopt-constants.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								perl/Curl_easy/curlopt-constants.c
									
									
									
									
									
										Normal file
									
								
							| @@ -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': | ||||
| @@ -16,20 +16,30 @@ require AutoLoader; | ||||
| # Do not simply export all your public functions/methods/constants. | ||||
| @EXPORT = qw( | ||||
| CURLOPT_AUTOREFERER | ||||
| CURLOPT_CAINFO | ||||
| CURLOPT_CLOSEFUNCTION | ||||
| CURLOPT_CLOSEPOLICY | ||||
| CURLOPT_CONNECTTIMEOUT | ||||
| CURLOPT_COOKIE | ||||
| CURLOPT_COOKIEFILE | ||||
| CURLOPT_COOKIEJAR | ||||
| CURLOPT_CRLF | ||||
| CURLOPT_CUSTOMREQUEST | ||||
| CURLOPT_EGDSOCKET | ||||
| CURLOPT_ERRORBUFFER | ||||
| CURLOPT_FAILONERROR | ||||
| CURLOPT_FILE | ||||
| CURLOPT_FILETIME | ||||
| CURLOPT_FOLLOWLOCATION | ||||
| CURLOPT_FORBID_REUSE | ||||
| CURLOPT_FRESH_CONNECT | ||||
| CURLOPT_FTPAPPEND | ||||
| CURLOPT_FTPASCII | ||||
| CURLOPT_FTPLISTONLY | ||||
| CURLOPT_FTPPORT | ||||
| CURLOPT_HEADER | ||||
| CURLOPT_HEADERFUNCTION | ||||
| CURLOPT_HTTPGET | ||||
| CURLOPT_HTTPHEADER | ||||
| CURLOPT_HTTPPOST | ||||
| CURLOPT_HTTPPROXYTUNNEL | ||||
| @@ -40,6 +50,8 @@ CURLOPT_INTERFACE | ||||
| CURLOPT_KRB4LEVEL | ||||
| CURLOPT_LOW_SPEED_LIMIT | ||||
| CURLOPT_LOW_SPEED_TIME | ||||
| CURLOPT_MAXCONNECTS | ||||
| CURLOPT_MAXREDIRS | ||||
| CURLOPT_MUTE | ||||
| CURLOPT_NETRC | ||||
| CURLOPT_NOBODY | ||||
| @@ -59,6 +71,7 @@ CURLOPT_PROXYPORT | ||||
| CURLOPT_PROXYUSERPWD | ||||
| CURLOPT_PUT | ||||
| CURLOPT_QUOTE | ||||
| CURLOPT_RANDOM_FILE | ||||
| CURLOPT_RANGE | ||||
| CURLOPT_READFUNCTION | ||||
| CURLOPT_REFERER | ||||
| @@ -66,7 +79,11 @@ CURLOPT_RESUME_FROM | ||||
| CURLOPT_SSLCERT | ||||
| CURLOPT_SSLCERTPASSWD | ||||
| CURLOPT_SSLVERSION | ||||
| CURLOPT_SSL_CIPHER_LIST | ||||
| CURLOPT_SSL_VERIFYHOST | ||||
| CURLOPT_SSL_VERIFYPEER | ||||
| CURLOPT_STDERR | ||||
| CURLOPT_TELNETOPTIONS | ||||
| CURLOPT_TIMECONDITION | ||||
| CURLOPT_TIMEOUT | ||||
| CURLOPT_TIMEVALUE | ||||
| @@ -78,17 +95,7 @@ CURLOPT_USERPWD | ||||
| CURLOPT_VERBOSE | ||||
| CURLOPT_WRITEFUNCTION | ||||
| CURLOPT_WRITEHEADER | ||||
| CURLOPT_MAXREDIRS | ||||
| CURLOPT_FILETIME | ||||
| CURLOPT_TELNETOPTIONS | ||||
| CURLOPT_MAXCONNECTS | ||||
| CURLOPT_CLOSEPOLICY | ||||
| CURLOPT_CLOSEFUNCTION | ||||
| CURLOPT_FRESH_CONNECT | ||||
| CURLOPT_FORBID_REUSE | ||||
| CURLOPT_RANDOM_FILE | ||||
| CURLOPT_EGD_SOCKET | ||||
| CURLOPT_CONNECTTIMEOUT | ||||
| CURLOPT_WRITEINFO | ||||
|  | ||||
| CURLINFO_EFFECTIVE_URL | ||||
| CURLINFO_HTTP_CODE | ||||
| @@ -110,7 +117,7 @@ CURLINFO_CONTENT_LENGTH_UPLOAD | ||||
| USE_INTERNAL_VARS | ||||
| ); | ||||
|  | ||||
| $VERSION = '1.1.7'; | ||||
| $VERSION = '1.1.8'; | ||||
|  | ||||
| $Curl::easy::headers = ""; | ||||
| $Curl::easy::content = ""; | ||||
| @@ -133,25 +140,31 @@ bootstrap Curl::easy $VERSION; | ||||
| __END__ | ||||
| # Below is the stub of documentation for your module. You better edit it! | ||||
|  | ||||
| =pod  | ||||
|  | ||||
| =head1 NAME | ||||
|  | ||||
| Curl::easy - Perl extension for libcurl | ||||
|  | ||||
| =head1 SYNOPSIS | ||||
|  | ||||
|   use Curl::easy; | ||||
| 	use Curl::easy; | ||||
|   | ||||
|   $curl = Curl::easy::init(); | ||||
|   $CURLcode = Curl::easy::setopt($curl, CURLoption, Value); | ||||
|   $CURLcode = Curl::easy::perform($curl); | ||||
|   Curl::easy::cleanup($curl); | ||||
| 	$curl = Curl::easy::init(); | ||||
| 	$CURLcode = Curl::easy::setopt($curl, CURLoption, Value); | ||||
| 	$CURLcode = Curl::easy::perform($curl); | ||||
| 	Curl::easy::cleanup($curl); | ||||
|  | ||||
| 	Read curl_easy_setopt for details of most CURLoption values | ||||
|  | ||||
| =head1 DESCRIPTION  | ||||
|  | ||||
|  | ||||
|   | ||||
| =head1 DESCRIPTION | ||||
|   | ||||
| This perl module provides an interface to the libcurl C library. See | ||||
| B<Curl::easy> provides an interface to the libcurl C library. See | ||||
| http://curl.haxx.se/ for more information on cURL and libcurl. | ||||
|   | ||||
| =head1 FILES and CALLBACKS | ||||
|  | ||||
| =head2 FILES and CALLBACKS | ||||
|  | ||||
| Curl::easy supports the various options of curl_easy_setopt which require either a FILE * or | ||||
| a callback function. | ||||
| @@ -254,9 +267,11 @@ indicate an error. | ||||
|   | ||||
| Georg Horn <horn@koblenz-net.de> | ||||
|   | ||||
| Additional callback,pod and test work by Cris Bailiff <c.bailiff@devsecure.com> | ||||
| Additional callback, pod and test work by Cris Bailiff <c.bailiff@devsecure.com> | ||||
| and Forrest Cahoon <forrest.cahoon@merrillcorp.com> | ||||
|  | ||||
| Currently maintained by Cris Bailiff <c.bailiff@devsecure.com> | ||||
|  | ||||
| =head1 Copyright | ||||
|  | ||||
| Copyright (C) 2000, Daniel Stenberg, , et al. | ||||
|   | ||||
| @@ -437,123 +437,7 @@ constant(char *name, int arg) | ||||
|     if (strncmp(name, "CURLOPT_", 8) == 0) { | ||||
| 	name += 8; | ||||
| 	switch (*name) { | ||||
| 	case 'A': | ||||
| 	case 'B': | ||||
| 	    if (strEQ(name, "AUTOREFERER")) return CURLOPT_AUTOREFERER; | ||||
| 	    break; | ||||
| 	case 'C': | ||||
| 	    if (strEQ(name, "CONNECTTIMEOUT")) return CURLOPT_CONNECTTIMEOUT; | ||||
| 	    if (strEQ(name, "COOKIE")) return CURLOPT_COOKIE; | ||||
| 	    if (strEQ(name, "COOKIEFILE")) return CURLOPT_COOKIEFILE; | ||||
| 	    if (strEQ(name, "CLOSEFUNCTION")) return CURLOPT_CLOSEFUNCTION; | ||||
| 	    if (strEQ(name, "CLOSEPOLICY")) return CURLOPT_CLOSEPOLICY; | ||||
| 	    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, "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; | ||||
| 	    if (strEQ(name, "FRESH_CONNECT")) return CURLOPT_FRESH_CONNECT; | ||||
| 	    break; | ||||
| 	case 'G': | ||||
| 	case 'H': | ||||
| 	    if (strEQ(name, "HEADER")) return CURLOPT_HEADER; | ||||
|             if (strEQ(name, "HEADERFUNCTION")) return CURLOPT_HEADERFUNCTION; | ||||
| 	    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': | ||||
| 	case 'J': | ||||
| 	    if (strEQ(name, "INFILE")) return CURLOPT_INFILE; | ||||
| 	    if (strEQ(name, "INFILESIZE")) return CURLOPT_INFILESIZE; | ||||
| 	    if (strEQ(name, "INTERFACE")) return CURLOPT_INTERFACE; | ||||
| 	    break; | ||||
| 	case 'K': | ||||
| 	case 'L': | ||||
| 	    if (strEQ(name, "KRB4LEVEL")) return CURLOPT_KRB4LEVEL; | ||||
| 	    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; | ||||
| 	    break; | ||||
| 	case 'N': | ||||
| 	    if (strEQ(name, "MUTE")) return CURLOPT_MUTE; | ||||
| 	    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, "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': | ||||
| 	case 'V': | ||||
| 	    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; | ||||
| 	    if (strEQ(name, "VERBOSE")) return CURLOPT_VERBOSE; | ||||
| 	    break; | ||||
| 	case 'W': | ||||
| 	case 'X': | ||||
| 	case 'Y': | ||||
| 	case 'Z': | ||||
| 	    if (strEQ(name, "WRITEFUNCTION")) return CURLOPT_WRITEFUNCTION; | ||||
| 	    if (strEQ(name, "WRITEHEADER")) return CURLOPT_WRITEHEADER; | ||||
| 	    if (strEQ(name, "WRITEINFO")) return CURLOPT_WRITEINFO; | ||||
| 	    break; | ||||
| #include "curlopt-constants.c" | ||||
| 	} | ||||
|     } | ||||
|     if (strEQ(name, "USE_INTERNAL_VARS")) return USE_INTERNAL_VARS; | ||||
|   | ||||
							
								
								
									
										48
									
								
								perl/Curl_easy/examples/basicfirst.pl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								perl/Curl_easy/examples/basicfirst.pl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| use strict; | ||||
| use Curl::easy; | ||||
|  | ||||
| my $url = "http://curl.haxx.se/dev/"; | ||||
|  | ||||
| print "Testing curl version ",&Curl::easy::version(),"\n"; | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl= Curl::easy::init(); | ||||
| if(!$curl) { | ||||
|     die "curl init failed!\n"; | ||||
| } | ||||
|  | ||||
| # Follow location headers | ||||
|  Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
|  | ||||
| # Add some additional headers to the http-request: | ||||
| my @myheaders; | ||||
| $myheaders[0] = "I-am-a-silly-programmer: yes indeed you are"; | ||||
| $myheaders[1] = "User-Agent: Perl interface for libcURL"; | ||||
|  Curl::easy::setopt($curl, Curl::easy::CURLOPT_HTTPHEADER, \@myheaders); | ||||
|                                                                          | ||||
| my $errbuf; | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_URL, $url); | ||||
|  | ||||
| sub body_callback { | ||||
|     my ($chunk,$handle)=@_; | ||||
|     push @$handle, $chunk; | ||||
|     return length($chunk); # OK | ||||
| } | ||||
|  Curl::easy::setopt($curl, CURLOPT_WRITEFUNCTION, \&body_callback); | ||||
|  | ||||
| my @body; | ||||
|  Curl::easy::setopt($curl, CURLOPT_FILE, \@body); | ||||
|  | ||||
| if (Curl::easy::perform($curl) != 0) { | ||||
|     print "Failed :$errbuf\n"; | ||||
| }; | ||||
|  | ||||
| # Cleanup | ||||
|  Curl::easy::cleanup($curl); | ||||
|  | ||||
| print @body; | ||||
							
								
								
									
										38
									
								
								perl/Curl_easy/t/00constants.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								perl/Curl_easy/t/00constants.t
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
|  | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make test'. After `make install' it should work as `perl thisfile.t' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| # (It may become useful if the test is moved to ./t subdirectory.) | ||||
| use Benchmark; | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..2\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################## End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| my $count=1; | ||||
|  | ||||
| print STDERR "Testing curl version ",&Curl::easy::version(),"\n"; | ||||
|  | ||||
| if (CURLOPT_URL != 10000+2) { | ||||
| 	print "not "; | ||||
| }  | ||||
|  | ||||
| print "ok ".++$count; | ||||
|  | ||||
| exit; | ||||
							
								
								
									
										93
									
								
								perl/Curl_easy/t/01basic.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								perl/Curl_easy/t/01basic.t
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,93 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make t/thisfile.t'. After `make install' it should work as `perl thisfile.t' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..6\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################### End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| my $count=1; | ||||
|  | ||||
| # Read URL to get | ||||
| my $defurl = "http://localhost/cgi-bin/printenv"; | ||||
| my $url; | ||||
| if (defined ($ENV{CURL_TEST_URL})) { | ||||
| 	$url=$ENV{CURL_TEST_URL}; | ||||
| } else { | ||||
| $url = ""; | ||||
| print "Please enter an URL to fetch [$defurl]: "; | ||||
| $url = <STDIN>; | ||||
| if ($url =~ /^\s*\n/) { | ||||
|     $url = $defurl; | ||||
| } | ||||
| } | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl = Curl::easy::init(); | ||||
| if ($curl == 0) { | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_MUTE, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30); | ||||
|  | ||||
| open HEAD, ">head.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEHEADER, *HEAD); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| open BODY, ">body.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_FILE,*BODY); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| my $errbuf; | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_URL, $url); | ||||
|  | ||||
| print "ok ".++$count."\n"; | ||||
| # Add some additional headers to the http-request: | ||||
| my @myheaders; | ||||
| $myheaders[0] = "Server: www"; | ||||
| $myheaders[1] = "User-Agent: Perl interface for libcURL"; | ||||
| Curl::easy::setopt($curl, CURLOPT_HTTPHEADER, \@myheaders); | ||||
|                                                                          | ||||
| my $bytes; | ||||
| my $realurl; | ||||
| my $httpcode; | ||||
|  | ||||
| # Go get it | ||||
| my $retcode=Curl::easy::perform($curl); | ||||
| if ($retcode == 0) { | ||||
|     Curl::easy::getinfo($curl, CURLINFO_SIZE_DOWNLOAD, $bytes); | ||||
|     print STDERR "$bytes bytes read "; | ||||
|     Curl::easy::getinfo($curl, CURLINFO_EFFECTIVE_URL, $realurl); | ||||
|     Curl::easy::getinfo($curl, CURLINFO_HTTP_CODE, $httpcode); | ||||
|     print STDERR "effective fetched url (http code: $httpcode) was: $url "; | ||||
| } else { | ||||
|    # We can acces the error message in $errbuf here | ||||
|     print STDERR "$retcode / '$errbuf'\n"; | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| exit; | ||||
							
								
								
									
										89
									
								
								perl/Curl_easy/t/02header-callback.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								perl/Curl_easy/t/02header-callback.t
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,89 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make t/thisfile.t'. After `make install' it should work as `perl thisfile.t' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..9\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################### End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| my $count=1; | ||||
|  | ||||
| # Read URL to get | ||||
| my $defurl = "http://localhost/cgi-bin/printenv"; | ||||
| my $url; | ||||
| if (defined ($ENV{CURL_TEST_URL})) { | ||||
| 	$url=$ENV{CURL_TEST_URL}; | ||||
| } else { | ||||
| $url = ""; | ||||
| print "Please enter an URL to fetch [$defurl]: "; | ||||
| $url = <STDIN>; | ||||
| if ($url =~ /^\s*\n/) { | ||||
|     $url = $defurl; | ||||
| } | ||||
| } | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl = Curl::easy::init(); | ||||
| if ($curl == 0) { | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_MUTE, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30); | ||||
|  | ||||
| open HEAD, ">head.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEHEADER, *HEAD); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| open BODY, ">body.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_FILE,*BODY); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| my $errbuf; | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_URL, $url); | ||||
|  | ||||
| print "ok ".++$count."\n"; | ||||
| # The header callback will only be called if your libcurl has the | ||||
| # CURLOPT_HEADERFUNCTION supported, otherwise your headers | ||||
| # go to CURLOPT_WRITEFUNCTION instead... | ||||
| # | ||||
|  | ||||
| my $header_called=0; | ||||
| sub header_callback { print STDERR "header callback called\n"; $header_called=1; return length($_[0])}; | ||||
|  | ||||
| # test for sub reference and head callback | ||||
| Curl::easy::setopt($curl, CURLOPT_HEADERFUNCTION, \&header_callback); | ||||
| print "ok ".++$count."\n";                 | ||||
|  | ||||
| if (Curl::easy::perform($curl) != 0) { | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok ".++$count."\n";                 | ||||
|  | ||||
| print STDERR "next test will fail on libcurl < 7.7.2\n"; | ||||
| print "not " if (!$header_called); # ok if you have a libcurl <7.7.2 | ||||
| print "ok ".++$count."\n";                 | ||||
|  | ||||
| exit; | ||||
							
								
								
									
										105
									
								
								perl/Curl_easy/t/03body-callback.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								perl/Curl_easy/t/03body-callback.t
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,105 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make t/thisfile.t'. After `make install' it should work as `perl thisfile.t' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..9\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################### End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| my $count=1; | ||||
|  | ||||
| # Read URL to get | ||||
| my $defurl = "http://localhost/cgi-bin/printenv"; | ||||
| my $url; | ||||
| if (defined ($ENV{CURL_TEST_URL})) { | ||||
| 	$url=$ENV{CURL_TEST_URL}; | ||||
| } else { | ||||
| $url = ""; | ||||
| print "Please enter an URL to fetch [$defurl]: "; | ||||
| $url = <STDIN>; | ||||
| if ($url =~ /^\s*\n/) { | ||||
|     $url = $defurl; | ||||
| } | ||||
| } | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl = Curl::easy::init(); | ||||
| if ($curl == 0) { | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_MUTE, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30); | ||||
|  | ||||
| open HEAD, ">head.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEHEADER, *HEAD); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| open BODY, ">body.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_FILE,*BODY); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| my $errbuf; | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_URL, $url); | ||||
|  | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| # The header callback will only be called if your libcurl has the | ||||
| # CURLOPT_HEADERFUNCTION supported, otherwise your headers | ||||
| # go to CURLOPT_WRITEFUNCTION instead... | ||||
| # | ||||
|  | ||||
| my $header_called=0; | ||||
| sub header_callback { print STDERR "header callback called\n"; $header_called=1; return length($_[0])}; | ||||
|  | ||||
| # test for sub reference and head callback | ||||
| Curl::easy::setopt($curl, CURLOPT_HEADERFUNCTION, \&header_callback); | ||||
|  | ||||
| my $body_called=0; | ||||
| sub body_callback { | ||||
| 	my ($chunk,$handle)=@_; | ||||
| 	print STDERR "body callback called with ",length($chunk)," bytes\n"; | ||||
| 	print STDERR "data=$chunk\n"; | ||||
| 	$body_called++; | ||||
| 	return length($chunk); # OK | ||||
| } | ||||
|  | ||||
|  | ||||
| # test for ref to sub and body callback | ||||
| my $body_ref=\&body_callback; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEFUNCTION, $body_ref); | ||||
|  | ||||
| if (Curl::easy::perform($curl) != 0) { | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
|  | ||||
| print STDERR "next test will fail on libcurl < 7.7.2\n"; | ||||
| print STDERR "not " if (!$header_called); # ok if you have a libcurl <7.7.2 | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| print "not " if (!$body_called); | ||||
| print "ok ".++$count."\n"; | ||||
							
								
								
									
										87
									
								
								perl/Curl_easy/t/04abort-test.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								perl/Curl_easy/t/04abort-test.t
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,87 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make t/thisfile.t'. After `make install' it should work as `perl thisfile.t' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..8\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################### End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| my $count=1; | ||||
|  | ||||
| # Read URL to get | ||||
| my $defurl = "http://localhost/cgi-bin/printenv"; | ||||
| my $url; | ||||
| if (defined ($ENV{CURL_TEST_URL})) { | ||||
| 	$url=$ENV{CURL_TEST_URL}; | ||||
| } else { | ||||
| $url = ""; | ||||
| print "Please enter an URL to fetch [$defurl]: "; | ||||
| $url = <STDIN>; | ||||
| if ($url =~ /^\s*\n/) { | ||||
|     $url = $defurl; | ||||
| } | ||||
| } | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl = Curl::easy::init(); | ||||
| if ($curl == 0) { | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_MUTE, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30); | ||||
|  | ||||
| open HEAD, ">head.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEHEADER, *HEAD); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| open BODY, ">body.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_FILE,*BODY); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| my $errbuf; | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_URL, $url); | ||||
|  | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| my $body_abort_called=0; | ||||
| sub body_abort_callback { | ||||
| 	my ($chunk,$sv)=@_; | ||||
| 	print STDERR "body abort callback called with ",length($chunk)," bytes\n"; | ||||
| 	$body_abort_called++; | ||||
| 	return  -1; # signal a failure | ||||
| } | ||||
|  | ||||
| # test we can abort a request mid-way | ||||
| my $body_abort_ref=\&body_abort_callback; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEFUNCTION, $body_abort_ref); | ||||
|  | ||||
| if (Curl::easy::perform($curl) == 0) { # reverse test - this should have failed | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| print "not " if (!$body_abort_called); # should have been called | ||||
| print "ok ".++$count."\n"; | ||||
							
								
								
									
										99
									
								
								perl/Curl_easy/t/05progress.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								perl/Curl_easy/t/05progress.t
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,99 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make t/thisfile.t'. After `make install' it should work as `perl thisfile.t' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..9\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################### End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| my $count=1; | ||||
|  | ||||
| # Read URL to get | ||||
| my $defurl = "http://localhost/cgi-bin/printenv"; | ||||
| my $url; | ||||
| if (defined ($ENV{CURL_TEST_URL})) { | ||||
| 	$url=$ENV{CURL_TEST_URL}; | ||||
| } else { | ||||
| $url = ""; | ||||
| print "Please enter an URL to fetch [$defurl]: "; | ||||
| $url = <STDIN>; | ||||
| if ($url =~ /^\s*\n/) { | ||||
|     $url = $defurl; | ||||
| } | ||||
| } | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl = Curl::easy::init(); | ||||
| if ($curl == 0) { | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_MUTE, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30); | ||||
|  | ||||
| open HEAD, ">head.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEHEADER, *HEAD); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| open BODY, ">body.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_FILE,*BODY); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| my $errbuf; | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_URL, $url); | ||||
|  | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 0); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| # inline progress function | ||||
| # tests for inline subs and progress callback | ||||
| # - progress callback must return 'true' on each call. | ||||
|   | ||||
| my $progress_called=0; | ||||
| sub prog_callb | ||||
| { | ||||
|     my ($clientp,$dltotal,$dlnow,$ultotal,$ulnow)=@_; | ||||
|     print STDERR "\nperl progress_callback has been called!\n"; | ||||
|     print STDERR "clientp: $clientp, dltotal: $dltotal, dlnow: $dlnow, ultotal: $ultotal, "; | ||||
|     print STDERR "ulnow: $ulnow\n"; | ||||
| 	$progress_called++; | ||||
|     return 0; | ||||
| }                         | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_PROGRESSFUNCTION, \&prog_callb); | ||||
|  | ||||
| # Turn progress meter back on - this doesn't work in older libcurls -  once its off, its off. | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 0); | ||||
|  | ||||
| if (Curl::easy::perform($curl) != 0) { | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| print "not " if (!$progress_called); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
							
								
								
									
										99
									
								
								perl/Curl_easy/t/06http-post.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								perl/Curl_easy/t/06http-post.t
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,99 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make t/thisfile.t'. After `make install' it should work as `perl thisfile.t' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..7\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################### End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| my $count=1; | ||||
|  | ||||
| # Read URL to get | ||||
| my $defurl = "http://localhost/cgi-bin/printenv"; | ||||
| my $url; | ||||
| if (defined ($ENV{CURL_TEST_URL})) { | ||||
| 	$url=$ENV{CURL_TEST_URL}; | ||||
| } else { | ||||
| $url = ""; | ||||
| print "Please enter an URL to fetch [$defurl]: "; | ||||
| $url = <STDIN>; | ||||
| if ($url =~ /^\s*\n/) { | ||||
|     $url = $defurl; | ||||
| } | ||||
| } | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl = Curl::easy::init(); | ||||
| if ($curl == 0) { | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_MUTE, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30); | ||||
|  | ||||
| open HEAD, ">head.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEHEADER, *HEAD); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| open BODY, ">body.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_FILE,*BODY); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| my $errbuf; | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, 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::easy::setopt($curl,CURLOPT_READFUNCTION,\&read_callb); | ||||
| Curl::easy::setopt($curl,CURLOPT_INFILESIZE,$read_max ); | ||||
| Curl::easy::setopt($curl,CURLOPT_UPLOAD,1 ); | ||||
| Curl::easy::setopt($curl,CURLOPT_CUSTOMREQUEST,"POST" ); | ||||
|                                                         | ||||
| if (Curl::easy::perform($curl) != 0) { | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok ".++$count."\n"; | ||||
							
								
								
									
										129
									
								
								perl/Curl_easy/t/07ftp-upload.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								perl/Curl_easy/t/07ftp-upload.t
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,129 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make t/thisfile.t'. After `make install' it should work as `perl thisfile.t' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..10\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################### End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| my $count=1; | ||||
|  | ||||
| # Read URL to get | ||||
| my $defurl = "ftp://user\@localhost//tmp/blah"; | ||||
| my $url; | ||||
| if (defined ($ENV{CURL_TEST_URL_FTP})) { | ||||
| 	$url=$ENV{CURL_TEST_URL_FTP}; | ||||
| };# else { | ||||
| #$url = ""; | ||||
| #print "Please enter an URL to fetch [$defurl]: "; | ||||
| #$url = <STDIN>; | ||||
| #if ($url =~ /^\s*\n/) { | ||||
|     $url = $defurl; | ||||
| #} | ||||
| #} | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl = Curl::easy::init(); | ||||
| if ($curl == 0) { | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_MUTE, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30); | ||||
|  | ||||
| open HEAD, ">head.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEHEADER, *HEAD); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| open BODY, ">body.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_FILE,*BODY); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| my $errbuf; | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_URL, $url); | ||||
|  | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| sub passwd_callb | ||||
| { | ||||
|     my ($clientp,$prompt,$buflen)=@_; | ||||
|     print STDERR "\nperl passwd_callback has been called!\n"; | ||||
|     print STDERR "clientp: $clientp, prompt: $prompt, buflen: $buflen\n"; | ||||
|     print STDERR "\nEnter max $buflen characters for $prompt "; | ||||
|     my $data = <STDIN>; | ||||
|     chomp($data); | ||||
|     return (0,$data); | ||||
| }                                                          | ||||
|  | ||||
| # Now do an ftp upload: | ||||
|  | ||||
|  | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_UPLOAD, 1); | ||||
|  | ||||
|  | ||||
| my $read_max=1000; | ||||
| Curl::easy::setopt($curl,CURLOPT_INFILESIZE,$read_max );    | ||||
| print "ok ".++$count."\n"; | ||||
|   | ||||
| sub read_callb | ||||
| { | ||||
|     my ($maxlen,$sv)=@_; | ||||
|     print STDERR "\nperl read_callback has been called!\n"; | ||||
|     print STDERR "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 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 ""; | ||||
|         } | ||||
| } | ||||
|                 | ||||
| # Use perl read callback to read data to be uploaded | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_READFUNCTION, \&read_callb); | ||||
|  | ||||
| # Use perl passwd callback to read password for login to ftp server | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_PASSWDFUNCTION, \&passwd_callb); | ||||
|  | ||||
| print "ok ".++$count."\n"; | ||||
| my $bytes; | ||||
|  | ||||
| # Go get it | ||||
| if (Curl::easy::perform($curl) == 0) { | ||||
|     Curl::easy::getinfo($curl, Curl::easy::CURLINFO_SIZE_UPLOAD, $bytes); | ||||
|     print STDERR "$bytes bytes transferred\n"; | ||||
| } else { | ||||
|     # We can acces the error message in $errbuf here | ||||
|     print STDERR "'$errbuf'\n"; | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| # Cleanup | ||||
| Curl::easy::cleanup($curl); | ||||
| print "ok ".++$count."\n"; | ||||
							
								
								
									
										98
									
								
								perl/Curl_easy/t/08ssl.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								perl/Curl_easy/t/08ssl.t
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,98 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make t/thisfile.t'. After `make install' it should work as `perl thisfile.t' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..20\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################### End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| my $count=1; | ||||
|  | ||||
| # list of tests | ||||
| # 	site-url,         verifypeer(0,1),  verifyhost(0,2), result(0=ok, 1=fail) | ||||
| my $url_list=[ | ||||
| 	[ 'https://216.168.252.86/',  0, 0, 0 ], # www.awayweb.com | ||||
| 	[ 'https://216.168.252.86/',  0, 2, 1 ], # www.awayweb.com | ||||
| 	[ 'https://www.verisign.com/', 0, 0, 0 ], | ||||
| 	[ 'https://www.verisign.com/', 0, 2, 0 ], | ||||
| 	[ 'https://www.verisign.com/', 1, 2, 0 ], # these fail on openssl0.9.5 - unknown sig | ||||
| 	[ 'https://www.verisign.com/', 1, 2, 0 ], # these fail on openssl0.9.5 - unknown sig | ||||
| 	[ 'https://lc2.law13.hotmail.passport.com/', 0, 0, 0 ], | ||||
| 	[ 'https://lc2.law13.hotmail.passport.com/', 0, 2, 0 ], | ||||
| 	[ 'https://lc2.law13.hotmail.passport.com/', 1, 2, 0 ], # fail on 0.9.5 | ||||
| 	[ 'https://lc2.law13.hotmail.passport.com/', 1, 2, 0 ], # fail on 0.9.5 | ||||
| 	[ 'https://www.modssl.org/',  0, 0, 0 ], | ||||
| 	[ 'https://www.modssl.org/',  0, 2, 0 ], | ||||
| 	[ 'https://www.modssl.org/',  1, 0, 1 ], | ||||
| 	[ 'https://www.modssl.org/',  1, 2, 1 ], | ||||
| ]; | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl = Curl::easy::init(); | ||||
| if ($curl == 0) { | ||||
|     print "not "; | ||||
| } | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_MUTE, 0); | ||||
| #Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
| Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30); | ||||
|  | ||||
| my @myheaders; | ||||
| $myheaders[1] = "User-Agent: Verifying SSL functions in perl interface for libcURL"; | ||||
| Curl::easy::setopt($curl, CURLOPT_HTTPHEADER, \@myheaders); | ||||
|                                                                                         | ||||
| open HEAD, ">head.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEHEADER, *HEAD); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| open BODY, ">body.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_FILE,*BODY); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| my $errbuf; | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
| print "ok ".++$count."\n"; | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_FORBID_REUSE, 1); | ||||
|  | ||||
|  | ||||
| print "ok ".++$count."\n"; | ||||
| Curl::easy::setopt($curl, CURLOPT_CAINFO,"ca-bundle.crt");                        | ||||
|  | ||||
| foreach my $test_list (@$url_list) { | ||||
|     my ($url,$verifypeer,$verifyhost,$result)=@{$test_list}; | ||||
|     print STDERR "testing $url verify=$verifypeer at level $verifyhost expect ".($result?"fail":"pass")."\n"; | ||||
|  | ||||
|     Curl::easy::setopt($curl, CURLOPT_SSL_VERIFYPEER,$verifypeer); # do verify  | ||||
|     Curl::easy::setopt($curl, CURLOPT_SSL_VERIFYHOST,$verifyhost); # check name | ||||
|     my $retcode; | ||||
|  | ||||
|     Curl::easy::setopt($curl, CURLOPT_URL, $url); | ||||
|  | ||||
|     $retcode=Curl::easy::perform($curl); | ||||
|     if ( ($retcode != 0) != $result) { | ||||
|   	print STDERR "error $retcode $errbuf\n"; | ||||
| 	print "not "; | ||||
|     }; | ||||
|     print "ok ".++$count."\n"; | ||||
|  | ||||
| } | ||||
							
								
								
									
										2
									
								
								perl/Curl_easy/t/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								perl/Curl_easy/t/Makefile.am
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| EXTRA_DIST = 00constants.t 01basic.t 02header-callback.t 03body-callback.t\ | ||||
| 04abort-test.t 05progress.t 06http-post.t 07ftp-upload.t 08ssl.t | ||||
| @@ -1,321 +0,0 @@ | ||||
| # Test script for Perl extension Curl::easy. | ||||
| # Check out the file README for more info. | ||||
|  | ||||
| # Before `make install' is performed this script should be runnable with | ||||
| # `make test'. After `make install' it should work as `perl test.pl' | ||||
|  | ||||
| ######################### We start with some black magic to print on failure. | ||||
|  | ||||
| # Change 1..1 below to 1..last_test_to_print . | ||||
| # (It may become useful if the test is moved to ./t subdirectory.) | ||||
| use Benchmark; | ||||
| use strict; | ||||
|  | ||||
| BEGIN { $| = 1; print "1..13\n"; } | ||||
| END {print "not ok 1\n" unless $::loaded;} | ||||
| use Curl::easy; | ||||
|  | ||||
| $::loaded = 1; | ||||
| print "ok 1\n"; | ||||
|  | ||||
| ######################### End of black magic. | ||||
|  | ||||
| # Insert your test code below (better if it prints "ok 13" | ||||
| # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||
| # of the test code): | ||||
|  | ||||
| print "Testing curl version ",&Curl::easy::version(),"\n"; | ||||
|  | ||||
| # Read URL to get | ||||
| my $defurl = "http://localhost/cgi-bin/printenv"; | ||||
| my $url = ""; | ||||
| print "Please enter an URL to fetch [$defurl]: "; | ||||
| $url = <STDIN>; | ||||
| if ($url =~ /^\s*\n/) { | ||||
|     $url = $defurl; | ||||
| } | ||||
|  | ||||
| # Init the curl session | ||||
| my $curl; | ||||
| if (($curl = Curl::easy::init()) != 0) { | ||||
|     print "ok 2\n"; | ||||
| } else { | ||||
|     print "ko 2\n"; | ||||
| } | ||||
|  | ||||
|  | ||||
| # No progress meter please | ||||
| # !! Need this on for all tests, as once disabled, can't re-enable it... | ||||
| #Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1); | ||||
|  | ||||
| # Shut up completely | ||||
| Curl::easy::setopt($curl, CURLOPT_MUTE, 1); | ||||
|  | ||||
| # Follow location headers | ||||
| Curl::easy::setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||||
|  | ||||
| # Set timeout | ||||
| Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30); | ||||
|  | ||||
| # Set file where to read cookies from | ||||
| Curl::easy::setopt($curl, CURLOPT_COOKIEFILE, "cookies"); | ||||
|  | ||||
| # Set file where to store the header | ||||
| open HEAD, ">head.out"; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEHEADER, *HEAD); | ||||
| print "ok 3\n"; | ||||
|  | ||||
| # Set file where to store the body | ||||
| # Send body to stdout - test difference between FILE * and SV * | ||||
| #open BODY, ">body.out"; | ||||
| #Curl::easy::setopt($curl, CURLOPT_FILE,*BODY); | ||||
| print "ok 4\n"; | ||||
|  | ||||
| # Add some additional headers to the http-request: | ||||
| my @myheaders; | ||||
| $myheaders[0] = "Server: www"; | ||||
| $myheaders[1] = "User-Agent: Perl interface for libcURL"; | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_HTTPHEADER, \@myheaders); | ||||
|                                                                          | ||||
| # Store error messages in variable $errbuf | ||||
| # NOTE: The name of the variable is passed as a string! | ||||
| # setopt() creates a perl variable with that name, and | ||||
| # perform() stores the errormessage into it if an error occurs. | ||||
|   | ||||
| Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "errbuf"); | ||||
| Curl::easy::setopt($curl, CURLOPT_URL, $url); | ||||
| print "ok 5\n"; | ||||
|  | ||||
| my $bytes; | ||||
| my $realurl; | ||||
| my $httpcode; | ||||
| my $errbuf; | ||||
|  | ||||
| # Go get it | ||||
| if (Curl::easy::perform($curl) == 0) { | ||||
|     Curl::easy::getinfo($curl, CURLINFO_SIZE_DOWNLOAD, $bytes); | ||||
|     print "ok 6: $bytes bytes read\n"; | ||||
|     Curl::easy::getinfo($curl, CURLINFO_EFFECTIVE_URL, $realurl); | ||||
|     Curl::easy::getinfo($curl, CURLINFO_HTTP_CODE, $httpcode); | ||||
|     print "effective fetched url (http code: $httpcode) was: $url\n"; | ||||
| } else { | ||||
|    # We can acces the error message in $errbuf here | ||||
|     print "not ok 6: '$errbuf'\n"; | ||||
| 	die "basic url access failed"; | ||||
| } | ||||
|  | ||||
| # cleanup | ||||
| #close HEAD; | ||||
| # test here - BODY is still expected to be the output | ||||
| # Curl-easy-1.0.2.pm core dumps if we 'perform' with a closed output FD... | ||||
| #close BODY; | ||||
| #exit; | ||||
| # | ||||
| # The header callback will only be called if your libcurl has the | ||||
| # CURLOPT_HEADERFUNCTION supported, otherwise your headers | ||||
| # go to CURLOPT_WRITEFUNCTION instead... | ||||
| # | ||||
|  | ||||
| my $header_called=0; | ||||
| sub header_callback { print "header callback called\n"; $header_called=1; return length($_[0])}; | ||||
|  | ||||
| # test for sub reference and head callback | ||||
| Curl::easy::setopt($curl, CURLOPT_HEADERFUNCTION, \&header_callback); | ||||
| print "ok 7\n"; # so far so good | ||||
|  | ||||
| if (Curl::easy::perform($curl) != 0) { | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok 8\n"; | ||||
|  | ||||
| print "next test will fail on libcurl < 7.7.2\n"; | ||||
| print "not " if (!$header_called); # ok if you have a libcurl <7.7.2 | ||||
| print "ok 9\n"; | ||||
|  | ||||
| my $body_called=0; | ||||
| sub body_callback { | ||||
| 	my ($chunk,$handle)=@_; | ||||
| 	print "body callback called with ",length($chunk)," bytes\n"; | ||||
| 	print "data=$chunk\n"; | ||||
| 	$body_called++; | ||||
| 	return length($chunk); # OK | ||||
| } | ||||
|  | ||||
| # test for ref to sub and body callback | ||||
| my $body_ref=\&body_callback; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEFUNCTION, $body_ref); | ||||
|  | ||||
| if (Curl::easy::perform($curl) != 0) { | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok 10\n"; | ||||
|  | ||||
| print "not " if (!$body_called); | ||||
| print "ok 11\n"; | ||||
|  | ||||
| my $body_abort_called=0; | ||||
| sub body_abort_callback { | ||||
| 	my ($chunk,$sv)=@_; | ||||
| 	print "body abort callback called with ",length($chunk)," bytes\n"; | ||||
| 	$body_abort_called++; | ||||
| 	return  -1; # signal a failure | ||||
| } | ||||
|  | ||||
| # test we can abort a request mid-way | ||||
| my $body_abort_ref=\&body_abort_callback; | ||||
| Curl::easy::setopt($curl, CURLOPT_WRITEFUNCTION, $body_abort_ref); | ||||
|  | ||||
| if (Curl::easy::perform($curl) == 0) { # reverse test - this should have failed | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok 12\n"; | ||||
|  | ||||
| print "not " if (!$body_abort_called); # should have been called | ||||
| print "ok 13\n"; | ||||
|  | ||||
| # reset to a working 'write' function for next tests | ||||
| Curl::easy::setopt($curl,CURLOPT_WRITEFUNCTION, sub { return length($_[0])} ); | ||||
|  | ||||
| # inline progress function | ||||
| # tests for inline subs and progress callback | ||||
| # - progress callback must return 'true' on each call. | ||||
|   | ||||
| my $progress_called=0; | ||||
| sub prog_callb | ||||
| { | ||||
|     my ($clientp,$dltotal,$dlnow,$ultotal,$ulnow)=@_; | ||||
|     print "\nperl progress_callback has been called!\n"; | ||||
|     print "clientp: $clientp, dltotal: $dltotal, dlnow: $dlnow, ultotal: $ultotal, "; | ||||
|     print "ulnow: $ulnow\n"; | ||||
| 	$progress_called++; | ||||
|     return 0; | ||||
| }                         | ||||
|  | ||||
| Curl::easy::setopt($curl, CURLOPT_PROGRESSFUNCTION, \&prog_callb); | ||||
|  | ||||
| # Turn progress meter back on - this doesn't work - once its off, its off. | ||||
| Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 0); | ||||
|  | ||||
| if (Curl::easy::perform($curl) != 0) { | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok 14\n"; | ||||
|  | ||||
| print "not " if (!$progress_called); | ||||
| print "ok 15\n"; | ||||
|  | ||||
| my $read_max=10; | ||||
|  | ||||
| sub read_callb | ||||
| { | ||||
|     my ($maxlen,$sv)=@_; | ||||
|     print "\nperl read_callback has been called!\n"; | ||||
|     print "max data size: $maxlen\n"; | ||||
| 	print "(upload needs $read_max bytes)\n"; | ||||
|     print "context: ".$sv."\n"; | ||||
| 	if ($read_max > 0) { | ||||
| 		print "\nEnter max ", $read_max, " characters to be uploaded.\n"; | ||||
| 		my $data = <STDIN>; | ||||
| 		chomp $data; | ||||
| 		$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::easy::setopt($curl,CURLOPT_READFUNCTION,\&read_callb); | ||||
| Curl::easy::setopt($curl,CURLOPT_INFILESIZE,$read_max ); | ||||
| Curl::easy::setopt($curl,CURLOPT_UPLOAD,1 ); | ||||
| Curl::easy::setopt($curl,CURLOPT_CUSTOMREQUEST,"POST" ); | ||||
|                                                         | ||||
| if (Curl::easy::perform($curl) != 0) { | ||||
| 	print "not "; | ||||
| }; | ||||
| print "ok 16\n"; | ||||
|  | ||||
| sub passwd_callb | ||||
| { | ||||
|     my ($clientp,$prompt,$buflen)=@_; | ||||
|     print "\nperl passwd_callback has been called!\n"; | ||||
|     print "clientp: $clientp, prompt: $prompt, buflen: $buflen\n"; | ||||
|     print "\nEnter max $buflen characters for $prompt "; | ||||
|     my $data = <STDIN>; | ||||
|     chomp($data); | ||||
|     return (0,$data); | ||||
| }                                                          | ||||
|  | ||||
| Curl::easy::cleanup($curl); | ||||
|  | ||||
| # Now do an ftp upload: | ||||
|  | ||||
| $defurl = "ftp://horn\@localhost//tmp/bla"; | ||||
| print "\n\nPlease enter an URL for ftp upload [$defurl]: "; | ||||
| $url = <STDIN>; | ||||
| if ($url =~ /^\s*\n/) { | ||||
|     $url = $defurl; | ||||
| } | ||||
|  | ||||
| # Init the curl session | ||||
| if (($curl = Curl::easy::init()) != 0) { | ||||
|     print "ok 17\n"; | ||||
| } else { | ||||
|     print "not ok 17\n"; | ||||
| } | ||||
|  | ||||
| # Set URL to get | ||||
| if (Curl::easy::setopt($curl, Curl::easy::CURLOPT_URL, $url) == 0) { | ||||
|     print "ok 18\n"; | ||||
| } else { | ||||
|     print "not ok 18\n"; | ||||
|  | ||||
| } | ||||
|  | ||||
| # Tell libcurl to to an upload | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_UPLOAD, 1); | ||||
|  | ||||
| # No progress meter please | ||||
| #Curl::easy::setopt($curl, Curl::easy::CURLOPT_NOPROGRESS, 1); | ||||
|  | ||||
| # Use our own progress callback | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_PROGRESSFUNCTION, \&prog_callb); | ||||
|  | ||||
| # Shut up completely | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_MUTE, 1); | ||||
|  | ||||
| # Store error messages in $errbuf | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_ERRORBUFFER, "errbuf"); | ||||
|  | ||||
| $read_max=10; | ||||
| # Use perl read callback to read data to be uploaded | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_READFUNCTION, | ||||
|     \&read_callb); | ||||
|  | ||||
| # Use perl passwd callback to read password for login to ftp server | ||||
| Curl::easy::setopt($curl, Curl::easy::CURLOPT_PASSWDFUNCTION, \&passwd_callb); | ||||
|  | ||||
| print "ok 19\n"; | ||||
|  | ||||
| # Go get it | ||||
| if (Curl::easy::perform($curl) == 0) { | ||||
|     Curl::easy::getinfo($curl, Curl::easy::CURLINFO_SIZE_UPLOAD, $bytes); | ||||
|     print "ok 20: $bytes bytes transferred\n\n"; | ||||
| } else { | ||||
|     # We can acces the error message in $errbuf here | ||||
|     print "not ok 20: '$errbuf'\n"; | ||||
| } | ||||
|  | ||||
| # Cleanup | ||||
| Curl::easy::cleanup($curl); | ||||
| print "ok 21\n"; | ||||
|  | ||||
| # Copyright (C) 2000, Daniel Stenberg, , 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. | ||||
|                                                    | ||||
| @@ -21,8 +21,8 @@ LINKD = link.exe /incremental:yes /debug /libpath:"../lib" | ||||
|  | ||||
| CFLAGS = /I "../include" /nologo /W3 /GX /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c | ||||
| LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:I386 | ||||
| LINKLIBS = wsock32.lib libcurl.lib | ||||
| LINKLIBS_DEBUG = wsock32.lib libcurld.lib | ||||
| LINKLIBS = ws2_32.lib libcurl.lib | ||||
| LINKLIBS_DEBUG = ws2_32.lib libcurld.lib | ||||
|  | ||||
| RELEASE_OBJS= \ | ||||
| 	hugehelpr.obj \ | ||||
|   | ||||
| @@ -44,7 +44,7 @@ | ||||
| #define OS "unknown" | ||||
| #endif | ||||
|  | ||||
| #ifndef fileno /* sunos 4 have this as a macro! */ | ||||
| #if !defined(fileno) && !defined(WIN32) /* sunos 4 have this as a macro! */ | ||||
| int fileno( FILE *stream); | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -1,3 +1,3 @@ | ||||
| #define CURL_NAME "curl" | ||||
| #define CURL_VERSION "7.8.2-pre1" | ||||
| #define CURL_VERSION "7.9" | ||||
| #define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") " | ||||
|   | ||||
							
								
								
									
										57
									
								
								tests/FILEFORMAT
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								tests/FILEFORMAT
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
|  The file format of the test suite is a very simple and extendable format. All | ||||
| data for a single test case resides in a single ASCII file. Labels mark the | ||||
| beginning and the end of all sections. Each label must be written in its own | ||||
| line and is resembling XML/HTML. | ||||
|  | ||||
|  Each file is split up in three main sections: reply, client and verify. The | ||||
| reply section is used for the server to know what to send as a reply for the | ||||
| requests curl sends, the client section defines how the client should behave | ||||
| while the verify section defines how to verify that the data stored after a | ||||
| command has been run ended up correctly. | ||||
|  | ||||
|  Each main section has a number of available subsections that can be | ||||
| specified, that will be checked/used if specified. This document includes all | ||||
| the subsections currently supported. | ||||
|  | ||||
| <reply> | ||||
| <data> | ||||
| data to sent to the client on its request | ||||
| </data> | ||||
| <datacheck> | ||||
| if the data is sent but this is what should be checked afterwards | ||||
| </datacheck> | ||||
| <size> | ||||
| number to return on a ftp SIZE command | ||||
| </size> | ||||
| </reply> | ||||
|  | ||||
| <client> | ||||
| <name> | ||||
| test case description | ||||
| </name> | ||||
| <command> | ||||
| command line to run, there's a bunch of %variables that get replaced | ||||
| accordingly. more about them elsewhere | ||||
| </command> | ||||
| <file name="log/filename"> | ||||
| this creates the named file with this content before the test case is run | ||||
| which is useful if the test case needs a file to act on. | ||||
| </file> | ||||
| </client> | ||||
|  | ||||
| <verify> | ||||
| <errorcode> | ||||
| numerical error code curl is supposed to return | ||||
| </errorcode> | ||||
| <strip> | ||||
| One regex per line that is removed from the protocol dumps before the | ||||
| comparison is made. This is very useful to remove dependencies on dynamicly | ||||
| changing protocol data such as port numbers or user-agent strings. | ||||
| </strip> | ||||
| <protocol> | ||||
| the protocol dump curl should transmit | ||||
| </protocol> | ||||
| <upload> | ||||
| the contents of the upload data curl should have sent | ||||
| </upload> | ||||
| </verify> | ||||
| @@ -1,5 +1,6 @@ | ||||
| EXTRA_DIST = ftpserver.pl httpserver.pl httpsserver.pl runtests.pl \ | ||||
| 	     ftpsserver.pl stunnel.pm getpart.pm | ||||
| 	     ftpsserver.pl stunnel.pm getpart.pm FILEFORMAT README \ | ||||
| 	     stunnel.pem | ||||
|  | ||||
| SUBDIRS = data | ||||
|  | ||||
|   | ||||
| @@ -5,9 +5,11 @@ test: | ||||
| 	[ -f test1 ] || ln -s $(srcdir)/test* . | ||||
|  | ||||
| EXTRA_DIST = \ | ||||
| test1    test104  test13   test19   test21   test3    test5    \ | ||||
| test10   test105  test14   test2    test22   test300  test6    \ | ||||
| test100  test106  test15   test20   test23   test33   test7    \ | ||||
| test101  test107  test16   test200  test24   test4    test8    \ | ||||
| test102  test11   test17   test201  test25   test400  test9    \ | ||||
| test103  test12   test18   test202  test26   test43   test44 | ||||
| test1    test106  test113  test120  test15   test201  test3    test44 \ | ||||
| test10   test107  test114  test121  test16   test202  test300  test5 \ | ||||
| test100  test108  test115  test122  test17   test21   test301  test6 \ | ||||
| test101  test109  test116  test123  test18   test22   test302  test7 \ | ||||
| test102  test11   test117  test124  test19   test23   test33   test8 \ | ||||
| test103  test110  test118  test125  test2    test24   test4    test9 \ | ||||
| test104  test111  test119  test13   test20   test25   test400  \ | ||||
| test105  test112  test12   test14   test200  test26   test43    | ||||
							
								
								
									
										41
									
								
								tests/data/test108
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								tests/data/test108
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| <data> | ||||
| </data> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP PORT upload with CWD | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/CWD/STOR/RETR/108 -T log/upload108 -P - | ||||
| </command> | ||||
| <file name="log/upload108"> | ||||
| Moooooooooooo | ||||
|  upload this | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <strip> | ||||
| ^PORT .* | ||||
| ^EPRT .* | ||||
| ^LPRT .* | ||||
| </strip> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| CWD CWD/STOR/RETR | ||||
| PORT 127,0,0,1,5,109 | ||||
| TYPE I | ||||
| STOR 108 | ||||
| </protocol> | ||||
| <upload> | ||||
| Moooooooooooo | ||||
|  upload this | ||||
| </upload> | ||||
| </verify> | ||||
							
								
								
									
										37
									
								
								tests/data/test109
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								tests/data/test109
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| <data> | ||||
| </data> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP PASV upload append | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/109 -T log/upload109 --append | ||||
| </command> | ||||
| <file name="log/upload109"> | ||||
| Moooooooooooo | ||||
|  upload this | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <strip> | ||||
| </strip> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| APPE 109 | ||||
| </protocol> | ||||
| <upload> | ||||
| Moooooooooooo | ||||
|  upload this | ||||
| </upload> | ||||
| </verify> | ||||
							
								
								
									
										36
									
								
								tests/data/test110
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								tests/data/test110
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| <data> | ||||
| expected to be a file without the first part | ||||
| but we emulate that | ||||
| </data> | ||||
| <size> | ||||
| 85 | ||||
| </size> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download resume with set limit | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/110 -C 20 | ||||
| </command> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <strip> | ||||
| </strip> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| SIZE 110 | ||||
| REST 20 | ||||
| RETR 110 | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										33
									
								
								tests/data/test111
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								tests/data/test111
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| <size> | ||||
| 85 | ||||
| </size> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download resume beyond file size | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/111 -C 2000 | ||||
| </command> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 36 | ||||
| </errorcode> | ||||
| <strip> | ||||
| </strip> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| SIZE 111 | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										37
									
								
								tests/data/test112
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								tests/data/test112
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP PASV upload resume | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/112 -T log/upload112 -C 40 | ||||
| </command> | ||||
| <file name="log/upload112"> | ||||
| this is the *****crap******** that we're gonna upload | ||||
|  | ||||
| worx? | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <strip> | ||||
| </strip> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| APPE 112 | ||||
| </protocol> | ||||
| <upload> | ||||
|  gonna upload | ||||
|  | ||||
| worx? | ||||
| </upload> | ||||
| </verify> | ||||
							
								
								
									
										26
									
								
								tests/data/test113
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								tests/data/test113
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download, failed login: USER not valid | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/113 | ||||
| </command> | ||||
| <file name="log/ftpserver.cmd"> | ||||
| REPLY USER 314 bluah you fewl! | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 12 | ||||
| </errorcode> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										27
									
								
								tests/data/test114
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								tests/data/test114
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download, failed login: PASS not valid | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/114 | ||||
| </command> | ||||
| <file name="log/ftpserver.cmd"> | ||||
| REPLY PASS 314 bluah you f00l! | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 11 | ||||
| </errorcode> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										29
									
								
								tests/data/test115
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								tests/data/test115
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download, failed PASV | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/115 | ||||
| </command> | ||||
| <file name="log/ftpserver.cmd"> | ||||
| REPLY PASV 314 bluah you f00l! | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 13 | ||||
| </errorcode> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										33
									
								
								tests/data/test116
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								tests/data/test116
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download, failed PORT | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/116 -P 127.0.0.1 | ||||
| </command> | ||||
| <file name="log/ftpserver.cmd"> | ||||
| REPLY PORT 314 bluah you f00l! | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 30 | ||||
| </errorcode> | ||||
| <strip> | ||||
| ^PORT 127,0,0,1,.* | ||||
| ^EPRT .* | ||||
| ^LPRT .* | ||||
| </strip> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										30
									
								
								tests/data/test117
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								tests/data/test117
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download, failed TYPE | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/117 | ||||
| </command> | ||||
| <file name="log/ftpserver.cmd"> | ||||
| REPLY TYPE 314 bluah you f00l! | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 17 | ||||
| </errorcode> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										31
									
								
								tests/data/test118
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								tests/data/test118
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download, failed RETR | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/118 | ||||
| </command> | ||||
| <file name="log/ftpserver.cmd"> | ||||
| REPLY RETR 314 bluah you f00l! | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 19 | ||||
| </errorcode> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| RETR 118 | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										35
									
								
								tests/data/test119
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								tests/data/test119
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download, failed RETR with PORT | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/119 -P - | ||||
| </command> | ||||
| <file name="log/ftpserver.cmd"> | ||||
| REPLY RETR 314 bluah you f00l! | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 19 | ||||
| </errorcode> | ||||
| <strip> | ||||
| ^PORT.* | ||||
| ^EPRT .* | ||||
| ^LPRT .* | ||||
| </strip> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| TYPE I | ||||
| RETR 119 | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										34
									
								
								tests/data/test120
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								tests/data/test120
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| <data> | ||||
| data | ||||
|     to | ||||
|       see | ||||
| that FTP | ||||
| works | ||||
|   so does it? | ||||
| </data> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| ftp download with post-quote delete operation | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/120 -Q "-DELE file" | ||||
| </command> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| RETR 120 | ||||
| DELE file | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										35
									
								
								tests/data/test121
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								tests/data/test121
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| <data> | ||||
| data | ||||
|     to | ||||
|       see | ||||
| that FTP | ||||
| works | ||||
|   so does it? | ||||
| </data> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| ftp download with post- and pre-transfer delete operations | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/121 -Q "-DELE after_transfer" -Q "DELE before_transfer" | ||||
| </command> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| DELE before_transfer | ||||
| PASV | ||||
| TYPE I | ||||
| RETR 121 | ||||
| DELE after_transfer | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										28
									
								
								tests/data/test122
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								tests/data/test122
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| <size> | ||||
| 5 | ||||
| </size> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download resume with whole file already downloaded | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/122 -C 5 | ||||
| </command> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| SIZE 122 | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										27
									
								
								tests/data/test123
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								tests/data/test123
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP upload resume with whole file already downloaded | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/123 -T log/upload123 -C 51 | ||||
| </command> | ||||
| <file name="log/upload123"> | ||||
| -------------------------------------------------- | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										31
									
								
								tests/data/test124
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								tests/data/test124
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| <data> | ||||
| we can still send data even if pwd fails! | ||||
| </data> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download, failed PWD | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/124 | ||||
| </command> | ||||
| <file name="log/ftpserver.cmd"> | ||||
| REPLY PWD 314 bluah you f00l! | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| PASV | ||||
| TYPE I | ||||
| RETR 124 | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										29
									
								
								tests/data/test125
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								tests/data/test125
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| FTP download, failed CWD | ||||
|  </name> | ||||
|  <command> | ||||
| ftp://%HOSTIP:%FTPPORT/path/to/file/125 | ||||
| </command> | ||||
| <file name="log/ftpserver.cmd"> | ||||
| REPLY CWD 314 bluah you f00l! | ||||
| </file> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 9 | ||||
| </errorcode> | ||||
| <protocol> | ||||
| USER anonymous | ||||
| PASS curl_by_daniel@haxx.se | ||||
| PWD | ||||
| CWD path/to/file | ||||
| </protocol> | ||||
| </verify> | ||||
							
								
								
									
										42
									
								
								tests/data/test301
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								tests/data/test301
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| # | ||||
| # Server-side | ||||
| <reply> | ||||
| <data> | ||||
| HTTP/1.1 200 OK | ||||
| Date: Thu, 09 Nov 2010 14:49:00 GMT | ||||
| Server: test-server/fake | ||||
| Content-Type: text/html | ||||
| Funny-head: yesyes | ||||
|  | ||||
| </data> | ||||
| </reply> | ||||
|  | ||||
| # | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| HTTPS GET with user and password | ||||
|  </name> | ||||
|  <command> | ||||
|  -u fake:user https://%HOSTIP:%HTTPSPORT/2 | ||||
| </command> | ||||
| </test> | ||||
|  | ||||
| # | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <strip> | ||||
| ^User-Agent:.* | ||||
| </strip> | ||||
| <protocol> | ||||
| GET /2 HTTP/1.1 | ||||
| Authorization: Basic ZmFrZTp1c2Vy | ||||
| Host: 127.0.0.1:8433 | ||||
| Pragma: no-cache | ||||
| Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* | ||||
|  | ||||
| </protocol> | ||||
| <data> | ||||
| [insert full protocol verifiction dump here] | ||||
| </data> | ||||
| </verify> | ||||
							
								
								
									
										31
									
								
								tests/data/test302
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								tests/data/test302
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| # | ||||
| # Server-side | ||||
| <reply> | ||||
| </reply> | ||||
|  | ||||
| # | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| HTTPS GET over HTTP proxy fails | ||||
|  </name> | ||||
|  <command> | ||||
|  -U fake:user -x %HOSTIP:%HOSTPORT https://ssl.fakeurl-to.test/slash/302 | ||||
| </command> | ||||
| </test> | ||||
|  | ||||
| # | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <errorcode> | ||||
| 26 | ||||
| </errorcode> | ||||
| <strip> | ||||
| ^User-Agent:.* | ||||
| </strip> | ||||
| <protocol> | ||||
| </protocol> | ||||
| <data> | ||||
| [insert full protocol verifiction dump here] | ||||
| </data> | ||||
| </verify> | ||||
							
								
								
									
										64
									
								
								tests/data/test45
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								tests/data/test45
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,64 @@ | ||||
| # Server-side | ||||
| <reply> | ||||
| <data> | ||||
| HTTP/1.1 301 This is a weirdo text message | ||||
| Date: Thu, 09 Nov 2010 14:49:00 GMT | ||||
| Server: test-server/fake | ||||
| Location: data.cgi?moo=http://&/110002 | ||||
| Connection: close | ||||
|  | ||||
| This server reply is for testing a simple Location: following | ||||
|  | ||||
| </data> | ||||
| <data2> | ||||
| HTTP/1.1 200 Followed here fine | ||||
| Date: Thu, 09 Nov 2010 14:49:00 GMT | ||||
| Server: test-server/fake | ||||
|  | ||||
| If this is received, the location following worked | ||||
|  | ||||
| </data2> | ||||
| <datacheck> | ||||
| HTTP/1.1 301 This is a weirdo text message | ||||
| Date: Thu, 09 Nov 2010 14:49:00 GMT | ||||
| Server: test-server/fake | ||||
| Location: data.cgi?moo=http://&/110002 | ||||
| Connection: close | ||||
|  | ||||
| HTTP/1.1 200 Followed here fine | ||||
| Date: Thu, 09 Nov 2010 14:49:00 GMT | ||||
| Server: test-server/fake | ||||
|  | ||||
| If this is received, the location following worked | ||||
|  | ||||
| </datacheck> | ||||
| </reply> | ||||
|  | ||||
| # Client-side | ||||
| <client> | ||||
|  <name> | ||||
| simple HTTP Location: without protocol in initial URL | ||||
|  </name> | ||||
|  <command> | ||||
| %HOSTIP:%HOSTPORT/want/45 -L | ||||
| </command> | ||||
| </test> | ||||
|  | ||||
| # Verify data after the test has been "shot" | ||||
| <verify> | ||||
| <strip> | ||||
| ^User-Agent:.* | ||||
| </strip> | ||||
| <protocol> | ||||
| GET /want/45 HTTP/1.1 | ||||
| Host: 127.0.0.1:8999 | ||||
| Pragma: no-cache | ||||
| Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* | ||||
|  | ||||
| GET /want/data.cgi?moo=http://&/110002 HTTP/1.1 | ||||
| Host: 127.0.0.1:8999 | ||||
| Pragma: no-cache | ||||
| Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* | ||||
|  | ||||
| </protocol> | ||||
| </verify> | ||||
| @@ -118,6 +118,7 @@ my %commandfunc = ( 'PORT' => \&PORT_command, | ||||
| my $rest=0; | ||||
| sub REST_command { | ||||
|     $rest = $_[0]; | ||||
|     logmsg "Set REST position to $rest\n" | ||||
| } | ||||
|  | ||||
| sub LIST_command { | ||||
| @@ -160,6 +161,8 @@ sub NLST_command { | ||||
| sub SIZE_command { | ||||
|     my $testno = $_[0]; | ||||
|  | ||||
|     loadtest("data/test$testno"); | ||||
|  | ||||
|     logmsg "SIZE number $testno\n"; | ||||
|  | ||||
|     my @data = getpart("reply", "size"); | ||||
| @@ -168,9 +171,11 @@ sub SIZE_command { | ||||
|  | ||||
|     if($size) { | ||||
|         print "213 $size\r\n"; | ||||
|         logmsg "SIZE $testno returned $size\n"; | ||||
|     } | ||||
|     else { | ||||
|         print "550 $testno: No such file or directory.\r\n"; | ||||
|         logmsg "SIZE $testno: no such file\n"; | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
| @@ -204,18 +209,15 @@ sub RETR_command { | ||||
|         if($rest) { | ||||
|             # move read pointer forward | ||||
|             $size -= $rest; | ||||
|             if($verbose) { | ||||
|                 print STDERR "** REST $rest was removed from size.\n"; | ||||
|             } | ||||
|             logmsg "REST $rest was removed from size, makes $size left\n"; | ||||
|             $rest = 0; # reset REST offset again | ||||
|         } | ||||
|         print "150 Binary data connection for $testno () ($size bytes).\r\n"; | ||||
|         $rest=0; # reset rest again | ||||
|         logmsg "150 Binary data connection for $testno ($size bytes).\n"; | ||||
|  | ||||
|         if($verbose) { | ||||
|             print STDERR "150 Binary data connection for $testno ($size bytes).\n"; | ||||
|         } | ||||
|         for(@data) { | ||||
|             print SOCK $_; | ||||
|             my $send = $_; | ||||
|             print SOCK $send; | ||||
|         } | ||||
|         close(SOCK); | ||||
|  | ||||
| @@ -223,9 +225,7 @@ sub RETR_command { | ||||
|     } | ||||
|     else { | ||||
|         print "550 $testno: No such file or directory.\r\n"; | ||||
|         if($verbose) { | ||||
|             print STDERR "550 $testno: no such file\n"; | ||||
|         } | ||||
|         logmsg "550 $testno: no such file\n"; | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
| @@ -331,9 +331,7 @@ sub customize { | ||||
|     open(CUSTOM, "<log/ftpserver.cmd") || | ||||
|         return 1; | ||||
|  | ||||
|     if($verbose) { | ||||
|         print STDERR "FTPD: Getting commands from log/ftpserver.cmd\n"; | ||||
|     } | ||||
|     logmsg "FTPD: Getting commands from log/ftpserver.cmd\n"; | ||||
|  | ||||
|     while(<CUSTOM>) { | ||||
|         if($_ =~ /REPLY ([A-Z]+) (.*)/) { | ||||
|   | ||||
| @@ -40,7 +40,7 @@ do { | ||||
|  | ||||
| my $path = `pwd`; | ||||
| chomp $path; | ||||
| my $cmd = "$stunnel -p $path/data/stunnel.pem -P $path/.ftps.pid -d $port -r $ftp"; | ||||
| my $cmd = "$stunnel -p $path/stunnel.pem -P $path/.ftps.pid -d $port -r $ftp"; | ||||
|  | ||||
| if($verbose) { | ||||
|     print "FTPS server: $cmd\n"; | ||||
|   | ||||
| @@ -66,7 +66,6 @@ for ( $waitedpid = 0; | ||||
|  | ||||
|         my @headers; | ||||
|  | ||||
|       stdin: | ||||
|         while(<STDIN>) { | ||||
|             if($_ =~ /([A-Z]*) (.*) HTTP\/1.(\d)/) { | ||||
|                 $request=$1; | ||||
| @@ -96,6 +95,12 @@ for ( $waitedpid = 0; | ||||
|                 if($request =~ /^(POST|PUT)$/) { | ||||
|                     $left=$cl; | ||||
|                 } | ||||
|                 elsif($request =~ /^CONNECT$/) { | ||||
|                     if($verbose) { | ||||
|                         print STDERR "We're emulating a SSL proxy!\n"; | ||||
|                     } | ||||
|                     $left = -1; | ||||
|                 } | ||||
|                 else { | ||||
|                     $left = -1; # force abort | ||||
|                 } | ||||
| @@ -105,7 +110,13 @@ for ( $waitedpid = 0; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if($path =~ /verifiedserver/) { | ||||
|         if($request =~ /^CONNECT$/) { | ||||
|             # ssl proxy mode | ||||
|             print "HTTP/1.1 400 WE CANNOT ROOL NOW\r\n", | ||||
|             "Server: bahoooba\r\n\r\n"; | ||||
|             exit; | ||||
|         } | ||||
|         elsif($path =~ /verifiedserver/) { | ||||
|             # this is a hard-coded query-string for the test script | ||||
|             # to verify that this is the server actually running! | ||||
|             print "HTTP/1.1 999 WE ROOLZ\r\n"; | ||||
|   | ||||
| @@ -43,7 +43,7 @@ do { | ||||
|  | ||||
| my $path = `pwd`; | ||||
| chomp $path; | ||||
| my $cmd = "$stunnel -p $path/data/stunnel.pem -P $path/.https.pid -d $port -r $http"; | ||||
| my $cmd = "$stunnel -p $path/stunnel.pem -P $path/.https.pid -d $port -r $http"; | ||||
|  | ||||
| if($verbose) { | ||||
|     print "$cmd\n"; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user