diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 3 | ||||
-rw-r--r-- | lib/config.dj | 92 | ||||
-rw-r--r-- | lib/getpass.c | 6 | ||||
-rw-r--r-- | lib/makefile.dj | 157 | ||||
-rw-r--r-- | lib/setup.h | 17 | ||||
-rw-r--r-- | lib/url.c | 27 | ||||
-rw-r--r-- | lib/urldata.h | 2 |
7 files changed, 298 insertions, 6 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 342a29c46..62c5c55d9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -7,7 +7,8 @@ AUTOMAKE_OPTIONS = foreign nostdinc EXTRA_DIST = getdate.y Makefile.b32 Makefile.b32.resp Makefile.m32 \ Makefile.vc6 Makefile.riscos libcurl.def curllib.dsp \ curllib.dsw config-vms.h config-win32.h config-riscos.h config-mac.h \ - config.h.in ca-bundle.crt README.encoding README.memoryleak + config.h.in ca-bundle.crt README.encoding README.memoryleak \ + makefile.dj config.dj lib_LTLIBRARIES = libcurl.la diff --git a/lib/config.dj b/lib/config.dj new file mode 100644 index 000000000..6fd92a636 --- /dev/null +++ b/lib/config.dj @@ -0,0 +1,92 @@ +#ifndef _CURL_CONFIG_DJGPP_H
+#define _CURL_CONFIG_DJGPP_H
+
+#define OS "djgpp"
+#define PACKAGE "curl"
+
+#define CURL_CA_BUNDLE "/dev/env/CURL_CA_BUNDLE"
+
+#if (DJGPP_MINOR >= 4)
+/* #define HAVE_DLOPEN 1 maybe not (DXE3) */
+#endif
+
+#if 1 /* use ioctlsocket() via fsext'ed fcntl() */
+ #define HAVE_O_NONBLOCK 1
+#else
+ #define HAVE_IOCTLSOCKET 1
+#endif
+
+#define HAVE_ALARM 1
+#define HAVE_ARPA_INET_H 1
+#define HAVE_CLOSESOCKET 1
+#define HAVE_FCNTL_H 1
+#define HAVE_GETHOSTBYADDR 1
+#define HAVE_GETHOSTNAME 1
+#define HAVE_GETPASS 1
+#define HAVE_GETSERVBYNAME 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_INET_ADDR 1
+#define HAVE_INET_NTOA 1
+#define HAVE_IO_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_NETDB_H 1
+#define HAVE_NETINET_IN_H 1
+#define HAVE_NET_IF_H 1
+#define HAVE_PERROR 1
+#define HAVE_SELECT 1
+#define HAVE_SETJMP_H 1
+#define HAVE_SETVBUF 1
+#define HAVE_SIGNAL 1
+#define HAVE_SIGACTION 1
+#define HAVE_SIGSETJMP 1
+#define HAVE_SOCKET 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRDUP 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRICMP 1
+#define HAVE_STRSTR 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_TERMIOS_H 1
+#define HAVE_TIME_H 1
+#define HAVE_UNAME 1
+#define HAVE_UNISTD_H 1
+#define HAVE_VPRINTF 1
+
+#define RETSIGTYPE void
+#define SIZEOF_LONG_DOUBLE 16
+#define SIZEOF_LONG_LONG 8
+#define STDC_HEADERS 1
+#define TIME_WITH_SYS_TIME 1
+
+#define BSD
+#define USE_ZLIB
+
+/* #define MALLOCDEBUG */
+
+#ifdef HAVE_OPENSSL_ENGINE_H /* on cmd-line */
+ #define HAVE_OPENSSL_X509_H 1
+ #define HAVE_OPENSSL_SSL_H 1
+ #define HAVE_OPENSSL_RSA_H 1
+ #define HAVE_OPENSSL_PEM_H 1
+ #define HAVE_OPENSSL_ERR_H 1
+ #define HAVE_OPENSSL_CRYPTO_H 1
+ #define HAVE_LIBSSL 1
+ #define HAVE_LIBCRYPTO 1
+ #define OPENSSL_NO_KRB5 1
+#endif
+
+#define in_addr_t u_long
+#define socklen_t int
+#define ssize_t int
+
+#include <stdlib.h>
+#include <string.h>
+#include <tcp.h> /* Watt-32 API */
+
+#undef word
+
+#endif /* _CURL_CONFIG_DJGPP_H */
+
diff --git a/lib/getpass.c b/lib/getpass.c index 118579e69..b6ea97805 100644 --- a/lib/getpass.c +++ b/lib/getpass.c @@ -99,7 +99,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) char infp_fclose = 0; FILE *outfp; RETSIGTYPE (*sigint)(); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__DJGPP__) RETSIGTYPE (*sigtstp)(); #endif size_t bytes_read; @@ -119,7 +119,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) sigint = signal(SIGINT, SIG_IGN); /* 20000318 mgs * this is needed by the emx system, SIGTSTP is not a supported signal */ -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__DJGPP__) sigtstp = signal(SIGTSTP, SIG_IGN); #endif @@ -181,7 +181,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) #endif signal(SIGINT, sigint); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__DJGPP__) signal(SIGTSTP, sigtstp); #endif diff --git a/lib/makefile.dj b/lib/makefile.dj new file mode 100644 index 000000000..d3a9dc40c --- /dev/null +++ b/lib/makefile.dj @@ -0,0 +1,157 @@ +#
+# Adapted for djgpp2 / Watt-32 / DOS by
+# Gisle Vanem <giva@bgnett.no>
+#
+
+DEPEND_PREREQ = config.h getdate.c
+
+include ../packages/DOS/common.dj
+
+ifeq ($(USE_SSL),1)
+ CFLAGS += -I$(OPENSSL_ROOT)
+endif
+
+SOURCES = base64.c connect.c content_.c cookie.c dict.c \
+ easy.c escape.c file.c formdata.c ftp.c \
+ getdate.c getenv.c getinfo.c getpass.c hash.c \
+ hostip.c http.c http_chu.c if2ip.c krb4.c \
+ ldap.c llist.c memdebug.c mprintf.c multi.c \
+ netrc.c progress.c security.c sendf.c share.c \
+ speedche.c ssluse.c strequal.c strtok.c telnet.c \
+ timeval.c transfer.c url.c version.c
+
+OBJECTS = $(SOURCES:.c=.o)
+CURL_LIB = libcurl.a
+
+all: config.h $(CURL_LIB)
+
+$(CURL_LIB): $(OBJECTS)
+ ar rs $@ $?
+
+config.h: config.dj
+ @echo '#include "./config.dj"' > $@
+
+getdate.c: getdate.y
+ $(YACC) -o $@ $^
+
+clean:
+ - rm -f $(OBJECTS) $(CURL_LIB) Makefile.bak config.h getdate.c
+
+# DO NOT DELETE THIS LINE
+base64.o: base64.c setup.h config.h config.dj ../include/curl/mprintf.h \
+ base64.h
+connect.o: connect.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h sendf.h if2ip.h
+content_.o: content_.c setup.h config.h config.dj
+cookie.o: cookie.c setup.h config.h config.dj cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h getdate.h strequal.h strtok.h
+dict.o: dict.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h transfer.h sendf.h progress.h strequal.h \
+ ../include/curl/mprintf.h
+easy.o: easy.c setup.h config.h config.dj strequal.h urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h transfer.h ssluse.h url.h getinfo.h \
+ ../include/curl/mprintf.h
+escape.o: escape.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h
+file.o: file.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h progress.h sendf.h escape.h ../include/curl/mprintf.h
+formdata.o: formdata.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ formdata.h strequal.h
+ftp.o: ftp.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \
+ llist.h sendf.h if2ip.h progress.h transfer.h escape.h http.h ftp.h \
+ strequal.h ssluse.h connect.h ../include/curl/mprintf.h
+getdate.o: getdate.c setup.h config.h config.dj getdate.h
+getenv.o: getenv.c setup.h config.h config.dj
+getinfo.o: getinfo.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \
+ llist.h
+getpass.o: getpass.c setup.h config.h config.dj
+hash.o: hash.c setup.h config.h config.dj hash.h llist.h
+hostip.o: hostip.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h sendf.h share.h ../include/curl/mprintf.h
+http.o: http.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h transfer.h sendf.h progress.h base64.h strequal.h \
+ ssluse.h ../include/curl/mprintf.h
+http_chu.o: http_chu.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h sendf.h content_encoding.h ../include/curl/mprintf.h
+if2ip.o: if2ip.c setup.h config.h config.dj
+krb4.o: krb4.c setup.h config.h config.dj
+ldap.o: ldap.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h sendf.h escape.h transfer.h ../include/curl/mprintf.h
+llist.o: llist.c setup.h config.h config.dj llist.h
+memdebug.o: memdebug.c
+mprintf.o: mprintf.c setup.h config.h config.dj
+multi.o: multi.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \
+ llist.h transfer.h url.h connect.h progress.h
+netrc.o: netrc.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ strequal.h strtok.h
+progress.o: progress.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \
+ llist.h sendf.h progress.h ../include/curl/mprintf.h
+security.o: security.c setup.h config.h config.dj
+sendf.o: sendf.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \
+ llist.h sendf.h connect.h ../include/curl/mprintf.h
+share.o: share.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \
+ llist.h share.h
+speedche.o: speedche.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \
+ llist.h sendf.h speedcheck.h
+ssluse.o: ssluse.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h sendf.h url.h
+strequal.o: strequal.c setup.h config.h config.dj
+strtok.o: strtok.c setup.h config.h config.dj
+telnet.o: telnet.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h transfer.h sendf.h ../include/curl/mprintf.h \
+ arpa_telnet.h
+timeval.o: timeval.c timeval.h setup.h config.h config.dj
+transfer.o: transfer.c setup.h config.h config.dj strequal.h urldata.h \
+ cookie.h ../include/curl/curl.h ../include/curl/types.h \
+ ../include/curl/easy.h ../include/curl/multi.h formdata.h timeval.h \
+ http_chunks.h hostip.h hash.h llist.h netrc.h content_encoding.h \
+ transfer.h sendf.h speedcheck.h getpass.h progress.h getdate.h http.h \
+ url.h getinfo.h ssluse.h ../include/curl/mprintf.h
+url.o: url.c setup.h config.h config.dj urldata.h cookie.h \
+ ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \
+ ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \
+ hash.h llist.h netrc.h base64.h ssluse.h if2ip.h transfer.h sendf.h \
+ getpass.h progress.h strequal.h escape.h strtok.h share.h \
+ content_encoding.h ftp.h dict.h telnet.h http.h file.h ldap.h url.h \
+ connect.h ca-bundle.h ../include/curl/mprintf.h
+version.o: version.c setup.h config.h config.dj ../include/curl/curl.h \
+ ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \
+ urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \
+ llist.h
diff --git a/lib/setup.h b/lib/setup.h index a1eb9392f..0a109111f 100644 --- a/lib/setup.h +++ b/lib/setup.h @@ -135,20 +135,33 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO) #define HAVE_ALARM #endif -#define PATH_CHAR ";" #define DIR_CHAR "\\" #define DOT_CHAR "_" #else + +#ifdef DJGPP +#define sclose(x) close_s(x) +#define sread(x,y,z) read_s(x,y,z) +#define swrite(x,y,z) write_s(x,y,z) +#define select(n,r,w,x,t) select_s(n,r,w,x,t) +#else + #define sclose(x) close(x) #define sread(x,y,z) recv(x,y,z,0) #define swrite(x,y,z) send(x,y,z,0) #define HAVE_ALARM -#define PATH_CHAR ":" +#endif + #define DIR_CHAR "/" #define DOT_CHAR "." +#ifdef DJGPP +#undef DOT_CHAR +#define DOT_CHAR "_" +#endif + #ifdef HAVE_STRCASECMP /* this is for "-ansi -Wall -pedantic" to stop complaining! */ extern int (strcasecmp)(const char *s1, const char *s2); @@ -2149,6 +2149,33 @@ static CURLcode CreateConnection(struct SessionHandle *data, if(proxy && *proxy) { /* we have a proxy here to set */ + char *ptr; + char user[MAX_CURL_USER_LENGTH]; + char passwd[MAX_CURL_PASSWORD_LENGTH]; + + /* skip the possible protocol piece */ + ptr=strstr(proxy, "://"); + if(ptr) + ptr += 3; + else + ptr = proxy; + + /* check for an @-letter */ + ptr = strchr(ptr, '@'); + if(ptr && (2 == sscanf(proxy, "%" MAX_CURL_USER_LENGTH_TXT"[^:]:" + "%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", + user, passwd))) { + /* found user and password, rip them out */ + strcpy(data->state.proxyuser, user); + strcpy(data->state.proxypasswd, passwd); + conn->bits.proxy_user_passwd = TRUE; /* enable it */ + + ptr = strdup(ptr+1); + free(proxy); /* free the former data */ + proxy = ptr; /* now use this instead */ + } + + data->change.proxy = proxy; data->change.proxy_alloc=TRUE; /* this needs to be freed later */ conn->bits.httpproxy = TRUE; diff --git a/lib/urldata.h b/lib/urldata.h index 293fee984..efd73b2cf 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -564,6 +564,8 @@ typedef enum { * Session-data MUST be put in the connectdata struct and here. */ #define MAX_CURL_USER_LENGTH 256 #define MAX_CURL_PASSWORD_LENGTH 256 +#define MAX_CURL_USER_LENGTH_TXT "255" +#define MAX_CURL_PASSWORD_LENGTH_TXT "255" struct UrlState { enum { |