Compare commits
131 Commits
curl-7_9_1
...
curl-7_9_2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
139ab3740a | ||
![]() |
7b832e1745 | ||
![]() |
914b9e441b | ||
![]() |
f0f6ab49f5 | ||
![]() |
436d147925 | ||
![]() |
4bd78a7df4 | ||
![]() |
7ee6a9dc25 | ||
![]() |
1b56ae8478 | ||
![]() |
d52c0b6f05 | ||
![]() |
3ff2bfa0e4 | ||
![]() |
aa21a3d5c3 | ||
![]() |
fc33ad8cf2 | ||
![]() |
779043f7a3 | ||
![]() |
265bb99382 | ||
![]() |
7493db2338 | ||
![]() |
c3ad019c99 | ||
![]() |
05b84bfe91 | ||
![]() |
dbfa1e55b6 | ||
![]() |
a0fd63f611 | ||
![]() |
4ec0401529 | ||
![]() |
61e6554b7f | ||
![]() |
f6f3f79aa8 | ||
![]() |
c16c017f8b | ||
![]() |
2f03ef39d1 | ||
![]() |
db33926432 | ||
![]() |
946090b9cd | ||
![]() |
1f7f0fda71 | ||
![]() |
b84d947be4 | ||
![]() |
07c67138c9 | ||
![]() |
10717bd39b | ||
![]() |
302bb4a4b3 | ||
![]() |
81b5af2d1b | ||
![]() |
87c562845c | ||
![]() |
6c81d74626 | ||
![]() |
533c24a471 | ||
![]() |
6a9697387a | ||
![]() |
85c8981b3d | ||
![]() |
6c5b8e1d59 | ||
![]() |
2cc16d89e6 | ||
![]() |
42eb74922d | ||
![]() |
c528a7ee33 | ||
![]() |
eb2da7ec2b | ||
![]() |
01ed950bbe | ||
![]() |
b1076e0a9e | ||
![]() |
332eb7651a | ||
![]() |
cfdcf5c933 | ||
![]() |
820de919b6 | ||
![]() |
a32cd520bd | ||
![]() |
b93a60daf9 | ||
![]() |
e2844f5e04 | ||
![]() |
cabb46db3d | ||
![]() |
d09b436937 | ||
![]() |
10fdb1d743 | ||
![]() |
f0d3fccd4b | ||
![]() |
aff19f64b5 | ||
![]() |
15a56b42d6 | ||
![]() |
d3706814e9 | ||
![]() |
6513dcef68 | ||
![]() |
81f22465ba | ||
![]() |
dccc77a325 | ||
![]() |
13ac89af24 | ||
![]() |
ffefcab1bc | ||
![]() |
0226b53b75 | ||
![]() |
bbf80d0f93 | ||
![]() |
6003f24f78 | ||
![]() |
4382a80b9a | ||
![]() |
9fe920cd90 | ||
![]() |
f0ee7115d3 | ||
![]() |
5986c653ef | ||
![]() |
0e7203be89 | ||
![]() |
52dbc96c32 | ||
![]() |
1c8da21083 | ||
![]() |
8f304d8167 | ||
![]() |
30a0bd9cf5 | ||
![]() |
ae40cdf92f | ||
![]() |
b342fbdcda | ||
![]() |
d1ea596f88 | ||
![]() |
064cf971ef | ||
![]() |
91b1598756 | ||
![]() |
17b18bca3c | ||
![]() |
be3d601217 | ||
![]() |
ca0fd33d2d | ||
![]() |
271f96f78f | ||
![]() |
b0130e6b3b | ||
![]() |
d0c1f3e25b | ||
![]() |
b244710ddb | ||
![]() |
d465291ded | ||
![]() |
84e462d5f6 | ||
![]() |
508466a175 | ||
![]() |
e6dd4a6456 | ||
![]() |
8d62e21072 | ||
![]() |
25fe47f262 | ||
![]() |
fe8365d214 | ||
![]() |
2519a8cc9f | ||
![]() |
b8ff21124a | ||
![]() |
6aafc2dfd2 | ||
![]() |
65b22480f4 | ||
![]() |
60f19269d0 | ||
![]() |
5121499082 | ||
![]() |
3e049a90b7 | ||
![]() |
c5d97df7f1 | ||
![]() |
c2479ccb7a | ||
![]() |
fc07eb45f4 | ||
![]() |
c7cdb0f266 | ||
![]() |
92aedf850e | ||
![]() |
dd157fc349 | ||
![]() |
05f3ca880f | ||
![]() |
a18d41a463 | ||
![]() |
1affbff8f9 | ||
![]() |
c55d0bb804 | ||
![]() |
0ffec712e1 | ||
![]() |
6ebac3dc76 | ||
![]() |
3b976ea9f1 | ||
![]() |
2c16dfb526 | ||
![]() |
fe3a78ab19 | ||
![]() |
1a984ea847 | ||
![]() |
2a0cde3041 | ||
![]() |
3552775b52 | ||
![]() |
818a632e80 | ||
![]() |
00afb0f638 | ||
![]() |
2e32d415c0 | ||
![]() |
3dfc509d33 | ||
![]() |
4379142af7 | ||
![]() |
8a6dc57212 | ||
![]() |
af636c535c | ||
![]() |
2f77b0a4c6 | ||
![]() |
08ad385e0e | ||
![]() |
5623e0bb0e | ||
![]() |
3d438d8d64 | ||
![]() |
d89c495782 | ||
![]() |
f5ba174f4d |
246
CHANGES
246
CHANGES
@@ -6,6 +6,248 @@
|
||||
|
||||
History of Changes
|
||||
|
||||
Version 7.9.2
|
||||
|
||||
Daniel (5 December 2001)
|
||||
- Jon Travis found out that if you used libcurl and CURLOPT_UPLOAD and then
|
||||
on the same handle used CURLOPT_HTTPGET it would still attempt to upload.
|
||||
His suggested fix was perfect.
|
||||
|
||||
Daniel (4 December 2001)
|
||||
- Incorporated more macos fixes and added four specific files in a new
|
||||
subdirectory below src.
|
||||
|
||||
Daniel (3 December 2001)
|
||||
- Eric Lavigne reported two problems:
|
||||
|
||||
First one in the curl_strnequal() function. I think this problem is rather
|
||||
macos 9 specific, as most platform provides a function to use instead of the
|
||||
one provided by libcurl.
|
||||
|
||||
A second, more important, was in the way we take care of FTP responses. The
|
||||
code would read a large chunk of data and search for the end-of-response
|
||||
line within that chunk. When found, it would just skip the rest of the
|
||||
data. However, when the network connections are special, or perhaps the
|
||||
server is, we could actually get more than one response in that chunk of
|
||||
data so that when the next invoke to this function was done, the response
|
||||
had already been read and thrown away. Now, we cache the data not used in
|
||||
one call, as it could be useful in the subsequent call. Test case 126 was
|
||||
added and the test ftp server modified, to exercise this particular case.
|
||||
|
||||
Version 7.9.2-pre8
|
||||
|
||||
Daniel (2 December 2001)
|
||||
- Bug report #487825 correctly identified a problem when using a proxy and
|
||||
following a redirection from HTTP to HTTPS. libcurl then re-used the same
|
||||
proxy connection but without doing a proper HTTPS request.
|
||||
|
||||
- Fixed win32 compiling quirks.
|
||||
|
||||
Version 7.9.2-pre7
|
||||
|
||||
Daniel (30 November 2001)
|
||||
- Documented --disable-epsv and CURLOPT_FTP_USE_EPSV.
|
||||
|
||||
Daniel (29 November 2001)
|
||||
- Added --disable-epsv as an option. When used, curl won't attempt to use the
|
||||
EPSV command when doing passive FTP downloads. Wrote a test case for it.
|
||||
|
||||
- Eric provided a few more fixes for building on Macs. He also pointed out
|
||||
a flaw in the signal handler restoration code.
|
||||
|
||||
Daniel (28 November 2001)
|
||||
- Fiddled with some Tru64 problems reported by Dimitris Sarris. They appeared
|
||||
only when using VERBOSE ftp transfers. Do we use a too small buffer for
|
||||
gethostbyaddr_r(), was the lack of using in_addr_t wrong or is it that the
|
||||
hostent struct must be blanked before use? With Dimitris help and these
|
||||
patches, the problems seem to be history.
|
||||
|
||||
- CURLOPT_FTP_USE_EPSV was added and can be set to FALSE to prevent libcurl
|
||||
from using the EPSV command before trying the normal PASV. Heikki Korpela
|
||||
pointed out that some firewalls and similar don't like the EPSV so we must
|
||||
be able to shut if off to work everywhere.
|
||||
|
||||
- I added a configure check for 'in_addr_t' and made the ftp code use that to
|
||||
receive the inet_addr() return code in. Works on Solaris and Linux at
|
||||
least. The Linux man page for inet_addr() doesn't even mention in_addr_t...
|
||||
|
||||
- Adjusted (almost) all FTP tests to the new command sequence.
|
||||
|
||||
- FTP command sequence changes:
|
||||
|
||||
EPSV is now always attempted before PASV. It is the final touch to make IPv6
|
||||
passive FTP downloads to work, but EPSV is not restricted to IPv6 but works
|
||||
fine with IPv4 too on the servers that support it.
|
||||
|
||||
SIZE is now always issued before RETR. It makes curl know the actual
|
||||
download size before the download takes place, as it makes it less important
|
||||
to find the size sent in RETR responses. Many sites don't include the size
|
||||
in there.
|
||||
|
||||
Both these changes made it necessary to change the test suite's ftp server
|
||||
code, and all FTP test cases need to be checked and adjusted!
|
||||
|
||||
Daniel (27 November 2001)
|
||||
- Hans Steegers pointed out that the telnet code read from stdout, not stdin
|
||||
as it is supposed to do!
|
||||
|
||||
Version 7.9.2-pre6
|
||||
|
||||
Daniel (27 November 2001)
|
||||
- Eric Lavigne's minor changes to build on MacOS before OS X were applied.
|
||||
|
||||
- greep at mindspring.com provided a main index.html page for our release
|
||||
archive docs directory. It just links to all the existing HTML files, but
|
||||
I think it may come useful to people.
|
||||
|
||||
- There's now some initial code to support the EPSV FTP command. That should
|
||||
be used to do passive transfers IPv6-style. The code is still #if 0'ed in
|
||||
lib/ftp.c as I have no IPv6 ftp server to test this with.
|
||||
|
||||
Daniel (26 November 2001)
|
||||
- Robert Schlabbach had problems to understand how to do resumed transfers,
|
||||
and I clarified the man page -C section somewhat.
|
||||
|
||||
Version 7.9.2-pre5
|
||||
|
||||
Daniel (22 November 2001)
|
||||
- Andr<64>s Garc<72>a helped me out to track down the roots of bug report #479537,
|
||||
which was concerning curl returning the wrong error code when failing to
|
||||
connect. This didn't happen on all systems, and more specificly I've so far
|
||||
only seen this happen on IPv4-only Linux hosts.
|
||||
|
||||
- I applied the fixes for the two bugs Eric Lavigne found when doing his MacOS
|
||||
port. A missing comma in arpa_telnet.h and a pretty wild write in the FTP
|
||||
response reader function. The latter write is however likely to occur in our
|
||||
own buffer unless very big FTP server replies (>25K) are read. I've never
|
||||
seen such a reply ever, so I think this is a relatively minor risk.
|
||||
|
||||
Daniel (21 November 2001)
|
||||
- Moonesamy provided code to prevent junk from being output when libcurl
|
||||
returns an error code but no error description and that corrects how make is
|
||||
run in the Makefile.dist file (that appears as root Makefile in release
|
||||
archives).
|
||||
|
||||
- Eric Lavigne mailed me bugfixes and patches for building libcurl on MacOS
|
||||
(non-X).
|
||||
|
||||
- Kevin Roth modified the cygwin files once again, now to build against the
|
||||
shared OpenSSL DLLs.
|
||||
|
||||
Version 7.9.2-pre4
|
||||
|
||||
Daniel (20 November 2001)
|
||||
- Georg Horn brought a patch that introduced CURLINFO_STARTTRANSFER_TIME,
|
||||
complete with man page updates!
|
||||
|
||||
Daniel (19 November 2001)
|
||||
- Miklos Nemeth provided details enough to update the Borland makefile
|
||||
properly.
|
||||
|
||||
- Lars M Gustafsson found a case with a bad free(). In fact, it was so bad I'm
|
||||
amazed we never saw this before!
|
||||
|
||||
- Kevin Roth patched the cygwin Makfile.
|
||||
|
||||
Daniel (16 November 2001)
|
||||
- Klevtsov Vadim fixed a bug in how time-conditionals were sent when doing
|
||||
HTTP.
|
||||
|
||||
Version 7.9.2-pre3
|
||||
|
||||
Daniel (14 November 2001)
|
||||
- Samuel Listopad patched away the problem with SSL we got when someone call
|
||||
curl_global_init() => curl_global_cleanup() => curl_global_init(). The
|
||||
second init would not "take" and SSL would be unusable with curl from that
|
||||
point. This doesn't change the fact that calling the functions that way is
|
||||
wrong. curl_global_init() should be called exactly once and not more.
|
||||
|
||||
Daniel (13 November 2001)
|
||||
- Fixed some minor variable type mixups in ftp.c that caused compiler warnings
|
||||
on HP-UX 11.00.
|
||||
|
||||
- The FTP fix I did yesterday used an uninitialized variable that caused
|
||||
spurious errors when doing FTP.
|
||||
|
||||
Version 7.9.2-pre2
|
||||
|
||||
Daniel (12 November 2001)
|
||||
- Ricardo Cadime fell over a multiple-requests problem when first a FTP
|
||||
directory fetch failed and then a second request is made after that. The
|
||||
second request happened to get the FTP server response back from the
|
||||
previous request, when it did its initial CWD command.
|
||||
|
||||
- Bjorn Reese pointed out that we could improve the time diff function to
|
||||
prevent truncation a bit.
|
||||
|
||||
- Kai-Uwe Rommel made me aware that -p (http proxy tunnel) silly enough didn't
|
||||
work for plain HTTP requests! So I made that work.
|
||||
|
||||
Version 7.9.2-pre1
|
||||
|
||||
Daniel (12 November 2001)
|
||||
- Rewrote the Curl_ConnectHTTPProxyTunnel(). It should now not only work a lot
|
||||
faster, it should also support such ("broken") proxies that John Lask
|
||||
previously have reported problems with. His proxy sends a trailing zero byte
|
||||
after the end of the (proxy-) headers. I've tested this myself and it seems
|
||||
to work on a proxy the previous version also worked with...! This rewrite is
|
||||
due to the problems John Lask previously experienced.
|
||||
|
||||
- Andr<64>s Garc<72>a found out why the "current speed" meter sometimes showed 2048K
|
||||
for very quick transfers. It turned out the "time diff"-function returned a
|
||||
zero millisecond diff. We now always say it is at least one millisecond! In
|
||||
reality, these timers very rarely have that good resolution so even though
|
||||
the time diff was longer than 1 millisecond, it was reported as no diff.
|
||||
|
||||
- I also modified the getinfo() again when returning times, as Paul Harrington
|
||||
reports that 7.9.1 only returns times with 1 second accuracy, which indeed
|
||||
is wrong.
|
||||
|
||||
Daniel (8 November 2001)
|
||||
- Marcus Webster found out that curl_formadd() could read one byte outside a
|
||||
buffer boundary, which then of course could lead to a crash. Marcus also
|
||||
gracefully provided a patch for this this.
|
||||
|
||||
- Glen Scott ran configure on his Cobalt Qube and it didn't figure out the
|
||||
correct way of calling gethostbyname_r() and thus failed to resolve hosts.
|
||||
This is two errors: it shouldn't continue the configure script if it finds
|
||||
gethostbyname_r() but can't figure out how to use it, and it should really
|
||||
figure out how to use it as it was running Linux and we know how that
|
||||
works...
|
||||
|
||||
Daniel (7 November 2001)
|
||||
- docs/VERSIONS is a new file in the archive that explains the version number
|
||||
system we use in the curl project.
|
||||
|
||||
- Did some more fixes that now makes libcurl only ignore signals as long as
|
||||
it needs to, and then restore (if any) previous signal handler again.
|
||||
|
||||
Daniel (6 November 2001)
|
||||
- Enrik Berkhan posted bug report #478780, in which he very correctly pointed
|
||||
out two bad timeout matters in libcurl: we didn't restore the sigaction
|
||||
struct (the alarm handler for SIGALRM) nor did we restore the previous
|
||||
alarm() timeout that could've been set by a "parent" process or similar.
|
||||
|
||||
- Kevin Roth made the cygwin binary get stripped before install.
|
||||
|
||||
Daniel (5 November 2001)
|
||||
- Detlef Schmier reported that curl didn't compile using Solaris 8 with the
|
||||
native cc compiler. It was due to a bad function prototype. Fixed now.
|
||||
Unfortunately, I can't enable the -Wstrict-prototypes in my debug builds
|
||||
though, as gcc then complains like crazy on OpenSSL include files... :-(
|
||||
|
||||
- John Lask provided SSL over HTTP proxy fixes. They'll need some tweaking
|
||||
to work on all platforms.
|
||||
|
||||
- John Lask added the -1/--TLSv1 options that forces SSL into using TLS
|
||||
version 1 when speaking HTTPS.
|
||||
|
||||
- John Lask brought a brand new VC++ makefile for the lib directory, that
|
||||
works a lot better than the previous!
|
||||
|
||||
- Ramana Mokkapati brought some clever insights on the LDAP failures (bug
|
||||
report #475407), and his suggested changes are now applied.
|
||||
|
||||
Version 7.9.1
|
||||
|
||||
Daniel (4 November 2001)
|
||||
@@ -34,8 +276,8 @@ Daniel (1 November 2001)
|
||||
Version 7.9.1-pre7
|
||||
|
||||
Daniel (31 October 2001)
|
||||
- The curl_easy_getinfo() timers accidentally lost they're subsecond accuracy
|
||||
as the calculations used longs instead of doubles! Paul Harrington reported.
|
||||
- The curl_easy_getinfo() timers accidentally lost their subsecond accuracy as
|
||||
the calculations used longs instead of doubles! Paul Harrington reported.
|
||||
|
||||
- The SSL SocketIsDead() checks weren't good enough (as expected really), so I
|
||||
had to add a generic internal try-it-out system. If the request on a re-used
|
||||
|
2
LEGAL
2
LEGAL
@@ -1,4 +1,4 @@
|
||||
Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
Copyright (C) 1998-2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
@@ -6,9 +6,8 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
|
||||
EXTRA_DIST = \
|
||||
CHANGES LEGAL maketgz MITX.txt MPL-1.1.txt \
|
||||
config-win32.h reconf Makefile.dist \
|
||||
curl-config.in build_vms.com config-riscos.h \
|
||||
config-vms.h curl-mode.el
|
||||
reconf Makefile.dist curl-config.in build_vms.com curl-mode.el \
|
||||
config-vms.h config-win32.h config-riscos.h config-mac.h
|
||||
|
||||
bin_SCRIPTS = curl-config
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# In order to be useful for every potential user, curl and libcurl are
|
||||
# dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
@@ -43,13 +43,13 @@ mingw32-ssl:
|
||||
|
||||
vc:
|
||||
cd lib
|
||||
nmake -f Makefile.vc6
|
||||
nmake -f Makefile.vc6 cfg=release
|
||||
cd ..\src
|
||||
nmake -f Makefile.vc6
|
||||
|
||||
vc-ssl:
|
||||
cd lib
|
||||
nmake -f Makefile.vc6 release-ssl
|
||||
nmake -f Makefile.vc6 cfg=release-ssl
|
||||
cd ..\src
|
||||
nmake -f Makefile.vc6
|
||||
|
||||
|
2
README
2
README
@@ -26,7 +26,7 @@ README
|
||||
The official download mirror sites are:
|
||||
|
||||
Sweden -- ftp://ftp.sunet.se/pub/www/utilities/curl/
|
||||
Sweden -- ftp://cool.haxx.se/curl/
|
||||
Sweden -- http://cool.haxx.se/curl/
|
||||
Germany -- ftp://ftp.fu-berlin.de/pub/unix/network/curl/
|
||||
|
||||
To download the very latest source off the CVS server do this:
|
||||
|
@@ -62,3 +62,5 @@
|
||||
#undef HAVE_O_NONBLOCK
|
||||
#undef HAVE_DISABLED_NONBLOCKING
|
||||
|
||||
/* Define this to 'int' if in_addr_t is not an available typedefed type */
|
||||
#undef in_addr_t
|
||||
|
45
acinclude.m4
45
acinclude.m4
@@ -143,6 +143,43 @@ AC_DEFUN([TYPE_SOCKLEN_T],
|
||||
#include <sys/socket.h>])
|
||||
])
|
||||
|
||||
dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
|
||||
dnl and a few other things. If not found, we set it to unsigned int, as even
|
||||
dnl 64-bit implementations use to set it to a 32-bit type.
|
||||
AC_DEFUN([TYPE_IN_ADDR_T],
|
||||
[
|
||||
AC_CHECK_TYPE([in_addr_t], ,[
|
||||
AC_MSG_CHECKING([for in_addr_t equivalent])
|
||||
AC_CACHE_VAL([curl_cv_in_addr_t_equiv],
|
||||
[
|
||||
# Systems have either "struct sockaddr *" or
|
||||
# "void *" as the second argument to getpeername
|
||||
curl_cv_in_addr_t_equiv=
|
||||
for t in int size_t unsigned long "unsigned long"; do
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
],[
|
||||
$t data = inet_addr ("1.2.3.4");
|
||||
],[
|
||||
curl_cv_in_addr_t_equiv="$t"
|
||||
break
|
||||
])
|
||||
done
|
||||
|
||||
if test "x$curl_cv_in_addr_t_equiv" = x; then
|
||||
AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
|
||||
fi
|
||||
])
|
||||
AC_MSG_RESULT($curl_cv_in_addr_t_equiv)
|
||||
AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
|
||||
[type to use in place of in_addr_t if not defined])],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>,
|
||||
#include <arpa/inet.h>])
|
||||
])
|
||||
|
||||
dnl ************************************************************
|
||||
dnl check for "localhost", if it doesn't exist, we can't do the
|
||||
dnl gethostbyname_r tests!
|
||||
@@ -335,6 +372,8 @@ AC_DEFUN(CURL_CHECK_GETHOSTBYNAME_R,
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#undef NULL
|
||||
#define NULL (void *)0
|
||||
|
||||
int
|
||||
gethostbyname_r(const char *, struct hostent *, struct hostent_data *);],[
|
||||
@@ -350,6 +389,8 @@ gethostbyname_r(NULL, NULL, NULL);],[
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#undef NULL
|
||||
#define NULL (void *)0
|
||||
|
||||
int
|
||||
gethostbyname_r(const char *,struct hostent *, struct hostent_data *);],[
|
||||
@@ -363,6 +404,8 @@ gethostbyname_r(NULL, NULL, NULL);],[
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#undef NULL
|
||||
#define NULL (void *)0
|
||||
|
||||
struct hostent *
|
||||
gethostbyname_r(const char *, struct hostent *, char *, int, int *);],[
|
||||
@@ -375,6 +418,8 @@ gethostbyname_r(NULL, NULL, NULL, 0, NULL);],[
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#undef NULL
|
||||
#define NULL (void *)0
|
||||
|
||||
int
|
||||
gethostbyname_r(const char *, struct hostent *, char *, size_t,
|
||||
|
45
config-mac.h
Normal file
45
config-mac.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#define OS "mac"
|
||||
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
#define HAVE_NETDB_H 1
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_NET_IF_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
#define HAVE_FCNTL_H 1
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_TIME_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_UTIME_H 1
|
||||
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_UTIME 1
|
||||
#define HAVE_INET_NTOA 1
|
||||
#define HAVE_SETVBUF 1
|
||||
#define HAVE_STRFTIME 1
|
||||
#define HAVE_INET_ADDR 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_SELECT 1
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
//#define HAVE_STRICMP 1
|
||||
#define HAVE_SIGACTION 1
|
||||
|
||||
#ifdef MACOS_SSL_SUPPORT
|
||||
# define USE_SSLEAY 1
|
||||
# define USE_OPENSSL 1
|
||||
#endif
|
||||
|
||||
#define HAVE_RAND_STATUS 1
|
||||
#define HAVE_RAND_EGD 1
|
||||
|
||||
#define HAVE_FIONBIO 1
|
||||
|
||||
#include <extra/stricmp.h>
|
||||
#include <extra/strdup.h>
|
@@ -42,7 +42,7 @@
|
||||
#define SIZEOF_LONG_DOUBLE 16
|
||||
|
||||
/* The number of bytes in a long long. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
/* #define SIZEOF_LONG_LONG 8 */
|
||||
|
||||
/* Define if you have the gethostbyaddr function. */
|
||||
#define HAVE_GETHOSTBYADDR 1
|
||||
@@ -179,6 +179,9 @@
|
||||
/* Define if you have the RAND_screen function when using SSL */
|
||||
#define HAVE_RAND_SCREEN 1
|
||||
|
||||
/* Define this to if in_addr_t is not an available typedefed type */
|
||||
#define in_addr_t unsigned long
|
||||
|
||||
/*************************************************
|
||||
* This section is for compiler specific defines.*
|
||||
*************************************************/
|
||||
|
@@ -492,7 +492,6 @@ AC_CHECK_HEADERS( \
|
||||
sys/stat.h \
|
||||
sys/types.h \
|
||||
sys/time.h \
|
||||
getopt.h \
|
||||
sys/param.h \
|
||||
termios.h \
|
||||
termio.h \
|
||||
@@ -527,6 +526,7 @@ AC_CHECK_SIZEOF(long long, 4)
|
||||
AC_CHECK_TYPE(ssize_t, int)
|
||||
|
||||
TYPE_SOCKLEN_T
|
||||
TYPE_IN_ADDR_T
|
||||
|
||||
dnl Checks for library functions.
|
||||
dnl AC_PROG_GCC_TRADITIONAL
|
||||
|
16
docs/BUGS
16
docs/BUGS
@@ -1,3 +1,4 @@
|
||||
$Id$
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
@@ -35,23 +36,24 @@ BUGS
|
||||
The address and how to subscribe to the mailing list is detailed in the
|
||||
MANUAL file.
|
||||
|
||||
HOW TO GET A STACK TRACE with a common unix debugger
|
||||
====================================================
|
||||
How To Get A Stack Trace
|
||||
========================
|
||||
|
||||
First, you must make sure that you compile all sources with -g and that you
|
||||
don't 'strip' the final executable.
|
||||
don't 'strip' the final executable. Try to avoid optimizing the code as
|
||||
well, remove -O, -O2 etc from the compiler options.
|
||||
|
||||
Run the program until it bangs.
|
||||
Run the program until it dumps core.
|
||||
|
||||
Run your debugger on the core file, like '<debugger> curl core'. <debugger>
|
||||
should be replaced with the name of your debugger, in most cases that will
|
||||
be 'gdb', but 'dbx' and others also occur.
|
||||
|
||||
When the debugger has finished loading the core file and presents you a
|
||||
prompt, you can give the compiler instructions. Enter 'where' (without the
|
||||
quotes) and press return.
|
||||
prompt, enter 'where' (without the quotes) and press return.
|
||||
|
||||
The list that is presented is the stack trace. If everything worked, it is
|
||||
supposed to contain the chain of functions that were called when curl
|
||||
crashed.
|
||||
crashed. Include the stack trace with your detailed bug report. It'll help a
|
||||
lot.
|
||||
|
||||
|
22
docs/FAQ
22
docs/FAQ
@@ -1,4 +1,4 @@
|
||||
Updated: November 1, 2001 (http://curl.haxx.se/docs/faq.shtml)
|
||||
Updated: November 27, 2001 (http://curl.haxx.se/docs/faq.shtml)
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
@@ -36,7 +36,7 @@ FAQ
|
||||
3.9 How do I use curl in PHP, Perl, Tcl, Ruby or Java?
|
||||
3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
|
||||
3.11 How do I POST with a different Content-Type?
|
||||
3.12 Why do FTP specific features over HTTP proxy fails?
|
||||
3.12 Why do FTP specific features over HTTP proxy fail?
|
||||
|
||||
4. Running Problems
|
||||
4.1 Problems connecting to SSL servers.
|
||||
@@ -154,9 +154,9 @@ FAQ
|
||||
have them inserted in the main sources (of course on the condition that
|
||||
developers agree on that the fixes are good).
|
||||
|
||||
The list of contributors in the bottom of the man page is only a small part
|
||||
of all the people that every day provide us with bug reports, suggestions,
|
||||
ideas and source code.
|
||||
The list of contributors in the docs/THANKS file is only a small part of all
|
||||
the people that every day provide us with bug reports, suggestions, ideas
|
||||
and source code.
|
||||
|
||||
curl is developed by a community, with Daniel at the wheel.
|
||||
|
||||
@@ -171,9 +171,11 @@ FAQ
|
||||
sourceforge.net hosts several project tools we take advantage from like the
|
||||
bug tracker, mailing lists and more.
|
||||
|
||||
If you feel you want to show support our project with a donation, a very
|
||||
nice way of doing that would be to buy "gift certificates" at useful online
|
||||
shopping sites, such as amazon.com or thinkgeek.com.
|
||||
If you want to support our project with a donation or similar, one way of
|
||||
doing that would be to buy "gift certificates" at useful online shopping
|
||||
sites, such as amazon.com or thinkgeek.com. Another way would be to sponsor
|
||||
us through a banner-program or by simply helping us coding, documenting,
|
||||
testing etc.
|
||||
|
||||
1.7 What about CURL from curl.com?
|
||||
|
||||
@@ -383,7 +385,7 @@ FAQ
|
||||
etc.
|
||||
|
||||
There is one exception to this rule, and that is if you can "tunnel through"
|
||||
the given HTTP proxy. Proxy tunneling is enabled with a special option (-P)
|
||||
the given HTTP proxy. Proxy tunneling is enabled with a special option (-p)
|
||||
and is generally not available as proxy admins usuable disable tunneling to
|
||||
other ports than 443 (which is used for HTTPS access through proxies).
|
||||
|
||||
@@ -480,7 +482,7 @@ FAQ
|
||||
|
||||
All error codes that are larger than the highest documented error code means
|
||||
that curl has exited due to a crash. This is a serious error, and we
|
||||
appriciate a detailed bug report from you that describes how we could go
|
||||
appreciate a detailed bug report from you that describes how we could go
|
||||
ahead and repeat this!
|
||||
|
||||
4.7. How do I keep user names and passwords secret in Curl command lines?
|
||||
|
@@ -56,7 +56,7 @@ FTP
|
||||
- download
|
||||
- authentication
|
||||
- kerberos security
|
||||
- PORT or PASV
|
||||
- active/passive using PORT, EPRT, PASV or EPSV
|
||||
- single file size information (compare to HTTP HEAD)
|
||||
- 'type=' URL support
|
||||
- dir listing
|
||||
|
30
docs/INSTALL
30
docs/INSTALL
@@ -36,8 +36,7 @@ UNIX
|
||||
The configure script always tries to find a working SSL library unless
|
||||
explicitly told not to. If you have OpenSSL installed in the default search
|
||||
path for your compiler/linker, you don't need to do anything special. If
|
||||
you have OpenSSL installed in e.g /usr/local/ssl, you can run configure
|
||||
like:
|
||||
you have OpenSSL installed in /usr/local/ssl, you can run configure like:
|
||||
|
||||
./configure --with-ssl
|
||||
|
||||
@@ -46,13 +45,13 @@ UNIX
|
||||
|
||||
./configure --with-ssl=/opt/OpenSSL
|
||||
|
||||
If you insist on forcing a build *without* SSL support, even though you may
|
||||
have it installed in your system, you can run configure like this:
|
||||
If you insist on forcing a build without SSL support, even though you may
|
||||
have OpenSSL installed in your system, you can run configure like this:
|
||||
|
||||
./configure --without-ssl
|
||||
|
||||
If you have OpenSSL installed, but with the libraries in one place and the
|
||||
header files somewhere else, you'll have to set the LDFLAGS and CPPFLAGS
|
||||
header files somewhere else, you have to set the LDFLAGS and CPPFLAGS
|
||||
environment variables prior to running configure. Something like this
|
||||
should work:
|
||||
|
||||
@@ -72,7 +71,7 @@ UNIX
|
||||
LIBS=-lRSAglue -lrsaref
|
||||
(as suggested by Doug Kaufman)
|
||||
|
||||
KNOWN PROBLEMS
|
||||
KNOWN PROBLEMS (these ones should not happen anymore)
|
||||
|
||||
If you happen to have autoconf installed, but a version older than 2.12
|
||||
you will get into trouble. Then you can still build curl by issuing these
|
||||
@@ -101,8 +100,8 @@ UNIX
|
||||
|
||||
MORE OPTIONS
|
||||
|
||||
Remember, to force configure to use the standard cc compiler if both
|
||||
cc and gcc are present, run configure like
|
||||
To force configure to use the standard cc compiler if both cc and gcc are
|
||||
present, run configure like
|
||||
|
||||
CC=cc ./configure
|
||||
or
|
||||
@@ -130,11 +129,6 @@ UNIX
|
||||
|
||||
./configure --with-krb4=/usr/athena
|
||||
|
||||
If your system support shared libraries, but you want to built a static
|
||||
version only, you can disable building the shared version by using:
|
||||
|
||||
./configure --disable-shared
|
||||
|
||||
If you're a curl developer and use gcc, you might want to enable more
|
||||
debug options with the --enable-debug option.
|
||||
|
||||
@@ -177,9 +171,9 @@ Win32
|
||||
Make the sources in the src/ drawer be a "win32 console application"
|
||||
project. Name it curl.
|
||||
|
||||
With VC++, add 'wsock32.lib' to the link libs when you build curl!
|
||||
Borland seems to do that itself magically. Of course you have to
|
||||
make sure it links with the libcurl too!
|
||||
With VC++, add 'ws2_32.lib' to the link libs when you build curl!
|
||||
Borland seems to do that itself magically. Of course you have to make
|
||||
sure it links with the libcurl too!
|
||||
|
||||
For VC++ 6, there's an included Makefile.vc6 that should be possible
|
||||
to use out-of-the-box.
|
||||
@@ -379,10 +373,13 @@ PORTS
|
||||
- Alpha OpenVMS V7.1-1H2
|
||||
- Alpha Tru64 v5.0 5.1
|
||||
- HP-PA HP-UX 9.X 10.X 11.X
|
||||
- HP-PA Linux
|
||||
- MIPS IRIX 6.2, 6.5
|
||||
- MIPS Linux
|
||||
- Power AIX 4.2, 4.3.1, 4.3.2
|
||||
- PowerPC Darwin 1.0
|
||||
- PowerPC Linux
|
||||
- PowerPC Mac OS 9
|
||||
- PowerPC Mac OS X
|
||||
- SINIX-Z v5
|
||||
- Sparc Linux
|
||||
@@ -403,6 +400,7 @@ PORTS
|
||||
- i386 Windows 95, 98, ME, NT, 2000
|
||||
- ia64 Linux 2.3.99
|
||||
- m68k AmigaOS 3
|
||||
- m68k Linux
|
||||
- m68k OpenBSD
|
||||
- s390 Linux
|
||||
|
||||
|
@@ -56,12 +56,13 @@ HTMLPAGES = \
|
||||
curl_mprintf.html \
|
||||
curl_global_init.html \
|
||||
curl_global_cleanup.html \
|
||||
libcurl.html
|
||||
libcurl.html \
|
||||
index.html
|
||||
|
||||
EXTRA_DIST = $(man_MANS) \
|
||||
MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS \
|
||||
README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS \
|
||||
$(HTMLPAGES)
|
||||
VERSIONS $(HTMLPAGES)
|
||||
|
||||
MAN2HTML= gnroff -man $< | man2html >$@
|
||||
|
||||
|
@@ -12,18 +12,11 @@ README.win32
|
||||
systems. While not being the main develop target, a fair share of curl users
|
||||
are win32-based.
|
||||
|
||||
Some documentation in this archive will be tricky to read for Windows
|
||||
people, as they come in unix-style man pages. You can either download a
|
||||
freely available nroff binary for win32 (*pointers appriciated*), convert
|
||||
the files into plain-text on your neighbor's unix machine or run over to the
|
||||
curl web site and view them as plain HTML.
|
||||
The unix-style man pages are tricky to read on windows, so therefore are all
|
||||
those pages also converted to HTML and those are also included in the
|
||||
release archives.
|
||||
|
||||
The main curl.1 man page is "built-in". Use a command line similar to this
|
||||
in order to extract a separate text file:
|
||||
The main curl.1 man page is also "built-in" in the command line tool. Use a
|
||||
command line similar to this in order to extract a separate text file:
|
||||
|
||||
curl -M >manual.txt
|
||||
|
||||
Download all the libcurl man pages in HTML format using the link on the
|
||||
bottom of this page:
|
||||
|
||||
http://curl.haxx.se/libcurl/c/
|
||||
|
@@ -53,7 +53,7 @@ that have contributed with non-trivial parts:
|
||||
- Albert Chin-A-Young <china@thewrittenword.com>
|
||||
- Stephen Kick <skick@epicrealm.com>
|
||||
- Martin Hedenfalk <mhe@stacken.kth.se>
|
||||
- Richard Prescott
|
||||
- Richard Prescott <rip at step.polymtl.ca>
|
||||
- Jason S. Priebe <priebe@wral-tv.com>
|
||||
- T. Bharath <TBharath@responsenetworks.com>
|
||||
- Alexander Kourakos <awk@users.sourceforge.net>
|
||||
@@ -75,3 +75,4 @@ that have contributed with non-trivial parts:
|
||||
- Andrew Francis <locust@familyhealth.com.au>
|
||||
- Tomasz Lacki <Tomasz.Lacki@primark.pl>
|
||||
- Georg Huettenegger <georg@ist.org>
|
||||
- John Lask <johnlask@hotmail.com>
|
||||
|
17
docs/TODO
17
docs/TODO
@@ -58,9 +58,6 @@ TODO
|
||||
likely that we know the size when downloading. Some sites support SIZE but
|
||||
don't show the size in the RETR response!
|
||||
|
||||
* Make FTP PASV work with IPv6 support. RFC 2428 "FTP Extensions for IPv6 and
|
||||
NATs" is interesting.
|
||||
|
||||
HTTP
|
||||
|
||||
* HTTP PUT for files passed on stdin *OR* when the --crlf option is
|
||||
@@ -101,14 +98,24 @@ TODO
|
||||
|
||||
SSL
|
||||
|
||||
* Add an interface to libcurl that enables "session IDs" to get
|
||||
exported/imported. Cris Bailiff said: "OpenSSL has functions which can
|
||||
serialise the current SSL state to a buffer of your choice, and
|
||||
recover/reset the state from such a buffer at a later date - this is used
|
||||
by mod_ssl for apache to implement and SSL session ID cache"
|
||||
|
||||
* Make curl's SSL layer option capable of using other free SSL libraries.
|
||||
Such as the Mozilla Security Services
|
||||
(http://www.mozilla.org/projects/security/pki/nss/) and GNUTLS
|
||||
(http://gnutls.hellug.gr/)
|
||||
|
||||
LDAP
|
||||
CLIENT
|
||||
|
||||
* Multiple URL requests don't work. [http://sourceforge.net/tracker/index.php?func=detail&aid=475407&group_id=976&atid=100976]
|
||||
* "curl ftp://site.com/*.txt"
|
||||
|
||||
* Several URLs can be specified to get downloaded. We should be able to use
|
||||
the same syntax to specify several files to get uploaded (using the same
|
||||
persistant connection), using -T.
|
||||
|
||||
TEST SUITE
|
||||
|
||||
|
64
docs/VERSIONS
Normal file
64
docs/VERSIONS
Normal file
@@ -0,0 +1,64 @@
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
Version Numbers and Releases
|
||||
|
||||
Curl is not only curl. Curl is also libcurl. They're actually individually
|
||||
versioned, but they mostly follow each other rather closely.
|
||||
|
||||
The version numbering is always built up using the same system:
|
||||
|
||||
X.Y[.Z][-preN]
|
||||
|
||||
Where
|
||||
X is main version number
|
||||
Y is release number
|
||||
Z is patch number
|
||||
N is pre-release number
|
||||
|
||||
One of these numbers will get bumped in each new release. The numbers to the
|
||||
right of a bumped number will be reset to zero. If Z is zero, it is not
|
||||
included in the version number. The pre release number is only included in
|
||||
pre releases (they're never used in public, official, releases).
|
||||
|
||||
The main version number will get bumped when *really* big, world colliding
|
||||
changes are made. The release number is bumped when big changes are
|
||||
performed. The patch number is bumped when the changes are mere bugfixes and
|
||||
only minor feature changes. The pre-release is a counter, to identify which
|
||||
pre-release a certain release is.
|
||||
|
||||
When reaching the end of a pre-release period, the version without the
|
||||
pre-release part will be released as a public release.
|
||||
|
||||
It means that after release 1.2.3, we can release 2.0 if something really big
|
||||
has been made, 1.3 if not that big changes were made or 1.2.4 if mostly bugs
|
||||
were fixed. Before 1.2.4 is released, we might release a 1.2.4-pre1 release
|
||||
for the brave people to try before the actual release.
|
||||
|
||||
Bumping, as in increasing the number with 1, is unconditionally only
|
||||
affecting one of the numbers (except the ones to the right of it, that may be
|
||||
set to zero). 1 becomes 2, 3 becomes 4, 9 becomes 10, 88 becomes 89 and 99
|
||||
becomes 100. So, after 1.2.9 comes 1.2.10. After 3.99.3, 3.100 might come.
|
||||
|
||||
All original curl source release archives are named according to the libcurl
|
||||
version (not according to the curl client version that, as said before, might
|
||||
differ).
|
||||
|
||||
As a service to any application that might want to support new libcurl
|
||||
features while still being able to build with older versions, all releases
|
||||
have the libcurl version stored in the curl/curl.h file using a static
|
||||
numbering scheme that can be used for comparison. The version number is
|
||||
defined as:
|
||||
|
||||
#define LIBCURL_VERSION_NUM 0xXXYYZZ
|
||||
|
||||
Where XX, YY and ZZ are the main version, release and patch numbers in
|
||||
hexadecimal. All three numbers are always represented using two digits. 1.2
|
||||
would appear as "0x010200" while version 9.11.7 appears as "0x090b07".
|
||||
|
||||
This 6-digit hexadecimal number does not show pre-release number, and it is
|
||||
always a greater number in a more recent release. It makes comparisons with
|
||||
greater than and less than work.
|
33
docs/curl.1
33
docs/curl.1
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man curl.1
|
||||
.\" Written by Daniel Stenberg
|
||||
.\"
|
||||
.TH curl 1 "30 Oct 2001" "Curl 7.9.1" "Curl Manual"
|
||||
.TH curl 1 "30 Nov 2001" "Curl 7.9.2" "Curl Manual"
|
||||
.SH NAME
|
||||
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
|
||||
HTTPS syntax.
|
||||
@@ -117,13 +117,13 @@ be written to stdout. (Option added in curl 7.9)
|
||||
If this option is used several times, the last specfied file name will be
|
||||
used.
|
||||
.IP "-C/--continue-at <offset>"
|
||||
Continue/Resume a previous file transfer at the given offset. The
|
||||
given offset is the exact number of bytes that will be skipped
|
||||
counted from the beginning of the source file before it is transfered
|
||||
to the destination.
|
||||
If used with uploads, the ftp server command SIZE will not be used by
|
||||
curl. Upload resume is for FTP only.
|
||||
HTTP resume is only possible with HTTP/1.1 or later servers.
|
||||
Continue/Resume a previous file transfer at the given offset. The given offset
|
||||
is the exact number of bytes that will be skipped counted from the beginning
|
||||
of the source file before it is transfered to the destination. If used with
|
||||
uploads, the ftp server command SIZE will not be used by curl.
|
||||
|
||||
Use "-C -" to tell curl to automatically find out where/how to resume the
|
||||
transfer. It then uses the given output/input files to figure that out.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-d/--data <data>"
|
||||
@@ -161,10 +161,14 @@ using this option the entire context of the posted data is kept as-is. If you
|
||||
want to post a binary file without the strip-newlines feature of the
|
||||
--data-ascii option, this is for you.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
|
||||
If this option is used several times, the ones following the first will
|
||||
append data.
|
||||
.IP "--disable-epsv"
|
||||
(FTP) Tell curl to disable the use of the EPSV command when doing passive FTP
|
||||
downloads. Curl will normally always first attempt to use EPSV before PASV,
|
||||
but with this option, it will not try using EPSV.
|
||||
|
||||
IF this option is used several times, each occurrence will toggle this on/off.
|
||||
.IP "-D/--dump-header <file>"
|
||||
(HTTP/FTP)
|
||||
Write the HTTP headers to this file. Write the FTP file info to this
|
||||
@@ -569,6 +573,11 @@ The time, in seconds, it took from the start until the file transfer is just
|
||||
about to begin. This includes all pre-transfer commands and negotiations that
|
||||
are specific to the particular protocol(s) involved.
|
||||
.TP
|
||||
.B time_starttransfer
|
||||
The time, in seconds, it took from the start until the first byte is just about
|
||||
to be transfered. This includes time_pretransfer and also the time the
|
||||
server needs to calculate the result.
|
||||
.TP
|
||||
.B size_download
|
||||
The total amount of bytes that were downloaded.
|
||||
.TP
|
||||
@@ -790,6 +799,10 @@ Too many redirects. When following redirects, curl hit the maximum amount.
|
||||
Unknown TELNET option specified.
|
||||
.IP 49
|
||||
Malformed telnet option.
|
||||
.IP 51
|
||||
The remote peer's SSL certificate wasn't ok
|
||||
.IP 52
|
||||
The server didn't reply anything, which here is considered an error.
|
||||
.IP XX
|
||||
There will appear more error codes here in future releases. The existing ones
|
||||
are meant to never change.
|
||||
|
@@ -52,6 +52,12 @@ start until the file transfer is just about to begin. This includes all
|
||||
pre-transfer commands and negotiations that are specific to the particular
|
||||
protocol(s) involved.
|
||||
.TP
|
||||
.B CURLINFO_STARTTRANSFER_TIME
|
||||
Pass a pointer to a double to receive the time, in seconds, it took from the
|
||||
start until the first byte is just about to be transfered. This includes
|
||||
CURLINFO_PRETRANSFER_TIME and also the time the server needs to calculate
|
||||
the result.
|
||||
.TP
|
||||
.B CURLINFO_SIZE_UPLOAD
|
||||
Pass a pointer to a double to receive the total amount of bytes that were
|
||||
uploaded.
|
||||
|
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man [file]
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH curl_easy_setopt 3 "11 Oct 2001" "libcurl 7.9.1" "libcurl Manual"
|
||||
.TH curl_easy_setopt 3 "30 Nov 2001" "libcurl 7.9.2" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_easy_setopt - Set curl easy-session options
|
||||
.SH SYNOPSIS
|
||||
@@ -336,13 +336,15 @@ Pass a pointer to a linked list of FTP commands to pass to the server prior to
|
||||
your ftp request. The linked list should be a fully valid list of 'struct
|
||||
curl_slist' structs properly filled in. Use \fIcurl_slist_append(3)\fP to
|
||||
append strings (commands) to the list, and clear the entire list afterwards
|
||||
with \fIcurl_slist_free_all(3)\fP.
|
||||
with \fIcurl_slist_free_all(3)\fP. Disable this operation again by setting a
|
||||
NULL to this option.
|
||||
.TP
|
||||
.B CURLOPT_POSTQUOTE
|
||||
Pass a pointer to a linked list of FTP commands to pass to the server after
|
||||
your ftp transfer request. The linked list should be a fully valid list of
|
||||
struct curl_slist structs properly filled in as described for
|
||||
\fICURLOPT_QUOTE\fP.
|
||||
\fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this
|
||||
option.
|
||||
.TP
|
||||
.B CURLOPT_WRITEHEADER
|
||||
Pass a pointer to be used to write the header part of the received data to. If
|
||||
@@ -545,6 +547,29 @@ compile OpenSSL.
|
||||
|
||||
You'll find more details about cipher lists on this URL:
|
||||
\fIhttp://www.openssl.org/docs/apps/ciphers.html\fP
|
||||
.TP
|
||||
.B CURLOPT_HTTP_VERSION
|
||||
Pass a long, set to one of the values described below. They force libcurl to
|
||||
use the specific HTTP versions. This is not sensible to do unless you have a
|
||||
good reason.
|
||||
.RS
|
||||
.TP 5
|
||||
.B CURL_HTTP_VERSION_NONE
|
||||
We don't care about what version the library uses. libcurl will use whatever
|
||||
it thinks fit.
|
||||
.TP
|
||||
.B CURL_HTTP_VERSION_1_0
|
||||
Enforce HTTP 1.0 requests.
|
||||
.TP
|
||||
.B CURL_HTTP_VERSION_1_1
|
||||
Enforce HTTP 1.1 requests.
|
||||
.RE
|
||||
.TP
|
||||
.B CURLOPT_FTP_USE_EPSV
|
||||
Pass a long. If the value is non-zero, it tells curl to use the EPSV command
|
||||
when doing passive FTP downloads (which is always does by default). Using EPSV
|
||||
means that it will first attempt to use EPSV before using PASV, but if you
|
||||
pass FALSE (zero) to this option, it will not try using EPSV, only plain PASV.
|
||||
.PP
|
||||
.SH RETURN VALUE
|
||||
CURLE_OK (zero) means that the option was set properly, non-zero means an
|
||||
|
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man [file]
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH curl_global_init 3 "14 August 2001" "libcurl 7.8.1" "libcurl Manual"
|
||||
.TH curl_global_init 3 "13 Nov 2001" "libcurl 7.9.1" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_global_init - Global libcurl initialisation
|
||||
.SH SYNOPSIS
|
||||
@@ -11,8 +11,8 @@ curl_global_init - Global libcurl initialisation
|
||||
.BI "CURLcode curl_global_init(long " flags ");"
|
||||
.ad
|
||||
.SH DESCRIPTION
|
||||
This function should be called once (no matter how many threads or libcurl
|
||||
sessions that'll be used) by every application that uses libcurl.
|
||||
This function should only be called once (no matter how many threads or
|
||||
libcurl sessions that'll be used) by every application that uses libcurl.
|
||||
|
||||
If this function hasn't been invoked when \fIcurl_easy_init\fP is called, it
|
||||
will be done automatically by libcurl.
|
||||
@@ -23,6 +23,8 @@ init, as described below. Set the desired bits by ORing the values together.
|
||||
You must however \fBalways\fP use the \fIcurl_global_cleanup\fP function, as
|
||||
that cannot be called automatically for you by libcurl.
|
||||
|
||||
Calling this function more than once will cause unpredictable results.
|
||||
|
||||
This function was added in libcurl 7.8.
|
||||
.SH FLAGS
|
||||
.TP 5
|
||||
|
38
docs/index.html
Normal file
38
docs/index.html
Normal file
@@ -0,0 +1,38 @@
|
||||
HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<TITLE>Index to Curl documentation</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY>
|
||||
<H1 ALIGN="CENTER">Index to Curl documentation</H1>
|
||||
|
||||
<H2>Programs</H2>
|
||||
<P><A HREF="curl-config.html">curl-config.html</A>
|
||||
<P><A HREF="curl.html">curl.html</A>
|
||||
|
||||
<H2>Library routines</H2>
|
||||
<P><A HREF="libcurl.html">libcurl.html</A>
|
||||
<P><A HREF="curl_easy_cleanup.html">curl_easy_cleanup.html</A>
|
||||
<P><A HREF="curl_easy_duphandle.html">curl_easy_duphandle.html</A>
|
||||
<P><A HREF="curl_easy_getinfo.html">curl_easy_getinfo.html</A>
|
||||
<P><A HREF="curl_easy_init.html">curl_easy_init.html</A>
|
||||
<P><A HREF="curl_easy_perform.html">curl_easy_perform.html</A>
|
||||
<P><A HREF="curl_easy_setopt.html">curl_easy_setopt.html</A>
|
||||
<P><A HREF="curl_escape.html">curl_escape.html</A>
|
||||
<P><A HREF="curl_formadd.html">curl_formadd.html</A>
|
||||
<P><A HREF="curl_formfree.html">curl_formfree.html</A>
|
||||
<P><A HREF="curl_formparse.html">curl_formparse.html</A>
|
||||
<P><A HREF="curl_getdate.html">curl_getdate.html</A>
|
||||
<P><A HREF="curl_getenv.html">curl_getenv.html</A>
|
||||
<P><A HREF="curl_global_cleanup.html">curl_global_cleanup.html</A>
|
||||
<P><A HREF="curl_global_init.html">curl_global_init.html</A>
|
||||
<P><A HREF="curl_mprintf.html">curl_mprintf.html</A>
|
||||
<P><A HREF="curl_slist_append.html">curl_slist_append.html</A>
|
||||
<P><A HREF="curl_slist_free_all.html">curl_slist_free_all.html</A>
|
||||
<P><A HREF="curl_strequal.html">curl_strequal.html</A>
|
||||
<P><A HREF="curl_strnequal.html">curl_strnequal.html</A>
|
||||
<P><A HREF="curl_unescape.html">curl_unescape.html</A>
|
||||
<P><A HREF="curl_version.html">curl_version.html</A>
|
||||
</BODY>
|
||||
</HTML>
|
@@ -212,10 +212,8 @@ typedef enum {
|
||||
in the CURLOPT_FLAGS to activate this */
|
||||
CINIT(RANGE, OBJECTPOINT, 7),
|
||||
|
||||
#if 0
|
||||
/* Configuration flags */
|
||||
CINIT(FLAGS, LONG, 8),
|
||||
#endif
|
||||
/* not used */
|
||||
|
||||
/* Specified file stream to upload from (use as input): */
|
||||
CINIT(INFILE, OBJECTPOINT, 9),
|
||||
|
||||
@@ -298,7 +296,7 @@ typedef enum {
|
||||
CINIT(COOKIEFILE, OBJECTPOINT, 31),
|
||||
|
||||
/* What version to specifly try to use.
|
||||
3 = SSLv3, 2 = SSLv2, all else makes it try v3 first then v2 */
|
||||
See CURL_SSLVERSION defines below. */
|
||||
CINIT(SSLVERSION, LONG, 32),
|
||||
|
||||
/* What kind of HTTP time condition to use, see defines */
|
||||
@@ -321,11 +319,8 @@ typedef enum {
|
||||
/* HTTP request, for odd commands like DELETE, TRACE and others */
|
||||
CINIT(STDERR, OBJECTPOINT, 37),
|
||||
|
||||
#if 0
|
||||
/* Progress mode set alternative progress mode displays. Alternative
|
||||
ones should now be made by the client, not the lib! */
|
||||
CINIT(PROGRESSMODE, LONG, 38),
|
||||
#endif
|
||||
/* 38 is not used */
|
||||
|
||||
/* send linked-list of post-transfer QUOTE commands */
|
||||
CINIT(POSTQUOTE, OBJECTPOINT, 39),
|
||||
|
||||
@@ -465,6 +460,11 @@ typedef enum {
|
||||
/* Specify which HTTP version to use! This must be set to one of the
|
||||
CURL_HTTP_VERSION* enums set below. */
|
||||
CINIT(HTTP_VERSION, LONG, 84),
|
||||
|
||||
/* Specificly switch on or off the FTP engine's use of the EPSV command. By
|
||||
default, that one will always be attempted before the more traditional
|
||||
PASV command. */
|
||||
CINIT(FTP_USE_EPSV, LONG, 85),
|
||||
|
||||
CURLOPT_LASTENTRY /* the last unusued */
|
||||
} CURLoption;
|
||||
@@ -480,6 +480,15 @@ enum {
|
||||
CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
|
||||
};
|
||||
|
||||
enum {
|
||||
CURL_SSLVERSION_DEFAULT,
|
||||
CURL_SSLVERSION_TLSv1,
|
||||
CURL_SSLVERSION_SSLv2,
|
||||
CURL_SSLVERSION_SSLv3,
|
||||
|
||||
CURL_SSLVERSION_LAST /* never use, keep last */
|
||||
};
|
||||
|
||||
|
||||
typedef enum {
|
||||
TIMECOND_NONE,
|
||||
@@ -575,8 +584,8 @@ CURLcode curl_global_init(long flags);
|
||||
void curl_global_cleanup(void);
|
||||
|
||||
/* This is the version number */
|
||||
#define LIBCURL_VERSION "7.9.1"
|
||||
#define LIBCURL_VERSION_NUM 0x070901
|
||||
#define LIBCURL_VERSION "7.9.2"
|
||||
#define LIBCURL_VERSION_NUM 0x070902
|
||||
|
||||
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
||||
struct curl_slist {
|
||||
@@ -626,7 +635,9 @@ typedef enum {
|
||||
CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
|
||||
CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
|
||||
|
||||
CURLINFO_LASTONE = 17
|
||||
CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
|
||||
|
||||
CURLINFO_LASTONE = 18
|
||||
} CURLINFO;
|
||||
|
||||
/* unfortunately, the easy.h include file needs the options and info stuff
|
||||
|
@@ -10,9 +10,6 @@ EXTRA_DIST = getdate.y \
|
||||
|
||||
lib_LTLIBRARIES = libcurl.la
|
||||
|
||||
# Some flags needed when trying to cause warnings ;-)
|
||||
# CFLAGS = -DMALLOCDEBUG -g # -Wall #-pedantic
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
|
||||
|
@@ -23,7 +23,7 @@ INCDIRS = -I$(CURNTDIR);$(TOPDIR)/include/
|
||||
# 'BCCDIR' has to be set up in your c:\autoexec.bat
|
||||
# i.e. SET BCCDIR = c:\Borland\BCC55
|
||||
# where c:\Borland\BCC55 is the compiler is installed
|
||||
LINKLIB = $(BCCDIR)/lib/psdk/wsock32.lib
|
||||
LINKLIB = $(BCCDIR)/lib/psdk/ws2_32.lib
|
||||
LIBCURLLIB = libcurl.lib
|
||||
|
||||
.SUFFIXES: .c
|
||||
|
@@ -27,5 +27,5 @@
|
||||
+version.obj &
|
||||
+easy.obj &
|
||||
+strequal.obj &
|
||||
+strtok.obj
|
||||
|
||||
+strtok.obj &
|
||||
+connect.obj
|
||||
|
551
lib/Makefile.vc6
551
lib/Makefile.vc6
@@ -1,377 +1,218 @@
|
||||
#############################################################
|
||||
#
|
||||
## Makefile for building libcurl.lib with MSVC6
|
||||
## Use: nmake -f makefile.vc6 [release | release-ssl | debug]
|
||||
## (default is release)
|
||||
##
|
||||
## Originally written by: Troy Engel <tengel@sonic.net>
|
||||
## Updated by: Craig Davison <cd@securityfocus.com>
|
||||
## Updated by: SM <sm@technologist.com>
|
||||
# Makefile for building libcurl with MSVC6
|
||||
#
|
||||
# Usage: see usage message below
|
||||
# Should be invoked from \lib directory
|
||||
# Edit the paths and desired library name
|
||||
# SSL path is only required if you intend compiling
|
||||
# with SSL.
|
||||
#
|
||||
# This make file leaves the result either a .lib or .dll file
|
||||
# in the \lib directory. It should be called from the \lib
|
||||
# directory.
|
||||
#
|
||||
# An option would have been to allow the source directory to
|
||||
# be specified, but I saw no requirement.
|
||||
#
|
||||
# Another option would have been to leave the .lib and .dll
|
||||
# files in the "cfg" directory, but then the make file
|
||||
# in \src would need to be changed.
|
||||
#
|
||||
##############################################################
|
||||
# CHANGE LOG
|
||||
# ------------------------------------------------------------
|
||||
# 05.11.2001 John Lask Initial Release
|
||||
#
|
||||
#
|
||||
##############################################################
|
||||
|
||||
PROGRAM_NAME = libcurl.lib
|
||||
PROGRAM_NAME_DEBUG = libcurld.lib
|
||||
#OPENSSL_PATH = ../../openssl-0.9.6b
|
||||
LIB_NAME = libcurl
|
||||
LIB_NAME_DEBUG = libcurld
|
||||
OPENSSL_PATH = ../../openssl-0.9.6
|
||||
|
||||
########################################################
|
||||
#############################################################
|
||||
## Nothing more to do below this line!
|
||||
|
||||
## Release
|
||||
CCR = cl.exe /MD /O2 /D "NDEBUG"
|
||||
LINKR = link.exe -lib /out:$(PROGRAM_NAME)
|
||||
|
||||
## Debug
|
||||
CCD = cl.exe /MDd /Gm /ZI /Od /D "_DEBUG" /GZ
|
||||
LINKD = link.exe -lib /out:$(PROGRAM_NAME_DEBUG)
|
||||
|
||||
## SSL Release
|
||||
CCRS = cl.exe /MD /O2 /D "NDEBUG" /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
|
||||
LINKRS = link.exe -lib /out:$(PROGRAM_NAME) /LIBPATH:$(OPENSSL_PATH)/out32dll
|
||||
|
||||
CCNODBG = cl.exe /MD /O2 /D "NDEBUG"
|
||||
CCDEBUG = cl.exe /MDd /Od /Gm /Zi /D "_DEBUG" /GZ
|
||||
CFLAGSSSL = /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
|
||||
CFLAGS = /I "../include" /nologo /W3 /GX /D "WIN32" /D "VC6" /D "_MBCS" /D "_LIB" /YX /FD /c /D "MSDOS"
|
||||
LFLAGS = /nologo
|
||||
LINKLIBS = ws2_32.lib
|
||||
LINKSLIBS = libeay32.lib ssleay32.lib RSAglue.lib
|
||||
|
||||
RELEASE_OBJS= \
|
||||
base64r.obj \
|
||||
cookier.obj \
|
||||
transferr.obj \
|
||||
escaper.obj \
|
||||
formdatar.obj \
|
||||
ftpr.obj \
|
||||
httpr.obj \
|
||||
http_chunksr.obj \
|
||||
ldapr.obj \
|
||||
dictr.obj \
|
||||
telnetr.obj \
|
||||
getdater.obj \
|
||||
getenvr.obj \
|
||||
getpassr.obj \
|
||||
hostipr.obj \
|
||||
if2ipr.obj \
|
||||
mprintfr.obj \
|
||||
netrcr.obj \
|
||||
progressr.obj \
|
||||
sendfr.obj \
|
||||
speedcheckr.obj \
|
||||
ssluser.obj \
|
||||
timevalr.obj \
|
||||
urlr.obj \
|
||||
filer.obj \
|
||||
getinfor.obj \
|
||||
versionr.obj \
|
||||
easyr.obj \
|
||||
strequalr.obj \
|
||||
strtokr.obj \
|
||||
connectr.obj
|
||||
LNKDLL = link.exe /DLL /def:libcurl.def
|
||||
LNKLIB = link.exe -lib
|
||||
LFLAGS = /nologo
|
||||
LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)/out32dll
|
||||
LINKLIBS = ws2_32.lib
|
||||
SSLLIBS = libeay32.lib ssleay32.lib RSAglue.lib
|
||||
CFGSET = FALSE
|
||||
|
||||
DEBUG_OBJS= \
|
||||
base64d.obj \
|
||||
cookied.obj \
|
||||
transferd.obj \
|
||||
escaped.obj \
|
||||
formdatad.obj \
|
||||
ftpd.obj \
|
||||
httpd.obj \
|
||||
http_chunksd.obj \
|
||||
ldapd.obj \
|
||||
dictd.obj \
|
||||
telnetd.obj \
|
||||
getdated.obj \
|
||||
getenvd.obj \
|
||||
getpassd.obj \
|
||||
hostipd.obj \
|
||||
if2ipd.obj \
|
||||
mprintfd.obj \
|
||||
netrcd.obj \
|
||||
progressd.obj \
|
||||
sendfd.obj \
|
||||
speedcheckd.obj \
|
||||
sslused.obj \
|
||||
timevald.obj \
|
||||
urld.obj \
|
||||
filed.obj \
|
||||
getinfod.obj \
|
||||
versiond.obj \
|
||||
easyd.obj \
|
||||
strequald.obj \
|
||||
strtokd.obj \
|
||||
connectd.obj
|
||||
######################
|
||||
# release
|
||||
|
||||
RELEASE_SSL_OBJS= \
|
||||
base64rs.obj \
|
||||
cookiers.obj \
|
||||
transferrs.obj \
|
||||
escapers.obj \
|
||||
formdatars.obj \
|
||||
ftprs.obj \
|
||||
httprs.obj \
|
||||
http_chunksrs.obj \
|
||||
ldaprs.obj \
|
||||
dictrs.obj \
|
||||
telnetrs.obj \
|
||||
getdaters.obj \
|
||||
getenvrs.obj \
|
||||
getpassrs.obj \
|
||||
hostiprs.obj \
|
||||
if2iprs.obj \
|
||||
mprintfrs.obj \
|
||||
netrcrs.obj \
|
||||
progressrs.obj \
|
||||
sendfrs.obj \
|
||||
speedcheckrs.obj \
|
||||
sslusers.obj \
|
||||
timevalrs.obj \
|
||||
urlrs.obj \
|
||||
filers.obj \
|
||||
getinfors.obj \
|
||||
versionrs.obj \
|
||||
easyrs.obj \
|
||||
strequalrs.obj \
|
||||
strtokrs.obj \
|
||||
connectrs.obj
|
||||
!IF "$(CFG)" == "release"
|
||||
TARGET =$(LIB_NAME).lib
|
||||
DIROBJ =.\$(CFG)
|
||||
LNK = $(LNKLIB) /out:$(TARGET)
|
||||
CC = $(CCNODBG)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
LINK_OBJS= \
|
||||
base64.obj \
|
||||
cookie.obj \
|
||||
transfer.obj \
|
||||
escape.obj \
|
||||
formdata.obj \
|
||||
ftp.obj \
|
||||
http.obj \
|
||||
http_chunks.obj \
|
||||
ldap.obj \
|
||||
dict.obj \
|
||||
telnet.obj \
|
||||
getdate.obj \
|
||||
getenv.obj \
|
||||
getpass.obj \
|
||||
hostip.obj \
|
||||
if2ip.obj \
|
||||
mprintf.obj \
|
||||
netrc.obj \
|
||||
progress.obj \
|
||||
sendf.obj \
|
||||
speedcheck.obj \
|
||||
ssluse.obj \
|
||||
timeval.obj \
|
||||
url.obj \
|
||||
file.obj \
|
||||
getinfo.obj \
|
||||
version.obj \
|
||||
easy.obj \
|
||||
strequal.obj \
|
||||
strtok.obj \
|
||||
connect.obj
|
||||
######################
|
||||
# release-dll
|
||||
|
||||
all : release
|
||||
!IF "$(CFG)" == "release-dll"
|
||||
TARGET =$(LIB_NAME).dll
|
||||
DIROBJ =.\$(CFG)
|
||||
LNK = $(LNKDLL) /out:$(TARGET) /IMPLIB:"$(LIB_NAME).lib"
|
||||
CC = $(CCNODBG)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
release: $(RELEASE_OBJS)
|
||||
$(LINKR) $(LFLAGS) $(LINKLIBS) $(LINK_OBJS)
|
||||
######################
|
||||
# release-ssl
|
||||
|
||||
debug: $(DEBUG_OBJS)
|
||||
$(LINKD) $(LFLAGS) $(LINKLIBS) $(LINK_OBJS)
|
||||
!IF "$(CFG)" == "release-ssl"
|
||||
TARGET =$(LIB_NAME).lib
|
||||
DIROBJ =.\$(CFG)
|
||||
LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(TARGET)
|
||||
LINKLIBS = $(LINKLIBS) $(SSLLIBS)
|
||||
CC = $(CCNODBG) $(CFLAGSSSL)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
release-ssl: $(RELEASE_SSL_OBJS)
|
||||
$(LINKRS) $(LFLAGS) $(LINKLIBS) $(LINKSLIBS) $(LINK_OBJS)
|
||||
######################
|
||||
# release-ssl-dll
|
||||
|
||||
## Release
|
||||
base64r.obj: base64.c
|
||||
$(CCR) $(CFLAGS) base64.c
|
||||
cookier.obj: cookie.c
|
||||
$(CCR) $(CFLAGS) cookie.c
|
||||
transferr.obj: transfer.c
|
||||
$(CCR) $(CFLAGS) transfer.c
|
||||
escaper.obj: escape.c
|
||||
$(CCR) $(CFLAGS) escape.c
|
||||
formdatar.obj: formdata.c
|
||||
$(CCR) $(CFLAGS) formdata.c
|
||||
ftpr.obj: ftp.c
|
||||
$(CCR) $(CFLAGS) ftp.c
|
||||
httpr.obj: http.c
|
||||
$(CCR) $(CFLAGS) http.c
|
||||
http_chunksr.obj: http_chunks.c
|
||||
$(CCR) $(CFLAGS) http_chunks.c
|
||||
ldapr.obj: ldap.c
|
||||
$(CCR) $(CFLAGS) ldap.c
|
||||
dictr.obj: dict.c
|
||||
$(CCR) $(CFLAGS) dict.c
|
||||
telnetr.obj: telnet.c
|
||||
$(CCR) $(CFLAGS) telnet.c
|
||||
getdater.obj: getdate.c
|
||||
$(CCR) $(CFLAGS) getdate.c
|
||||
getenvr.obj: getenv.c
|
||||
$(CCR) $(CFLAGS) getenv.c
|
||||
getpassr.obj: getpass.c
|
||||
$(CCR) $(CFLAGS) getpass.c
|
||||
hostipr.obj: hostip.c
|
||||
$(CCR) $(CFLAGS) hostip.c
|
||||
if2ipr.obj: if2ip.c
|
||||
$(CCR) $(CFLAGS) if2ip.c
|
||||
mprintfr.obj: mprintf.c
|
||||
$(CCR) $(CFLAGS) mprintf.c
|
||||
netrcr.obj: netrc.c
|
||||
$(CCR) $(CFLAGS) netrc.c
|
||||
progressr.obj: progress.c
|
||||
$(CCR) $(CFLAGS) progress.c
|
||||
sendfr.obj: sendf.c
|
||||
$(CCR) $(CFLAGS) sendf.c
|
||||
speedcheckr.obj: speedcheck.c
|
||||
$(CCR) $(CFLAGS) speedcheck.c
|
||||
ssluser.obj: ssluse.c
|
||||
$(CCR) $(CFLAGS) ssluse.c
|
||||
timevalr.obj: timeval.c
|
||||
$(CCR) $(CFLAGS) timeval.c
|
||||
urlr.obj: url.c
|
||||
$(CCR) $(CFLAGS) url.c
|
||||
filer.obj: file.c
|
||||
$(CCR) $(CFLAGS) file.c
|
||||
getinfor.obj: getinfo.c
|
||||
$(CCR) $(CFLAGS) getinfo.c
|
||||
versionr.obj: version.c
|
||||
$(CCR) $(CFLAGS) version.c
|
||||
easyr.obj: easy.c
|
||||
$(CCR) $(CFLAGS) easy.c
|
||||
strequalr.obj: strequal.c
|
||||
$(CCR) $(CFLAGS) strequal.c
|
||||
strtokr.obj:strtok.c
|
||||
$(CCR) $(CFLAGS) strtok.c
|
||||
connectr.obj:connect.c
|
||||
$(CCR) $(CFLAGS) connect.c
|
||||
!IF "$(CFG)" == "release-ssl-dll"
|
||||
TARGET =$(LIB_NAME).dll
|
||||
DIROBJ =.\$(CFG)
|
||||
LNK = $(LNKDLL) $(LFLAGSSSL) /out:$(TARGET) /IMPLIB:"$(LIB_NAME).lib"
|
||||
LINKLIBS = $(LINKLIBS) $(SSLLIBS)
|
||||
CC = $(CCNODBG) $(CFLAGSSSL)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
## Debug
|
||||
base64d.obj: base64.c
|
||||
$(CCD) $(CFLAGS) base64.c
|
||||
cookied.obj: cookie.c
|
||||
$(CCD) $(CFLAGS) cookie.c
|
||||
transferd.obj: transfer.c
|
||||
$(CCD) $(CFLAGS) transfer.c
|
||||
escaped.obj: escape.c
|
||||
$(CCD) $(CFLAGS) escape.c
|
||||
formdatad.obj: formdata.c
|
||||
$(CCD) $(CFLAGS) formdata.c
|
||||
ftpd.obj: ftp.c
|
||||
$(CCD) $(CFLAGS) ftp.c
|
||||
httpd.obj: http.c
|
||||
$(CCD) $(CFLAGS) http.c
|
||||
http_chunksd.obj: http_chunks.c
|
||||
$(CCD) $(CFLAGS) http_chunks.c
|
||||
ldapd.obj: ldap.c
|
||||
$(CCD) $(CFLAGS) ldap.c
|
||||
dictd.obj: dict.c
|
||||
$(CCD) $(CFLAGS) dict.c
|
||||
telnetd.obj: telnet.c
|
||||
$(CCD) $(CFLAGS) telnet.c
|
||||
getdated.obj: getdate.c
|
||||
$(CCD) $(CFLAGS) getdate.c
|
||||
getenvd.obj: getenv.c
|
||||
$(CCD) $(CFLAGS) getenv.c
|
||||
getpassd.obj: getpass.c
|
||||
$(CCD) $(CFLAGS) getpass.c
|
||||
hostipd.obj: hostip.c
|
||||
$(CCD) $(CFLAGS) hostip.c
|
||||
if2ipd.obj: if2ip.c
|
||||
$(CCD) $(CFLAGS) if2ip.c
|
||||
mprintfd.obj: mprintf.c
|
||||
$(CCD) $(CFLAGS) mprintf.c
|
||||
netrcd.obj: netrc.c
|
||||
$(CCD) $(CFLAGS) netrc.c
|
||||
progressd.obj: progress.c
|
||||
$(CCD) $(CFLAGS) progress.c
|
||||
sendfd.obj: sendf.c
|
||||
$(CCD) $(CFLAGS) sendf.c
|
||||
speedcheckd.obj: speedcheck.c
|
||||
$(CCD) $(CFLAGS) speedcheck.c
|
||||
sslused.obj: ssluse.c
|
||||
$(CCD) $(CFLAGS) ssluse.c
|
||||
timevald.obj: timeval.c
|
||||
$(CCD) $(CFLAGS) timeval.c
|
||||
urld.obj: url.c
|
||||
$(CCD) $(CFLAGS) url.c
|
||||
filed.obj: file.c
|
||||
$(CCD) $(CFLAGS) file.c
|
||||
getinfod.obj: getinfo.c
|
||||
$(CCD) $(CFLAGS) getinfo.c
|
||||
versiond.obj: version.c
|
||||
$(CCD) $(CFLAGS) version.c
|
||||
easyd.obj: easy.c
|
||||
$(CCD) $(CFLAGS) easy.c
|
||||
strequald.obj: strequal.c
|
||||
$(CCD) $(CFLAGS) strequal.c
|
||||
strtokd.obj:strtok.c
|
||||
$(CCD) $(CFLAGS) strtok.c
|
||||
connectd.obj:connect.c
|
||||
$(CCR) $(CFLAGS) connect.c
|
||||
|
||||
## Release SSL
|
||||
base64rs.obj: base64.c
|
||||
$(CCRS) $(CFLAGS) base64.c
|
||||
cookiers.obj: cookie.c
|
||||
$(CCRS) $(CFLAGS) cookie.c
|
||||
transferrs.obj: transfer.c
|
||||
$(CCRS) $(CFLAGS) transfer.c
|
||||
escapers.obj: escape.c
|
||||
$(CCRS) $(CFLAGS) escape.c
|
||||
formdatars.obj: formdata.c
|
||||
$(CCRS) $(CFLAGS) formdata.c
|
||||
ftprs.obj: ftp.c
|
||||
$(CCRS) $(CFLAGS) ftp.c
|
||||
httprs.obj: http.c
|
||||
$(CCRS) $(CFLAGS) http.c
|
||||
http_chunksrs.obj: http_chunks.c
|
||||
$(CCRS) $(CFLAGS) http_chunks.c
|
||||
ldaprs.obj: ldap.c
|
||||
$(CCRS) $(CFLAGS) ldap.c
|
||||
dictrs.obj: dict.c
|
||||
$(CCRS) $(CFLAGS) dict.c
|
||||
telnetrs.obj: telnet.c
|
||||
$(CCRS) $(CFLAGS) telnet.c
|
||||
getdaters.obj: getdate.c
|
||||
$(CCRS) $(CFLAGS) getdate.c
|
||||
getenvrs.obj: getenv.c
|
||||
$(CCRS) $(CFLAGS) getenv.c
|
||||
getpassrs.obj: getpass.c
|
||||
$(CCRS) $(CFLAGS) getpass.c
|
||||
hostiprs.obj: hostip.c
|
||||
$(CCRS) $(CFLAGS) hostip.c
|
||||
if2iprs.obj: if2ip.c
|
||||
$(CCRS) $(CFLAGS) if2ip.c
|
||||
mprintfrs.obj: mprintf.c
|
||||
$(CCRS) $(CFLAGS) mprintf.c
|
||||
netrcrs.obj: netrc.c
|
||||
$(CCRS) $(CFLAGS) netrc.c
|
||||
progressrs.obj: progress.c
|
||||
$(CCRS) $(CFLAGS) progress.c
|
||||
sendfrs.obj: sendf.c
|
||||
$(CCRS) $(CFLAGS) sendf.c
|
||||
speedcheckrs.obj: speedcheck.c
|
||||
$(CCRS) $(CFLAGS) speedcheck.c
|
||||
sslusers.obj: ssluse.c
|
||||
$(CCRS) $(CFLAGS) ssluse.c
|
||||
timevalrs.obj: timeval.c
|
||||
$(CCRS) $(CFLAGS) timeval.c
|
||||
urlrs.obj: url.c
|
||||
$(CCRS) $(CFLAGS) url.c
|
||||
filers.obj: file.c
|
||||
$(CCRS) $(CFLAGS) file.c
|
||||
getinfors.obj: getinfo.c
|
||||
$(CCRS) $(CFLAGS) getinfo.c
|
||||
versionrs.obj: version.c
|
||||
$(CCRS) $(CFLAGS) version.c
|
||||
easyrs.obj: easy.c
|
||||
$(CCRS) $(CFLAGS) easy.c
|
||||
strequalrs.obj: strequal.c
|
||||
$(CCRS) $(CFLAGS) strequal.c
|
||||
strtokrs.obj:strtok.c
|
||||
$(CCRS) $(CFLAGS) strtok.c
|
||||
connectrs.obj:connect.c
|
||||
$(CCR) $(CFLAGS) connect.c
|
||||
|
||||
|
||||
######################
|
||||
# debug
|
||||
|
||||
!IF "$(CFG)" == "debug"
|
||||
TARGET =$(LIB_NAME_DEBUG).lib
|
||||
DIROBJ =.\$(CFG)
|
||||
LNK = $(LNKLIB) /out:$(TARGET)
|
||||
CC = $(CCDEBUG)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
######################
|
||||
# debug-dll
|
||||
|
||||
!IF "$(CFG)" == "debug-dll"
|
||||
TARGET =$(LIB_NAME_DEBUG).dll
|
||||
DIROBJ =.\$(CFG)
|
||||
LNK = $(LNKDLL) /out:$(TARGET) /IMPLIB:"$(LIB_NAME_DEBUG).lib"
|
||||
CC = $(CCDEBUG)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
######################
|
||||
# debug-ssl
|
||||
#todo
|
||||
!IF "$(CFG)" == "debug-ssl"
|
||||
TARGET = $(LIB_NAME_DEBUG).lib
|
||||
DIROBJ =.\$(CFG)
|
||||
LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(TARGET)
|
||||
LINKLIBS = $(LINKLIBS) $(SSLLIBS)
|
||||
CC = $(CCDEBUG) $(CFLAGSSSL)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
######################
|
||||
# debug-ssl-dll
|
||||
|
||||
!IF "$(CFG)" == "debug-ssl-dll"
|
||||
TARGET =$(LIB_NAME_DEBUG).dll
|
||||
DIROBJ =.\$(CFG)
|
||||
LNK = $(LNKDLL) $(LFLAGSSSL) /out:$(TARGET) /IMPLIB:"$(LIB_NAME_DEBUG).lib"
|
||||
LINKLIBS = $(LINKLIBS) $(SSLLIBS)
|
||||
CC = $(CCDEBUG) $(CFLAGSSSL)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
#######################
|
||||
# Usage
|
||||
#
|
||||
!IF "$(CFGSET)" == "FALSE"
|
||||
!MESSAGE Usage: nmake -f makefile.vc6 CFG=<config> <target>
|
||||
!MESSAGE where <config> is one of:
|
||||
!MESSAGE release - release static library
|
||||
!MESSAGE release-dll - release dll
|
||||
!MESSAGE release-ssl - release static library with ssl
|
||||
!MESSAGE release-ssl-dll - release dll library with ssl
|
||||
!MESSAGE debug - debug static library
|
||||
!MESSAGE debug-dll - debug dll
|
||||
!MESSAGE debug-ssl - debug static library with ssl
|
||||
!MESSAGE debug-ssl-dll - debug dll library with ssl
|
||||
!MESSAGE <target> can be left blank in which case all is assumed
|
||||
!ERROR please choose a valid configuration "$(CFG)"
|
||||
!ENDIF
|
||||
|
||||
#######################
|
||||
#
|
||||
X_OBJS= \
|
||||
$(DIROBJ)\base64.obj \
|
||||
$(DIROBJ)\cookie.obj \
|
||||
$(DIROBJ)\transfer.obj \
|
||||
$(DIROBJ)\escape.obj \
|
||||
$(DIROBJ)\formdata.obj \
|
||||
$(DIROBJ)\ftp.obj \
|
||||
$(DIROBJ)\http.obj \
|
||||
$(DIROBJ)\http_chunks.obj \
|
||||
$(DIROBJ)\ldap.obj \
|
||||
$(DIROBJ)\dict.obj \
|
||||
$(DIROBJ)\telnet.obj \
|
||||
$(DIROBJ)\getdate.obj \
|
||||
$(DIROBJ)\getenv.obj \
|
||||
$(DIROBJ)\getpass.obj \
|
||||
$(DIROBJ)\hostip.obj \
|
||||
$(DIROBJ)\if2ip.obj \
|
||||
$(DIROBJ)\mprintf.obj \
|
||||
$(DIROBJ)\netrc.obj \
|
||||
$(DIROBJ)\progress.obj \
|
||||
$(DIROBJ)\sendf.obj \
|
||||
$(DIROBJ)\speedcheck.obj \
|
||||
$(DIROBJ)\ssluse.obj \
|
||||
$(DIROBJ)\timeval.obj \
|
||||
$(DIROBJ)\url.obj \
|
||||
$(DIROBJ)\file.obj \
|
||||
$(DIROBJ)\getinfo.obj \
|
||||
$(DIROBJ)\version.obj \
|
||||
$(DIROBJ)\easy.obj \
|
||||
$(DIROBJ)\strequal.obj \
|
||||
$(DIROBJ)\strtok.obj \
|
||||
$(DIROBJ)\connect.obj
|
||||
|
||||
|
||||
all : $(TARGET)
|
||||
|
||||
|
||||
$(TARGET): $(X_OBJS)
|
||||
$(LNK) $(LFLAGS) $(LINKLIBS) $(X_OBJS)
|
||||
|
||||
$(X_OBJS): $(DIROBJ)
|
||||
|
||||
$(DIROBJ):
|
||||
@if not exist "$(DIROBJ)" mkdir $(DIROBJ)
|
||||
|
||||
.SUFFIXES: .c .obj
|
||||
|
||||
{.\}.c{$(DIROBJ)\}.obj:
|
||||
$(CC) $(CFLAGS) /Fo"$@" $<
|
||||
|
||||
clean:
|
||||
-@erase *.obj
|
||||
-@erase $(DIROBJ)\*.obj
|
||||
-@erase vc60.idb
|
||||
-@erase vc60.pch
|
||||
|
||||
distrib: clean
|
||||
-@erase $(PROGRAM_NAME)
|
||||
|
||||
|
@@ -42,7 +42,7 @@
|
||||
static const char *telnetoptions[]=
|
||||
{
|
||||
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD",
|
||||
"NAME", "STATUS" "TIMING MARK", "RCTE",
|
||||
"NAME", "STATUS", "TIMING MARK", "RCTE",
|
||||
"NAOL", "NAOP", "NAOCRD", "NAOHTS",
|
||||
"NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD",
|
||||
"NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
|
||||
|
@@ -44,6 +44,10 @@
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h> /* required for free() prototype, without it, this crashes
|
||||
on macos 68K */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
@@ -61,6 +65,7 @@
|
||||
#include <winsock.h>
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define EISCONN WSAEISCONN
|
||||
#endif
|
||||
|
||||
#include "urldata.h"
|
||||
@@ -309,9 +314,8 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||
|
||||
return CURLE_HTTP_PORT_FAILED;
|
||||
}
|
||||
#else /* end of ipv4-specific section */
|
||||
#endif /* end of ipv4-specific section */
|
||||
|
||||
/* we only use socketerror() on IPv6-enabled machines */
|
||||
static
|
||||
int socketerror(int sockfd)
|
||||
{
|
||||
@@ -324,7 +328,6 @@ int socketerror(int sockfd)
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TCP connect to the given host with timeout, proxy or remote doesn't matter.
|
||||
@@ -525,6 +528,16 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
}
|
||||
}
|
||||
|
||||
if(0 == rc) {
|
||||
int err = socketerror(sockfd);
|
||||
if ((0 == err) || (EISCONN == err)) {
|
||||
/* we are connected, awesome! */
|
||||
break;
|
||||
}
|
||||
/* nope, not connected for real */
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
if(0 != rc) {
|
||||
/* get a new timeout for next attempt */
|
||||
after = Curl_tvnow();
|
||||
@@ -542,6 +555,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
/* no good connect was made */
|
||||
sclose(sockfd);
|
||||
*sockconn = -1;
|
||||
failf(data, "Couldn't connect to host");
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,7 @@ int Curl_nonblock(int socket, /* operate on this */
|
||||
|
||||
CURLcode Curl_connecthost(struct connectdata *conn,
|
||||
Curl_addrinfo *host, /* connect to this */
|
||||
long port, /* connect to this port number */
|
||||
int port, /* connect to this port number */
|
||||
int *sockconn, /* not set if error is returned */
|
||||
Curl_ipconnect **addr /* the one we used */
|
||||
); /* index we used */
|
||||
|
@@ -923,7 +923,7 @@ static int AddFormData(struct FormData **formp,
|
||||
length = strlen((char *)line);
|
||||
|
||||
newform->line = (char *)malloc(length+1);
|
||||
memcpy(newform->line, line, length+1);
|
||||
memcpy(newform->line, line, length);
|
||||
newform->length = length;
|
||||
newform->line[length]=0; /* zero terminate for easier debugging */
|
||||
|
||||
|
293
lib/ftp.c
293
lib/ftp.c
@@ -197,6 +197,8 @@ int Curl_GetFTPResponse(char *buf,
|
||||
#define SELECT_TIMEOUT 2
|
||||
int error = SELECT_OK;
|
||||
|
||||
struct FTP *ftp = conn->proto.ftp;
|
||||
|
||||
if (ftpcode)
|
||||
*ftpcode = 0; /* 0 for errors */
|
||||
|
||||
@@ -229,23 +231,41 @@ int Curl_GetFTPResponse(char *buf,
|
||||
interval.tv_sec = timeout;
|
||||
interval.tv_usec = 0;
|
||||
|
||||
switch (select (sockfd+1, &readfd, NULL, NULL, &interval)) {
|
||||
case -1: /* select() error, stop reading */
|
||||
error = SELECT_ERROR;
|
||||
failf(data, "Transfer aborted due to select() error");
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
error = SELECT_TIMEOUT;
|
||||
failf(data, "Transfer aborted due to timeout");
|
||||
break;
|
||||
default:
|
||||
if(!ftp->cache)
|
||||
switch (select (sockfd+1, &readfd, NULL, NULL, &interval)) {
|
||||
case -1: /* select() error, stop reading */
|
||||
error = SELECT_ERROR;
|
||||
failf(data, "Transfer aborted due to select() error");
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
error = SELECT_TIMEOUT;
|
||||
failf(data, "Transfer aborted due to timeout");
|
||||
break;
|
||||
default:
|
||||
error = SELECT_OK;
|
||||
break;
|
||||
}
|
||||
if(SELECT_OK == error) {
|
||||
/*
|
||||
* This code previously didn't use the kerberos sec_read() code
|
||||
* to read, but when we use Curl_read() it may do so. Do confirm
|
||||
* that this is still ok and then remove this comment!
|
||||
*/
|
||||
if(CURLE_OK != Curl_read(conn, sockfd, ptr, BUFSIZE-nread, &gotbytes))
|
||||
if(ftp->cache) {
|
||||
/* we had data in the "cache", copy that instead of doing an actual
|
||||
read */
|
||||
memcpy(ptr, ftp->cache, ftp->cache_size);
|
||||
gotbytes = ftp->cache_size;
|
||||
free(ftp->cache); /* free the cache */
|
||||
ftp->cache = NULL; /* clear the pointer */
|
||||
ftp->cache_size = 0; /* zero the size just in case */
|
||||
}
|
||||
else if(CURLE_OK != Curl_read(conn, sockfd, ptr,
|
||||
BUFSIZE-nread, &gotbytes))
|
||||
keepon = FALSE;
|
||||
|
||||
if(!keepon)
|
||||
;
|
||||
else if(gotbytes <= 0) {
|
||||
keepon = FALSE;
|
||||
error = SELECT_ERROR;
|
||||
@@ -279,20 +299,35 @@ int Curl_GetFTPResponse(char *buf,
|
||||
* line to the start of the buffer and zero terminate,
|
||||
* for old times sake (and krb4)! */
|
||||
char *meow;
|
||||
int i;
|
||||
for(meow=line_start, i=0; meow<ptr; meow++, i++)
|
||||
buf[i] = *meow;
|
||||
meow[i]=0; /* zero terminate */
|
||||
int n;
|
||||
for(meow=line_start, n=0; meow<ptr; meow++, n++)
|
||||
buf[n] = *meow;
|
||||
*meow=0; /* zero terminate */
|
||||
keepon=FALSE;
|
||||
line_start = ptr+1; /* advance pointer */
|
||||
i++; /* skip this before getting out */
|
||||
break;
|
||||
}
|
||||
perline=0; /* line starts over here */
|
||||
line_start = ptr+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} /* switch */
|
||||
if(!keepon && (i != gotbytes)) {
|
||||
/* We found the end of the response lines, but we didn't parse the
|
||||
full chunk of data we have read from the server. We therefore
|
||||
need to store the rest of the data to be checked on the next
|
||||
invoke as it may actually contain another end of response
|
||||
already! Cleverly figured out by Eric Lavigne in December
|
||||
2001. */
|
||||
ftp->cache_size = gotbytes - i;
|
||||
ftp->cache = (char *)malloc(ftp->cache_size);
|
||||
if(ftp->cache)
|
||||
memcpy(ftp->cache, line_start, ftp->cache_size);
|
||||
else
|
||||
return CURLE_OUT_OF_MEMORY; /**BANG**/
|
||||
}
|
||||
} /* there was data */
|
||||
} /* if(no error) */
|
||||
} /* while there's buffer left and loop is requested */
|
||||
|
||||
if(!error)
|
||||
@@ -558,6 +593,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
|
||||
ssize_t nread;
|
||||
char *buf = data->state.buffer; /* this is our buffer */
|
||||
int ftpcode;
|
||||
CURLcode result=CURLE_OK;
|
||||
|
||||
if(data->set.upload) {
|
||||
if((-1 != data->set.infilesize) && (data->set.infilesize != *ftp->bytecountp)) {
|
||||
@@ -575,8 +611,12 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
|
||||
else if(!conn->bits.resume_done &&
|
||||
!data->set.no_body &&
|
||||
(0 == *ftp->bytecountp)) {
|
||||
/* We consider this an error, but there's no true FTP error received
|
||||
why we need to continue to "read out" the server response too.
|
||||
We don't want to leave a "waiting" server reply if we'll get told
|
||||
to make a second request on this same connection! */
|
||||
failf(data, "No data was received!");
|
||||
return CURLE_FTP_COULDNT_RETR_FILE;
|
||||
result = CURLE_FTP_COULDNT_RETR_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,12 +644,10 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
|
||||
conn->bits.resume_done = FALSE; /* clean this for next connection */
|
||||
|
||||
/* Send any post-transfer QUOTE strings? */
|
||||
if(data->set.postquote) {
|
||||
CURLcode result = ftp_sendquote(conn, data->set.postquote);
|
||||
return result;
|
||||
}
|
||||
if(!result && data->set.postquote)
|
||||
result = ftp_sendquote(conn, data->set.postquote);
|
||||
|
||||
return CURLE_OK;
|
||||
return result;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -633,8 +671,7 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)
|
||||
if (item->data) {
|
||||
FTPSENDF(conn, "%s", item->data);
|
||||
|
||||
nread = Curl_GetFTPResponse(
|
||||
conn->data->state.buffer, conn, &ftpcode);
|
||||
nread = Curl_GetFTPResponse(conn->data->state.buffer, conn, &ftpcode);
|
||||
if (nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
@@ -810,10 +847,10 @@ ftp_pasv_verbose(struct connectdata *conn,
|
||||
#ifdef HAVE_INET_NTOA_R
|
||||
char ntoa_buf[64];
|
||||
#endif
|
||||
char hostent_buf[8192];
|
||||
char hostent_buf[9000];
|
||||
|
||||
#if defined(HAVE_INET_ADDR)
|
||||
unsigned long address;
|
||||
in_addr_t address;
|
||||
# if defined(HAVE_GETHOSTBYADDR_R)
|
||||
int h_errnop;
|
||||
# endif
|
||||
@@ -822,12 +859,19 @@ ftp_pasv_verbose(struct connectdata *conn,
|
||||
# ifdef HAVE_GETHOSTBYADDR_R
|
||||
|
||||
# ifdef HAVE_GETHOSTBYADDR_R_5
|
||||
/* AIX, Digital Unix style:
|
||||
/* AIX, Digital Unix (OSF1, Tru64) style:
|
||||
extern int gethostbyaddr_r(char *addr, size_t len, int type,
|
||||
struct hostent *htent, struct hostent_data *ht_data); */
|
||||
|
||||
/* Fred Noz helped me try this out, now it at least compiles! */
|
||||
|
||||
/* Bjorn Reese (November 28 2001):
|
||||
The Tru64 man page on gethostbyaddr_r() says that
|
||||
the hostent struct must be filled with zeroes before the call to
|
||||
gethostbyaddr_r(). */
|
||||
|
||||
memset(hostent_buf, 0, sizeof(struct hostent));
|
||||
|
||||
if(gethostbyaddr_r((char *) &address,
|
||||
sizeof(address), AF_INET,
|
||||
(struct hostent *)hostent_buf,
|
||||
@@ -1256,41 +1300,64 @@ CURLcode ftp_use_pasv(struct connectdata *conn)
|
||||
char *buf = data->state.buffer; /* this is our buffer */
|
||||
int ftpcode; /* receive FTP response codes in this */
|
||||
CURLcode result;
|
||||
Curl_addrinfo *addr=NULL;
|
||||
Curl_ipconnect *conninfo;
|
||||
|
||||
/*
|
||||
Here's the excecutive summary on what to do:
|
||||
|
||||
PASV is RFC959, expect:
|
||||
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)
|
||||
|
||||
LPSV is RFC1639, expect:
|
||||
228 Entering Long Passive Mode (4,4,a1,a2,a3,a4,2,p1,p2)
|
||||
|
||||
EPSV is RFC2428, expect:
|
||||
229 Entering Extended Passive Mode (|||port|)
|
||||
|
||||
*/
|
||||
|
||||
#if 1
|
||||
const char *mode[] = { "EPSV", "PASV", NULL };
|
||||
int results[] = { 229, 227, 0 };
|
||||
#else
|
||||
#if 0
|
||||
/* no support for IPv6 passive mode yet */
|
||||
char *mode[] = { "EPSV", "LPSV", "PASV", NULL };
|
||||
int results[] = { 229, 228, 227, 0 };
|
||||
#else
|
||||
const char *mode[] = { "PASV", NULL };
|
||||
int results[] = { 227, 0 };
|
||||
#endif
|
||||
#endif
|
||||
int modeoff;
|
||||
unsigned short connectport; /* the local port connect() should use! */
|
||||
unsigned short newport; /* remote port, not necessary the local one */
|
||||
char *hostdataptr=NULL;
|
||||
|
||||
for (modeoff = 0; mode[modeoff]; modeoff++) {
|
||||
FTPSENDF(conn, mode[modeoff], "");
|
||||
/* newhost must be able to hold a full IP-style address in ASCII, which
|
||||
in the IPv6 case means 5*8-1 = 39 letters */
|
||||
char newhost[48];
|
||||
char *newhostp=NULL;
|
||||
|
||||
for (modeoff = (data->set.ftp_use_epsv?0:1);
|
||||
mode[modeoff]; modeoff++) {
|
||||
result = Curl_ftpsendf(conn, mode[modeoff]);
|
||||
if(result)
|
||||
return result;
|
||||
nread = Curl_GetFTPResponse(buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if (ftpcode == results[modeoff])
|
||||
break;
|
||||
if (ftpcode == results[modeoff])
|
||||
break;
|
||||
}
|
||||
|
||||
if (!mode[modeoff]) {
|
||||
failf(data, "Odd return code after PASV");
|
||||
return CURLE_FTP_WEIRD_PASV_REPLY;
|
||||
}
|
||||
else if (strcmp(mode[modeoff], "PASV") == 0) {
|
||||
else if (227 == results[modeoff]) {
|
||||
int ip[4];
|
||||
int port[2];
|
||||
unsigned short newport; /* remote port, not necessary the local one */
|
||||
unsigned short connectport; /* the local port connect() should use! */
|
||||
char newhost[32];
|
||||
|
||||
Curl_addrinfo *addr;
|
||||
char *hostdataptr=NULL;
|
||||
Curl_ipconnect *conninfo;
|
||||
char *str=buf;
|
||||
|
||||
/*
|
||||
@@ -1318,55 +1385,85 @@ CURLcode ftp_use_pasv(struct connectdata *conn)
|
||||
}
|
||||
|
||||
sprintf(newhost, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|
||||
newhostp = newhost;
|
||||
newport = (port[0]<<8) + port[1];
|
||||
if(data->change.proxy) {
|
||||
/*
|
||||
* This is a tunnel through a http proxy and we need to connect to the
|
||||
* proxy again here. We already have the name info for it since the
|
||||
* previous lookup.
|
||||
*/
|
||||
addr = conn->hostaddr;
|
||||
connectport =
|
||||
(unsigned short)conn->port; /* we connect to the proxy's port */
|
||||
}
|
||||
else {
|
||||
/* normal, direct, ftp connection */
|
||||
addr = Curl_getaddrinfo(data, newhost, newport, &hostdataptr);
|
||||
if(!addr) {
|
||||
failf(data, "Can't resolve new host %s", newhost);
|
||||
return CURLE_FTP_CANT_GET_HOST;
|
||||
}
|
||||
connectport = newport; /* we connect to the remote port */
|
||||
}
|
||||
|
||||
result = Curl_connecthost(conn,
|
||||
addr,
|
||||
connectport,
|
||||
&conn->secondarysocket,
|
||||
&conninfo);
|
||||
|
||||
if((CURLE_OK == result) &&
|
||||
data->set.verbose)
|
||||
/* this just dumps information about this second connection */
|
||||
ftp_pasv_verbose(conn, conninfo, newhost, connectport);
|
||||
|
||||
if(hostdataptr)
|
||||
Curl_freeaddrinfo(hostdataptr);
|
||||
}
|
||||
#if 1
|
||||
else if (229 == results[modeoff]) {
|
||||
char *ptr = strchr(buf, '(');
|
||||
if(ptr) {
|
||||
unsigned int num;
|
||||
char separator[4];
|
||||
ptr++;
|
||||
if(5 == sscanf(ptr, "%c%c%c%u%c",
|
||||
&separator[0],
|
||||
&separator[1],
|
||||
&separator[2],
|
||||
&num,
|
||||
&separator[3])) {
|
||||
/* the four separators should be identical */
|
||||
newport = num;
|
||||
|
||||
if(CURLE_OK != result)
|
||||
return result;
|
||||
|
||||
if (data->set.tunnel_thru_httpproxy) {
|
||||
/* We want "seamless" FTP operations through HTTP proxy tunnel */
|
||||
result = Curl_ConnectHTTPProxyTunnel(conn, conn->secondarysocket,
|
||||
newhost, newport);
|
||||
if(CURLE_OK != result)
|
||||
return result;
|
||||
/* we should use the same host we already are connected to */
|
||||
newhostp = conn->name;
|
||||
}
|
||||
else
|
||||
ptr=NULL;
|
||||
}
|
||||
if(!ptr) {
|
||||
failf(data, "Weirdly formatted EPSV reply");
|
||||
return CURLE_FTP_WEIRD_PASV_REPLY;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
return CURLE_FTP_CANT_RECONNECT;
|
||||
|
||||
if(data->change.proxy) {
|
||||
/*
|
||||
* This is a tunnel through a http proxy and we need to connect to the
|
||||
* proxy again here. We already have the name info for it since the
|
||||
* previous lookup.
|
||||
*/
|
||||
addr = conn->hostaddr;
|
||||
connectport =
|
||||
(unsigned short)conn->port; /* we connect to the proxy's port */
|
||||
}
|
||||
else {
|
||||
/* normal, direct, ftp connection */
|
||||
addr = Curl_getaddrinfo(data, newhostp, newport, &hostdataptr);
|
||||
if(!addr) {
|
||||
failf(data, "Can't resolve new host %s", newhost);
|
||||
return CURLE_FTP_CANT_GET_HOST;
|
||||
}
|
||||
connectport = newport; /* we connect to the remote port */
|
||||
}
|
||||
|
||||
result = Curl_connecthost(conn,
|
||||
addr,
|
||||
connectport,
|
||||
&conn->secondarysocket,
|
||||
&conninfo);
|
||||
|
||||
if((CURLE_OK == result) &&
|
||||
data->set.verbose)
|
||||
/* this just dumps information about this second connection */
|
||||
ftp_pasv_verbose(conn, conninfo, newhost, connectport);
|
||||
|
||||
if(hostdataptr)
|
||||
Curl_freeaddrinfo(hostdataptr);
|
||||
|
||||
if(CURLE_OK != result)
|
||||
return result;
|
||||
|
||||
if (data->set.tunnel_thru_httpproxy) {
|
||||
/* We want "seamless" FTP operations through HTTP proxy tunnel */
|
||||
result = Curl_ConnectHTTPProxyTunnel(conn, conn->secondarysocket,
|
||||
newhost, newport);
|
||||
if(CURLE_OK != result)
|
||||
return result;
|
||||
}
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -1506,11 +1603,13 @@ CURLcode ftp_perform(struct connectdata *conn)
|
||||
if(conn->resume_from < 0 ) {
|
||||
/* we could've got a specified offset from the command line,
|
||||
but now we know we didn't */
|
||||
ssize_t gottensize;
|
||||
|
||||
if(CURLE_OK != ftp_getsize(conn, ftp->file, &conn->resume_from)) {
|
||||
if(CURLE_OK != ftp_getsize(conn, ftp->file, &gottensize)) {
|
||||
failf(data, "Couldn't get remote file size");
|
||||
return CURLE_FTP_COULDNT_GET_SIZE;
|
||||
}
|
||||
conn->resume_from = gottensize;
|
||||
}
|
||||
|
||||
if(conn->resume_from) {
|
||||
@@ -1665,22 +1764,32 @@ CURLcode ftp_perform(struct connectdata *conn)
|
||||
(data->set.ftp_list_only?"NLST":"LIST"));
|
||||
}
|
||||
else {
|
||||
ssize_t foundsize;
|
||||
|
||||
/* Set type to binary (unless specified ASCII) */
|
||||
result = ftp_transfertype(conn, data->set.ftp_ascii);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
/* Attempt to get the size, it'll be useful in some cases: for resumed
|
||||
downloads and when talking to servers that don't give away the size
|
||||
in the RETR response line. */
|
||||
result = ftp_getsize(conn, ftp->file, &foundsize);
|
||||
if(CURLE_OK == result)
|
||||
downloadsize = foundsize;
|
||||
|
||||
if(conn->resume_from) {
|
||||
|
||||
/* Daniel: (August 4, 1999)
|
||||
*
|
||||
* We start with trying to use the SIZE command to figure out the size
|
||||
* of the file we're gonna get. If we can get the size, this is by far
|
||||
* the best way to know if we're trying to resume beyond the EOF. */
|
||||
int foundsize=-1;
|
||||
|
||||
result = ftp_getsize(conn, ftp->file, &foundsize);
|
||||
|
||||
* the best way to know if we're trying to resume beyond the EOF.
|
||||
*
|
||||
* Daniel, November 28, 2001. We *always* get the size on downloads
|
||||
* now, so it is done before this even when not doing resumes. I saved
|
||||
* the comment above for nostalgical reasons! ;-)
|
||||
*/
|
||||
if(CURLE_OK != result) {
|
||||
infof(data, "ftp server doesn't support SIZE\n");
|
||||
/* We couldn't get the size and therefore we can't know if there
|
||||
@@ -1954,6 +2063,8 @@ CURLcode Curl_ftp_disconnect(struct connectdata *conn)
|
||||
if(ftp) {
|
||||
if(ftp->entrypath)
|
||||
free(ftp->entrypath);
|
||||
if(ftp->cache)
|
||||
free(ftp->cache);
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn);
|
||||
CURLcode Curl_ftp_connect(struct connectdata *conn);
|
||||
CURLcode Curl_ftp_disconnect(struct connectdata *conn);
|
||||
|
||||
size_t Curl_ftpsendf(struct connectdata *, const char *fmt, ...);
|
||||
CURLcode Curl_ftpsendf(struct connectdata *, const char *fmt, ...);
|
||||
|
||||
/* The kerberos stuff needs this: */
|
||||
int Curl_GetFTPResponse(char *buf, struct connectdata *conn,
|
||||
|
@@ -21,6 +21,8 @@
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@@ -43,6 +43,7 @@ CURLcode Curl_initinfo(struct SessionHandle *data)
|
||||
pro->t_nslookup = 0;
|
||||
pro->t_connect = 0;
|
||||
pro->t_pretransfer = 0;
|
||||
pro->t_starttransfer = 0;
|
||||
|
||||
info->httpcode = 0;
|
||||
info->httpversion=0;
|
||||
@@ -107,6 +108,9 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
|
||||
case CURLINFO_PRETRANSFER_TIME:
|
||||
*param_doublep = data->progress.t_pretransfer;
|
||||
break;
|
||||
case CURLINFO_STARTTRANSFER_TIME:
|
||||
*param_doublep = data->progress.t_starttransfer;
|
||||
break;
|
||||
case CURLINFO_SIZE_UPLOAD:
|
||||
*param_doublep = data->progress.uploaded;
|
||||
break;
|
||||
|
@@ -35,9 +35,7 @@
|
||||
* Daniel Stenberg <daniel@haxx.se>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include "setup.h" /* setup.h is required for read() prototype */
|
||||
|
||||
#ifndef HAVE_GETPASS_R
|
||||
|
||||
|
@@ -28,7 +28,6 @@
|
||||
|
||||
#define _REENTRANT
|
||||
|
||||
|
||||
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
|
||||
#include <winsock.h>
|
||||
#else
|
||||
@@ -47,6 +46,9 @@
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h> /* required for free() prototypes */
|
||||
#endif
|
||||
#ifdef VMS
|
||||
#include <inet.h>
|
||||
#include <stdlib.h>
|
||||
|
169
lib/http.c
169
lib/http.c
@@ -204,28 +204,6 @@ CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size)
|
||||
/* end of the add_buffer functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Read everything until a newline.
|
||||
*/
|
||||
|
||||
static
|
||||
int GetLine(int sockfd, char *ptr, struct connectdata *conn)
|
||||
{
|
||||
ssize_t nread;
|
||||
|
||||
/* get us a full line, terminated with a newline */
|
||||
for(nread=0; (nread<BUFSIZE); nread++, ptr++) {
|
||||
if((CURLE_OK != Curl_read(conn, sockfd, ptr, 1, &nread)) ||
|
||||
(nread <= 0) || (*ptr == '\n'))
|
||||
break;
|
||||
}
|
||||
*ptr=0; /* zero terminate */
|
||||
|
||||
return nread>0?nread:0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This function checks the linked list of custom HTTP headers for a particular
|
||||
* header (prefix).
|
||||
@@ -258,6 +236,22 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
|
||||
struct SessionHandle *data=conn->data;
|
||||
CURLcode result;
|
||||
|
||||
int nread; /* total size read */
|
||||
int perline; /* count bytes per line */
|
||||
bool keepon=TRUE;
|
||||
ssize_t gotbytes;
|
||||
char *ptr;
|
||||
int timeout = 3600; /* default timeout in seconds */
|
||||
struct timeval interval;
|
||||
fd_set rkeepfd;
|
||||
fd_set readfd;
|
||||
char *line_start;
|
||||
|
||||
#define SELECT_OK 0
|
||||
#define SELECT_ERROR 1
|
||||
#define SELECT_TIMEOUT 2
|
||||
int error = SELECT_OK;
|
||||
|
||||
infof(data, "Establish HTTP proxy tunnel to %s:%d\n", hostname, remote_port);
|
||||
|
||||
/* OK, now send the connect request to the proxy */
|
||||
@@ -276,19 +270,105 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* wait for the proxy to send us a HTTP/1.0 200 OK header */
|
||||
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);
|
||||
/* Now, read the full reply we get from the proxy */
|
||||
|
||||
if(2 == sscanf(data->state.buffer, "HTTP/1.%d %d",
|
||||
&subversion,
|
||||
&httperror)) {
|
||||
;
|
||||
|
||||
if(data->set.timeout) {
|
||||
/* if timeout is requested, find out how much remaining time we have */
|
||||
timeout = data->set.timeout - /* timeout time */
|
||||
Curl_tvdiff(Curl_tvnow(), conn->now)/1000; /* spent time */
|
||||
if(timeout <=0 ) {
|
||||
failf(data, "Transfer aborted due to timeout");
|
||||
return -SELECT_TIMEOUT; /* already too little time */
|
||||
}
|
||||
}
|
||||
|
||||
FD_ZERO (&readfd); /* clear it */
|
||||
FD_SET (tunnelsocket, &readfd); /* read socket */
|
||||
|
||||
/* get this in a backup variable to be able to restore it on each lap in the
|
||||
select() loop */
|
||||
rkeepfd = readfd;
|
||||
|
||||
ptr=data->state.buffer;
|
||||
line_start = ptr;
|
||||
|
||||
nread=0;
|
||||
perline=0;
|
||||
keepon=TRUE;
|
||||
|
||||
while((nread<BUFSIZE) && (keepon && !error)) {
|
||||
readfd = rkeepfd; /* set every lap */
|
||||
interval.tv_sec = timeout;
|
||||
interval.tv_usec = 0;
|
||||
|
||||
switch (select (tunnelsocket+1, &readfd, NULL, NULL, &interval)) {
|
||||
case -1: /* select() error, stop reading */
|
||||
error = SELECT_ERROR;
|
||||
failf(data, "Transfer aborted due to select() error");
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
error = SELECT_TIMEOUT;
|
||||
failf(data, "Transfer aborted due to timeout");
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* This code previously didn't use the kerberos sec_read() code
|
||||
* to read, but when we use Curl_read() it may do so. Do confirm
|
||||
* that this is still ok and then remove this comment!
|
||||
*/
|
||||
if(CURLE_OK != Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread,
|
||||
&gotbytes))
|
||||
keepon = FALSE;
|
||||
else if(gotbytes <= 0) {
|
||||
keepon = FALSE;
|
||||
error = SELECT_ERROR;
|
||||
failf(data, "Connection aborted");
|
||||
}
|
||||
else {
|
||||
/* we got a whole chunk of data, which can be anything from one
|
||||
* byte to a set of lines and possibly just a piece of the last
|
||||
* line */
|
||||
int i;
|
||||
|
||||
nread += gotbytes;
|
||||
for(i = 0; i < gotbytes; ptr++, i++) {
|
||||
perline++; /* amount of bytes in this line so far */
|
||||
if(*ptr=='\n') {
|
||||
/* a newline is CRLF in ftp-talk, so the CR is ignored as
|
||||
the line isn't really terminated until the LF comes */
|
||||
|
||||
/* output debug output if that is requested */
|
||||
if(data->set.verbose) {
|
||||
fputs("< ", data->set.err);
|
||||
fwrite(line_start, perline, 1, data->set.err);
|
||||
/* no need to output LF here, it is part of the data */
|
||||
}
|
||||
|
||||
if('\r' == line_start[0]) {
|
||||
/* end of headers */
|
||||
keepon=FALSE;
|
||||
break; /* breaks out of loop, not switch */
|
||||
}
|
||||
|
||||
if(2 == sscanf(line_start, "HTTP/1.%d %d",
|
||||
&subversion,
|
||||
&httperror)) {
|
||||
;
|
||||
}
|
||||
|
||||
perline=0; /* line starts over here */
|
||||
line_start = ptr+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} /* switch */
|
||||
} /* while there's buffer left and loop is requested */
|
||||
|
||||
if(error)
|
||||
return CURLE_READ_ERROR;
|
||||
|
||||
if(200 != httperror) {
|
||||
if(407 == httperror)
|
||||
/* Added Nov 6 1998 */
|
||||
@@ -318,15 +398,18 @@ CURLcode Curl_http_connect(struct connectdata *conn)
|
||||
* us to the host we want to talk to. Only after the connect
|
||||
* has occured, can we start talking SSL
|
||||
*/
|
||||
if (conn->protocol & PROT_HTTPS) {
|
||||
if (data->change.proxy) {
|
||||
/* HTTPS through a proxy can only be done with a tunnel */
|
||||
result = Curl_ConnectHTTPProxyTunnel(conn, conn->firstsocket,
|
||||
conn->hostname, conn->remote_port);
|
||||
if(CURLE_OK != result)
|
||||
return result;
|
||||
}
|
||||
|
||||
if(data->change.proxy &&
|
||||
((conn->protocol & PROT_HTTPS) || data->set.tunnel_thru_httpproxy)) {
|
||||
|
||||
/* either HTTPS over proxy, OR explicitly asked for a tunnel */
|
||||
result = Curl_ConnectHTTPProxyTunnel(conn, conn->firstsocket,
|
||||
conn->hostname, conn->remote_port);
|
||||
if(CURLE_OK != result)
|
||||
return result;
|
||||
}
|
||||
|
||||
if(conn->protocol & PROT_HTTPS) {
|
||||
/* now, perform the SSL initialization for this socket */
|
||||
result = Curl_SSLConnect(conn);
|
||||
if(result)
|
||||
@@ -450,7 +533,9 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
host, ppath,
|
||||
conn->protocol&PROT_HTTPS?TRUE:FALSE);
|
||||
}
|
||||
if ((data->change.proxy) && !(conn->protocol&PROT_HTTPS)) {
|
||||
if (data->change.proxy &&
|
||||
!data->set.tunnel_thru_httpproxy &&
|
||||
!(conn->protocol&PROT_HTTPS)) {
|
||||
/* The path sent to the proxy is in fact the entire URL */
|
||||
ppath = data->change.url;
|
||||
}
|
||||
@@ -666,7 +751,7 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
|
||||
strftime(buf, BUFSIZE-1, "%a, %d %b %Y %H:%M:%S %Z", thistime);
|
||||
strftime(buf, BUFSIZE-1, "%a, %d %b %Y %H:%M:%S GMT", thistime);
|
||||
#else
|
||||
/* TODO: Right, we *could* write a replacement here */
|
||||
strcpy(buf, "no strftime() support");
|
||||
|
@@ -95,9 +95,11 @@ static void DynaClose(void)
|
||||
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
|
||||
if (libldap) {
|
||||
dlclose(libldap);
|
||||
libldap=NULL;
|
||||
}
|
||||
if (liblber) {
|
||||
dlclose(liblber);
|
||||
liblber=NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -174,7 +176,9 @@ CURLcode Curl_ldap(struct connectdata *conn)
|
||||
conn->hostname, conn->port);
|
||||
status = CURLE_COULDNT_CONNECT;
|
||||
} else {
|
||||
rc = ldap_simple_bind_s(server, data->state.user, data->state.passwd);
|
||||
rc = ldap_simple_bind_s(server,
|
||||
conn->bits.user_passwd?data->state.user:NULL,
|
||||
conn->bits.user_passwd?data->state.passwd:NULL);
|
||||
if (rc != 0) {
|
||||
failf(data, "LDAP: %s", ldap_err2string(rc));
|
||||
status = CURLE_LDAP_CANNOT_BIND;
|
||||
|
@@ -70,6 +70,9 @@ void curl_memdebug(const char *logname)
|
||||
void *curl_domalloc(size_t size, int line, const char *source)
|
||||
{
|
||||
void *mem=(malloc)(size);
|
||||
if(mem)
|
||||
/* fill memory with junk */
|
||||
memset(mem, 0xA5, size);
|
||||
if(logfile)
|
||||
fprintf(logfile, "MEM %s:%d malloc(%d) = %p\n",
|
||||
source, line, size, mem);
|
||||
|
@@ -92,14 +92,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static const char rcsid[] = "@(#)$Id$";
|
||||
|
||||
/*
|
||||
* To test:
|
||||
*
|
||||
* Use WIDTH, PRECISION and NUMBERED ARGUMENT combined.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -909,14 +902,14 @@ static int dprintf_formatf(
|
||||
}
|
||||
else {
|
||||
/* Write "(nil)" for a nil pointer. */
|
||||
static char nil[] = "(nil)";
|
||||
static char strnil[] = "(nil)";
|
||||
register char *point;
|
||||
|
||||
width -= sizeof(nil) - 1;
|
||||
width -= sizeof(strnil) - 1;
|
||||
if (p->flags & FLAGS_LEFT)
|
||||
while (width-- > 0)
|
||||
OUTCHAR(' ');
|
||||
for (point = nil; *point != '\0'; ++point)
|
||||
for (point = strnil; *point != '\0'; ++point)
|
||||
OUTCHAR(*point);
|
||||
if (! (p->flags & FLAGS_LEFT))
|
||||
while (width-- > 0)
|
||||
|
309
lib/multi.c
Normal file
309
lib/multi.c
Normal file
@@ -0,0 +1,309 @@
|
||||
/*****************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include "multi.h" /* will become <curl/multi.h> soon */
|
||||
|
||||
struct Curl_message {
|
||||
/* the 'CURLMsg' is the part that is visible to the external user */
|
||||
struct CURLMsg extmsg;
|
||||
struct Curl_message *next;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
CURLM_STATE_INIT,
|
||||
CURLM_STATE_CONNECT,
|
||||
CURLM_STATE_DO,
|
||||
CURLM_STATE_PERFORM,
|
||||
CURLM_STATE_DONE,
|
||||
CURLM_STATE_COMPLETED,
|
||||
|
||||
CURLM_STATE_LAST /* not a true state, never use this */
|
||||
} CURLMstate;
|
||||
|
||||
struct Curl_one_easy {
|
||||
/* first, two fields for the linked list of these */
|
||||
struct Curl_one_easy *next;
|
||||
struct Curl_one_easy *prev;
|
||||
|
||||
CURL *easy_handle; /* this is the easy handle for this unit */
|
||||
CURLMstate state; /* the handle's state */
|
||||
CURLcode result; /* previous result */
|
||||
};
|
||||
|
||||
|
||||
#define CURL_MULTI_HANDLE 0x000bab1e
|
||||
|
||||
#define GOOD_MULTI_HANDLE(x) ((x)&&(((struct Curl_multi *)x)->type == CURL_MULTI_HANDLE))
|
||||
#define GOOD_EASY_HANDLE(x) (x)
|
||||
|
||||
/* This is the struct known as CURLM on the outside */
|
||||
struct Curl_multi {
|
||||
/* First a simple identifier to easier detect if a user mix up
|
||||
this multi handle with an easy handle. Set this to CURL_MULTI_HANDLE. */
|
||||
long type;
|
||||
|
||||
/* We have a linked list with easy handles */
|
||||
struct Curl_one_easy easy;
|
||||
/* This is the amount of entries in the linked list above. */
|
||||
int num_easy;
|
||||
|
||||
/* this is a linked list of posted messages */
|
||||
struct Curl_message *msgs;
|
||||
/* amount of messages in the queue */
|
||||
int num_msgs;
|
||||
|
||||
};
|
||||
|
||||
|
||||
CURLM *curl_multi_init(void)
|
||||
{
|
||||
struct Curl_multi *multi;
|
||||
|
||||
multi = (void *)malloc(sizeof(struct Curl_multi));
|
||||
|
||||
if(multi) {
|
||||
memset(multi, 0, sizeof(struct Curl_multi));
|
||||
multi->type = CURL_MULTI_HANDLE;
|
||||
}
|
||||
|
||||
return (CURLM *) multi;
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||
CURL *easy_handle)
|
||||
{
|
||||
struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
|
||||
struct Curl_one_easy *easy;
|
||||
|
||||
/* First, make some basic checks that the CURLM handle is a good handle */
|
||||
if(!GOOD_MULTI_HANDLE(multi))
|
||||
return CURLM_BAD_HANDLE;
|
||||
|
||||
/* Verify that we got a somewhat good easy handle too */
|
||||
if(!GOOD_EASY_HANDLE(easy_handle))
|
||||
return CURLM_BAD_EASY_HANDLE;
|
||||
|
||||
/* Now, time to add an easy handle to the multi stack */
|
||||
easy = (struct Curl_one_easy *)malloc(sizeof(struct Curl_one_easy));
|
||||
if(!easy)
|
||||
return CURLM_OUT_OF_MEMORY;
|
||||
|
||||
/* clean it all first (just to be sure) */
|
||||
memset(easy, 0, sizeof(struct Curl_one_easy));
|
||||
|
||||
/* set the easy handle */
|
||||
easy->easy_handle = easy_handle;
|
||||
easy->state = CURLM_STATE_INIT;
|
||||
|
||||
/* We add this new entry first in the list. We make our 'next' point to the
|
||||
previous next and our 'prev' point back to the 'first' struct */
|
||||
easy->next = multi->easy.next;
|
||||
easy->prev = &multi->easy;
|
||||
|
||||
/* make 'easy' the first node in the chain */
|
||||
multi->easy.next = easy;
|
||||
|
||||
/* if there was a next node, make sure its 'prev' pointer links back to
|
||||
the new node */
|
||||
if(easy->next)
|
||||
easy->next->prev = easy;
|
||||
|
||||
/* increase the node-counter */
|
||||
multi->num_easy++;
|
||||
|
||||
return CURLM_OK;
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle)
|
||||
{
|
||||
struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
|
||||
struct Curl_one_easy *easy;
|
||||
|
||||
/* First, make some basic checks that the CURLM handle is a good handle */
|
||||
if(!GOOD_MULTI_HANDLE(multi))
|
||||
return CURLM_BAD_HANDLE;
|
||||
|
||||
/* Verify that we got a somewhat good easy handle too */
|
||||
if(!GOOD_EASY_HANDLE(curl_handle))
|
||||
return CURLM_BAD_EASY_HANDLE;
|
||||
|
||||
/* scan through the list and remove the 'curl_handle' */
|
||||
easy = multi->easy.next;
|
||||
while(easy) {
|
||||
if(easy->easy_handle == curl_handle)
|
||||
break;
|
||||
easy=easy->next;
|
||||
}
|
||||
if(easy) {
|
||||
/* If the 'state' is not INIT or COMPLETED, we might need to do something
|
||||
nice to put the easy_handle in a good known state when this returns. */
|
||||
|
||||
/* make the previous node point to our next */
|
||||
if(easy->prev)
|
||||
easy->prev->next = easy->next;
|
||||
/* make our next point to our previous node */
|
||||
if(easy->next)
|
||||
easy->next->prev = easy->prev;
|
||||
|
||||
/* NOTE NOTE NOTE
|
||||
We do not touch the easy handle here! */
|
||||
free(easy);
|
||||
|
||||
multi->num_easy--; /* one less to care about now */
|
||||
|
||||
return CURLM_OK;
|
||||
}
|
||||
else
|
||||
return CURLM_BAD_EASY_HANDLE; /* twasn't found */
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||
fd_set *read_fd_set, fd_set *write_fd_set,
|
||||
fd_set *exc_fd_set, int *max_fd)
|
||||
{
|
||||
/* Scan through all the easy handles to get the file descriptors set.
|
||||
Some easy handles may not have connected to the remote host yet,
|
||||
and then we must make sure that is done. */
|
||||
struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
|
||||
struct Curl_one_easy *easy;
|
||||
|
||||
if(!GOOD_MULTI_HANDLE(multi))
|
||||
return CURLM_BAD_HANDLE;
|
||||
|
||||
easy=multi->easy.next;
|
||||
while(easy) {
|
||||
switch(easy->state) {
|
||||
case CURLM_STATE_INIT:
|
||||
case CURLM_STATE_CONNECT:
|
||||
case CURLM_STATE_DO:
|
||||
case CURLM_STATE_DONE:
|
||||
/* we want curl_multi_perform() to get called, but we don't have any
|
||||
file descriptors to set */
|
||||
break;
|
||||
case CURLM_STATE_PERFORM:
|
||||
/* This should have a set of file descriptors for us to set. */
|
||||
/* after the transfer is done, go DONE */
|
||||
break;
|
||||
}
|
||||
easy = easy->next; /* check next handle */
|
||||
}
|
||||
|
||||
return CURLM_OK;
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
{
|
||||
struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
|
||||
struct Curl_one_easy *easy;
|
||||
bool done;
|
||||
|
||||
if(!GOOD_MULTI_HANDLE(multi))
|
||||
return CURLM_BAD_HANDLE;
|
||||
|
||||
easy=multi->easy.next;
|
||||
while(easy) {
|
||||
|
||||
switch(easy->state) {
|
||||
case CURLM_STATE_INIT:
|
||||
/* init this transfer. Hm, uh, I can't think of anything to init
|
||||
right now, let's skip over to CONNECT at once!
|
||||
|
||||
easy->result = Curl_init(easy->easy_handle);
|
||||
if(CURLE_OK == easy->result)
|
||||
*/
|
||||
/* after init, go CONNECT */
|
||||
easy->state = CURLM_STATE_CONNECT;
|
||||
break;
|
||||
case CURLM_STATE_CONNECT:
|
||||
/* connect */
|
||||
easy->result = Curl_connect(easy->easy_handle);
|
||||
/* after connect, go DO */
|
||||
if(CURLE_OK == easy->result)
|
||||
easy->state = CURLM_STATE_DO;
|
||||
break;
|
||||
case CURLM_STATE_DO:
|
||||
/* Do the fetch or put request */
|
||||
easy->result = Curl_do(easy->easy_handle);
|
||||
/* after do, go PERFORM */
|
||||
if(CURLE_OK == easy->result)
|
||||
easy->state = CURLM_STATE_PERFORM;
|
||||
break;
|
||||
case CURLM_STATE_PERFORM:
|
||||
/* read/write data if it is ready to do so */
|
||||
easy->result = Curl_readwrite(easy->easy_handle, &done);
|
||||
/* hm, when we follow redirects, we may need to go back to the CONNECT
|
||||
state */
|
||||
/* after the transfer is done, go DONE */
|
||||
if(TRUE == done)
|
||||
easy->state = CURLM_STATE_DONE;
|
||||
break;
|
||||
case CURLM_STATE_DONE:
|
||||
/* post-transfer command */
|
||||
easy->result = Curl_done(easy->easy_handle);
|
||||
/* after we have DONE what we're supposed to do, go COMPLETED */
|
||||
if(CURLE_OK == easy->result)
|
||||
easy->state = CURLM_STATE_COMPLETED;
|
||||
break;
|
||||
case CURLM_STATE_COMPLETED:
|
||||
/* this is a completed transfer, it is likely to still be connected */
|
||||
|
||||
/* This node should be delinked from the list now and we should post
|
||||
an information message that we are complete. */
|
||||
break;
|
||||
}
|
||||
if((CURLM_STATE_COMPLETED != easy->state) &&
|
||||
(CURLE_OK != easy->result)) {
|
||||
/*
|
||||
* If an error was returned, and we aren't in completed now,
|
||||
* then we go to completed and consider this transfer aborted.
|
||||
*/
|
||||
easy->state = CURLM_STATE_COMPLETED;
|
||||
}
|
||||
|
||||
easy = easy->next; /* operate on next handle */
|
||||
}
|
||||
return CURLM_OK;
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_cleanup(CURLM *multi_handle)
|
||||
{
|
||||
struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
|
||||
if(GOOD_MULTI_HANDLE(multi)) {
|
||||
multi->type = 0; /* not good anymore */
|
||||
|
||||
/* remove all easy handles */
|
||||
|
||||
free(multi);
|
||||
|
||||
return CURLM_OK;
|
||||
}
|
||||
else
|
||||
return CURLM_BAD_HANDLE;
|
||||
}
|
||||
|
||||
CURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue);
|
||||
|
183
lib/multi.h
Normal file
183
lib/multi.h
Normal file
@@ -0,0 +1,183 @@
|
||||
#ifndef __CURL_MULTI_H
|
||||
#define __CURL_MULTI_H
|
||||
/*****************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
/*
|
||||
This is meant to be the "external" header file. Don't give away any
|
||||
internals here!
|
||||
|
||||
This document presents a mixture of ideas from at least:
|
||||
- Daniel Stenberg
|
||||
- Steve Dekorte
|
||||
- Sterling Hughes
|
||||
- Ben Greear
|
||||
|
||||
-------------------------------------------
|
||||
GOALS
|
||||
|
||||
o Enable a "pull" interface. The application that uses libcurl decides where
|
||||
and when to ask libcurl to get/send data.
|
||||
|
||||
o Enable multiple simultaneous transfers in the same thread without making it
|
||||
complicated for the application.
|
||||
|
||||
o Enable the application to select() on its own file descriptors and curl's
|
||||
file descriptors simultaneous easily.
|
||||
|
||||
Example source using this interface: http://curl.haxx.se/dev/multi-app.c
|
||||
|
||||
*/
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include <curl/types.h>
|
||||
|
||||
typedef void CURLM;
|
||||
|
||||
typedef enum {
|
||||
CURLM_OK,
|
||||
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
|
||||
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
||||
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
|
||||
CURLM_LAST
|
||||
} CURLMcode;
|
||||
|
||||
typedef enum {
|
||||
CURLMSG_NONE, /* first, not used */
|
||||
CURLMSG_DONE, /* This easy handle has completed. 'whatever' points to
|
||||
the CURLcode of the transfer */
|
||||
CURLMSG_LAST /* last, not used */
|
||||
} CURLMSG;
|
||||
|
||||
struct CURLMsg {
|
||||
CURLMSG msg; /* what this message means */
|
||||
CURL *easy_handle; /* the handle it concerns */
|
||||
union {
|
||||
void *whatever; /* message-specific data */
|
||||
CURLcode result; /* return code for transfer */
|
||||
} data;
|
||||
};
|
||||
typedef struct CURLMsg CURLMsg;
|
||||
|
||||
/*
|
||||
* Name: curl_multi_init()
|
||||
*
|
||||
* Desc: inititalize multi-style curl usage
|
||||
* Returns: a new CURLM handle to use in all 'curl_multi' functions.
|
||||
*/
|
||||
CURLM *curl_multi_init(void);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_add_handle()
|
||||
*
|
||||
* Desc: add a standard curl handle to the multi stack
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_remove_handle()
|
||||
*
|
||||
* Desc: removes a curl handle from the multi stack again
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_fdset()
|
||||
*
|
||||
* Desc: Ask curl for its fd_set sets. The app can use these to select() or
|
||||
* poll() on. We want curl_multi_perform() called as soon as one of
|
||||
* them are ready.
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
fd_set *exc_fd_set,
|
||||
int *max_fd);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_perform()
|
||||
*
|
||||
* Desc: When the app thinks there's data available for curl it calls this
|
||||
* function to read/write whatever there is right now. This returns
|
||||
* as soon as the reads and writes are done. This function does not
|
||||
* require that there actually is data available for reading or that
|
||||
* data can be written, it can be called just in case. It returns
|
||||
* the number of handles that still transfer data in the second
|
||||
* argument's integer-pointer.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code. *NOTE* that this only
|
||||
* returns errors etc regarding the whole multi stack. There might
|
||||
* still have occurred problems on invidual transfers even when this
|
||||
* returns OK.
|
||||
*/
|
||||
CURLMcode curl_multi_perform(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_cleanup()
|
||||
*
|
||||
* Desc: Cleans up and removes a whole multi stack. It does not free or
|
||||
* touch any individual easy handles in any way. We need to define
|
||||
* in what state those handles will be if this function is called
|
||||
* in the middle of a transfer.
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURLMcode curl_multi_cleanup(CURLM *multi_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_info_read()
|
||||
*
|
||||
* Desc: Ask the multi handle if there's any messages/informationals from
|
||||
* the individual transfers. Messages include informationals such as
|
||||
* error code from the transfer or just the fact that a transfer is
|
||||
* completed. More details on these should be written down as well.
|
||||
*
|
||||
* Repeated calls to this function will return a new struct each
|
||||
* time, until a special "end of msgs" struct is returned as a signal
|
||||
* that there is no more to get at this point.
|
||||
*
|
||||
* The data the returned pointer points to will not survive calling
|
||||
* curl_multi_cleanup().
|
||||
*
|
||||
* The 'CURLMsg' struct is meant to be very simple and only contain
|
||||
* very basic informations. If more involved information is wanted,
|
||||
* we will provide the particular "transfer handle" in that struct
|
||||
* and that should/could/would be used in subsequent
|
||||
* curl_easy_getinfo() calls (or similar). The point being that we
|
||||
* must never expose complex structs to applications, as then we'll
|
||||
* undoubtably get backwards compatibility problems in the future.
|
||||
*
|
||||
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
|
||||
* of structs. It also writes the number of messages left in the
|
||||
* queue (after this read) in the integer the second argument points
|
||||
* to.
|
||||
*/
|
||||
CURLMsg *curl_multi_info_read(CURLM *multi_handle,
|
||||
int *msgs_in_queue);
|
||||
|
||||
#endif
|
@@ -111,23 +111,25 @@ void Curl_pgrsTime(struct SessionHandle *data, timerid timer)
|
||||
/* mistake filter */
|
||||
break;
|
||||
case TIMER_STARTSINGLE:
|
||||
/* This is set at the start of a single fetch, there may be several
|
||||
fetches within an operation, why we add all other times relative
|
||||
to this one */
|
||||
/* This is set at the start of a single fetch */
|
||||
data->progress.t_startsingle = Curl_tvnow();
|
||||
break;
|
||||
|
||||
case TIMER_NAMELOOKUP:
|
||||
data->progress.t_nslookup +=
|
||||
(double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000;
|
||||
data->progress.t_nslookup =
|
||||
(double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0;
|
||||
break;
|
||||
case TIMER_CONNECT:
|
||||
data->progress.t_connect +=
|
||||
(double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000;
|
||||
data->progress.t_connect =
|
||||
(double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0;
|
||||
break;
|
||||
case TIMER_PRETRANSFER:
|
||||
data->progress.t_pretransfer +=
|
||||
(double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000;
|
||||
data->progress.t_pretransfer =
|
||||
(double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0;
|
||||
break;
|
||||
case TIMER_STARTTRANSFER:
|
||||
data->progress.t_starttransfer =
|
||||
(double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0;
|
||||
break;
|
||||
case TIMER_POSTRANSFER:
|
||||
/* this is the normal end-of-transfer thing */
|
||||
@@ -227,7 +229,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
||||
/* The exact time spent so far (from the start) */
|
||||
timespent = (double)Curl_tvdiff (now, data->progress.start)/1000;
|
||||
|
||||
data->progress.timespent = (long)timespent;
|
||||
data->progress.timespent = timespent;
|
||||
|
||||
/* The average download speed this far */
|
||||
data->progress.dlspeed =
|
||||
@@ -275,6 +277,8 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
||||
/* Figure out the exact time for the time span */
|
||||
span_ms = Curl_tvdiff(now,
|
||||
data->progress.speeder_time[checkindex]);
|
||||
if(0 == span_ms)
|
||||
span_ms=1; /* at least one millisecond MUST have passed */
|
||||
|
||||
/* Calculate the average speed the last 'countindex' seconds */
|
||||
data->progress.current_speed =
|
||||
|
@@ -31,6 +31,7 @@ typedef enum {
|
||||
TIMER_NAMELOOKUP,
|
||||
TIMER_CONNECT,
|
||||
TIMER_PRETRANSFER,
|
||||
TIMER_STARTTRANSFER,
|
||||
TIMER_POSTRANSFER,
|
||||
TIMER_STARTSINGLE,
|
||||
TIMER_LAST /* must be last */
|
||||
|
@@ -27,6 +27,10 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h> /* required for send() & recv() prototypes */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
13
lib/setup.h
13
lib/setup.h
@@ -41,9 +41,14 @@
|
||||
|
||||
#else
|
||||
#ifdef WIN32
|
||||
/* include the hand-modified win32 adjusted config.h! */
|
||||
/* hand-modified win32 config.h! */
|
||||
#include "../config-win32.h"
|
||||
#endif
|
||||
#ifdef macintosh
|
||||
/* hand-modified MacOS config.h! */
|
||||
#include "config-mac.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus /* (rabe) */
|
||||
@@ -110,13 +115,13 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
|
||||
#define sclose(x) closesocket(x)
|
||||
#define sread(x,y,z) recv(x,y,z,0)
|
||||
#define swrite(x,y,z) (size_t)send(x,y,z,0)
|
||||
#define myalarm(x) /* win32 is a silly system */
|
||||
#undef HAVE_ALARM
|
||||
#else
|
||||
/* gcc-for-win is still good :) */
|
||||
#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 myalarm(x) alarm(x)
|
||||
#define HAVE_ALARM
|
||||
#endif
|
||||
|
||||
#define PATH_CHAR ";"
|
||||
@@ -127,7 +132,7 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
|
||||
#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 myalarm(x) alarm(x)
|
||||
#define HAVE_ALARM
|
||||
|
||||
#define PATH_CHAR ":"
|
||||
#define DIR_CHAR "/"
|
||||
|
14
lib/ssluse.c
14
lib/ssluse.c
@@ -292,6 +292,8 @@ void Curl_SSL_cleanup(void)
|
||||
/* EVP_cleanup() removes all ciphers and digests from the
|
||||
table. */
|
||||
EVP_cleanup();
|
||||
|
||||
init_ssl=0; /* not inited any more */
|
||||
}
|
||||
#else
|
||||
/* SSL disabled, do nothing */
|
||||
@@ -540,15 +542,21 @@ Curl_SSLConnect(struct connectdata *conn)
|
||||
|
||||
/* Make funny stuff to get random input */
|
||||
random_the_seed(conn);
|
||||
|
||||
|
||||
/* check to see if we've been told to use an explicit SSL/TLS version */
|
||||
switch(data->set.ssl.version) {
|
||||
default:
|
||||
case CURL_SSLVERSION_DEFAULT:
|
||||
/* we try to figure out version */
|
||||
req_method = SSLv23_client_method();
|
||||
break;
|
||||
case 2:
|
||||
case CURL_SSLVERSION_TLSv1:
|
||||
req_method = TLSv1_client_method();
|
||||
break;
|
||||
case CURL_SSLVERSION_SSLv2:
|
||||
req_method = SSLv2_client_method();
|
||||
break;
|
||||
case 3:
|
||||
case CURL_SSLVERSION_SSLv3:
|
||||
req_method = SSLv3_client_method();
|
||||
break;
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "setup.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
int curl_strequal(const char *first, const char *second)
|
||||
{
|
||||
@@ -62,6 +63,9 @@ int curl_strnequal(const char *first, const char *second, size_t max)
|
||||
first++;
|
||||
second++;
|
||||
}
|
||||
if(0 == max)
|
||||
return 1; /* they are equal this far */
|
||||
|
||||
return toupper(*first) == toupper(*second);
|
||||
#endif
|
||||
}
|
||||
|
@@ -1142,7 +1142,7 @@ CURLcode Curl_telnet(struct connectdata *conn)
|
||||
#else
|
||||
FD_ZERO (&readfd); /* clear it */
|
||||
FD_SET (sockfd, &readfd);
|
||||
FD_SET (1, &readfd);
|
||||
FD_SET (0, &readfd);
|
||||
|
||||
keepfd = readfd;
|
||||
|
||||
@@ -1156,13 +1156,13 @@ CURLcode Curl_telnet(struct connectdata *conn)
|
||||
case 0: /* timeout */
|
||||
break;
|
||||
default: /* read! */
|
||||
if(FD_ISSET(1, &readfd)) { /* read from stdin */
|
||||
if(FD_ISSET(0, &readfd)) { /* read from stdin */
|
||||
unsigned char outbuf[2];
|
||||
int out_count = 0;
|
||||
size_t bytes_written;
|
||||
char *buffer = buf;
|
||||
|
||||
nread = read(1, buf, 255);
|
||||
nread = read(0, buf, 255);
|
||||
|
||||
while(nread--) {
|
||||
outbuf[0] = *buffer++;
|
||||
|
@@ -69,10 +69,10 @@ struct timeval Curl_tvnow (void)
|
||||
* Make sure that the first argument is the more recent time, as otherwise
|
||||
* we'll get a weird negative time-diff back...
|
||||
*/
|
||||
long Curl_tvdiff (struct timeval t1, struct timeval t2)
|
||||
long Curl_tvdiff (struct timeval newer, struct timeval older)
|
||||
{
|
||||
return (t1.tv_sec*1000 + t1.tv_usec/1000)-
|
||||
(t2.tv_sec*1000 + t2.tv_usec/1000);
|
||||
return (newer.tv_sec-older.tv_sec)*1000+
|
||||
(499+newer.tv_usec-older.tv_usec)/1000;
|
||||
}
|
||||
|
||||
long Curl_tvlong (struct timeval t1)
|
||||
|
@@ -42,7 +42,7 @@ struct timeval {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct timeval Curl_tvnow ();
|
||||
struct timeval Curl_tvnow (void);
|
||||
|
||||
/* the diff is from now on returned in number of milliseconds! */
|
||||
long Curl_tvdiff (struct timeval t1, struct timeval t2);
|
||||
|
@@ -305,6 +305,8 @@ Transfer(struct connectdata *c_conn)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ((bytecount == 0) && (writebytecount == 0))
|
||||
Curl_pgrsTime(data, TIMER_STARTTRANSFER);
|
||||
if((keepon & KEEP_READ) && FD_ISSET(conn->sockfd, &readfd)) {
|
||||
/* read! */
|
||||
urg = Curl_read(conn, conn->sockfd, buf, BUFSIZE -1, &nread);
|
||||
@@ -900,6 +902,10 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
||||
struct connectdata *conn=NULL;
|
||||
bool port=TRUE; /* allow data->set.use_port to set port to use */
|
||||
char *newurl = NULL; /* possibly a new URL to follow to! */
|
||||
#ifdef HAVE_SIGNAL
|
||||
/* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
|
||||
void (*prev_signal)(int sig);
|
||||
#endif
|
||||
|
||||
if(!data->change.url)
|
||||
/* we can't do anything wihout URL */
|
||||
@@ -916,10 +922,23 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
||||
data->state.this_is_a_follow = FALSE; /* reset this */
|
||||
data->state.errorbuf = FALSE; /* no error has occurred */
|
||||
|
||||
Curl_initinfo(data); /* reset session-specific information "variables" */
|
||||
#if defined(HAVE_SIGNAL) && defined(SIGPIPE)
|
||||
/*************************************************************
|
||||
* Tell signal handler to ignore SIGPIPE
|
||||
*************************************************************/
|
||||
prev_signal = signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
Curl_initinfo(data); /* reset session-specific information "variables" */
|
||||
Curl_pgrsStartNow(data);
|
||||
|
||||
/*
|
||||
* It is important that there is NO 'return' from this function any any
|
||||
* other place than falling down the bottom! This is because we have cleanup
|
||||
* stuff that must be done before we get back, and that is only performed
|
||||
* after this do-while loop.
|
||||
*/
|
||||
|
||||
do {
|
||||
Curl_pgrsTime(data, TIMER_STARTSINGLE);
|
||||
res = Curl_connect(data, &conn, port);
|
||||
@@ -1035,8 +1054,10 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
||||
point to read-only data */
|
||||
char *url_clone=strdup(data->change.url);
|
||||
|
||||
if(!url_clone)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
if(!url_clone) {
|
||||
res = CURLE_OUT_OF_MEMORY;
|
||||
break; /* skip out of this loop NOW */
|
||||
}
|
||||
|
||||
/* protsep points to the start of the host name */
|
||||
protsep=strstr(url_clone, "//");
|
||||
@@ -1070,8 +1091,10 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
||||
1 + /* possible slash */
|
||||
strlen(newurl) + 1/* zero byte */);
|
||||
|
||||
if(!newest)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
if(!newest) {
|
||||
res = CURLE_OUT_OF_MEMORY;
|
||||
break; /* go go go out from this loop */
|
||||
}
|
||||
sprintf(newest, "%s%s%s", url_clone, ('/' == newurl[0])?"":"/",
|
||||
newurl);
|
||||
free(newurl);
|
||||
@@ -1159,9 +1182,10 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
||||
if(newurl)
|
||||
free(newurl);
|
||||
|
||||
/* make absolutely sure the alarm is switched off! */
|
||||
if(data->set.timeout || data->set.connecttimeout)
|
||||
myalarm(0);
|
||||
#if defined(HAVE_SIGNAL) && defined(SIGPIPE)
|
||||
/* restore the signal handler for SIGPIPE before we get back */
|
||||
signal(SIGPIPE, prev_signal);
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
176
lib/url.c
176
lib/url.c
@@ -72,7 +72,6 @@
|
||||
#include <inet.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_SELECT
|
||||
#error "We can't compile without select() support!"
|
||||
#endif
|
||||
@@ -144,13 +143,23 @@ RETSIGTYPE alarmfunc(int signal)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This is the internal function curl_easy_cleanup() calls. This should
|
||||
* cleanup and free all resources associated with this sessionhandle.
|
||||
*
|
||||
* NOTE: if we ever add something that attempts to write to a socket or
|
||||
* similar here, we must ignore SIGPIPE first. It is currently only done
|
||||
* when curl_easy_perform() is invoked.
|
||||
*/
|
||||
|
||||
CURLcode Curl_close(struct SessionHandle *data)
|
||||
{
|
||||
/* Loop through all open connections and kill them one by one */
|
||||
while(-1 != ConnectionKillOne(data));
|
||||
|
||||
#ifdef USE_SSLEAY
|
||||
/* Close down all open info open SSL and sessions */
|
||||
/* Close down all open SSL info and sessions */
|
||||
Curl_SSL_Close_All(data);
|
||||
#endif
|
||||
|
||||
@@ -200,10 +209,6 @@ CURLcode Curl_open(struct SessionHandle **curl)
|
||||
{
|
||||
/* We don't yet support specifying the URL at this point */
|
||||
struct SessionHandle *data;
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction sigact;
|
||||
#endif
|
||||
|
||||
/* Very simple start-up: alloc the struct, init it with zeroes and return */
|
||||
data = (struct SessionHandle *)malloc(sizeof(struct SessionHandle));
|
||||
if(!data)
|
||||
@@ -240,6 +245,7 @@ CURLcode Curl_open(struct SessionHandle **curl)
|
||||
data->state.current_speed = -1; /* init to negative == impossible */
|
||||
|
||||
data->set.httpreq = HTTPREQ_GET; /* Default HTTP request */
|
||||
data->set.ftp_use_epsv = TRUE; /* FTP defaults to EPSV operations */
|
||||
|
||||
/* make libcurl quiet by default: */
|
||||
data->set.hide_progress = TRUE; /* CURLOPT_NOPROGRESS changes these */
|
||||
@@ -263,31 +269,6 @@ CURLcode Curl_open(struct SessionHandle **curl)
|
||||
|
||||
*curl = data;
|
||||
|
||||
/*************************************************************
|
||||
* Set signal handler to catch SIGALRM
|
||||
*************************************************************/
|
||||
#ifdef HAVE_SIGACTION
|
||||
sigaction(SIGALRM, NULL, &sigact);
|
||||
sigact.sa_handler = alarmfunc;
|
||||
#ifdef SA_RESTART
|
||||
/* HPUX doesn't have SA_RESTART but defaults to that behaviour! */
|
||||
sigact.sa_flags &= ~SA_RESTART;
|
||||
#endif
|
||||
sigaction(SIGALRM, &sigact, NULL);
|
||||
#else
|
||||
/* no sigaction(), revert to the much lamer signal() */
|
||||
#ifdef HAVE_SIGNAL
|
||||
signal(SIGALRM, alarmfunc);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*************************************************************
|
||||
* Tell signal handler to ignore SIGPIPE
|
||||
*************************************************************/
|
||||
#if defined(HAVE_SIGNAL) && defined(SIGPIPE)
|
||||
(void) signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -543,6 +524,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
||||
data->set.ftpport = va_arg(param, char *);
|
||||
data->set.ftp_use_port = data->set.ftpport?1:0;
|
||||
break;
|
||||
|
||||
case CURLOPT_FTP_USE_EPSV:
|
||||
data->set.ftp_use_epsv = va_arg(param, long)?TRUE:FALSE;
|
||||
break;
|
||||
|
||||
case CURLOPT_HTTPHEADER:
|
||||
/*
|
||||
* Set a list with HTTP headers to use (or replace internals with)
|
||||
@@ -570,8 +556,10 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
||||
/*
|
||||
* Set to force us do HTTP GET
|
||||
*/
|
||||
if(va_arg(param, long))
|
||||
if(va_arg(param, long)) {
|
||||
data->set.httpreq = HTTPREQ_GET;
|
||||
data->set.upload = FALSE; /* switch off upload */
|
||||
}
|
||||
break;
|
||||
|
||||
case CURLOPT_INFILE:
|
||||
@@ -957,9 +945,9 @@ static bool SocketIsDead(int sock)
|
||||
}
|
||||
|
||||
/*
|
||||
* Given one filled in connection struct, this function should detect if there
|
||||
* already is one that have all the significant details exactly the same and
|
||||
* thus should be used instead.
|
||||
* Given one filled in connection struct (named needle), this function should
|
||||
* detect if there already is one that have all the significant details
|
||||
* exactly the same and thus should be used instead.
|
||||
*/
|
||||
static bool
|
||||
ConnectionExists(struct SessionHandle *data,
|
||||
@@ -978,8 +966,14 @@ ConnectionExists(struct SessionHandle *data,
|
||||
if(!check)
|
||||
/* NULL pointer means not filled-in entry */
|
||||
continue;
|
||||
if(!needle->bits.httpproxy) {
|
||||
/* The requested connection does not use a HTTP proxy */
|
||||
if(!needle->bits.httpproxy || needle->protocol&PROT_SSL) {
|
||||
/* The requested connection does not use a HTTP proxy or it
|
||||
uses SSL. */
|
||||
|
||||
if(!(needle->protocol&PROT_SSL) && check->bits.httpproxy)
|
||||
/* we don't do SSL but the cached connection has a proxy,
|
||||
then don't match this */
|
||||
continue;
|
||||
|
||||
if(strequal(needle->protostr, check->protostr) &&
|
||||
strequal(needle->name, check->name) &&
|
||||
@@ -1164,12 +1158,24 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
{
|
||||
char *tmp;
|
||||
char *buf;
|
||||
CURLcode result;
|
||||
CURLcode result=CURLE_OK;
|
||||
char resumerange[40]="";
|
||||
struct connectdata *conn;
|
||||
struct connectdata *conn_temp;
|
||||
char endbracket;
|
||||
int urllen;
|
||||
#ifdef HAVE_ALARM
|
||||
unsigned int prev_alarm;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction keep_sigact; /* store the old struct here */
|
||||
bool keep_copysig; /* did copy it? */
|
||||
#else
|
||||
#ifdef HAVE_SIGNAL
|
||||
void *keep_sigact; /* store the old handler here */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*************************************************************
|
||||
* Check input data
|
||||
@@ -1551,14 +1557,14 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
conn->protocol |= PROT_HTTP;
|
||||
conn->curl_do = Curl_http;
|
||||
conn->curl_done = Curl_http_done;
|
||||
conn->curl_connect = Curl_http_connect;
|
||||
}
|
||||
else if (strequal(conn->protostr, "HTTPS")) {
|
||||
#ifdef USE_SSLEAY
|
||||
|
||||
conn->port = (data->set.use_port && allow_port)?data->set.use_port:PORT_HTTPS;
|
||||
conn->remote_port = PORT_HTTPS;
|
||||
conn->protocol |= PROT_HTTP;
|
||||
conn->protocol |= PROT_HTTPS;
|
||||
conn->protocol |= PROT_HTTP|PROT_HTTPS|PROT_SSL;
|
||||
|
||||
conn->curl_do = Curl_http;
|
||||
conn->curl_done = Curl_http_done;
|
||||
@@ -1589,7 +1595,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
|
||||
if(strequal(conn->protostr, "FTPS")) {
|
||||
#ifdef USE_SSLEAY
|
||||
conn->protocol |= PROT_FTPS;
|
||||
conn->protocol |= PROT_FTPS|PROT_SSL;
|
||||
#else
|
||||
failf(data, LIBCURL_NAME
|
||||
" was built with SSL disabled, ftps: not supported!");
|
||||
@@ -1937,17 +1943,45 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
* Set timeout if that is being used
|
||||
*************************************************************/
|
||||
if(data->set.timeout || data->set.connecttimeout) {
|
||||
/*************************************************************
|
||||
* Set signal handler to catch SIGALRM
|
||||
* Store the old value to be able to set it back later!
|
||||
*************************************************************/
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction sigact;
|
||||
sigaction(SIGALRM, NULL, &sigact);
|
||||
keep_sigact = sigact;
|
||||
keep_copysig = TRUE; /* yes, we have a copy */
|
||||
sigact.sa_handler = alarmfunc;
|
||||
#ifdef SA_RESTART
|
||||
/* HPUX doesn't have SA_RESTART but defaults to that behaviour! */
|
||||
sigact.sa_flags &= ~SA_RESTART;
|
||||
#endif
|
||||
/* now set the new struct */
|
||||
sigaction(SIGALRM, &sigact, NULL);
|
||||
#else
|
||||
/* no sigaction(), revert to the much lamer signal() */
|
||||
#ifdef HAVE_SIGNAL
|
||||
keep_sigact = signal(SIGALRM, alarmfunc);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* We set the timeout on the name resolving phase first, separately from
|
||||
* the download/upload part to allow a maximum time on everything. This is
|
||||
* a signal-based timeout, why it won't work and shouldn't be used in
|
||||
* multi-threaded environments. */
|
||||
|
||||
/* myalarm() makes a signal get sent when the timeout fires off, and that
|
||||
#ifdef HAVE_ALARM
|
||||
/* alarm() makes a signal get sent when the timeout fires off, and that
|
||||
will abort system calls */
|
||||
if(data->set.connecttimeout)
|
||||
myalarm(data->set.connecttimeout);
|
||||
else
|
||||
myalarm(data->set.timeout);
|
||||
prev_alarm = alarm(data->set.connecttimeout?
|
||||
data->set.connecttimeout:
|
||||
data->set.timeout);
|
||||
/* We can expect the conn->created time to be "now", as that was just
|
||||
recently set in the beginning of this function and nothing slow
|
||||
has been done since then until now. */
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
@@ -1966,7 +2000,8 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
}
|
||||
if(!conn->hostaddr) {
|
||||
failf(data, "Couldn't resolve host '%s'", conn->name);
|
||||
return CURLE_COULDNT_RESOLVE_HOST;
|
||||
result = CURLE_COULDNT_RESOLVE_HOST;
|
||||
/* don't return yet, we need to clean up the timeout first */
|
||||
}
|
||||
}
|
||||
else if(!conn->hostaddr) {
|
||||
@@ -1980,13 +2015,52 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
|
||||
if(!conn->hostaddr) {
|
||||
failf(data, "Couldn't resolve proxy '%s'", conn->proxyhost);
|
||||
return CURLE_COULDNT_RESOLVE_PROXY;
|
||||
result = CURLE_COULDNT_RESOLVE_PROXY;
|
||||
/* don't return yet, we need to clean up the timeout first */
|
||||
}
|
||||
}
|
||||
Curl_pgrsTime(data, TIMER_NAMELOOKUP);
|
||||
if(data->set.timeout || data->set.connecttimeout)
|
||||
/* switch off signal-based timeouts */
|
||||
myalarm(0);
|
||||
#ifdef HAVE_ALARM
|
||||
if(data->set.timeout || data->set.connecttimeout) {
|
||||
#ifdef HAVE_SIGACTION
|
||||
if(keep_copysig) {
|
||||
/* we got a struct as it looked before, now put that one back nice
|
||||
and clean */
|
||||
sigaction(SIGALRM, &keep_sigact, NULL); /* put it back */
|
||||
}
|
||||
#else
|
||||
#ifdef HAVE_SIGNAL
|
||||
/* restore the previous SIGALRM handler */
|
||||
signal(SIGALRM, keep_sigact);
|
||||
#endif
|
||||
#endif
|
||||
/* switch back the alarm() to either zero or to what it was before minus
|
||||
the time we spent until now! */
|
||||
if(prev_alarm) {
|
||||
/* there was an alarm() set before us, now put it back */
|
||||
long elapsed_ms = Curl_tvdiff(Curl_tvnow(), conn->created);
|
||||
long alarm_set;
|
||||
|
||||
/* the alarm period is counted in even number of seconds */
|
||||
alarm_set = prev_alarm - elapsed_ms/1000;
|
||||
|
||||
if(alarm_set<=0) {
|
||||
/* if it turned negative, we should fire off a SIGALRM here, but we
|
||||
won't, and zero would be to switch it off so we never set it to
|
||||
less than 1! */
|
||||
alarm(1);
|
||||
result = CURLE_OPERATION_TIMEOUTED;
|
||||
failf(data, "Previous alarm fired off!");
|
||||
}
|
||||
else
|
||||
alarm(alarm_set);
|
||||
}
|
||||
else
|
||||
alarm(0); /* just shut it off */
|
||||
}
|
||||
#endif
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
/*************************************************************
|
||||
* Proxy authentication
|
||||
|
@@ -175,6 +175,9 @@ struct FTP {
|
||||
char *file; /* decoded file */
|
||||
|
||||
char *entrypath; /* the PWD reply when we logged on */
|
||||
|
||||
char *cache; /* data cache between getresponse()-calls */
|
||||
size_t cache_size; /* size of cache in bytes */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@@ -223,6 +226,7 @@ struct connectdata {
|
||||
#define PROT_LDAP (1<<7)
|
||||
#define PROT_FILE (1<<8)
|
||||
#define PROT_FTPS (1<<9)
|
||||
#define PROT_SSL (1<<10) /* protocol requires SSL */
|
||||
|
||||
Curl_addrinfo *hostaddr; /* IP-protocol independent host info pointer list */
|
||||
char *hostent_buf; /* pointer to allocated memory for name info */
|
||||
@@ -246,7 +250,7 @@ struct connectdata {
|
||||
|
||||
char *range; /* range, if used. See README for detailed specification on
|
||||
this syntax. */
|
||||
int resume_from; /* continue [ftp] transfer from here */
|
||||
ssize_t resume_from; /* continue [ftp] transfer from here */
|
||||
|
||||
char *proxyhost; /* name of the http proxy host */
|
||||
|
||||
@@ -374,7 +378,7 @@ struct Progress {
|
||||
int width; /* screen width at download start */
|
||||
int flags; /* see progress.h */
|
||||
|
||||
long timespent;
|
||||
double timespent;
|
||||
|
||||
double dlspeed;
|
||||
double ulspeed;
|
||||
@@ -382,6 +386,7 @@ struct Progress {
|
||||
double t_nslookup;
|
||||
double t_connect;
|
||||
double t_pretransfer;
|
||||
double t_starttransfer;
|
||||
|
||||
struct timeval start;
|
||||
struct timeval t_startsingle;
|
||||
@@ -566,6 +571,7 @@ struct UserDefined {
|
||||
bool reuse_forbid; /* forbidden to be reused, close after use */
|
||||
bool reuse_fresh; /* do not re-use an existing connection */
|
||||
bool expect100header; /* TRUE if we added Expect: 100-continue */
|
||||
bool ftp_use_epsv; /* if EPSV is to be attempted or not */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -15,20 +15,21 @@ EXTRA_DIST = README
|
||||
CYGBUILD = 1
|
||||
|
||||
# Cygwin tarball build dir (fully-qualified name, gets deleted when done)
|
||||
cygwintmp = $(CURDIR)/cygwinbin-builddir
|
||||
cygwintmp = $(CURDIR)/tmp_binbuild
|
||||
|
||||
cygwinbin:
|
||||
rm -rf $(cygwintmp)
|
||||
$(MAKE) -C $(top_builddir) install prefix=$(cygwintmp)/usr
|
||||
$(MAKE) -C $(top_builddir) install-strip prefix=$(cygwintmp)/usr
|
||||
$(STRIP) $(cygwintmp)/usr/bin/cygcurl-?.dll
|
||||
$(mkinstalldirs) $(cygwintmp)/usr/doc/Cygwin \
|
||||
$(cygwintmp)/usr/doc/$(PACKAGE)-$(VERSION)
|
||||
cd $(top_srcdir); \
|
||||
cp packages/Win32/cygwin/README \
|
||||
cp $(srcdir)/README \
|
||||
$(cygwintmp)/usr/doc/Cygwin/$(PACKAGE)-$(VERSION)-$(CYGBUILD).README
|
||||
cd $(top_srcdir) ; \
|
||||
cp CHANGES LEGAL MPL-1.1.txt README docs/FAQ docs/FEATURES docs/TODO \
|
||||
cd $(top_srcdir) ; cp CHANGES LEGAL MPL-1.1.txt MITX.txt README \
|
||||
docs/FAQ docs/FEATURES docs/TODO \
|
||||
$(cygwintmp)/usr/doc/$(PACKAGE)-$(VERSION)
|
||||
cd $(cygwintmp) ; \
|
||||
tar cjf $(PACKAGE)-$(VERSION)-$(CYGBUILD).tar.bz2 usr
|
||||
mv $(cygwintmp)/$(PACKAGE)-$(VERSION)-$(CYGBUILD).tar.bz2 . \
|
||||
&& rm -rf $(cygwintmp)
|
||||
|
||||
|
@@ -1,35 +1,34 @@
|
||||
Curl is a tool for transferring files with URL syntax, supporting FTP, FTPS,
|
||||
HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP. Curl supports HTTPS
|
||||
certificates, HTTP POST, HTTP PUT, FTP uploading, kerberos, HTTP form based
|
||||
upload, proxies, cookies, user+password authentication, file transfer resume,
|
||||
http proxy tunneling and a busload of other useful tricks.
|
||||
See /usr/doc/curl-<version>/FEATURES for more info.
|
||||
Curl is a tool for transferring files with URL syntax, supporting
|
||||
FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP.
|
||||
Curl supports HTTPS certificates, HTTP POST, HTTP PUT,
|
||||
FTP uploading, kerberos, HTTP form based upload, proxies,
|
||||
cookies, user+password authentication, file transfer resume,
|
||||
http proxy tunneling and a busload of other useful tricks.
|
||||
|
||||
cURL (as of 7.9.1) builds 100% cleanly OOTB.
|
||||
|
||||
The Cygwin specific source files (README and a Makefile for
|
||||
building binary tarballs) are not in a CYGWIN-PATCHES directory.
|
||||
They are at: <srctop>/packages/Win32/cygwin/
|
||||
See /usr/doc/curl-<version>/FEATURES for more info.
|
||||
|
||||
|
||||
Direct Dependencies:
|
||||
OpenSSL 0.9.6b
|
||||
Dependencies:
|
||||
- Cygwin
|
||||
- OpenSSL 0.9.6b-2+ (*)
|
||||
(*) cURL can be built without SSL support: ./configure --without-ssl
|
||||
|
||||
|
||||
Canonical Homepage:
|
||||
Canonical Homepage and Downloads:
|
||||
http://curl.haxx.se/
|
||||
|
||||
|
||||
Canonical Download:
|
||||
http://curl.haxx.se/download.html
|
||||
|
||||
|
||||
Build Instructions:
|
||||
Download the source, move it to a location of your choosing, and then:
|
||||
Cygwin specific source files (a .README template and a Makefile
|
||||
for building binary tarballs) are maintained in the upstream
|
||||
CVS at: <srctop>/packages/Win32/cygwin/
|
||||
|
||||
|
||||
Build Instructions (as distributed via cygwin's setup.exe):
|
||||
(NOTE: as of curl 7.9.1, compiles/tests 100% cleanly OOTB under cygwin)
|
||||
|
||||
Download the source, unpack it to a location of your choosing, and then:
|
||||
|
||||
$ tar xjf curl-<ver>-X-src.tar.bz2
|
||||
$ cd curl-<ver>-X
|
||||
$ ./configure --prefix=/usr
|
||||
$ make
|
||||
$ make test # optional, requires perl
|
||||
@@ -42,19 +41,45 @@ Build Instructions:
|
||||
|
||||
|
||||
Packaging Instructions:
|
||||
To create a new binary tarball for cygwin's setup.exe, the first step is to
|
||||
do a clean build (./configure and make). The 'make install' step is optional.
|
||||
Then do:
|
||||
---BINARY---
|
||||
Compile cleanly (./configure + make). Then:
|
||||
|
||||
$ cd curl-<ver>-X
|
||||
$ make cygwinbin CYGBUILD=X
|
||||
$ make cygwinbin CYGBUILD=n
|
||||
|
||||
where "X" is the cygwin release number (e.g. the "-1" in curl-7.9.3-1).
|
||||
If you leave off "CYGBUILD=X", X defaults to 1.
|
||||
where n is the cygwin release number (e.g. the "1" in curl-7.9-1).
|
||||
If you leave off "CYGBUILD=n", n defaults to 1.
|
||||
|
||||
Assuming everything worked properly, you'll find your cygwin
|
||||
binary tarball in the curl-<ver>-X/packages/Win32/cygwin/ directory.
|
||||
Assuming everything worked properly, you'll find your binary tarball
|
||||
in the packages/Win32/cygwin/ sub-directory.
|
||||
|
||||
---SOURCE---
|
||||
1. unpack the pristine source into an otherwise empty directory
|
||||
2. rename the source dir to add the "-$(REL)" suffix, e.g.:
|
||||
$ mv curl-7.9 curl-7.9-1
|
||||
3. add a CYGWIN-PATCHES directory, and add this readme to it
|
||||
$ cd curl-7.9-$(REL); mkdir CYGWIN-PATCHES
|
||||
$ cp packages/Win32/cygwin/README CYGWIN-PATCHES/curl-7.9-$(REL).README
|
||||
4. if applicable, document any changes in the README file
|
||||
5. create a patch which, when applied (patch -p1 < curl-7.9-$(REL).patch)
|
||||
will remove any patches you've applied:
|
||||
$ cd ..
|
||||
$ diff -Nrup (patched-src-dir) (pristine-src-dir) > curl-7.9-$(REL).patch
|
||||
and then move it into the CYGWIN-PATCHES directory
|
||||
6. repack
|
||||
|
||||
---SETUP.HINT---
|
||||
sdesc: "a client that groks URLs"
|
||||
ldesc: "Curl is a tool for transferring files with URL syntax,
|
||||
supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE
|
||||
and LDAP. Curl supports HTTPS certificates, HTTP POST, HTTP PUT,
|
||||
FTP uploading, kerberos, HTTP form based upload, proxies,
|
||||
cookies, user+password authentication, file transfer resume,
|
||||
http proxy tunneling and a busload of other useful tricks."
|
||||
category: Web Libs
|
||||
requires: cygwin openssl
|
||||
|
||||
|
||||
Cygwin port maintained by:
|
||||
Cygwin port maintained by:
|
||||
Kevin Roth <kproth at bigfoot dot com>
|
||||
Questions about cURL should be directed to curl@contactor.se.
|
||||
Questions about its cygwin package should be directed to cygwin@cygwin.com.
|
||||
|
@@ -12,6 +12,7 @@ bin_PROGRAMS = curl #memtest
|
||||
|
||||
noinst_HEADERS = setup.h \
|
||||
config-win32.h \
|
||||
config-mac.h \
|
||||
urlglob.h \
|
||||
version.h \
|
||||
writeout.h
|
||||
@@ -26,8 +27,12 @@ BUILT_SOURCES = hugehelp.c
|
||||
CLEANFILES = hugehelp.c
|
||||
NROFF=@NROFF@
|
||||
|
||||
EXTRA_DIST = mkhelp.pl config-win32.h curlmsg.msg\
|
||||
Makefile.vc6 Makefile.b32 Makefile.m32 config.h.in
|
||||
EXTRA_DIST = mkhelp.pl curlmsg.msg \
|
||||
Makefile.vc6 Makefile.b32 Makefile.m32 config.h.in \
|
||||
macos/curl.mcp.xml.sit.hqx \
|
||||
macos/MACINSTALL.TXT \
|
||||
macos/src/curl_GUSIConfig.cpp \
|
||||
macos/src/macos_main.cpp
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
|
||||
|
12
src/config-mac.h
Normal file
12
src/config-mac.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_FCNTL_H 1
|
||||
#define HAVE_UTIME_H 1
|
||||
#define HAVE_SYS_UTIME_H 1
|
||||
|
||||
#define HAVE_SETVBUF 1
|
||||
#define HAVE_UTIME 1
|
||||
|
||||
#define main(x,y) curl_main(x,y)
|
||||
|
||||
/* we provide our own strdup prototype */
|
||||
char *strdup(char *s1);
|
1
src/macos/MACINSTALL.TXT
Normal file
1
src/macos/MACINSTALL.TXT
Normal file
@@ -0,0 +1 @@
|
||||
MACOS (not MACOS X)
|
1
src/macos/curl.mcp.xml.sit.hqx
Normal file
1
src/macos/curl.mcp.xml.sit.hqx
Normal file
File diff suppressed because one or more lines are too long
1
src/macos/src/curl_GUSIConfig.cpp
Normal file
1
src/macos/src/curl_GUSIConfig.cpp
Normal file
@@ -0,0 +1 @@
|
||||
/**************** BEGIN GUSI CONFIGURATION ****************************
|
1
src/macos/src/macos_main.cpp
Normal file
1
src/macos/src/macos_main.cpp
Normal file
@@ -0,0 +1 @@
|
||||
/* =========================================================================
|
29
src/main.c
29
src/main.c
@@ -313,6 +313,7 @@ static void help(void)
|
||||
" -d/--data <data> HTTP POST data (H)\n"
|
||||
" --data-ascii <data> HTTP POST ASCII data (H)\n"
|
||||
" --data-binary <data> HTTP POST binary data (H)\n"
|
||||
" --disable-epsv Prevents curl from using EPSV (F)\n"
|
||||
" -D/--dump-header <file> Write the headers to this file\n"
|
||||
" --egd-file <file> EGD socket path for random data (SSL)\n"
|
||||
" -e/--referer Referer page (H)");
|
||||
@@ -364,6 +365,7 @@ static void help(void)
|
||||
" -z/--time-cond <time> Includes a time condition to the server (H)\n"
|
||||
" -Z/--max-redirs <num> Set maximum number of redirections allowed (H)\n"
|
||||
" -0/--http1.0 Force usage of HTTP 1.0 (H)\n"
|
||||
" -1/--tlsv1 Force usage of TLSv1 (H)\n"
|
||||
" -2/--sslv2 Force usage of SSLv2 (H)\n"
|
||||
" -3/--sslv3 Force usage of SSLv3 (H)");
|
||||
puts(" -#/--progress-bar Display transfer progress as a progress bar\n"
|
||||
@@ -386,6 +388,7 @@ struct Configurable {
|
||||
char *cookiefile; /* read from this file */
|
||||
bool use_resume;
|
||||
bool resume_from_current;
|
||||
bool disable_epsv;
|
||||
int resume_from;
|
||||
char *postfields;
|
||||
long postfieldsize;
|
||||
@@ -861,8 +864,10 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
{"5b", "egd-file", TRUE},
|
||||
{"5c", "connect-timeout", TRUE},
|
||||
{"5d", "ciphers", TRUE},
|
||||
{"5e", "disable-epsv", FALSE},
|
||||
|
||||
{"0", "http1.0", FALSE},
|
||||
{"1", "tlsv1", FALSE},
|
||||
{"2", "sslv2", FALSE},
|
||||
{"3", "sslv3", FALSE},
|
||||
{"a", "append", FALSE},
|
||||
@@ -1026,6 +1031,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
case 'd': /* ciphers */
|
||||
GetStr(&config->cipher_list, nextarg);
|
||||
break;
|
||||
case 'e': /* --disable-epsv */
|
||||
config->disable_epsv ^= TRUE;
|
||||
break;
|
||||
default: /* the URL! */
|
||||
{
|
||||
struct getout *url;
|
||||
@@ -1060,13 +1068,17 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
/* HTTP version 1.0 */
|
||||
config->httpversion = CURL_HTTP_VERSION_1_0;
|
||||
break;
|
||||
case '1':
|
||||
/* TLS version 1 */
|
||||
config->ssl_version = CURL_SSLVERSION_TLSv1;
|
||||
break;
|
||||
case '2':
|
||||
/* SSL version 2 */
|
||||
config->ssl_version = 2;
|
||||
config->ssl_version = CURL_SSLVERSION_SSLv2;
|
||||
break;
|
||||
case '3':
|
||||
/* SSL version 2 */
|
||||
config->ssl_version = 3;
|
||||
/* SSL version 3 */
|
||||
config->ssl_version = CURL_SSLVERSION_SSLv3;
|
||||
break;
|
||||
case 'a':
|
||||
/* This makes the FTP sessions use APPE instead of STOR */
|
||||
@@ -1452,7 +1464,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
}
|
||||
hit = -1;
|
||||
|
||||
} while(!singleopt && *++parse && !*usedarg);
|
||||
} while(!longopt && !singleopt && *++parse && !*usedarg);
|
||||
|
||||
return PARAM_OK;
|
||||
}
|
||||
@@ -1833,6 +1845,8 @@ operate(struct Configurable *config, int argc, char *argv[])
|
||||
int res = 0;
|
||||
int i;
|
||||
|
||||
errorbuffer[0]=0; /* prevent junk from being output */
|
||||
|
||||
#ifdef MALLOCDEBUG
|
||||
/* this sends all memory debug messages to a logfile named memdump */
|
||||
curl_memdebug("memdump");
|
||||
@@ -2297,6 +2311,11 @@ operate(struct Configurable *config, int argc, char *argv[])
|
||||
|
||||
if(config->httpversion)
|
||||
curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, config->httpversion);
|
||||
|
||||
/* new in libcurl 7.9.2: */
|
||||
if(config->disable_epsv)
|
||||
/* disable it */
|
||||
curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, FALSE);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
@@ -2316,8 +2335,6 @@ operate(struct Configurable *config, int argc, char *argv[])
|
||||
if(config->headerfile && !headerfilep && heads.stream)
|
||||
fclose(heads.stream);
|
||||
|
||||
if(urlbuffer)
|
||||
free(urlbuffer);
|
||||
if (outfile && !strequal(outfile, "-") && outs.stream)
|
||||
fclose(outs.stream);
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
@@ -38,6 +38,10 @@
|
||||
/* include the hand-modified win32 adjusted config.h! */
|
||||
#include "config-win32.h"
|
||||
#endif
|
||||
#ifdef macintosh
|
||||
/* this is not the same as Mac OS X */
|
||||
#include "config-mac.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef OS
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
@@ -21,6 +21,9 @@
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
/* client-local setup.h */
|
||||
#include "setup.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#define CURL_NAME "curl"
|
||||
#define CURL_VERSION "7.9.1"
|
||||
#define CURL_VERSION "7.9.2"
|
||||
#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "
|
||||
|
@@ -37,6 +37,7 @@ typedef enum {
|
||||
VAR_NAMELOOKUP_TIME,
|
||||
VAR_CONNECT_TIME,
|
||||
VAR_PRETRANSFER_TIME,
|
||||
VAR_STARTTRANSFER_TIME,
|
||||
VAR_SIZE_DOWNLOAD,
|
||||
VAR_SIZE_UPLOAD,
|
||||
VAR_SPEED_DOWNLOAD,
|
||||
@@ -61,6 +62,7 @@ static struct variable replacements[]={
|
||||
{"time_namelookup", VAR_NAMELOOKUP_TIME},
|
||||
{"time_connect", VAR_CONNECT_TIME},
|
||||
{"time_pretransfer", VAR_PRETRANSFER_TIME},
|
||||
{"time_starttransfer", VAR_STARTTRANSFER_TIME},
|
||||
{"size_header", VAR_HEADER_SIZE},
|
||||
{"size_request", VAR_REQUEST_SIZE},
|
||||
{"size_download", VAR_SIZE_DOWNLOAD},
|
||||
@@ -138,6 +140,11 @@ void ourWriteOut(CURL *curl, char *writeinfo)
|
||||
curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &doubleinfo))
|
||||
fprintf(stream, "%.3f", doubleinfo);
|
||||
break;
|
||||
case VAR_STARTTRANSFER_TIME:
|
||||
if(CURLE_OK ==
|
||||
curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &doubleinfo))
|
||||
fprintf(stream, "%.3f", doubleinfo);
|
||||
break;
|
||||
case VAR_SIZE_UPLOAD:
|
||||
if(CURLE_OK ==
|
||||
curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &doubleinfo))
|
||||
|
@@ -5,14 +5,13 @@ test:
|
||||
[ -f test1 ] || ln -s $(srcdir)/test* .
|
||||
|
||||
EXTRA_DIST = \
|
||||
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 test47 \
|
||||
test105 test112 test12 test14 test200 test26 test43 test46 \
|
||||
test34 test36 test37 test27 test28 test29 test303 test126 test400 \
|
||||
test401 test30
|
||||
|
||||
test1 test108 test117 test127 test20 test27 test34 test46 \
|
||||
test10 test109 test118 test13 test200 test28 test36 test47 \
|
||||
test100 test11 test119 test14 test201 test29 test37 test5 \
|
||||
test101 test110 test12 test15 test202 test3 test4 test6 \
|
||||
test102 test111 test120 test16 test21 test30 test400 test7 \
|
||||
test103 test112 test121 test17 test22 test300 test401 test8 \
|
||||
test104 test113 test122 test18 test23 test301 test402 test9 \
|
||||
test105 test114 test123 test19 test24 test302 test43 \
|
||||
test106 test115 test124 test190 test25 test303 test44 \
|
||||
test107 test116 test125 test2 test26 test33 test45 test126
|
||||
|
@@ -37,7 +37,7 @@ filter off really nothing
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
PASV
|
||||
EPSV
|
||||
TYPE A
|
||||
LIST
|
||||
</protocol>
|
||||
|
@@ -19,6 +19,10 @@ FTP RETR PASV
|
||||
ftp://%HOSTIP:%FTPPORT/102
|
||||
</command>
|
||||
</test>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY EPSV 500 no such command
|
||||
</file>
|
||||
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
@@ -26,8 +30,10 @@ ftp://%HOSTIP:%FTPPORT/102
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
TYPE I
|
||||
SIZE 102
|
||||
RETR 102
|
||||
</protocol>
|
||||
</verify>
|
||||
|
@@ -34,6 +34,7 @@ PWD
|
||||
CWD a/path
|
||||
PORT 127,0,0,1,246,33
|
||||
TYPE I
|
||||
SIZE 103
|
||||
RETR 103
|
||||
</protocol>
|
||||
</verify>
|
||||
|
@@ -18,6 +18,10 @@ FTP user+password in URL and ASCII transfer
|
||||
<command>
|
||||
ftp://userdude:passfellow@%HOSTIP:%FTPPORT/103 --use-ascii
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY EPSV 500 no such command
|
||||
REPLY SIZE 500 no such command
|
||||
</file>
|
||||
</test>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
@@ -26,8 +30,10 @@ ftp://userdude:passfellow@%HOSTIP:%FTPPORT/103 --use-ascii
|
||||
USER userdude
|
||||
PASS passfellow
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
TYPE A
|
||||
SIZE 103
|
||||
RETR 103
|
||||
</protocol>
|
||||
</verify>
|
||||
|
@@ -27,8 +27,9 @@ USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
CWD /path with spaces/and things2
|
||||
PASV
|
||||
EPSV
|
||||
TYPE A
|
||||
SIZE 106
|
||||
RETR 106
|
||||
</protocol>
|
||||
</verify>
|
||||
|
@@ -31,7 +31,7 @@ works
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
PASV
|
||||
EPSV
|
||||
TYPE I
|
||||
STOR 107
|
||||
</protocol>
|
||||
|
@@ -26,7 +26,7 @@ Moooooooooooo
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
PASV
|
||||
EPSV
|
||||
TYPE I
|
||||
APPE 109
|
||||
</protocol>
|
||||
|
@@ -17,6 +17,9 @@ FTP download resume with set limit
|
||||
<command>
|
||||
ftp://%HOSTIP:%FTPPORT/110 -C 20
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY EPSV 500 no such command
|
||||
</file>
|
||||
</test>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
@@ -27,6 +30,7 @@ ftp://%HOSTIP:%FTPPORT/110 -C 20
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
TYPE I
|
||||
SIZE 110
|
||||
|
@@ -26,7 +26,7 @@ ftp://%HOSTIP:%FTPPORT/111 -C 2000
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
PASV
|
||||
EPSV
|
||||
TYPE I
|
||||
SIZE 111
|
||||
</protocol>
|
||||
|
@@ -25,7 +25,7 @@ worx?
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
PASV
|
||||
EPSV
|
||||
TYPE I
|
||||
APPE 112
|
||||
</protocol>
|
||||
|
@@ -12,6 +12,7 @@ ftp://%HOSTIP:%FTPPORT/115
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY PASV 314 bluah you f00l!
|
||||
REPLY EPSV 314 bluah you f00l!
|
||||
</file>
|
||||
</test>
|
||||
|
||||
@@ -24,6 +25,7 @@ REPLY PASV 314 bluah you f00l!
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
</protocol>
|
||||
</verify>
|
||||
|
@@ -11,6 +11,7 @@ FTP download, failed TYPE
|
||||
ftp://%HOSTIP:%FTPPORT/117
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY EPSV 314 bluah you f00l!
|
||||
REPLY TYPE 314 bluah you f00l!
|
||||
</file>
|
||||
</test>
|
||||
@@ -24,6 +25,7 @@ REPLY TYPE 314 bluah you f00l!
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
TYPE I
|
||||
</protocol>
|
||||
|
@@ -12,6 +12,7 @@ ftp://%HOSTIP:%FTPPORT/118
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY RETR 314 bluah you f00l!
|
||||
REPLY EPSV 314 bluah you f00l!
|
||||
</file>
|
||||
</test>
|
||||
|
||||
@@ -24,8 +25,10 @@ REPLY RETR 314 bluah you f00l!
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
TYPE I
|
||||
SIZE 118
|
||||
RETR 118
|
||||
</protocol>
|
||||
</verify>
|
||||
|
@@ -30,6 +30,7 @@ USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
TYPE I
|
||||
SIZE 119
|
||||
RETR 119
|
||||
</protocol>
|
||||
</verify>
|
||||
|
@@ -18,6 +18,9 @@ ftp download with post-quote delete operation
|
||||
<command>
|
||||
ftp://%HOSTIP:%FTPPORT/120 -Q "-DELE file"
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY EPSV 314 bluah you f00l!
|
||||
</file>
|
||||
</test>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
@@ -26,8 +29,10 @@ ftp://%HOSTIP:%FTPPORT/120 -Q "-DELE file"
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
TYPE I
|
||||
SIZE 120
|
||||
RETR 120
|
||||
DELE file
|
||||
</protocol>
|
||||
|
@@ -27,8 +27,9 @@ USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
DELE before_transfer
|
||||
PASV
|
||||
EPSV
|
||||
TYPE I
|
||||
SIZE 121
|
||||
RETR 121
|
||||
DELE after_transfer
|
||||
</protocol>
|
||||
|
@@ -13,6 +13,9 @@ FTP download resume with whole file already downloaded
|
||||
<command>
|
||||
ftp://%HOSTIP:%FTPPORT/122 -C 5
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY EPSV 500 no such command
|
||||
</file>
|
||||
</test>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
@@ -21,6 +24,7 @@ ftp://%HOSTIP:%FTPPORT/122 -C 5
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
TYPE I
|
||||
SIZE 122
|
||||
|
@@ -21,7 +21,7 @@ ftp://%HOSTIP:%FTPPORT/123 -T log/upload123 -C 51
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
PASV
|
||||
EPSV
|
||||
TYPE I
|
||||
</protocol>
|
||||
</verify>
|
||||
|
@@ -15,6 +15,7 @@ ftp://%HOSTIP:%FTPPORT/124
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY PWD 314 bluah you f00l!
|
||||
REPLY EPSV 314 bluah you f00l!
|
||||
</file>
|
||||
</test>
|
||||
|
||||
@@ -24,8 +25,10 @@ REPLY PWD 314 bluah you f00l!
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
TYPE I
|
||||
SIZE 124
|
||||
RETR 124
|
||||
</protocol>
|
||||
</verify>
|
||||
|
@@ -1,30 +1,33 @@
|
||||
# Server-side
|
||||
<reply>
|
||||
moooooooo
|
||||
<data>
|
||||
this is file contents
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<name>
|
||||
FTP download with strict timeout and slow CWD
|
||||
FTP download with multiple replies at once in RETR
|
||||
</name>
|
||||
<command>
|
||||
ftp://%HOSTIP:%FTPPORT/path/to/file/126 -m 3
|
||||
ftp://%HOSTIP:%FTPPORT/blalbla/lululul/126
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
DELAY CWD 15
|
||||
RETRWEIRDO
|
||||
</file>
|
||||
</test>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<errorcode>
|
||||
28
|
||||
</errorcode>
|
||||
<protocol>
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
CWD path/to/file
|
||||
CWD blalbla/lululul
|
||||
EPSV
|
||||
TYPE I
|
||||
SIZE 126
|
||||
RETR 126
|
||||
</protocol>
|
||||
</verify>
|
||||
|
30
tests/data/test127
Normal file
30
tests/data/test127
Normal file
@@ -0,0 +1,30 @@
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
moooooooo
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<name>
|
||||
FTP --disable-epsv
|
||||
</name>
|
||||
<command>
|
||||
ftp://%HOSTIP:%FTPPORT/path/to/file/127 --disable-epsv
|
||||
</command>
|
||||
</test>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
CWD path/to/file
|
||||
PASV
|
||||
TYPE I
|
||||
SIZE 127
|
||||
RETR 127
|
||||
</protocol>
|
||||
</verify>
|
30
tests/data/test190
Normal file
30
tests/data/test190
Normal file
@@ -0,0 +1,30 @@
|
||||
# Server-side
|
||||
<reply>
|
||||
moooooooo
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<name>
|
||||
FTP download with strict timeout and slow CWD
|
||||
</name>
|
||||
<command>
|
||||
ftp://%HOSTIP:%FTPPORT/path/to/file/126 -m 3
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
DELAY CWD 15
|
||||
</file>
|
||||
</test>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<errorcode>
|
||||
28
|
||||
</errorcode>
|
||||
<protocol>
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
CWD path/to/file
|
||||
</protocol>
|
||||
</verify>
|
@@ -25,6 +25,9 @@ FTPS dir list PASV
|
||||
<command>
|
||||
ftps://%HOSTIP:%FTPSPORT/
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
REPLY EPSV 500 no such command
|
||||
</file>
|
||||
</test>
|
||||
|
||||
#
|
||||
@@ -37,6 +40,7 @@ filter off really nothing
|
||||
USER anonymous
|
||||
PASS curl_by_daniel@haxx.se
|
||||
PWD
|
||||
EPSV
|
||||
PASV
|
||||
TYPE A
|
||||
LIST
|
||||
|
@@ -26,6 +26,7 @@ sub logmsg { print FTPLOG "$$: "; print FTPLOG @_; }
|
||||
sub ftpmsg { print INPUT @_; }
|
||||
|
||||
my $verbose=0; # set to 1 for debugging
|
||||
my $retrweirdo=0;
|
||||
|
||||
my $port = 8921; # just a default
|
||||
do {
|
||||
@@ -65,6 +66,7 @@ my %commandok = (
|
||||
'USER' => 'fresh',
|
||||
'PASS' => 'passwd',
|
||||
'PASV' => 'loggedin|twosock',
|
||||
'EPSV' => 'loggedin|twosock',
|
||||
'PORT' => 'loggedin|twosock',
|
||||
'TYPE' => 'loggedin|twosock',
|
||||
'LIST' => 'twosock',
|
||||
@@ -86,6 +88,7 @@ my %statechange = ( 'USER' => 'passwd', # USER goes to passwd state
|
||||
'PASS' => 'loggedin', # PASS goes to loggedin state
|
||||
'PORT' => 'twosock', # PORT goes to twosock
|
||||
'PASV' => 'twosock', # PASV goes to twosock
|
||||
'EPSV' => 'twosock', # EPSV goes to twosock
|
||||
);
|
||||
|
||||
# this text is shown before the function specified below is run
|
||||
@@ -108,6 +111,7 @@ my %commandfunc = ( 'PORT' => \&PORT_command,
|
||||
'LIST' => \&LIST_command,
|
||||
'NLST' => \&NLST_command,
|
||||
'PASV' => \&PASV_command,
|
||||
'EPSV' => \&PASV_command,
|
||||
'RETR' => \&RETR_command,
|
||||
'SIZE' => \&SIZE_command,
|
||||
'REST' => \&REST_command,
|
||||
@@ -174,8 +178,19 @@ sub SIZE_command {
|
||||
logmsg "SIZE $testno returned $size\n";
|
||||
}
|
||||
else {
|
||||
print "550 $testno: No such file or directory.\r\n";
|
||||
logmsg "SIZE $testno: no such file\n";
|
||||
$size=0;
|
||||
@data = getpart("reply", "data");
|
||||
for(@data) {
|
||||
$size += length($_);
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -212,16 +227,30 @@ sub RETR_command {
|
||||
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";
|
||||
logmsg "150 Binary data connection for $testno ($size bytes).\n";
|
||||
if($retrweirdo) {
|
||||
print "150 Binary data connection for $testno () ($size bytes).\r\n",
|
||||
"226 File transfer complete\r\n";
|
||||
logmsg "150+226 in one shot!\n";
|
||||
|
||||
for(@data) {
|
||||
my $send = $_;
|
||||
print SOCK $send;
|
||||
for(@data) {
|
||||
my $send = $_;
|
||||
print SOCK $send;
|
||||
}
|
||||
close(SOCK);
|
||||
$retrweirdo=0; # switch off the weirdo again!
|
||||
}
|
||||
close(SOCK);
|
||||
else {
|
||||
print "150 Binary data connection for $testno () ($size bytes).\r\n";
|
||||
logmsg "150 Binary data connection for $testno ($size bytes).\n";
|
||||
|
||||
print "226 File transfer complete\r\n";
|
||||
for(@data) {
|
||||
my $send = $_;
|
||||
print SOCK $send;
|
||||
}
|
||||
close(SOCK);
|
||||
|
||||
print "226 File transfer complete\r\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "550 $testno: No such file or directory.\r\n";
|
||||
@@ -259,6 +288,8 @@ sub STOR_command {
|
||||
|
||||
my $pasvport=9000;
|
||||
sub PASV_command {
|
||||
my ($arg, $cmd)=@_;
|
||||
|
||||
socket(Server2, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
|
||||
setsockopt(Server2, SOL_SOCKET, SO_REUSEADDR,
|
||||
pack("l", 1)) || die "setsockopt: $!";
|
||||
@@ -283,8 +314,17 @@ sub PASV_command {
|
||||
}
|
||||
listen(Server2,SOMAXCONN) || die "listen: $!";
|
||||
|
||||
printf("227 Entering Passive Mode (127,0,0,1,%d,%d)\n",
|
||||
($pasvport/256), ($pasvport%256));
|
||||
if($cmd ne "EPSV") {
|
||||
# PASV reply
|
||||
logmsg "replying to a $cmd command\n";
|
||||
printf("227 Entering Passive Mode (127,0,0,1,%d,%d)\n",
|
||||
($pasvport/256), ($pasvport%256));
|
||||
}
|
||||
else {
|
||||
# EPSV reply
|
||||
logmsg "replying to a $cmd command\n";
|
||||
printf("229 Entering Passive Mode (|||%d|)\n", $pasvport);
|
||||
}
|
||||
|
||||
my $paddr = accept(SOCK, Server2);
|
||||
my($iport,$iaddr) = sockaddr_in($paddr);
|
||||
@@ -297,6 +337,7 @@ sub PASV_command {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sub PORT_command {
|
||||
my $arg = $_[0];
|
||||
|
||||
@@ -341,6 +382,10 @@ sub customize {
|
||||
elsif($_ =~ /DELAY ([A-Z]+) (\d*)/) {
|
||||
$delayreply{$1}=$2;
|
||||
}
|
||||
elsif($_ =~ /RETRWEIRDO/) {
|
||||
print "instructed to use RETRWEIRDO\n";
|
||||
$retrweirdo=1;
|
||||
}
|
||||
}
|
||||
close(CUSTOM);
|
||||
}
|
||||
@@ -432,6 +477,9 @@ for ( $waitedpid = 0;
|
||||
if($text eq "") {
|
||||
$text = $displaytext{$FTPCMD};
|
||||
}
|
||||
else {
|
||||
logmsg "$FTPCMD made to send '$text'\n";
|
||||
}
|
||||
if($text) {
|
||||
print "$text\r\n";
|
||||
}
|
||||
@@ -442,7 +490,7 @@ for ( $waitedpid = 0;
|
||||
my $func = $commandfunc{$FTPCMD};
|
||||
if($func) {
|
||||
# it is!
|
||||
\&$func($FTPARG);
|
||||
\&$func($FTPARG, $FTPCMD);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -516,6 +516,9 @@ sub singletest {
|
||||
$res /= 256;
|
||||
}
|
||||
|
||||
# remove the special FTP command file after each test!
|
||||
unlink($FTPDCMD);
|
||||
|
||||
my @err = getpart("verify", "errorcode");
|
||||
my $errorcode = $err[0];
|
||||
|
||||
|
Reference in New Issue
Block a user