diff -rNuX exclude curl-7.15.3-20060314/include/curl/curl.h curl/include/curl/curl.h --- curl-7.15.3-20060314/include/curl/curl.h 2006-03-13 22:00:48.000000000 -0500 +++ curl/include/curl/curl.h 2006-03-14 14:45:28.609435000 -0500 @@ -268,6 +268,8 @@ CURLE_FTP_COULDNT_STOR_FILE, /* 25 - failed FTP upload */ CURLE_READ_ERROR, /* 26 - could open/read from file */ CURLE_OUT_OF_MEMORY, /* 27 */ + /* Note: On EBCDIC platforms CURLE_OUT_OF_MEMORY may sometimes + indicate a conversion error instead of a memory allocation error */ CURLE_OPERATION_TIMEOUTED, /* 28 - the timeout time was reached */ CURLE_FTP_COULDNT_SET_ASCII, /* 29 - TYPE A failed */ CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ @@ -318,9 +320,22 @@ CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ CURLE_TFTP_EXISTS, /* 73 - File already exists */ CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ + CURLE_EBCDIC_CONV_FAILED, /* 75 - conversion to/from EBCDIC failed + (applies to EBCDIC platforms only) */ + CURLE_EBCDIC_CONV_REQD, /* 76 - caller must register conversion + callbacks for EBCDIC using + CURLOPT_CONV_ASCII_TO_EBCDIC_FUNCTION, + CURLOPT_CONV_EBCDIC_TO_ASCII_FUNCTION, + & CURLOPT_CONV_UTF8_TO_EBCDIC_FUNCTION + (applies to EBCDIC platforms only) */ CURL_LAST /* never use! */ } CURLcode; +#ifdef CURL_ON_EBCDIC_PLATFORM +/* This prototype applies to all EBCDIC conversion callbacks */ +typedef CURLcode (*curl_ebcdic_callback)(char *buffer, size_t length); +#endif /* CURL_ON_EBCDIC_PLATFORM */ + typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */ void *ssl_ctx, /* actually an OpenSSL SSL_CTX */ @@ -937,6 +952,21 @@ extracting it with CURLINFO_LASTSOCKET */ CINIT(CONNECT_ONLY, LONG, 141), +#ifdef CURL_ON_EBCDIC_PLATFORM + /* Function that will be called on EBCDIC platforms to convert + from ASCII to EBCDIC (instead of using the iconv calls in libcurl) */ + CINIT(CONV_ASCII_TO_EBCDIC_FUNCTION, FUNCTIONPOINT, 142), + + /* Function that will be called on EBCDIC platforms to convert + from EBCDIC to ASCII (instead of using the iconv calls in libcurl) */ + CINIT(CONV_EBCDIC_TO_ASCII_FUNCTION, FUNCTIONPOINT, 143), + + /* Function that will be called on EBCDIC platforms to convert + from UTF8 to EBCDIC (instead of using the iconv calls in libcurl) + Note that this matters only for SSL certificate processing. */ + CINIT(CONV_UTF8_TO_EBCDIC_FUNCTION, FUNCTIONPOINT, 144), +#endif /* CURL_ON_EBCDIC_PLATFORM */ + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; @@ -1146,7 +1176,7 @@ CURL_EXTERN char *curl_version(void); /* - * NAME curl_escape() + * NAME curl_escape2() * * DESCRIPTION * @@ -1154,18 +1184,22 @@ * %XX versions). This function returns a new allocated string or NULL if an * error occurred. */ -CURL_EXTERN char *curl_escape(const char *string, int length); +#define curl_escape(a, b) curl_escape2((void *)0, a, b) +CURL_EXTERN char *curl_escape2(void *handle, const char *string, int length); /* - * NAME curl_unescape() + * NAME curl_unescape2() * * DESCRIPTION * * Unescapes URL encoding in strings (converts all %XX codes to their 8bit * versions). This function returns a new allocated string or NULL if an error * occurred. + * On EBCDIC platforms the ASCII %XX codes are converted into EBCDIC. */ -CURL_EXTERN char *curl_unescape(const char *string, int length); +#define curl_unescape(a, b) curl_unescape2((void *)0, a, b) +CURL_EXTERN char *curl_unescape2(void *handle, + const char *string, int length); /* * NAME curl_free() diff -rNuX exclude curl-7.15.3-20060314/lib/config-tpf.h curl/lib/config-tpf.h --- curl-7.15.3-20060314/lib/config-tpf.h 1969-12-31 19:00:00.000000000 -0500 +++ curl/lib/config-tpf.h 2006-03-08 13:49:11.000000000 -0500 @@ -0,0 +1,648 @@ +#ifndef __LIBCONFIGTPF_H +#define __LIBCONFIGTPF_H +/* This file is normally generated by configure, but TPF has its own */ + +/* when building libcurl itself */ +/* #undef BUILDING_LIBCURL */ + +/* to disable cookies support */ +/* #undef CURL_DISABLE_COOKIES */ + +/* to disable cryptographic authentication */ +/* #undef CURL_DISABLE_CRYPTO_AUTH */ + +/* to disable DICT */ +#define CURL_DISABLE_DICT 1 + +/* to disable FILE */ +#define CURL_DISABLE_FILE 1 + +/* to disable FTP */ +/* #undef CURL_DISABLE_FTP */ + +/* to disable HTTP */ +#define CURL_DISABLE_HTTP 1 + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +/* to disable TELNET */ +#define CURL_DISABLE_TELNET 1 + +/* to disable TFTP */ +#define CURL_DISABLE_TFTP 1 + +/* to disable verbose strings */ +/* #undef CURL_DISABLE_VERBOSE_STRINGS */ + +/* when not building a shared library */ +/* #undef CURL_STATICLIB */ + +/* Set to explicitly specify we don't want to use thread-safe functions */ +/* #undef DISABLED_THREADSAFE */ +#define DISABLED_THREADSAFE 1 + +/* lber dynamic library file */ +/* #undef DL_LBER_FILE */ + +/* ldap dynamic library file */ +/* #undef DL_LDAP_FILE */ + +/* your Entropy Gathering Daemon socket pathname */ +/* #undef EGD_SOCKET */ + +/* Define if you want to enable IPv6 support */ +/* #undef ENABLE_IPV6 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the `basename' function. */ +#define HAVE_BASENAME 1 + +/* Define to 1 if you have the `closesocket' function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +/* #undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA */ +#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRYPTO_H */ +#define HAVE_CRYPTO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DES_H */ +#define HAVE_DES_H 1 + +/* disabled non-blocking sockets */ +/* #undef HAVE_DISABLED_NONBLOCKING */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `dlopen' function. */ +#define HAVE_DLOPEN 1 + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +/* #undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES */ +#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ERR_H */ +#define HAVE_ERR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* use FIONBIO for non-blocking sockets */ +/* #undef HAVE_FIONBIO */ +#define HAVE_FIONBIO 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define if getaddrinfo exists and works */ +/* #undef HAVE_GETADDRINFO */ + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* If you have gethostbyname */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gethostbyname_r' function. */ +/* #undef HAVE_GETHOSTBYNAME_R */ + +/* gethostbyname_r() takes 3 args */ +/* #undef HAVE_GETHOSTBYNAME_R_3 */ + +/* gethostbyname_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYNAME_R_5 */ + +/* gethostbyname_r() takes 6 args */ +/* #define HAVE_GETHOSTBYNAME_R_6 1 */ + +/* Define to 1 if you have the `getpass_r' function. */ +/* #undef HAVE_GETPASS_R */ + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `getrlimit' function. */ +#define HAVE_GETRLIMIT 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* we have a glibc-style strerror_r() */ +/* #undef HAVE_GLIBC_STRERROR_R */ + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* if you have the gssapi libraries */ +/* #undef HAVE_GSSAPI */ + +/* if you have the Heimdal gssapi libraries */ +/* #undef HAVE_GSSHEIMDAL */ + +/* if you have the MIT gssapi libraries */ +/* #undef HAVE_GSSMIT */ + +/* Define to 1 if you have the `idna_strerror' function. */ +/* #undef HAVE_IDNA_STRERROR */ + +/* Define to 1 if you have the `idn_free' function. */ +/* #undef HAVE_IDN_FREE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IDN_FREE_H */ + +/* Define to 1 if you have the `inet_addr' function. */ +#define HAVE_INET_ADDR 1 + +/* Define to 1 if you have the `inet_ntoa' function. */ +#define HAVE_INET_NTOA 1 + +/* Define to 1 if you have the `inet_ntoa_r' function. */ +/* #undef HAVE_INET_NTOA_R */ + +/* inet_ntoa_r() is declared */ +/* #undef HAVE_INET_NTOA_R_DECL */ + +/* Define to 1 if you have the `inet_pton' function. */ +/* #undef HAVE_INET_PTON */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* use ioctlsocket() for non-blocking sockets */ +/* #undef HAVE_IOCTLSOCKET */ + +/* use Ioctlsocket() for non-blocking sockets */ +/* #undef HAVE_IOCTLSOCKET_CASE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* if you have the Kerberos4 libraries (including -ldes) */ +/* #undef HAVE_KRB4 */ + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_KRB_H */ + +/* Define to 1 if you have the `dl' library (-ldl). */ +#define HAVE_LIBDL 1 + +/* Define to 1 if you have the header file. */ +/* #define HAVE_LIBGEN_H 1 */ + +/* Define to 1 if you have the `idn' library (-lidn). */ +/* #undef HAVE_LIBIDN */ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLVE */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +/* #undef HAVE_LIBSSL */ +#define HAVE_LIBSSL + +/* if zlib is available */ +/* #undef HAVE_LIBZ */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* if your compiler supports LL */ +#define HAVE_LL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* if your compiler supports long long */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +/* undef HAVE_NETINET_TCP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define if NI_WITHSCOPEID exists and works */ +/* #undef HAVE_NI_WITHSCOPEID */ + +/* we have no strerror_r() proto */ +/* #undef HAVE_NO_STRERROR_R_DECL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_CRYPTO_H */ +#define HAVE_OPENSSL_CRYPTO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_ENGINE_H */ +#define HAVE_OPENSSL_ENGINE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_ERR_H */ +#define HAVE_OPENSSL_ERR_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_PEM_H */ +#define HAVE_OPENSSL_PEM_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_PKCS12_H */ +#define HAVE_OPENSSL_PKCS12_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_RSA_H */ +#define HAVE_OPENSSL_RSA_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_SSL_H */ +#define HAVE_OPENSSL_SSL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_X509_H */ +#define HAVE_OPENSSL_X509_H 1 + +/* use O_NONBLOCK for non-blocking sockets */ +/* #undef HAVE_O_NONBLOCK 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PEM_H */ +#define HAVE_PEM_H 1 + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* Define to 1 if you have the `poll' function. */ +/* #undef HAVE_POLL */ + +/* If you have a fine poll */ +/* #undef HAVE_POLL_FINE */ + +/* we have a POSIX-style strerror_r() */ +/* #undef HAVE_POSIX_STRERROR_R */ +/* #define HAVE_POSIX_STRERROR_R 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `RAND_egd' function. */ +/* #undef HAVE_RAND_EGD */ +#define HAVE_RAND_EGD 1 + +/* Define to 1 if you have the `RAND_screen' function. */ +/* #undef HAVE_RAND_SCREEN */ + +/* Define to 1 if you have the `RAND_status' function. */ +/* #undef HAVE_RAND_STATUS */ +#define HAVE_RAND_STATUS 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RSA_H */ +#define HAVE_RSA_H 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#define HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SGTTY_H 1 */ + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the `siginterrupt' function. */ +/* #undef HAVE_SIGINTERRUPT */ + +/* Define to 1 if you have the `signal' function. */ +#define HAVE_SIGNAL 1 + +/* If you have sigsetjmp */ +/* #undef HAVE_SIGSETJMP */ + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* use SO_NONBLOCK for non-blocking sockets */ +/* #undef HAVE_SO_NONBLOCK */ + +/* Define this if you have the SPNEGO library fbopenssl */ +/* #undef HAVE_SPNEGO */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SSL_H */ +#define HAVE_SSL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strcmpi' function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ +#define HAVE_STRICMP + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +/* #undef HAVE_STRLCAT */ + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* if struct sockaddr_storage is defined */ +/* undef HAVE_STRUCT_SOCKADDR_STORAGE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_POLL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ +#define HAVE_SYS_SOCKIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UTIME_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMIOS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TLD_H */ + +/* Define to 1 if you have the `tld_strerror' function. */ +/* #undef HAVE_TLD_STRERROR */ + +/* Define to 1 if you have the `uname' function. */ +/* #undef HAVE_UNAME */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define this symbol if your OS supports changing the contents of argv */ +/* #undef HAVE_WRITABLE_ARGV */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_X509_H */ +#define undef HAVE_X509_H 1 + +/* if you have the zlib.h header file */ +/* #undef HAVE_ZLIB_H */ + +/* If you lack a fine basename() prototype */ +/* #undef NEED_BASENAME_PROTO */ + +/* need REENTRANT defined */ +/* #undef NEED_REENTRANT */ + +/* cpu-machine-OS */ +#define OS "s390x-ibm-tpf" + +/* Name of package */ +#define PACKAGE "curl" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "curl" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "curl -" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "curl" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "-" + +/* a suitable file to read random data from */ +/* #undef RANDOM_FILE */ + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to the type of arg 1 for `select'. */ +#define SELECT_TYPE_ARG1 int + +/* Define to the type of args 2, 3 and 4 for `select'. */ +#define SELECT_TYPE_ARG234 (fd_set *) + +/* Define to the type of arg 5 for `select'. */ +#define SELECT_TYPE_ARG5 (struct timeval *) + +/* The size of a `curl_off_t', as computed by sizeof. */ +#define SIZEOF_CURL_OFF_T 8 + +/* The size of a `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of a `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of a `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if you want to enable ares support */ +/* #undef USE_ARES */ + +/* if GnuTLS is enabled */ +/* #undef USE_GNUTLS */ + +/* If you want to build curl with the built-in manual */ +/* #undef USE_MANUAL */ + +/* if OpenSSL is in use */ +/* #undef USE_OPENSSL */ +#define USE_OPENSSL + +/* if SSL is enabled */ +/* #undef USE_SSLEAY */ +#define USE_SSLEAY + +/* to enable SSPI support */ +/* #undef USE_WINDOWS_SSPI */ + +/* Version number of package */ +#define VERSION "7.14.0" + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* define this if you need it to compile thread-safe code */ +/* #undef _THREAD_SAFE */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* type to use in place of in_addr_t if not defined */ +/* #undef in_addr_t */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ + +/* type to use in place of socklen_t if not defined */ +/* #undef socklen_t */ + +/* the signed version of size_t */ +/* #undef ssize_t */ + +#include /* for bzero, strcasecmp, and strncasecmp */ +#include /* for strcpy and strlen */ +#include /* for rand and srand */ + +#include /* for select and ioctl*/ + +/* include netdb.h for in_addr_t definition */ +#include + +/* use tpf_select_bsd instead of select + and throw in a tpf_process_signals too */ +#include /* for tpf_process_signals */ +#define select(a,b,c,d,e) tpf_select_bsd(a,b,c,d,e); tpf_process_signals() + +#define HAVE_GLIBC_STRERROR_R + +#endif /* __LIBCONFIGTPF_H */ diff -rNuX exclude curl-7.15.3-20060314/lib/easy.c curl/lib/easy.c --- curl-7.15.3-20060314/lib/easy.c 2006-02-11 22:00:07.000000000 -0500 +++ curl/lib/easy.c 2006-03-14 14:50:28.279435000 -0500 @@ -87,6 +87,24 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include +#ifdef CURL_ON_EBCDIC_PLATFORM +#include "sendf.h" /* for failf function prototype */ +#endif /* CURL_ON_EBCDIC_PLATFORM */ + +#ifdef CURL_USE_ICONV_ON_EBCDIC_PLATFORMS +#include +/* set default codesets if necessary */ +#ifndef CURL_ICONV_CODESET_OF_HOST +#define CURL_ICONV_CODESET_OF_HOST "IBM-1047" +#endif +#ifndef CURL_ICONV_CODESET_OF_NETWORK +#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" +#endif +#ifndef CURL_ICONV_CODESET_FOR_UTF8 +#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" +#endif +#endif /* CURL_USE_ICONV_ON_EBCDIC_PLATFORMS */ + /* The last #include file should be: */ #include "memdebug.h" @@ -169,6 +187,12 @@ static unsigned int initialized; static long init_flags; +#ifdef CURL_USE_ICONV_ON_EBCDIC_PLATFORMS +iconv_t outbound_cd = (iconv_t)-1; +iconv_t inbound_cd = (iconv_t)-1; +iconv_t utf8_cd = (iconv_t)-1; +#endif /* CURL_USE_ICONV_ON_EBCDIC_PLATFORMS */ + /* * If a memory-using function (like curl_getenv) is used before * curl_global_init() is called, we need to have these pointers set already. @@ -277,6 +301,19 @@ amiga_cleanup(); #endif +#ifdef CURL_USE_ICONV_ON_EBCDIC_PLATFORMS + /* close iconv conversion descriptors */ + if (inbound_cd != (iconv_t)-1) { + iconv_close(inbound_cd); + } + if (outbound_cd != (iconv_t)-1) { + iconv_close(outbound_cd); + } + if (utf8_cd != (iconv_t)-1) { + iconv_close(utf8_cd); + } +#endif /* CURL_USE_ICONV_ON_EBCDIC_PLATFORMS */ + init_flags = 0; } @@ -656,3 +693,180 @@ data->set.ssl.CAfile = (char *)CURL_CA_BUNDLE; #endif } + +#ifdef CURL_ON_EBCDIC_PLATFORM +/* + * Curl_convert_ebcdic_to_ascii() is an internal function + * for performing EBCDIC to ASCII conversions on EBCDIC platforms. + */ +CURLcode Curl_convert_ebcdic_to_ascii(struct SessionHandle *data, + char *buffer, size_t length) +{ + CURLcode rc; + + if(data->set.convebcdictoascii) { + /* use translation callback */ + rc = data->set.convebcdictoascii(buffer, length); + if(rc != CURLE_OK) { + failf(data, + "CURLOPT_CONV_EBCDIC_TO_ASCII_FUNCTION callback returned %i: %s", + rc, curl_easy_strerror(rc)); + } + return(rc); + } else { +#ifdef CURL_USE_ICONV_ON_EBCDIC_PLATFORMS + /* do the translation ourselves */ + char *input_ptr, *output_ptr; + size_t in_bytes, out_bytes, rc; + + /* open an iconv conversion descriptor if necessary */ + if(outbound_cd == (iconv_t)-1) { + outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK, + CURL_ICONV_CODESET_OF_HOST); + if(outbound_cd == (iconv_t)-1) { + failf(data, + "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", + CURL_ICONV_CODESET_OF_NETWORK, + CURL_ICONV_CODESET_OF_HOST, + errno, strerror(errno)); + return CURLE_EBCDIC_CONV_FAILED; + } + } + /* call iconv */ + input_ptr = output_ptr = buffer; + in_bytes = out_bytes = length; + rc = iconv(outbound_cd, &input_ptr, &in_bytes, + &output_ptr, &out_bytes); + if ((rc == -1) || (in_bytes != 0)) { + failf(data, + "The Curl_convert_ebcdic_to_ascii iconv call failed with errno %i: %s", + errno, strerror(errno)); + return CURLE_EBCDIC_CONV_FAILED; + } +#else + failf(data, "CURLOPT_CONV_EBCDIC_TO_ASCII_FUNCTION callback required"); + return CURLE_EBCDIC_CONV_REQD; +#endif /* CURL_USE_ICONV_ON_EBCDIC_PLATFORMS */ + } + + return CURLE_OK; +} + +/* + * Curl_convert_ascii_to_ebcdic() is an internal function + * for performing ASCII to EBCDIC conversions on EBCDIC platforms. + */ +CURLcode Curl_convert_ascii_to_ebcdic(struct SessionHandle *data, + char *buffer, size_t length) +{ + CURLcode rc; + + if(data->set.convasciitoebcdic) { + /* use translation callback */ + rc = data->set.convasciitoebcdic(buffer, length); + if(rc != CURLE_OK) { + failf(data, + "CURLOPT_CONV_ASCII_TO_EBCDIC_FUNCTION callback returned %i: %s", + rc, curl_easy_strerror(rc)); + } + return(rc); + } else { +#ifdef CURL_USE_ICONV_ON_EBCDIC_PLATFORMS + /* do the translation ourselves */ + char *input_ptr, *output_ptr; + size_t in_bytes, out_bytes, rc; + + /* open an iconv conversion descriptor if necessary */ + if(inbound_cd == (iconv_t)-1) { + inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_OF_NETWORK); + if(inbound_cd == (iconv_t)-1) { + failf(data, + "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", + CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_OF_NETWORK, + errno, strerror(errno)); + return CURLE_EBCDIC_CONV_FAILED; + } + } + /* call iconv */ + input_ptr = output_ptr = buffer; + in_bytes = out_bytes = length; + rc = iconv(inbound_cd, &input_ptr, &in_bytes, + &output_ptr, &out_bytes); + if ((rc == -1) || (in_bytes != 0)) { + failf(data, + "The Curl_convert_ascii_to_ebcdic iconv call failed with errno %i: %s", + errno, strerror(errno)); + return CURLE_EBCDIC_CONV_FAILED; + } +#else + failf(data, "CURLOPT_CONV_ASCII_TO_EBCDIC_FUNCTION callback required"); + return CURLE_EBCDIC_CONV_REQD; +#endif /* CURL_USE_ICONV_ON_EBCDIC_PLATFORMS */ + } + + return CURLE_OK; +} + +/* + * Curl_convert_utf8_to_ebcdic() is an internal function + * for performing UTF-8 to EBCDIC conversions on EBCDIC platforms. + */ +CURLcode Curl_convert_utf8_to_ebcdic(struct SessionHandle *data, + char *buffer, size_t length) +{ + CURLcode rc; + + if(data->set.convutf8toebcdic) { + /* use translation callback */ + rc = data->set.convutf8toebcdic(buffer, length); + if(rc != CURLE_OK) { + failf(data, + "CURLOPT_CONV_UTF8_TO_EBCDIC_FUNCTION callback returned %i: %s", + rc, curl_easy_strerror(rc)); + } + return(rc); + } else { +#ifdef CURL_USE_ICONV_ON_EBCDIC_PLATFORMS + /* do the translation ourselves */ + char *input_ptr, *output_ptr; + size_t in_bytes, out_bytes, rc; + + /* open an iconv conversion descriptor if necessary */ + if(utf8_cd == (iconv_t)-1) { + utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_FOR_UTF8); + if(utf8_cd == (iconv_t)-1) { + failf(data, + "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", + CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_FOR_UTF8, + errno, strerror(errno)); + return CURLE_EBCDIC_CONV_FAILED; + } + } + /* call iconv */ + input_ptr = output_ptr = buffer; + in_bytes = out_bytes = length; + rc = iconv(utf8_cd, &input_ptr, &in_bytes, &output_ptr, &out_bytes); + if ((rc == -1) || (in_bytes != 0)) { + failf(data, + "The Curl_convert_utf8_to_ebcdic iconv call failed with errno %i: %s", + errno, strerror(errno)); + return CURLE_EBCDIC_CONV_FAILED; + } + if (output_ptr < input_ptr) { + /* null terminate the now shorter output string */ + *output_ptr = 0x00; + } +#else + failf(data, "CURLOPT_CONV_UTF8_TO_EBCDIC_FUNCTION callback required"); + return CURLE_EBCDIC_CONV_REQD; +#endif /* CURL_USE_ICONV_ON_EBCDIC_PLATFORMS */ + } + + return CURLE_OK; +} + +#endif /* CURL_ON_EBCDIC_PLATFORM */ diff -rNuX exclude curl-7.15.3-20060314/lib/easyif.h curl/lib/easyif.h --- curl-7.15.3-20060314/lib/easyif.h 2005-03-31 21:00:05.000000000 -0500 +++ curl/lib/easyif.h 2006-03-08 13:58:45.000000000 -0500 @@ -27,5 +27,11 @@ * Prototypes for library-wide functions provided by easy.c */ void Curl_easy_addmulti(struct SessionHandle *data, void *multi); +CURLcode Curl_convert_ebcdic_to_ascii(struct SessionHandle *data, + char *buffer, size_t length); +CURLcode Curl_convert_ascii_to_ebcdic(struct SessionHandle *data, + char *buffer, size_t length); +CURLcode Curl_convert_utf8_to_ebcdic(struct SessionHandle *data, + char *buffer, size_t length); #endif /* __EASYIF_H */ diff -rNuX exclude curl-7.15.3-20060314/lib/escape.c curl/lib/escape.c --- curl-7.15.3-20060314/lib/escape.c 2004-07-01 22:00:03.000000000 -0400 +++ curl/lib/escape.c 2006-03-13 19:12:28.000000000 -0500 @@ -36,15 +36,24 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include +#ifdef CURL_ON_EBCDIC_PLATFORM +/* need Curl_convert_... prototypes */ +#include "urldata.h" +#include "easyif.h" +#endif /* CURL_ON_EBCDIC_PLATFORM */ + /* The last #include file should be: */ #include "memdebug.h" -char *curl_escape(const char *string, int inlength) +char *curl_escape2(void *handle, const char *string, int inlength) { size_t alloc = (inlength?(size_t)inlength:strlen(string))+1; char *ns; char *testing_ptr = NULL; unsigned char in; +#ifdef CURL_ON_EBCDIC_PLATFORM + unsigned char converted; +#endif /* CURL_ON_EBCDIC_PLATFORM */ size_t newlen = alloc; int strindex=0; size_t length; @@ -72,7 +81,19 @@ ns = testing_ptr; } } +#ifdef CURL_ON_EBCDIC_PLATFORM +/* Escape sequences are in ASCII, so we need to convert the input */ + converted = in; + if (Curl_convert_ebcdic_to_ascii((struct SessionHandle *)handle, + &converted, 1) != CURLE_OK) { + /* Curl_convert_ebcdic_to_ascii calls failf if unsuccessful */ + free(ns); + return NULL; + } + snprintf(&ns[strindex], 4, "%%%02X", converted); +#else snprintf(&ns[strindex], 4, "%%%02X", in); +#endif /* CURL_ON_EBCDIC_PLATFORM */ strindex+=3; } @@ -90,7 +111,7 @@ (in >= 'A' && in <= 'F') || \ (in >= '0' && in <= '9')) -char *curl_unescape(const char *string, int length) +char *curl_unescape2(void *handle, const char *string, int length) { int alloc = (length?length:(int)strlen(string))+1; char *ns = malloc(alloc); @@ -114,6 +135,15 @@ hex = strtol(hexstr, &ptr, 16); in = (unsigned char)hex; /* this long is never bigger than 255 anyway */ +#ifdef CURL_ON_EBCDIC_PLATFORM +/* Escape sequences are in ASCII, so we need to convert the result */ + if (Curl_convert_ascii_to_ebcdic((struct SessionHandle *)handle, + &in, 1) != CURLE_OK) { + /* Curl_convert_ascii_to_ebcdic calls failf if unsuccessful */ + free(ns); + return NULL; + } +#endif /* CURL_ON_EBCDIC_PLATFORM */ string+=2; alloc-=2; } diff -rNuX exclude curl-7.15.3-20060314/lib/escape.h curl/lib/escape.h --- curl-7.15.3-20060314/lib/escape.h 2006-01-09 22:00:57.000000000 -0500 +++ curl/lib/escape.h 2006-03-13 19:13:14.000000000 -0500 @@ -26,7 +26,7 @@ /* Escape and unescape URL encoding in strings. The functions return a new * allocated string or NULL if an error occurred. */ -char *curl_escape(const char *string, int length); -char *curl_unescape(const char *string, int length); +char *curl_escape2(void *handle, const char *string, int length); +char *curl_unescape2(void *handle, const char *string, int length); #endif diff -rNuX exclude curl-7.15.3-20060314/lib/file.c curl/lib/file.c --- curl-7.15.3-20060314/lib/file.c 2005-12-29 22:00:10.000000000 -0500 +++ curl/lib/file.c 2006-03-13 19:33:34.000000000 -0500 @@ -102,7 +102,7 @@ */ CURLcode Curl_file_connect(struct connectdata *conn) { - char *real_path = curl_unescape(conn->path, 0); + char *real_path = curl_unescape2(conn->data, conn->path, 0); struct FILEPROTO *file; int fd; #if defined(WIN32) || defined(MSDOS) || defined(__EMX__) diff -rNuX exclude curl-7.15.3-20060314/lib/ftp.c curl/lib/ftp.c --- curl-7.15.3-20060314/lib/ftp.c 2006-03-13 22:00:49.000000000 -0500 +++ curl/lib/ftp.c 2006-03-14 14:43:27.000000000 -0500 @@ -72,6 +72,10 @@ #include #include "urldata.h" #include "sendf.h" +#ifdef CURL_ON_EBCDIC_PLATFORM +/* need Curl_convert_... prototypes */ +#include "easyif.h" +#endif /* CURL_ON_EBCDIC_PLATFORM */ #include "if2ip.h" #include "hostip.h" @@ -159,12 +163,14 @@ } } -/* Returns non-zero iff the given string contains CR (0x0D) or LF (0x0A), which - are not allowed within RFC 959 . - */ +/* Returns non-zero if the given string contains CR (\r) or LF (\n), + which are not allowed within RFC 959 . + ASCII/EBCDIC Note: The input string is in the client's encoding, so + escape sequences \r & \n must be used instead of hex values 0x0d & 0x0a. +*/ static bool isBadFtpString(const char *string) { - return strchr(string, 0x0D) != NULL || strchr(string, 0x0A) != NULL; + return strchr(string, '\r') != NULL || strchr(string, '\n') != NULL; } /*********************************************************************** @@ -295,6 +301,14 @@ /* EWOULDBLOCK */ return CURLE_OK; /* return */ +#ifdef CURL_ON_EBCDIC_PLATFORM + if((res == CURLE_OK) && (gotbytes > 0)) { + /* convert to EBCDIC */ + result = res = Curl_convert_ascii_to_ebcdic(data, ptr, gotbytes); + /* Curl_convert_ascii_to_ebcdic calls failf if unsuccessful */ + } +#endif /* CURL_ON_EBCDIC_PLATFORM */ + if(CURLE_OK != res) keepon = FALSE; } @@ -518,6 +532,14 @@ /* EWOULDBLOCK */ continue; /* go looping again */ +#ifdef CURL_ON_EBCDIC_PLATFORM + if((res == CURLE_OK) && (gotbytes > 0)) { + /* convert to EBCDIC */ + result = res = Curl_convert_ascii_to_ebcdic(data, ptr, gotbytes); + /* Curl_convert_ascii_to_ebcdic calls failf if unsuccessful */ + } +#endif /* CURL_ON_EBCDIC_PLATFORM */ + if(CURLE_OK != res) keepon = FALSE; } @@ -1309,6 +1331,10 @@ NBFTPSENDF(conn, "TYPE %c", data->set.ftp_ascii?'A':'I'); state(conn, FTP_TYPE); +#ifdef CURL_ON_EBCDIC_PLATFORM + /* keep track of our current transfer type */ + data->ftp_current_transfertype_is_ascii = data->set.ftp_ascii; +#endif /* CURL_ON_EBCDIC_PLATFORM */ } else result = ftp_state_post_type(conn); @@ -2863,7 +2889,14 @@ if(ftp->prevpath) free(ftp->prevpath); - path = curl_unescape(conn->path, 0); /* get the "raw" path */ +#ifdef CURL_ON_EBCDIC_PLATFORM + /* reset flags and counters for possible future transfers */ + data->state.prev_block_had_trailing_cr = FALSE; + data->state.bare_cr_conversions = 0; + data->state.crlf_conversions = 0; +#endif /* CURL_ON_EBCDIC_PLATFORM */ + + path = curl_unescape2(conn->data, conn->path, 0); /* get the "raw" path */ if(!path) return CURLE_OUT_OF_MEMORY; @@ -2889,6 +2922,9 @@ if((-1 != data->set.infilesize) && (data->set.infilesize != *ftp->bytecountp) && !data->set.crlf && +#ifdef CURL_ON_EBCDIC_PLATFORM + !data->ftp_current_transfertype_is_ascii && +#endif /* CURL_ON_EBCDIC_PLATFORM */ !ftp->no_transfer) { failf(data, "Uploaded unaligned file size (%" FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes)", @@ -3060,6 +3096,11 @@ return ascii? CURLE_FTP_COULDNT_SET_ASCII:CURLE_FTP_COULDNT_SET_BINARY; } +#ifdef CURL_ON_EBCDIC_PLATFORM + /* keep track of our current transfer type */ + data->ftp_current_transfertype_is_ascii = ascii; +#endif /* CURL_ON_EBCDIC_PLATFORM */ + return CURLE_OK; } @@ -3160,6 +3201,10 @@ if(data->set.upload) { NBFTPSENDF(conn, "TYPE %c", data->set.ftp_ascii?'A':'I'); state(conn, FTP_STOR_TYPE); +#ifdef CURL_ON_EBCDIC_PLATFORM + /* keep track of our current transfer type */ + data->ftp_current_transfertype_is_ascii = data->set.ftp_ascii; +#endif /* CURL_ON_EBCDIC_PLATFORM */ } else { /* download */ @@ -3174,10 +3219,18 @@ need to set ASCII transfer mode. */ NBFTPSENDF(conn, "TYPE A", NULL); state(conn, FTP_LIST_TYPE); +#ifdef CURL_ON_EBCDIC_PLATFORM + /* keep track of our current transfer type */ + data->ftp_current_transfertype_is_ascii = 1; +#endif /* CURL_ON_EBCDIC_PLATFORM */ } else { NBFTPSENDF(conn, "TYPE %c", data->set.ftp_ascii?'A':'I'); state(conn, FTP_RETR_TYPE); +#ifdef CURL_ON_EBCDIC_PLATFORM + /* keep track of our current transfer type */ + data->ftp_current_transfertype_is_ascii = data->set.ftp_ascii; +#endif /* CURL_ON_EBCDIC_PLATFORM */ } } result = ftp_easy_statemach(conn); @@ -3300,6 +3353,14 @@ ftp_respinit(conn); +#ifdef CURL_ON_EBCDIC_PLATFORM + res = Curl_convert_ebcdic_to_ascii(data, s, write_len); + /* Curl_convert_ebcdic_to_ascii calls failf if unsuccessful */ + if(res != CURLE_OK) { + return res; + } +#endif /* CURL_ON_EBCDIC_PLATFORM */ + res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len, &bytes_written); @@ -3349,6 +3410,15 @@ bytes_written=0; write_len = strlen(s); +#ifdef CURL_ON_EBCDIC_PLATFORM + res = Curl_convert_ebcdic_to_ascii(conn->data, s, write_len); + /* Curl_convert_ebcdic_to_ascii calls failf if unsuccessful */ + + if(res != CURLE_OK) { + return(res); + } +#endif /* CURL_ON_EBCDIC_PLATFORM */ + while(1) { res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len, &bytes_written); @@ -3735,7 +3805,8 @@ if(!ftp->dirs) return CURLE_OUT_OF_MEMORY; - ftp->dirs[0] = curl_unescape(cur_pos, (int)(slash_pos-cur_pos)); + ftp->dirs[0] = curl_unescape2(conn->data, cur_pos, + (int)(slash_pos-cur_pos)); if(!ftp->dirs[0]) { free(ftp->dirs); return CURLE_OUT_OF_MEMORY; @@ -3765,7 +3836,9 @@ requires a parameter and a non-existant parameter a) doesn't work on many servers and b) has no effect on the others. */ int len = (int)(slash_pos - cur_pos + absolute_dir); - ftp->dirs[ftp->dirdepth] = curl_unescape(cur_pos - absolute_dir, len); + ftp->dirs[ftp->dirdepth] = curl_unescape2(conn->data, + cur_pos - absolute_dir, + len); if (!ftp->dirs[ftp->dirdepth]) { /* run out of memory ... */ failf(data, "no memory"); @@ -3803,7 +3876,7 @@ } if(*ftp->file) { - ftp->file = curl_unescape(ftp->file, 0); + ftp->file = curl_unescape2(conn->data, ftp->file, 0); if(NULL == ftp->file) { freedirs(ftp); failf(data, "no memory"); @@ -3830,7 +3903,7 @@ if(ftp->prevpath) { /* prevpath is "raw" so we convert the input path before we compare the strings */ - char *path = curl_unescape(conn->path, 0); + char *path = curl_unescape2(conn->data, conn->path, 0); if(!path) return CURLE_OUT_OF_MEMORY; diff -rNuX exclude curl-7.15.3-20060314/lib/ldap.c curl/lib/ldap.c --- curl-7.15.3-20060314/lib/ldap.c 2005-12-18 22:00:15.000000000 -0500 +++ curl/lib/ldap.c 2006-03-13 19:49:13.000000000 -0500 @@ -498,31 +498,31 @@ /* * Unescape the LDAP-URL components */ -static bool unescape_elements (LDAPURLDesc *ludp) +static bool unescape_elements (void *data, LDAPURLDesc *ludp) { int i; if (ludp->lud_filter) { - ludp->lud_filter = curl_unescape(ludp->lud_filter, 0); + ludp->lud_filter = curl_unescape2(data, ludp->lud_filter, 0); if (!ludp->lud_filter) return (FALSE); } for (i = 0; ludp->lud_attrs && ludp->lud_attrs[i]; i++) { - ludp->lud_attrs[i] = curl_unescape(ludp->lud_attrs[i], 0); + ludp->lud_attrs[i] = curl_unescape2(data, ludp->lud_attrs[i], 0); if (!ludp->lud_attrs[i]) return (FALSE); } for (i = 0; ludp->lud_exts && ludp->lud_exts[i]; i++) { - ludp->lud_exts[i] = curl_unescape(ludp->lud_exts[i], 0); + ludp->lud_exts[i] = curl_unescape2(data, ludp->lud_exts[i], 0); if (!ludp->lud_exts[i]) return (FALSE); } if (ludp->lud_dn) { char *dn = ludp->lud_dn; - char *new_dn = curl_unescape(dn, 0); + char *new_dn = curl_unescape2(data, dn, 0); free(dn); ludp->lud_dn = new_dn; @@ -633,7 +633,7 @@ LDAP_TRACE (("exts[%d] '%s'\n", i, ludp->lud_exts[i])); success: - if (!unescape_elements(ludp)) + if (!unescape_elements(conn->data, ludp)) return LDAP_NO_MEMORY; return LDAP_SUCCESS; } diff -rNuX exclude curl-7.15.3-20060314/lib/select.c curl/lib/select.c --- curl-7.15.3-20060314/lib/select.c 2005-11-13 22:00:19.000000000 -0500 +++ curl/lib/select.c 2006-03-08 14:56:29.000000000 -0500 @@ -50,8 +50,8 @@ #include "connect.h" #include "select.h" -#ifdef WIN32 -#define VERIFY_SOCK(x) /* Win-sockets are not in range [0..FD_SETSIZE> */ +#if defined(WIN32) || defined(TPF) +#define VERIFY_SOCK(x) /* sockets are not in range [0..FD_SETSIZE] */ #else #define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE)) #define VERIFY_SOCK(x) do { \ diff -rNuX exclude curl-7.15.3-20060314/lib/sendf.c curl/lib/sendf.c --- curl-7.15.3-20060314/lib/sendf.c 2005-04-07 22:00:17.000000000 -0400 +++ curl/lib/sendf.c 2006-03-13 19:11:22.000000000 -0500 @@ -59,9 +59,109 @@ #include #include "memory.h" #include "strerror.h" + +#ifdef CURL_ON_EBCDIC_PLATFORM +/* need Curl_convert_ascii_to_ebcdic prototype */ +#include "easyif.h" +#endif /* CURL_ON_EBCDIC_PLATFORM */ + /* The last #include file should be: */ #include "memdebug.h" +#ifdef CURL_ON_EBCDIC_PLATFORM +/* Note: This funciton could become generic + if it's of use on non-EBCDIC platforms */ +size_t curl_convert_lineends(struct SessionHandle *data, + curl_infotype type, + char *startPtr, size_t size) +{ +/* Change CRLF (\r\n) end-of-line markers to a single LF (\n). + If "split" is true, track when a CRLF is split between two blocks. + Change any remaining CRs to LFs. + */ + char *inPtr, *outPtr; + + /* sanity check */ + if ((startPtr == NULL) || (size < 1)) { + return(-1); + } + + if (data->state.prev_block_had_trailing_cr == TRUE) { + if (type == CURLINFO_DATA_IN) { + /* The previous block of incoming data + had a trailing CR, which was turned into a LF. */ + if (*startPtr == '\n') { + /* This block of incoming data starts with the + previous block's LF so get rid of it */ + memcpy(startPtr, startPtr+1, size-1); + size--; + /* and it wasn't a bare CR but was a CRLF conversion instead: */ + data->state.bare_cr_conversions--; + data->state.crlf_conversions++; + } + } + /* reset the flag regardless of the "type" */ + data->state.prev_block_had_trailing_cr = FALSE; + } + + /* find 1st CR, if any */ + inPtr = outPtr = memchr(startPtr, '\r', size); + if (inPtr) { + /* at least one CR, now look for CRLF */ + while (inPtr < (startPtr+size-1)) { + /* note that it's size-1, so we'll never look past the last byte */ + if (memcmp(inPtr, "\r\n", 2) == 0) { + /* CRLF found, bump past the CR and copy the NL */ + inPtr++; + *outPtr = *inPtr; + if (type == CURLINFO_DATA_IN) { + /* keep track of data CRLF conversions for information msgs */ + data->state.crlf_conversions++; + } + } else { + if (*inPtr == '\r') { + /* lone CR, move LF instead */ + *outPtr = '\n'; + if (type == CURLINFO_DATA_IN) { + data->state.bare_cr_conversions++; + } + } else { + /* not a CRLF nor a CR, just copy whatever it is */ + *outPtr = *inPtr; + } + } + outPtr++; + inPtr++; + } /* end of while loop */ + + if (inPtr < startPtr+size) { + /* handle last byte */ + if (*inPtr == '\r') { + /* deal with a CR at the end of the buffer */ + *outPtr = '\n'; /* copy a NL instead */ + if (type == CURLINFO_DATA_IN) { + /* make the extra effort to track a CRLF split + across two blocks if it's in the actual data */ + data->state.prev_block_had_trailing_cr = TRUE; + data->state.bare_cr_conversions++; + } + } else { + /* copy last byte */ + *outPtr = *inPtr; + } + outPtr++; + inPtr++; + } + if (outPtr < startPtr+size) { + /* tidy up output by null terminating the now shorter data */ + *outPtr = '\0'; + } + return(outPtr - startPtr); + } + return(size); +} +#endif /* CURL_ON_EBCDIC_PLATFORM */ + /* returns last node in linked list */ static struct curl_slist *slist_get_last(struct curl_slist *list) { @@ -293,6 +393,34 @@ if(0 == len) len = strlen(ptr); +#ifdef CURL_ON_EBCDIC_PLATFORM + if(type & CLIENTWRITE_BODY) { + if(data->ftp_current_transfertype_is_ascii) { + /* convert from ASCII to EBCDIC */ + size_t rc; + rc = Curl_convert_ascii_to_ebcdic(data, ptr, len); + /* Curl_convert_ascii_to_ebcdic calls failf if unsuccessful */ + if(rc != CURLE_OK) { + return(rc); + } + /* convert end-of-line markers */ + len = curl_convert_lineends(data, CURLINFO_DATA_IN, ptr, len); + } + /* If the previous block of data ended with CR + and this block of data is just a NL, + then the length might be zero */ + if (len) { + wrote = data->set.fwrite(ptr, 1, len, data->set.out); + } else { + wrote = len; + } + if(wrote != len) { + failf (data, "Failed writing body"); + return CURLE_WRITE_ERROR; + } + } +#else + if(type & CLIENTWRITE_BODY) { wrote = data->set.fwrite(ptr, 1, len, data->set.out); if(wrote != len) { @@ -300,6 +428,8 @@ return CURLE_WRITE_ERROR; } } +#endif /* else CURL_ON_EBCDIC_PLATFORM */ + if((type & CLIENTWRITE_HEADER) && (data->set.fwrite_header || data->set.writeheader) ) { /* @@ -309,6 +439,14 @@ curl_write_callback writeit= data->set.fwrite_header?data->set.fwrite_header:data->set.fwrite; + /* ASCII/EBCDIC Note: header is in host encoding + regardless of the transfer type (ASCII/Image) */ + +#ifdef CURL_ON_EBCDIC_PLATFORM + /* convert end-of-line markers */ + len = curl_convert_lineends(data, CURLINFO_HEADER_IN, ptr, len); +#endif /* CURL_ON_EBCDIC_PLATFORM */ + wrote = writeit(ptr, 1, len, data->set.writeheader); if(wrote != len) { failf (data, "Failed writing header"); @@ -375,6 +513,46 @@ static const char * const s_infotype[CURLINFO_END] = { "* ", "< ", "> ", "{ ", "} ", "{ ", "} " }; +#ifdef CURL_ON_EBCDIC_PLATFORM + char buf[BUFSIZE+1]; + + switch(type) { + case CURLINFO_HEADER_OUT: + /* assume output headers as ASCII */ + /* copy the data into my buffer so the original is unchanged */ + if (size > BUFSIZE) { + size = BUFSIZE; /* truncate if necessary */ + buf[BUFSIZE] = '\0'; + } + memcpy(buf, ptr, size); + Curl_convert_ascii_to_ebcdic(data, buf, size); + /* Curl_convert_ascii_to_ebcdic calls failf if unsuccessful */ + /* We might as well continue on even if it fails... */ + + /* convert end-of-line markers */ + size = curl_convert_lineends(data, CURLINFO_HEADER_OUT, buf, size); + ptr = buf; /* switch pointer to use my buffer instead */ + break; + case CURLINFO_HEADER_IN: + /* should already be in EBCDIC but with CRLFs */ + if (size > BUFSIZE) { + size = BUFSIZE; /* truncate if necessary */ + buf[BUFSIZE] = '\0'; + } + memcpy(buf, ptr, size); + /* convert end-of-line markers */ + size = curl_convert_lineends(data, CURLINFO_HEADER_IN, buf, size); + ptr = buf; /* switch pointer to use my buffer instead */ + break; + case CURLINFO_TEXT: + /* should already be in EBCDIC with LFs */ + break; + default: + /* leave everything else as-is */ + break; + } +#endif /* CURL_ON_EBCDIC_PLATFORM */ + if(data->set.fdebug) return (*data->set.fdebug)(data, type, ptr, size, data->set.debugdata); diff -rNuX exclude curl-7.15.3-20060314/lib/setup.h curl/lib/setup.h --- curl-7.15.3-20060314/lib/setup.h 2006-01-16 22:00:44.000000000 -0500 +++ curl/lib/setup.h 2006-03-08 14:34:31.000000000 -0500 @@ -67,6 +67,11 @@ #include "amigaos.h" #endif +#ifdef TPF +/* hand-modified TPF config.h */ +#include "config-tpf.h" +#endif + #endif /* HAVE_CONFIG_H */ /* diff -rNuX exclude curl-7.15.3-20060314/lib/ssluse.c curl/lib/ssluse.c --- curl-7.15.3-20060314/lib/ssluse.c 2006-03-13 22:00:50.000000000 -0500 +++ curl/lib/ssluse.c 2006-03-14 15:00:35.839435000 -0500 @@ -69,6 +69,11 @@ #include "memory.h" +#ifdef CURL_ON_EBCDIC_PLATFORM +/* need Curl_convert_... prototypes */ +#include "easyif.h" +#endif + /* The last #include file should be: */ #include "memdebug.h" @@ -972,6 +977,17 @@ if (peer_CN == nulstr) peer_CN = NULL; +#ifdef CURL_ON_EBCDIC_PLATFORM + else { + /* convert peer_CN from UTF8 to EBCDIC */ + size_t rc; + rc = Curl_convert_utf8_to_ebcdic(data, peer_CN, strlen(peer_CN)); + /* Curl_convert_utf8_to_ebcdic calls failf if unsuccessful */ + if (rc != CURLE_OK) { + return(rc); + } + } +#endif /* CURL_ON_EBCDIC_PLATFORM */ if (!peer_CN) { if(data->set.ssl.verifyhost > 1) { diff -rNuX exclude curl-7.15.3-20060314/lib/strerror.c curl/lib/strerror.c --- curl-7.15.3-20060314/lib/strerror.c 2005-12-02 22:00:31.000000000 -0500 +++ curl/lib/strerror.c 2006-03-14 15:01:43.269435000 -0500 @@ -132,7 +132,11 @@ return "failed to open/read local data from file/application"; case CURLE_OUT_OF_MEMORY: +#ifdef CURL_ON_EBCDIC_PLATFORM + return "EBCDIC translation failed -or- out of memory"; +#else return "out of memory"; +#endif case CURLE_OPERATION_TIMEOUTED: return "a timeout was reached"; @@ -266,6 +270,16 @@ case CURLE_TFTP_NOSUCHUSER: return "TFTP: No such user";; + case CURLE_EBCDIC_CONV_FAILED: + return "EBCDIC translation failed"; + + case CURLE_EBCDIC_CONV_REQD: +#ifdef USE_SSLEAY + return "caller must register conversion callbacks for EBCDIC using CURLOPT_CONV_ASCII_TO_EBCDIC_FUNCTION, CURLOPT_CONV_EBCDIC_TO_ASCII_FUNCTION, and CURLOPT_CONV_UTF8_TO_EBCDIC_FUNCTION"; +#else + return "caller must register conversion callbacks for EBCDIC using CURLOPT_ONV_ASCII_TO_EBCDIC_FUNCTION and CURLOPT_CONV_EBCDIC_TO_ASCII_FUNCTION"; +#endif + case CURLE_URL_MALFORMAT_USER: /* not used by current libcurl */ case CURLE_MALFORMAT_USER: /* not used by current libcurl */ case CURLE_BAD_CALLING_ORDER: /* not used by current libcurl */ diff -rNuX exclude curl-7.15.3-20060314/lib/tftp.c curl/lib/tftp.c --- curl-7.15.3-20060314/lib/tftp.c 2005-12-08 22:00:16.000000000 -0500 +++ curl/lib/tftp.c 2006-03-13 19:36:31.000000000 -0500 @@ -261,7 +261,7 @@ if(data->set.upload) { /* If we are uploading, send an WRQ */ state->spacket.event = htons(TFTP_EVENT_WRQ); - filename = curl_unescape(filename, (int)strlen(filename)); + filename = curl_unescape2(data, filename, (int)strlen(filename)); state->conn->upload_fromhere = (char *)state->spacket.u.data.data; if(data->set.infilesize != -1) { Curl_pgrsSetUploadSize(data, data->set.infilesize); diff -rNuX exclude curl-7.15.3-20060314/lib/transfer.c curl/lib/transfer.c --- curl-7.15.3-20060314/lib/transfer.c 2006-02-19 22:00:15.000000000 -0500 +++ curl/lib/transfer.c 2006-03-10 13:57:52.000000000 -0500 @@ -105,6 +105,11 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include +#ifdef CURL_ON_EBCDIC_PLATFORM +/* need Curl_convert_ebcdic_to_ascii prototype */ +#include "easyif.h" +#endif + /* The last #include file should be: */ #include "memdebug.h" @@ -167,6 +172,17 @@ *nreadp = nread; +#ifdef CURL_ON_EBCDIC_PLATFORM + if(data->ftp_current_transfertype_is_ascii) { + CURLcode res; + res = Curl_convert_ebcdic_to_ascii(data, conn->upload_fromhere, nread); + /* Curl_convert_ebcdic_to_ascii calls failf if unsuccessful */ + if(res != CURLE_OK) { + return(res); + } + } +#endif /* CURL_ON_EBCDIC_PLATFORM */ + return CURLE_OK; } @@ -1268,7 +1284,12 @@ conn->upload_present = nread; /* convert LF to CRLF if so asked */ +#ifdef CURL_ON_EBCDIC_PLATFORM + /* always convert on ASCII/text uploads from EBCDIC platforms */ + if ((data->set.crlf) || (data->ftp_current_transfertype_is_ascii)) { +#else if (data->set.crlf) { +#endif /* CURL_ON_EBCDIC_PLATFORM */ if(data->state.scratch == NULL) data->state.scratch = malloc(2*BUFSIZE); if(data->state.scratch == NULL) { @@ -1276,6 +1297,12 @@ return CURLE_OUT_OF_MEMORY; } for(i = 0, si = 0; i < nread; i++, si++) { + /* + * ASCII/EBCDIC Note: This is presumably a text (not binary) + * transfer so the data should already be in ASCII. + * That means the hex values for ASCII CR (0x0d) & LF (0x0a) + * must be used instead of the escape sequences \r & \n. + */ if (conn->upload_fromhere[i] == 0x0a) { data->state.scratch[si++] = 0x0d; data->state.scratch[si] = 0x0a; @@ -1402,6 +1429,30 @@ * returning. */ +#ifdef CURL_ON_EBCDIC_PLATFORM + if(!(conn->bits.no_body) && (conn->size != -1) && + !conn->newurl) { + if (data->state.bare_cr_conversions) { + if (data->state.bare_cr_conversions == 1) { + infof(data, "Warning: converted %i bare CR to a LF\n", + data->state.bare_cr_conversions); + } else { + infof(data, "Warning: converted %i bare CRs to LFs\n", + data->state.bare_cr_conversions); + } + } + if ((k->bytecount != conn->size) && (data->state.crlf_conversions)) { + if (data->state.crlf_conversions == 1) { + infof(data, "Converted %i CRLF sequence to a LF\n", + data->state.crlf_conversions); + } else { + infof(data, "Converted %i CRLF sequences to LFs\n", + data->state.crlf_conversions); + } + } + } +#endif /* CURL_ON_EBCDIC_PLATFORM */ + if(!(conn->bits.no_body) && (conn->size != -1) && (k->bytecount != conn->size) && !conn->newurl) { diff -rNuX exclude curl-7.15.3-20060314/lib/url.c curl/lib/url.c --- curl-7.15.3-20060314/lib/url.c 2006-03-07 22:00:19.000000000 -0500 +++ curl/lib/url.c 2006-03-14 13:45:26.000000000 -0500 @@ -318,6 +318,12 @@ /* use fread as default function to read input */ data->set.fread = (curl_read_callback)fread; +#ifdef CURL_ON_EBCDIC_PLATFORM + data->set.convasciitoebcdic = (curl_ebcdic_callback)NULL; + data->set.convebcdictoascii = (curl_ebcdic_callback)NULL; + data->set.convutf8toebcdic = (curl_ebcdic_callback)NULL; +#endif /* CURL_ON_EBCDIC_PLATFORM */ + data->set.infilesize = -1; /* we don't know any size */ data->set.postfieldsize = -1; data->set.maxredirs = -1; /* allow any amount by default */ @@ -1167,6 +1173,26 @@ /* When set to NULL, reset to our internal default function */ data->set.fread = (curl_read_callback)fread; break; +#ifdef CURL_ON_EBCDIC_PLATFORM + case CURLOPT_CONV_ASCII_TO_EBCDIC_FUNCTION: + /* + * "Convert from ASCII to EBCDIC" callback + */ + data->set.convasciitoebcdic = va_arg(param, curl_ebcdic_callback); + break; + case CURLOPT_CONV_EBCDIC_TO_ASCII_FUNCTION: + /* + * "Convert from EBCDIC to ASCII" callback + */ + data->set.convebcdictoascii = va_arg(param, curl_ebcdic_callback); + break; + case CURLOPT_CONV_UTF8_TO_EBCDIC_FUNCTION: + /* + * "Convert from UTF-8 to EBCDIC" callback + */ + data->set.convutf8toebcdic = va_arg(param, curl_ebcdic_callback); + break; +#endif /* CURL_ON_EBCDIC_PLATFORM */ case CURLOPT_IOCTLFUNCTION: /* * I/O control callback. Might be NULL. @@ -2795,11 +2821,11 @@ "%" MAX_CURL_PASSWORD_LENGTH_TXT "[^\n]", proxyuser, proxypasswd); - conn->proxyuser = curl_unescape(proxyuser,0); + conn->proxyuser = curl_unescape2(data,proxyuser,0); if(!conn->proxyuser) return CURLE_OUT_OF_MEMORY; - conn->proxypasswd = curl_unescape(proxypasswd,0); + conn->proxypasswd = curl_unescape2(data,proxypasswd,0); if(!conn->proxypasswd) return CURLE_OUT_OF_MEMORY; } @@ -3234,13 +3260,13 @@ username or password with reserved characters like ':' in them. */ Curl_safefree(conn->proxyuser); - conn->proxyuser = curl_unescape(proxyuser,0); + conn->proxyuser = curl_unescape2(data,proxyuser,0); if(!conn->proxyuser) res = CURLE_OUT_OF_MEMORY; else { Curl_safefree(conn->proxypasswd); - conn->proxypasswd = curl_unescape(proxypasswd,0); + conn->proxypasswd = curl_unescape2(data,proxypasswd,0); if(!conn->proxypasswd) res = CURLE_OUT_OF_MEMORY; @@ -3376,7 +3402,7 @@ sscanf(userpass, ":%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", passwd); if(user[0]) { - char *newname=curl_unescape(user, 0); + char *newname=curl_unescape2(data, user, 0); if(!newname) return CURLE_OUT_OF_MEMORY; if(strlen(newname) < sizeof(user)) @@ -3388,7 +3414,7 @@ } if (passwd[0]) { /* we have a password found in the URL, decode it! */ - char *newpasswd=curl_unescape(passwd, 0); + char *newpasswd=curl_unescape2(data, passwd, 0); if(!newpasswd) return CURLE_OUT_OF_MEMORY; if(strlen(newpasswd) < sizeof(passwd)) diff -rNuX exclude curl-7.15.3-20060314/lib/urldata.h curl/lib/urldata.h --- curl-7.15.3-20060314/lib/urldata.h 2006-03-07 22:00:19.000000000 -0500 +++ curl/lib/urldata.h 2006-03-14 13:35:55.000000000 -0500 @@ -910,8 +910,17 @@ #if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H) ENGINE *engine; #endif /* USE_SSLEAY */ -}; +#ifdef CURL_ON_EBCDIC_PLATFORM + /* for downloads we need to track CRLF sequences that span blocks */ + bool prev_block_had_trailing_cr; + /* how many CRLFs did we converted to LFs? */ + size_t crlf_conversions; + /* how many bare CRs did we converted to LFs? */ + size_t bare_cr_conversions; +#endif /* CURL_ON_EBCDIC_PLATFORM */ + +}; /* * This 'DynamicStatic' struct defines dynamic states that actually change @@ -985,6 +994,14 @@ curl_progress_callback fprogress; /* function for progress information */ curl_debug_callback fdebug; /* function that write informational data */ curl_ioctl_callback ioctl; /* function for I/O control */ +#ifdef CURL_ON_EBCDIC_PLATFORM + /* function to convert from ASCII to EBCDIC: */ + curl_ebcdic_callback convasciitoebcdic; + /* function to convert from EBCDIC to ASCII: */ + curl_ebcdic_callback convebcdictoascii; + /* function to convert from UTF-8 to EBCDIC: */ + curl_ebcdic_callback convutf8toebcdic; +#endif /* CURL_ON_EBCDIC_PLATFORM */ void *progress_client; /* pointer to pass to the progress callback */ void *ioctl_client; /* pointer to pass to the ioctl callback */ long timeout; /* in seconds, 0 means no timeout */ @@ -1115,6 +1132,10 @@ struct UrlState state; /* struct for fields used for state info and other dynamic purposes */ struct PureInfo info; /* stats, reports and info data */ +#ifdef CURL_ON_EBCDIC_PLATFORM + /* set by ftp_transfertype for use by Curl_client_write and others */ + bool ftp_current_transfertype_is_ascii; +#endif /* CURL_ON_EBCDIC_PLATFORM */ }; #define LIBCURL_NAME "libcurl"