Compare commits

..

153 Commits

Author SHA1 Message Date
Gisle Vanem
120f17ce04 Replace LF with CRLF. Ref RFC-2229, sec 2.3:
"Each command line must be terminated by a CRLF".
2005-02-09 11:50:41 +00:00
Daniel Stenberg
ab938bb9bd -O clarification 2005-02-08 23:39:47 +00:00
Daniel Stenberg
33820cd2ac inflate and out of memory fixes 2005-02-08 19:07:28 +00:00
Daniel Stenberg
41def21f91 ares_gethostbyname wants a 'ares_host_callback' in the 4th argument 2005-02-08 19:03:27 +00:00
Gisle Vanem
d118312922 Curl_addrinfo?_callback() and addrinfo_callback() now returns
CURLE_OK or CURLE_OUT_OF_MEMORY.
Add typecast in hostares.c.
2005-02-08 12:36:13 +00:00
Gisle Vanem
82b93e4945 Don't free too much in freedirs() if realloc() fails. 2005-02-08 12:32:28 +00:00
Daniel Stenberg
e36fb1ecda Curl_wait_for_resolv() no longer disconnects on failure, but leaves that
operation to the caller. Disconnecting has the disadvantage that the conn
pointer gets completely invalidated and this is not handled on lots of places
in the code.
2005-02-08 07:36:57 +00:00
Dan Fandrich
e4a1788614 Fix for a bug report that compressed files that are exactly 64 KiB long
produce a zlib error.
2005-02-07 19:12:37 +00:00
Gisle Vanem
7b23eff9cf Preserve previous status in Curl_http_done(). 2005-02-06 12:43:40 +00:00
Daniel Stenberg
67ff8e3ea3 valgrind errors occur too often when 'make test' is used. It is because too
many third-party libs and tools have problems. When curl is built without
--disable-shared, the testing is done with a front-end script which makes the
valgrind testing include (ba)sh as well and that often causes valgrind
errors. Either we improve the valgrind error scanner a lot to better identify
(lib)curl errors only, or we disable valgrind checking by default
2005-02-05 10:25:20 +00:00
Daniel Stenberg
2248599ae1 fix type 2005-02-04 23:53:12 +00:00
Daniel Stenberg
29350b363b Eric Vergnaud found a use of an uninitialized variable 2005-02-04 23:43:44 +00:00
Daniel Stenberg
83c470a443 David Byron pointed out that this -1 on the buffer size is pointless since
the buffer is already BUFSIZE +1 one big to fit the extra trailing zero. This
change is reported to fix David's weird SSL problem...
2005-02-04 13:42:41 +00:00
Daniel Stenberg
ab96e2d6e9 another example 2005-02-02 19:25:49 +00:00
Daniel Stenberg
6b81cf4bc9 HTML parsing example with libtidy, by Jeff Pohlmeyer 2005-02-02 19:25:37 +00:00
Daniel Stenberg
0d9301539e and we start over again 2005-02-01 08:46:06 +00:00
Daniel Stenberg
4a9e12542d 7.13 coming up 2005-02-01 07:54:36 +00:00
Daniel Stenberg
21b4105454 somewhat nicer libcurl usage 2005-01-31 20:03:01 +00:00
Daniel Stenberg
d7648d94ca htmltitle 2005-01-31 18:23:42 +00:00
Daniel Stenberg
883343ba63 HTML <head> parsing (with libxml) example code by Lars Nilsson. 2005-01-31 18:22:40 +00:00
Daniel Stenberg
16b5dc710f four changes 2005-01-30 22:57:19 +00:00
Daniel Stenberg
686d767053 if the DO operation returns failure, bail out and close down nicely to
prevent memory leakage
2005-01-30 22:54:06 +00:00
Daniel Stenberg
ed3176dd6b Let's add a cookie interface in 7.14 2005-01-30 13:26:12 +00:00
Daniel Stenberg
6a99ab098c Bugfixed the parser that scans the valgrind report outputs. I noticed that it
previously didn't detect and report the "Conditional jump or move depends on
uninitialised value(s)" error.

When I fixed this, I caught a few curl bugs with it. And then I had to spend
time to make the test suite IGNORE these errors when OpenSSL is used since it
produce massive amounts of valgrind warnings (but only of the "Conditional..."
kind it seems).

So, if a test that requires SSL is run, it ignores the "Conditional..."
errors, and you'll get a "valgrind PARTIAL" output instead of "valgrind OK".
2005-01-30 12:56:36 +00:00
Daniel Stenberg
b03adde546 properly mark tests as requiring feature 'SSL' 2005-01-30 12:53:05 +00:00
Daniel Stenberg
e6034ea299 Use calloc() to save us the memset() call and terminate conn->host.name
properly, to avoid reading uninited variables when using file:// (valgrind)
2005-01-30 12:42:15 +00:00
Daniel Stenberg
c7f51ebeab Clear the urlglob struct when allocated, since we might otherwise use
uninitialized variables. Pointed out to us by the friendly Valgrind.
2005-01-29 23:46:27 +00:00
Daniel Stenberg
9a820d7a98 include "url.h" for the Curl_safefree() proto 2005-01-29 22:38:45 +00:00
Daniel Stenberg
8dbaf534c8 Using the multi interface, and doing a requsted a re-used connection that
gets closed just after the request has been sent failed and did not re-issue
a request on a fresh reconnect like the easy interface did. Now it does!
(define CURL_MULTIEASY, run test case 160)
2005-01-29 22:31:06 +00:00
Daniel Stenberg
91f483c591 Define CURL_MULTIEASY when building this, to use my new curl_easy_perform()
that uses the multi interface to run the request. It is a great testbed for
the multi interface and I believe we shall do it this way for real in the
future when we have a successor to curl_multi_fdset().
2005-01-29 22:26:38 +00:00
Daniel Stenberg
c5b448038f corrected the URL 2005-01-29 13:54:15 +00:00
Daniel Stenberg
c4ff5eb0ca conn->ip_addr MUST NOT be used on re-used connections 2005-01-29 13:07:16 +00:00
Daniel Stenberg
0859cd2444 when using valgrind, include a much longer stack trace 2005-01-29 13:06:31 +00:00
Daniel Stenberg
59b45a90cc multi interface: when a request is denied due to "Maximum redirects followed"
libcurl leaked the last Location: URL.
2005-01-29 12:01:20 +00:00
Daniel Stenberg
f661475962 Connect failures with the multi interface was often returned as "connect()
timed out" even though the reason was different. Fixed this problem by not
setting this timeout to zero when using multi.
2005-01-28 23:21:24 +00:00
Daniel Stenberg
54b02ecf09 adjusted to the moved unlock of the DNS entry 2005-01-28 22:22:59 +00:00
Daniel Stenberg
4551e7ce49 KNOWN_BUGS #17 fixed. A DNS cache entry may not remain locked between two
curl_easy_perform() invokes. It was previously unlocked at disconnect, which
could mean that it remained locked between multiple transfers. The DNS cache
may not live as long as the connection cache does, as they are separate.

To deal with the lack of DNS (host address) data availability in re-used
connections, libcurl now keeps a copy of the IP adress as a string, to be able
to show it even on subsequent requests on the same connection.
2005-01-28 22:14:48 +00:00
Daniel Stenberg
064bc3ecbc Stephen More pointed out that CURLOPT_FTPPORT and the -P option didn't work
when built ipv6-enabled. I've now made a fix for it. Writing test cases for
custom port strings turned too tricky so unfortunately there's none.
2005-01-28 08:26:36 +00:00
Daniel Stenberg
cf38a4c470 test the EPRT/LPRT/PORT somewhat more 2005-01-27 23:03:02 +00:00
Daniel Stenberg
aacc79a3a3 Use the same work-around for the memdebug stuff as in the command line client,
to allow the contents of the env var decide the file name.
2005-01-27 22:40:56 +00:00
Daniel Stenberg
9864bf703d a slightly involved work-around to prevent the debug-tracing from logging
a free-without-alloc as the first call
2005-01-27 15:59:01 +00:00
Daniel Stenberg
289a42f050 Make the debug build get the debug dump file path from the environment
variable to allow the test suite to better control where it ends up.
2005-01-27 15:51:03 +00:00
Daniel Stenberg
ade1e79b37 verify a part of the PORT line 2005-01-27 12:59:40 +00:00
Daniel Stenberg
2415724d5f Make the server ignore the given PORT address, to make it possible to test
curl's -P option easier.
2005-01-26 23:18:31 +00:00
Daniel Stenberg
5463177f1f added more official web and download mirrors 2005-01-26 12:05:33 +00:00
Daniel Stenberg
4efd751eda new curlpp URL 2005-01-26 11:53:49 +00:00
Daniel Stenberg
2337efc3b1 fixed sort, mention C, the java binding is now maintained by Vic Hanson 2005-01-26 11:53:12 +00:00
Daniel Stenberg
b942a25a45 add number to the bugs to make them easier to refer to 2005-01-25 23:40:35 +00:00
Daniel Stenberg
beab9a9696 two known bugs 2005-01-25 22:21:42 +00:00
Daniel Stenberg
177dbc7be0 Ian Ford asked about support for the FTP command ACCT, and I discovered it is
present in RFC959... so now (lib)curl supports it as well. --ftp-account and
CURLOPT_FTP_ACCOUNT set the account string. (The server may ask for an account
string after PASS have been sent away. The client responds with "ACCT [account
string]".) Added test case 228 and 229 to verify the functionality. Updated
the test FTP server to support ACCT somewhat.
2005-01-25 22:13:12 +00:00
Daniel Stenberg
f2e71edcbd A minor "syntax error" in numerous test files corrected 2005-01-25 21:45:03 +00:00
Daniel Stenberg
fad6e5a5bc new web mirror 2005-01-25 13:59:48 +00:00
Daniel Stenberg
52f6c437fe --protocols is added in 7.13.0 2005-01-25 12:06:12 +00:00
Daniel Stenberg
80a8be6319 David Shaw contributed a fairly complete and detailed autoconf macro you can
use to detect libcurl and setup variables for the protocols the installed
libcurl supports: docs/libcurl/libcurl.m4
2005-01-25 09:29:05 +00:00
Daniel Stenberg
043d70fcdf Use plain structs and not typedef'ed ones in the hash and linked-list code. 2005-01-25 00:06:29 +00:00
Daniel Stenberg
4f7e958969 two options less 2005-01-23 00:08:56 +00:00
Daniel Stenberg
53143910a1 \fI marked \fP more function calls etc. 2005-01-22 22:43:04 +00:00
Daniel Stenberg
95656cd7f3 If you're using libcurl as a win32 DLL, you MUST use the CURLOPT_WRITEFUNCTION
if you set CURLOPT_WRITEDATA - or you will experience crashes.
2005-01-22 22:24:17 +00:00
Daniel Stenberg
d8f79b263d next release will be 7.13.0 2005-01-22 19:26:37 +00:00
Daniel Stenberg
51da8552c3 added a few items I plan to do 2005-01-22 09:03:55 +00:00
Daniel Stenberg
7e42cb61f7 FTP third transfer support overhaul. See CHANGES for details. 2005-01-21 09:32:32 +00:00
Daniel Stenberg
6c038680f9 clarify the struct name for CURLOPT_HTTPPOST 2005-01-21 08:56:04 +00:00
Daniel Stenberg
291a908f19 Added support for "verify" => "stripfile" to strip contents of the file that
is being checked.

Also made the server retrying sleep only one second instead of three, to reduce
some waiting when fooling around with the servers.
2005-01-20 22:48:43 +00:00
Daniel Stenberg
b264a03f89 Support file names passed to RETR that don't start with a number. In that
case, all non-numeric prefixing letters are cut off to figure out the test
number.
2005-01-20 22:47:31 +00:00
Daniel Stenberg
7472ede32a Philippe Hameau found out that -Q "+[command]" didn't work, although some code
was written for it. I fixed and added test case 227 to verify it.  The curl.1
man page didn't mention the '+' so I added it.
2005-01-20 22:22:12 +00:00
Daniel Stenberg
b5065e462b add support for NOOP 2005-01-20 22:05:44 +00:00
Daniel Stenberg
8dd799b4bd If you give a *_LARGE option you MUST make sure that the type of the passed-in
argument is a curl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you
must make sure that to pass in a type 'long' argument. */
2005-01-20 14:24:56 +00:00
Daniel Stenberg
a38520c90d added test226 too 2005-01-19 22:00:54 +00:00
Daniel Stenberg
3050ae57c0 Stephan Bergmann made libcurl return CURLE_URL_MALFORMAT if an FTP URL
contains %0a or %0d in the user, password or CWD parts. (A future fix would
include doing it for %00 as well - see KNOWN_BUGS for details.) Test case 225
and 226 were added to verify this
2005-01-19 21:56:02 +00:00
Daniel Stenberg
01205f772c today's proxy fixes 2005-01-19 18:05:56 +00:00
Gisle Vanem
06ad5be3af Don't copy 'stderr' for Win-CE in IPv6 code. Don't call
GetCurrentProcess() twice; use a local variable.
2005-01-19 10:20:55 +00:00
Daniel Stenberg
2fe3829e5e add a URL to an article about making Apache support PUT 2005-01-19 10:09:15 +00:00
Daniel Stenberg
a0c8b9bc68 Stephan Bergmann pointed out two flaws in libcurl built with HTTP disabled:
1) the proxy environment variables are still read and used to set HTTP proxy

2) you couldn't disable http proxy with CURLOPT_PROXY (since the option was
   disabled)
2005-01-19 09:36:44 +00:00
Daniel Stenberg
0406b1facf skip sys/socket.h on windows CE 2005-01-18 15:13:23 +00:00
Daniel Stenberg
65dbee01e5 check for errno.h 2005-01-18 14:34:50 +00:00
Daniel Stenberg
b1080f7c9a Cody Jones' enhanced version of Samuel Daz Garca's MSVC makefile patch. 2005-01-18 10:17:34 +00:00
Daniel Stenberg
7bfd58d41f Add support for server 'ftp2' which is a second FTP server. Useful for 3rd
party transfer tests or tests that need two FTP servers.
2005-01-17 20:20:34 +00:00
Daniel Stenberg
3851c6aae2 support the new --id command line option, that allows a second (or third or
whatever) instance to run without overwriting the previous' logfiles
2005-01-17 19:49:12 +00:00
Daniel Stenberg
ae03fa7d8e mention the name-prefix protocol guess thing 2005-01-17 14:57:21 +00:00
Daniel Stenberg
8a14dd25a9 updated the wording for -B/--use-ascii 2005-01-17 09:18:04 +00:00
Daniel Stenberg
e0bea7d541 Alex aka WindEagle pointed out that when doing "curl -v dictionary.com", curl
assumed this used the DICT protocol. While guessing protocols will remain
fuzzy, I've now made sure that the host names must start with "[protocol]."
for them to be a valid guessable name. I also removed "https" as a prefix that
indicates HTTPS, since we hardly ever see any host names using that.
2005-01-16 08:51:52 +00:00
Daniel Stenberg
534a8a05f3 mention --netrc in the -u description 2005-01-16 08:34:18 +00:00
Gisle Vanem
f5b8a26d9a errrno can by freak accident become EINTR on DOS or
Windows (unrelated to select). select() can never set errno
to EINTR on Windows.
2005-01-15 09:26:07 +00:00
Daniel Stenberg
cf51f7fb65 output better error detection, like when ipv6 can't resolve 2005-01-15 09:21:51 +00:00
Daniel Stenberg
4d1f3d3cd0 Added README.hostip 2005-01-14 13:43:29 +00:00
Daniel Stenberg
f70b87b4c5 verify the protocol too 2005-01-14 09:39:20 +00:00
Daniel Stenberg
0e26355348 Inspired by Martijn Koster's patch and example source at
http://www.greenhills.co.uk/mak/gentoo/curl-eintr-bug.c, I now made the
select() and poll() calls properly loop if they return -1 and errno is
EINTR. glibc docs for this is found here:
http://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html

This last link says BSD doesn't have this "effect". Will there be a problem
if we do this unconditionally?
S: ----------------------------------------------------------------------
2005-01-13 21:51:48 +00:00
Gisle Vanem
246ea56eab Added dependencies. 2005-01-12 15:32:41 +00:00
Gisle Vanem
7c1bba315b Added '-bd' option; target is a DLL.
Added dependencies.
2005-01-12 15:32:26 +00:00
Daniel Stenberg
9395cad379 support for retrieving used IP addresses 2005-01-11 22:26:00 +00:00
Daniel Stenberg
c5b2e85b47 Dan Torop cleaned up a few no longer used variables from David Phillips'
select() overhaul fix.
2005-01-11 20:22:44 +00:00
Gisle Vanem
38f8087281 Removed CURLTOOLDEBUG. It caused libcurl_wc.dll
to fail in mysterious ways.
2005-01-11 17:08:47 +00:00
Daniel Stenberg
e3fa7d021e Renamed easy.h and multi.h to easyif.h and multiif.h to make sure they don't
shadow our public headers with the former names.
2005-01-11 15:25:29 +00:00
Gisle Vanem
a1813e2b2d ".\lib\easy.h" shadows for <curl/easy.h> in Watcom.
Force including ../include/curl/easy.h.
2005-01-11 14:59:24 +00:00
Gisle Vanem
2e62458eef Fix '!if' expression. 2005-01-11 14:52:42 +00:00
Gisle Vanem
bb9e5565f2 ".\lib\multi.h" shadows for <curl/multi.h> in Watcom.
Force including ../include/curl/multi.h.
2005-01-11 14:32:09 +00:00
Daniel Stenberg
29102befa6 Cyrill Osterwalder posted a detailed analysis about a bug that occurs when
using a custom Host: header and curl fails to send a request on a re-used
persistent connection and thus creates a new connection and resends it. It
then sent two Host: headers. Cyrill's analysis was posted here:
http://curl.haxx.se/mail/archive-2005-01/0022.html
2005-01-11 14:00:45 +00:00
Daniel Stenberg
9d1145598a Bruce Mitchener identified (bug report #1099640) the never-ending SOCKS5
problem with the version byte and the check for bad versions. Bruce has lots
of clues on this, and based on his suggestion I've now removed the check of
that byte since it seems to be able to contain 1 or 5.
2005-01-10 23:32:14 +00:00
Daniel Stenberg
065e466f1a Use Curl_easy_addmulti() to clear associations from easy handles to multi
handles. Include multi.h to get proto.
2005-01-10 11:42:20 +00:00
Daniel Stenberg
3ac00f32af edited wording 2005-01-10 11:27:02 +00:00
Daniel Stenberg
21bb852750 Pavel Orehov reported memory problems with the multi interface in bug report
#1098843. In short, a shared DNS cache was setup for a multi handle and when
the shared cache was deleted before the individual easy handles, the latter
cleanups caused read/writes to already freed memory.
2005-01-10 10:07:07 +00:00
Daniel Stenberg
83bab78bda Hzhijun reported a memory leak in the SSL certificate code, that leaked the
remote certificate name when it didn't match the used host name.
2005-01-10 09:48:39 +00:00
Gisle Vanem
894ec46ef4 Note about the static lib requirement; -DCURL_STATICLIB. 2005-01-08 16:35:03 +00:00
Gisle Vanem
4eb1d3eb1b Watcom additions. 2005-01-08 16:15:06 +00:00
Gisle Vanem
945423e83a Added Watcom targets. 2005-01-08 16:12:27 +00:00
Gisle Vanem
9fd33c0b96 New file. 2005-01-08 16:06:37 +00:00
Gisle Vanem
3c09f2d2bd Added Makefile.Watcom to EXTRA_DIST. 2005-01-08 16:03:45 +00:00
Daniel Stenberg
7b4bf6a22c three recent bug fixes 2005-01-07 21:14:57 +00:00
Daniel Stenberg
b5b77f6367 disable the valgrind log checking 2005-01-07 21:11:24 +00:00
Daniel Stenberg
5a8097a4d5 fixed the valgrind log check and make it possible to disable it for a specific
test, see test 509
2005-01-07 21:11:13 +00:00
Daniel Stenberg
9cdf6fb64b added test 199 2005-01-07 21:09:50 +00:00
Daniel Stenberg
a137223b4f prevent a single byte read outside the string in test case 39 2005-01-06 22:54:37 +00:00
Daniel Stenberg
52e1ce9518 fixed #1097019, multiple GET posts (-G) error 2005-01-06 22:25:35 +00:00
Daniel Stenberg
8127a34f98 recent events 2005-01-05 14:12:06 +00:00
Gisle Vanem
2dcb8b674f Changed curl.dll to libcurl.dll. 2005-01-04 16:16:03 +00:00
Gisle Vanem
1e3b1b6e47 Minor comment fix. 2005-01-04 16:13:58 +00:00
Daniel Stenberg
9cdaae94cc just narrowed some text to fit within 80 cols 2005-01-04 16:01:34 +00:00
Gisle Vanem
316e74be74 Removed _WIN32_WINNT to support IPv6 under Win-2K. 2005-01-04 16:00:14 +00:00
Daniel Stenberg
af69c4f4f7 Marty Kuhrt's VMS update 2005-01-03 19:17:10 +00:00
Daniel Stenberg
ad9648a215 reverted the bad naming of the implib names 2005-01-02 21:15:29 +00:00
Daniel Stenberg
1576f3319e Alex Neblett's minor update 2005-01-02 19:19:32 +00:00
Daniel Stenberg
8ac90316d9 nah, don't use the system's getpass() function since it too often is limited
to 8(!) or similar lengths passwords
2004-12-26 09:17:38 +00:00
Daniel Stenberg
35ba5c826d issue 54 - this takes sweat 2004-12-25 23:15:45 +00:00
Daniel Stenberg
4f4ffa98b5 Test case 241 fails on all systems that support IPv6 but that don't have the
host name 'ip6-localhost' in /etc/hosts (or similar) since the test case uses
that host name to test the IPv6 name to address resolver.
2004-12-25 22:51:37 +00:00
Daniel Stenberg
b7d92c3e03 --protocols, license, src/config.h.in 2004-12-25 22:30:31 +00:00
Daniel Stenberg
4ecf939452 ./src/config.h.in is now removed from CVS. It is copied from the
lib/config.h.in file by buildconf
2004-12-25 22:10:38 +00:00
Daniel Stenberg
7ef6b05ef1 My reimplementation and cleanup of the getpass source code. We officially no
longer use Angus Mackay's getpass code due to the weirdo license his code was
donated to us under.
2004-12-25 22:08:02 +00:00
Daniel Stenberg
695f95aad1 mention the new --protocols 2004-12-24 09:02:23 +00:00
Daniel Stenberg
2a6ea6d7a7 David Shaw added --protocols, and thus the --feature no longer mentions what
protocols that are disabled.
2004-12-24 08:59:44 +00:00
Dan Fandrich
f5e0ff2170 Added LDAP library issue. 2004-12-23 22:34:00 +00:00
Daniel Stenberg
814d176b86 recent changes
and Merry Christmas!
2004-12-23 22:31:39 +00:00
Daniel Stenberg
3955b31362 David Shaw fixed the disable variables so that curl-config --feature works
correctly!
2004-12-23 08:48:59 +00:00
Daniel Stenberg
4b3fb5a01c issue 47 in next release? 2004-12-22 22:46:05 +00:00
Daniel Stenberg
67abd4cd47 Rune Kleveland fixed a minor memory leak for received cookies with the (rare)
version attribute set.
2004-12-22 22:33:31 +00:00
Daniel Stenberg
58f4af7973 Marcin Konicki provided two configure fixes and a source fix to make curl
build out-of-the-box on BeOS.
2004-12-22 22:28:10 +00:00
Dan Fandrich
99befd3a15 C ensures that static variables are initialized to 0 2004-12-22 20:12:15 +00:00
Daniel Stenberg
3acda85c2b added CURLINFO_HTTP_CONNECTCODE 2004-12-22 12:31:55 +00:00
Daniel Stenberg
dbb69797cf uh, fixed! 2004-12-22 09:21:04 +00:00
Daniel Stenberg
2910880b15 Added: 4 protocols we _could_ support and the CONNECT HTTP/1.0 detail we might
fix one day.
2004-12-22 09:19:29 +00:00
Daniel Stenberg
8b5f0abef1 more about error codes 2004-12-21 21:35:00 +00:00
Daniel Stenberg
10b5327b19 test enforced chunked encoding with PUT on a local file 2004-12-21 20:19:05 +00:00
Daniel Stenberg
4ba1eb26fa Added test case 217 that verified CURLINFO_HTTP_CONNECTCODE, and I made the
-w option support 'http_connect' to make it easier to verify!
2004-12-21 19:59:35 +00:00
Daniel Stenberg
444f6427b8 oops, variables first then code 2004-12-21 14:33:37 +00:00
Daniel Stenberg
a173e07eec Prevent failf() from using the va_list variable more than once.
See bug report #1088962 and  Single Unix Specification:
http://www.opengroup.org/onlinepubs/007908799/xsh/vfprintf.html
2004-12-21 14:22:10 +00:00
Daniel Stenberg
3de85777de mention how the FTP code should be fixed one day 2004-12-21 10:54:21 +00:00
Daniel Stenberg
f4c5314890 include sys/types.h before sys/select.h 2004-12-21 10:11:07 +00:00
Daniel Stenberg
1225ad58bd set debug curl too when -c is used 2004-12-21 10:10:40 +00:00
Daniel Stenberg
951fdeba67 How do I list the root dir of an FTP server? 2004-12-21 09:37:55 +00:00
Dan Fandrich
327b46cced Fixed a compile warning introduced by making the protocol table const. This
involves a binary-compatible change to the API struct curl_version_info_data
2004-12-20 21:14:45 +00:00
Dan Fandrich
80d301257c Make some more arrays of pointers const. 2004-12-20 18:23:43 +00:00
Dan Fandrich
0e59182945 gcc 2.7 can't handle a few warning options that gcc 2.95 can. 2004-12-20 18:20:17 +00:00
Daniel Stenberg
7270d5ce26 start working on 7.12.4 2004-12-20 13:09:38 +00:00
Daniel Stenberg
a142d419d2 and we start all over again 2004-12-20 12:51:14 +00:00
259 changed files with 4186 additions and 1496 deletions

269
CHANGES
View File

@@ -6,6 +6,275 @@
Changelog
Daniel (8 February 2005)
- Gisle fixed problems when libcurl runs out of memory, and worked on making
sure the proper error code is returned for those occations.
Daniel (7 February 2005)
- Maruko pointed out a problem with inflate decompressing exactly 64K
contents.
Daniel (5 February 2005)
- Eric Vergnaud found a use of an uninitialised variable in the ftp when doing
PORT on ipv6-enabled hosts.
- David Byron pointed out we could use BUFSIZE to read data (in
lib/transfer.c) instead of using BUFSIZE -1.
Version 7.13.0 (1 February 2005)
Daniel (31 January 2005)
- Added Lars Nilsson's htmltitle.cc example
Daniel (30 January 2005)
- Fixed a memory leak when using the multi interface and the DO operation
failed (as in test case 205).
- Fixed a valgrind warning for file:// operations.
- Fixed a valgrind report in the url globbing code for the curl command line
tool.
- Bugfixed the parser that scans the valgrind report outputs (in runtests.pl).
I noticed that it previously didn't detect and report the "Conditional jump
or move depends on uninitialised value(s)" error. When I fixed this, I
caught a few curl bugs with it. And then I had to spend time to make the
test suite IGNORE these errors when OpenSSL is used since it produce massive
amounts of valgrind warnings (but only of the "Conditional..." kind it
seems). So, if a test that requires SSL is run, it ignores the
"Conditional..." errors, and you'll get a "valgrind PARTIAL" output instead
of "valgrind OK".
Daniel (29 January 2005)
- Using the multi interface, and doing a requsted a re-used connection that
gets closed just after the request has been sent failed and did not re-issue
a request on a fresh reconnect like the easy interface did. Now it does!
- Define CURL_MULTIEASY when building libcurl (lib/easy.c to be exact), to use
my new curl_easy_perform() that uses the multi interface to run the
request. It is a great testbed for the multi interface and I believe we
shall do it this way for real in the future when we have a successor to
curl_multi_fdset(). I've used this approach to detect and fix several of the
recent multi-interfaces issues.
- Adjusted the KNOWN_BUGS #17 fix a bit more since the FTP code also did some
bad assumptions.
- multi interface: when a request is denied due to "Maximum redirects
followed" libcurl leaked the last Location: URL.
- Connect failures with the multi interface was often returned as "connect()
timed out" even though the reason was different.
Daniel (28 January 2005)
- KNOWN_BUGS #17 fixed. A DNS cache entry may not remain locked between two
curl_easy_perform() invokes. It was previously unlocked at disconnect, which
could mean that it remained locked between multiple transfers. The DNS cache
may not live as long as the connection cache does, as they are separate.
To deal with the lack of DNS (host address) data availability in re-used
connections, libcurl now keeps a copy of the IP adress as a string, to be
able to show it even on subsequent requests on the same connection.
The problem could be made to appear with this stunt:
1. create a multi handle
2. add an easy handle
3. fetch a URL that is persistent (leaves the connection alive)
4. remove the easy handle from the multi
5. kill the multi handle
6. create a multi handle
7. add the same easy handle to the new multi handle
8. fetch a URL from the same server as before (re-using the connection)
- Stephen More pointed out that CURLOPT_FTPPORT and the -P option didn't work
when built ipv6-enabled. I've now made a fix for it. Writing test cases for
custom port hosts turned too tricky so unfortunately there's none.
Daniel (25 January 2005)
- Ian Ford asked about support for the FTP command ACCT, and I discovered it
is present in RFC959... so now (lib)curl supports it as well. --ftp-account
and CURLOPT_FTP_ACCOUNT set the account string. (The server may ask for an
account string after PASS have been sent away. The client responds
with "ACCT [account string]".) Added test case 228 and 229 to verify the
functionality. Updated the test FTP server to support ACCT somewhat.
- David Shaw contributed a fairly complete and detailed autoconf test you can
use to detect libcurl and setup variables for the protocols the installed
libcurl supports: docs/libcurl/libcurl.m4
Daniel (21 January 2005)
- Major FTP third party transfer overhaul.
These four options are now obsolete: CURLOPT_SOURCE_HOST,
CURLOPT_SOURCE_PATH, CURLOPT_SOURCE_PORT (this option didn't work before)
and CURLOPT_PASV_HOST.
These two options are added: CURLOPT_SOURCE_URL and CURLOPT_SOURCE_QUOTE.
The target-side didn't use the proper path with RETR, and thus this only
worked correctly in the login path (i.e without doing any CWD). The source-
side still uses a wrong path, but the fix for this will need to wait. Verify
the flaw by using a source URL with included %XX-codes.
Made CURLOPT_FTPPORT control weather the target operation should use PORT
(or not). The other side thus uses passive (PASV) mode.
Updated the ftp3rdparty.c example source to use the updated options.
Added support for a second FTP server in the test suite. Named... ftp2.
Added test cases 230, 231 and 232 as a few first basic tests of very simple
3rd party transfers.
Changed the debug output to include 'target' and 'source' when a 3rd party
is being made, to make it clearer what commands/responses came on what
connection.
Added three new command line options: --3p-url, --3p-user and --3p-quote.
Documented the command line options and the curl_easy_setopt options related
to third party transfers.
(Temporarily) disabled the ability to re-use an existing connection for the
source connection. This is because it needs to force a new in case the
source and target is the same host, and the host name check is trickier now
when the source is identified with a full URL instead of a plain host name
like before.
TODO (short-term) for 3rd party transfers: quote support. The options are
there, we need to add test cases to verify their functionality.
TODO (long-term) for 3rd party transfers: IPv6 support (EPRT and EPSV etc)
and SSL/TSL support.
Daniel (20 January 2005)
- Philippe Hameau found out that -Q "+[command]" didn't work, although some
code was written for it. I fixed and added test case 227 to verify it.
The curl.1 man page didn't mention the '+' so I added it.
Daniel (19 January 2005)
- Stephan Bergmann made libcurl return CURLE_URL_MALFORMAT if an FTP URL
contains %0a or %0d in the user, password or CWD parts. (A future fix would
include doing it for %00 as well - see KNOWN_BUGS for details.) Test case
225 and 226 were added to verify this
- Stephan Bergmann pointed out two flaws in libcurl built with HTTP disabled:
1) the proxy environment variables are still read and used to set HTTP proxy
2) you couldn't disable http proxy with CURLOPT_PROXY (since the option was
disabled). This is important since apps may want to disable HTTP proxy
without actually knowing if libcurl was built to disable HTTP or not.
Based on Stephan's patch, both these issues should now be fixed.
Daniel (18 January 2005)
- Cody Jones' enhanced version of Samuel D<>az Garc<72>a's MSVC makefile patch was
applied.
Daniel (16 January 2005)
- Alex aka WindEagle pointed out that when doing "curl -v dictionary.com", curl
assumed this used the DICT protocol. While guessing protocols will remain
fuzzy, I've now made sure that the host names must start with "[protocol]."
for them to be a valid guessable name. I also removed "https" as a prefix
that indicates HTTPS, since we hardly ever see any host names using that.
Daniel (13 January 2005)
- Inspired by Martijn Koster's patch and example source at
http://www.greenhills.co.uk/mak/gentoo/curl-eintr-bug.c, I now made the
select() and poll() calls properly loop if they return -1 and errno is
EINTR. glibc docs for this is found here:
http://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html
This last link says BSD doesn't have this "effect". Will there be a problem
if we do this unconditionally?
Daniel (11 January 2005)
- Dan Torop cleaned up a few no longer used variables from David Phillips'
select() overhaul fix.
- Cyrill Osterwalder posted a detailed analysis about a bug that occurs when
using a custom Host: header and curl fails to send a request on a re-used
persistent connection and thus creates a new connection and resends it. It
then sent two Host: headers. Cyrill's analysis was posted here:
http://curl.haxx.se/mail/archive-2005-01/0022.html
- Bruce Mitchener identified (bug report #1099640) the never-ending SOCKS5
problem with the version byte and the check for bad versions. Bruce has lots
of clues on this, and based on his suggestion I've now removed the check of
that byte since it seems to be able to contain 1 or 5.
Daniel (10 January 2005)
- Pavel Orehov reported memory problems with the multi interface in bug report
#1098843. In short, a shared DNS cache was setup for a multi handle and when
the shared cache was deleted before the individual easy handles, the latter
cleanups caused read/writes to already freed memory.
- Hzhijun reported a memory leak in the SSL certificate code, that leaked the
remote certificate name when it didn't match the used host name.
Gisle (8 January 2005)
- Added Makefile.Watcom files (src/lib). Updated Makefile.dist.
Daniel (7 January 2005)
- Improved the test script's valgrind log parser to actually work! Also added
the ability to disable the log scanner for specific test cases. Test case
509 results in numerous problems and leaks in OpenSSL and has to get it
disabled.
Daniel (6 January 2005)
- Fixed a single-byte read out of bounds in test case 39 in the curl tool code
(i.e not in the library).
- Bug report #1097019 identified a problem when doing -d "data" with -G and
sending it to two URLs with {}. Added test 199 to verify the fix.
Daniel (4 January 2005)
- Marty Kuhrt adjusted a VMS build script slightly
- Kai Sommerfeld and Gisle Vanem fixed libcurl to build with IPv6 support on
Win2000.
Daniel (2 January 2005)
- Alex Neblett updated the MSVC makefiles slightly.
Daniel (25 December 2004)
- Removed src/config.h.in from CVS, it is now copied from the (generated)
lib/config.h.in instead, as they can very well be the same. This removes a
"manual hassle". You may want to re-run buildconf now.
- Werner Koch filed Debian bug report #286794, mentioning that curl contained
non-free (by Debian's view) source code. This was Angus Mackay's
src/getpass.c source code. I tried to contact him about it to quickly solve
this issue, but his email addresses bounce and I got some time "over" and
reimplemented the functionality once brought by Angus. We no longer use any
of Angus' original code and the new function is much simpler (IMO). Issue
solved.
Daniel (24 December 2004)
- David Shaw added --protocols to curl-config, so that it now lists all
protocols libcurl was built to support. --feature no longer lists disabled
protocols.
Daniel (23 December 2004)
- David Shaw fixed the configure --disable-[protocol] variables so that
curl-config --feature now works correctly!
Daniel (22 December 2004)
- Rune Kleveland fixed a minor memory leak for received cookies with the
(rare) version attribute set.
- Marcin Konicki provided two configure fixes and a source fix to make curl
build out-of-the-box on BeOS.
Daniel (21 December 2004)
- Added test case 217 that verified CURLINFO_HTTP_CONNECTCODE, and I made the
-w option support 'http_connect' to make it easier to verify!
- Fixed lib/select.c include order to build fine on FreeBSD
- Fixed failf()'s reuse of the va_list variable that crashed on FreeBSD.
Pointed out by Peter Pentchev.
Version 7.12.3 (20 December 2004)

View File

@@ -53,6 +53,18 @@ borland-clean:
cd ..\src
make -f Makefile.b32 clean
watcom:
cd lib
wmake -f Makefile.Watcom
cd ..\src
wmake -f Makefile.Watcom
watcom-clean:
cd lib
wmake -f Makefile.Watcom clean
cd ..\src
wmake -f Makefile.Watcom clean
mingw32:
$(MAKE) -C lib -f Makefile.m32 ZLIB=1
$(MAKE) -C src -f Makefile.m32 ZLIB=1
@@ -65,6 +77,37 @@ mingw32-clean:
$(MAKE) -C lib -f Makefile.m32 clean
$(MAKE) -C src -f Makefile.m32 clean
vc-clean:
cd lib
nmake -f Makefile.vc6 clean
cd ..\src
nmake -f Makefile.vc6 clean
vc-all:
cd lib
nmake -f Makefile.vc6 cfg=release
nmake -f Makefile.vc6 cfg=release-ssl
nmake -f Makefile.vc6 cfg=release-zlib
nmake -f Makefile.vc6 cfg=release-ssl-zlib
nmake -f Makefile.vc6 cfg=release-ssl-dll
nmake -f Makefile.vc6 cfg=release-zlib-dll
nmake -f Makefile.vc6 cfg=release-ssl-dll-zlib-dll
nmake -f Makefile.vc6 cfg=release-dll
nmake -f Makefile.vc6 cfg=release-dll-ssl-dll
nmake -f Makefile.vc6 cfg=release-dll-zlib-dll
nmake -f Makefile.vc6 cfg=release-dll-ssl-dll-zlib-dll
nmake -f Makefile.vc6 cfg=debug
nmake -f Makefile.vc6 cfg=debug-ssl
nmake -f Makefile.vc6 cfg=debug-zlib
nmake -f Makefile.vc6 cfg=debug-ssl-zlib
nmake -f Makefile.vc6 cfg=debug-ssl-dll
nmake -f Makefile.vc6 cfg=debug-zlib-dll
nmake -f Makefile.vc6 cfg=debug-ssl-dll-zlib-dll
nmake -f Makefile.vc6 cfg=debug-dll
nmake -f Makefile.vc6 cfg=debug-dll-ssl-dll
nmake -f Makefile.vc6 cfg=debug-dll-zlib-dll
nmake -f Makefile.vc6 cfg=debug-dll-ssl-dll-zlib-dll
vc:
cd lib
nmake /f Makefile.vc6 cfg=release
@@ -93,13 +136,43 @@ vc-ssl-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-ssl-dll
cd ..\src
nmake /f Makefile.vc6
nmake /f Makefile.vc6 cfg=release-ssl-dll
vc-libcurl-ssl-dll:
vc-dll-ssl-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-libcurl-ssl-dll
nmake /f Makefile.vc6 cfg=release-dll-ssl-dll
cd ..\src
nmake /f Makefile.vc6
nmake /f Makefile.vc6 cfg=release-dll-ssl-dll
vc-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-dll
vc-dll-zlib-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-dll-zlib-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-dll-zlib-dll
vc-dll-ssl-dll-zlib-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-dll-ssl-dll-zlib-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-dll-ssl-dll-zlib-dll
vc-ssl-dll-zlib-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-ssl-dll-zlib-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-ssl-dll-zlib-dll
vc-zlib-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-zlib-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-zlib-dll
djgpp:
$(MAKE) -C lib -f Makefile.dj

13
README
View File

@@ -34,20 +34,27 @@ WEB SITE
Sweden -- http://curl.haxx.se/
Australia -- http://curl.planetmirror.com/
Austria -- http://curl.gds.tuwien.ac.at/
Denmark -- http://curl.cofman.dk/
Estonia -- http://curl.wildyou.net/
France -- http://curl.mirror.internet.tp/
Germany -- http://curl.kgt.org/
Germany -- http://curl.mirror.at.stealer.net/
Germany -- http://curl.netmirror.org/
Russia -- http://curl.tsuren.net/
Taiwan -- http://curl.cs.pu.edu.tw/
Thailand -- http://curl.siamu.ac.th/
US (CA) -- http://curl.mirror.redwire.net/
US -- http://curl.signal42.com/
US (CA) -- http://curl.mirrormonster.com/
US (CA) -- http://curl.signal42.com/
US (TX) -- http://curl.109k.com/
DOWNLOAD
The official download mirror sites are:
Australia -- http://curl.planetmirror.com/download.html
Austria -- http://curl.gds.tuwien.ac.at/download.html
Estonia -- http://curl.wildyou.net/download.html
Germany -- ftp://ftp.fu-berlin.de/pub/unix/network/curl/
Germany -- http://curl.mirror.at.stealer.net/download.html
@@ -57,8 +64,12 @@ DOWNLOAD
Russia -- http://curl.tsuren.net/download.html
Sweden -- ftp://ftp.sunet.se/pub/www/utilities/curl/
Sweden -- http://cool.haxx.se/curl/
Taiwan -- http://curl.cs.pu.edu.tw/download.html
Thailand -- http://curl.siamu.ac.th/download.html
US (CA) -- http://curl.mirror.redwire.net/download.html
US (CA) -- http://curl.mirrormonster.com/download.html
US (CA) -- http://curl.signal42.com/download.html
US (TX) -- http://curl.109k.com/download.html
CVS

View File

@@ -1,81 +1,27 @@
Curl and libcurl 7.12.3
Curl and libcurl 7.13.1
Public curl release number: 84
Releases counted from the very beginning: 111
Available command line options: 100
Available curl_easy_setopt() options: 123
Public curl release number: 86
Releases counted from the very beginning: 113
Available command line options: 104
Available curl_easy_setopt() options: 122
Number of public functions in libcurl: 46
Amount of public web site mirrors: 14
Amount of public web site mirrors: 15
Number of known libcurl bindings: 29
This release includes the following changes:
o PKCS12 certificate support added
o added CURLINFO_SSL_ENGINES (and "--engine list")
o new configure options: --disable-cookies, --disable-crypto-auth and
--disable-verbose
o persistent ftp request improvements
o CURLOPT_IOCTLFUNCTION and CURLOPT_IOCTLDATA added. If your app uses HTTP
Digest, NTLM or Negotiate authentication, you will most likely want to use
these
o -w time_redirect and num_redirects
o no longer uses libcurl.def for building on Windows, OS/2 and Netware
o builds on Windows CE
o request retrying, --retry and family added
o FTP 3rd party transfers with source and dest on the same host now works
o added CURLINFO_NUM_CONNECTS
o
This release includes the following bugfixes:
o curl -E on windows accepts "c:/path" with forward-slash
o several improvements for large file support on windows
o file handle leak in aborted multipart formpost file upload
o -T upload multiple files with backslashes in file names
o modified credentials between two requests on a persistent http connection
o large file file:// resumes on Windows
o URLs with username and IPv6 numerical addresses
o configure works better with SSL libs in a "non-standard ld.so dir"
o curl-config --vernum zero prefixed
o bad memory access in the NTLM code
o EPSV on multi-homed servers now works correctly
o chunked-encoded transfers could get closed pre-maturely without error
o proxy CONNECT now default timeouts after 3600 seconds
o disabling EPSV or EPRT is ignored when connecting to an IPv6 FTP server
o no extra progress meter newline output after each Location: followed
o HTTP PUT/POST with Digest, NTLM or Negotiate no longer uses HEAD
o works with or gracefully bails out when exceeding FD_SETSIZE file
descriptors
o CURLINFO_REDIRECT_TIME works
o building with gssapi libs and hdeaders in the default dirs
o curl_getdate() parsing of dates later than year 2037 with 32 bit time_t
o curl -v when stderr is closed wrote debug messages to the network socket
o build failure with libidn 0.3.X or older
o huge POSTs on VMS
o configure no longer uses pkg-config on cross-compiles
o potential gzip decompress memory leak
o "-C - --fail" on a HTTP page already downloaded
o formposting a zero byte file
o use setlocale() for better IDN functionality by default
o
Other curl-related news since the previous public release:
o pycurl 7.12.2: http://pycurl.sf.net/
o TclCurl 0.12.2: http://personal1.iddeo.es/andresgarci/tclcurl/english/
o libcurl.NET 1.2: http://www.seasideresearch.com/downloads.html
o RCurl 0.5.1: http://www.omegahat.org/RCurl/
o libcurl.mono 1.0:
http://forge.novell.com/modules/xfmod/project/?libcurl-mono
o new German curl mirror: http://curl.kgt.org/
o
This release would not have looked like this without help, code, reports and
advice from friends like these:
Peter Wullinger, Guillaume Arluison, Alexander Krasnostavsky, Mohun Biswas,
Tomas Pospisek, Gisle Vanem, Dan Fandrich, Paul Nolan, Andres Garcia, Tim
Sneddon, Ian Gulliver, Jean-Philippe Barrette-LaPierre, Jeff Phillips,
Wojciech Zwiefka, David Phillips, Reinout van Schouwen, Maurice Barnum,
Richard Atterer, Rene Bernhardt, Matt Veenstra, Bryan Henderson, Ton Voon,
Kai Sommerfeld, David Byron, Harshal Pradhan, Tom Lee, Dinar, Jean-Marc
Ranger, Samuel Listopad
Thanks! (and sorry if I forgot to mention someone)

View File

@@ -1,8 +1,36 @@
Issues not sorted in any particular order.
To get fixed in 7.12.3 (planned release: December 2004)
To get fixed in 7.13.1 (planned release: April 2005)
======================
58 - Fix KNOWN_BUGS #19: "FTP 3rd party transfers with the multi interface
doesn't work"
59 - Figure out a fix for David Byron's SSL problems:
http://curl.haxx.se/mail/lib-2005-01/0240.html
47 - Peter Sylvester's patch for SRP on the TLS layer
Awaits OpenSSL support for this, no need to support this in libcurl before
there's an OpenSSL release that does it.
54 - Turn the FTP code into a state machine to support the multi interface
100% non-blocking.
To get fixed in 7.14.0
======================
55 - Add a function to the multi interface that gets file descriptors, as an
alternative to the curl_multi_fdset(). This is necessary to allow apps to
properly avoid the FD_SETSIZE problem.
56 - Make curl_easy_perform() a wrapper-function that simply creates a multi
handle, adds the easy handle to it, runs curl_multi_perform() until the
transfer is done, then detach the easy handle, destroy the multi handle
and return the easy handle's return code. This will thus make everything
internally use and assume the multi interface. The select()-loop should
use the new function from (55).
57 - Add an interface to libcurl for getting and setting cookies from an easy
handle. One idea: http://curl.haxx.se/mail/lib-2004-12/0195.html the
older idea: http://curl.haxx.se/dev/COOKIES. We need to settle on some
middle ground I guess.

View File

@@ -87,9 +87,7 @@ AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets]
dnl Ioctlsocket didnt compile, do test 5!
AC_TRY_COMPILE([
/* headers for SO_NONBLOCK test (BeOS) */
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <socket.h>
],[
/* SO_NONBLOCK source code */
long b = 1;
@@ -695,15 +693,15 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
if test "$gccnum" -ge "207"; then
dnl gcc 2.7 or later (well, they don't work on 2.2.2)
WARN="$WARN -Wno-long-long -Wmissing-declarations -Wsign-compare"
dnl gcc 2.7 or later
WARN="$WARN -Wmissing-declarations"
fi
if test "$gccnum" -gt "295"; then
dnl only if the compiler is newer than 2.95 since we got lots of
dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
dnl gcc 2.95.4 on FreeBSD 4.9!
WARN="$WARN -Wundef"
WARN="$WARN -Wundef -Wno-long-long -Wsign-compare"
fi
if test "$gccnum" -ge "296"; then

View File

@@ -168,6 +168,8 @@ echo "buildconf: running aclocal hack to convert all mv to mv -f"
perl -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
echo "buildconf: running autoheader"
${AUTOHEADER:-autoheader} || die "The autoheader command failed"
echo "buildconf: cp lib/config.h.in src/config.h.in"
cp lib/config.h.in src/config.h.in
echo "buildconf: running autoconf"
${AUTOCONF:-autoconf} || die "The autoconf command failed"

View File

@@ -133,8 +133,8 @@ AC_HELP_STRING([--disable-http],[Disable HTTP support]),
AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
AC_MSG_WARN([disable HTTP disables FTP over proxy and GOPHER too])
AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable GOPHER])
AC_SUBST(CURL_DISABLE_HTTP)
AC_SUBST(CURL_DISABLE_GOPHER)
AC_SUBST(CURL_DISABLE_HTTP, [1])
AC_SUBST(CURL_DISABLE_GOPHER, [1])
;;
*) AC_MSG_RESULT(yes)
;;
@@ -149,7 +149,7 @@ AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
no)
AC_MSG_RESULT(no)
AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
AC_SUBST(CURL_DISABLE_FTP)
AC_SUBST(CURL_DISABLE_FTP, [1])
;;
*) AC_MSG_RESULT(yes)
;;
@@ -164,7 +164,7 @@ AC_HELP_STRING([--disable-gopher],[Disable GOPHER support]),
no)
AC_MSG_RESULT(no)
AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable GOPHER])
AC_SUBST(CURL_DISABLE_GOPHER)
AC_SUBST(CURL_DISABLE_GOPHER, [1])
;;
*) AC_MSG_RESULT(yes)
;;
@@ -179,7 +179,7 @@ AC_HELP_STRING([--disable-file],[Disable FILE support]),
no)
AC_MSG_RESULT(no)
AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
AC_SUBST(CURL_DISABLE_FILE)
AC_SUBST(CURL_DISABLE_FILE, [1])
;;
*) AC_MSG_RESULT(yes)
;;
@@ -194,7 +194,7 @@ AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
no)
AC_MSG_RESULT(no)
AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
AC_SUBST(CURL_DISABLE_LDAP)
AC_SUBST(CURL_DISABLE_LDAP, [1])
;;
*) AC_MSG_RESULT(yes)
;;
@@ -209,7 +209,7 @@ AC_HELP_STRING([--disable-dict],[Disable DICT support]),
no)
AC_MSG_RESULT(no)
AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
AC_SUBST(CURL_DISABLE_DICT)
AC_SUBST(CURL_DISABLE_DICT, [1])
;;
*) AC_MSG_RESULT(yes)
;;
@@ -224,7 +224,7 @@ AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
no)
AC_MSG_RESULT(no)
AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
AC_SUBST(CURL_DISABLE_TELNET)
AC_SUBST(CURL_DISABLE_TELNET, [1])
;;
*) AC_MSG_RESULT(yes)
;;
@@ -314,6 +314,16 @@ then
)
fi
if test "$HAVE_GETHOSTBYNAME" != "1"
then
dnl gethostbyname in the net lib - for BeOS
AC_CHECK_LIB(net, gethostbyname,
[HAVE_GETHOSTBYNAME="1"
LIBS="$LIBS -lnet"
])
fi
if test "$HAVE_GETHOSTBYNAME" = "1"; then
AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
else
@@ -1171,6 +1181,7 @@ AC_CHECK_HEADERS(
sys/resource.h \
libgen.h \
locale.h \
errno.h \
setjmp.h,
dnl to do if not found
[],
@@ -1253,8 +1264,6 @@ AC_CHECK_FUNCS( strtoll \
inet_addr \
inet_ntoa \
inet_pton \
tcsetattr \
tcgetattr \
perror \
closesocket \
siginterrupt \

View File

@@ -19,7 +19,8 @@ Available values for OPTION include:
--ca ca bundle install path
--cc compiler
--cflags pre-processor and compiler flags
--feature newline separated list of enabled features
--features newline separated list of enabled features
--protocols newline separated list of enabled protocols
--help display this help and exit
--libs library linking information
--prefix curl install prefix
@@ -56,7 +57,7 @@ while test $# -gt 0; do
echo "$prefix"
;;
--feature)
--feature|--features)
if test "@USE_SSLEAY@" = "1"; then
echo "SSL"
fi
@@ -69,32 +70,40 @@ while test $# -gt 0; do
if test "@HAVE_LIBZ@" = "1"; then
echo "libz"
fi
if test "@CURL_DISABLE_HTTP@" = "1"; then
echo "HTTP-disabled"
fi
if test "@CURL_DISABLE_FTP@" = "1"; then
echo "FTP-disabled"
fi
if test "@CURL_DISABLE_GOPHER@" = "1"; then
echo "GOPHER-disabled"
fi
if test "@CURL_DISABLE_FILE@" = "1"; then
echo "FILE-disabled"
fi
if test "@CURL_DISABLE_TELNET@" = "1"; then
echo "TELNET-disabled"
fi
if test "@CURL_DISABLE_LDAP@" = "1"; then
echo "LDAP-disabled"
fi
if test "@CURL_DISABLE_DICT@" = "1"; then
echo "DICT-disabled"
fi
if test "@HAVE_ARES@" = "1"; then
echo "AsynchDNS"
fi
;;
--protocols)
if test "@CURL_DISABLE_HTTP@" != "1"; then
echo "HTTP"
if test "@USE_SSLEAY@" = "1"; then
echo "HTTPS"
fi
fi
if test "@CURL_DISABLE_FTP@" != "1"; then
echo "FTP"
if test "@USE_SSLEAY@" = "1"; then
echo "FTPS"
fi
fi
if test "@CURL_DISABLE_GOPHER@" != "1"; then
echo "GOPHER"
fi
if test "@CURL_DISABLE_FILE@" != "1"; then
echo "FILE"
fi
if test "@CURL_DISABLE_TELNET@" != "1"; then
echo "TELNET"
fi
if test "@CURL_DISABLE_LDAP@" != "1"; then
echo "LDAP"
fi
if test "@CURL_DISABLE_DICT@" != "1"; then
echo "DICT"
fi
;;
--version)
echo libcurl @VERSION@
exit 0
@@ -123,8 +132,7 @@ while test $# -gt 0; do
*)
echo "unknown option: $1"
usage
exit 1
usage 1
;;
esac
shift

View File

@@ -25,10 +25,14 @@ Basic
ScriptBasic bindings to libcurl. Writtten by Peter Verhas
http://scriptbasic.com/
C
libcurl is a C library in itself!
http://curl.haxx.se/libcurl/
C++
Written by Jean-Philippe Barrette-LaPierre
http://www.sourceforge.net/projects/curlpp
http://rrette.com/curlpp.html
Ch
@@ -68,7 +72,7 @@ glib/GTK+
Java
Written by Daniel Stenberg
Maintained by Vic Hanson
http://curl.haxx.se/libcurl/java/
Lua
@@ -76,16 +80,16 @@ Lua
Written by Steve Dekorte
http://curl.haxx.se/libcurl/lua/
.NET
Written by Jeffrey Phillips
http://www.seasideresearch.com/downloads.html
Mono
Written by Jeffrey Phillips
http://forge.novell.com/modules/xfmod/project/?libcurl-mono
.NET
Written by Jeffrey Phillips
http://www.seasideresearch.com/downloads.html
Object-Pascal
Free Pascal, Delphi and Kylix binding written by Christophe Espern.

View File

@@ -1,4 +1,4 @@
Updated: August 18, 2004 (http://curl.haxx.se/docs/faq.html)
Updated: December 21, 2004 (http://curl.haxx.se/docs/faq.html)
_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
@@ -42,6 +42,7 @@ FAQ
3.14 Does curl support javascript or pac (automated proxy config)?
3.15 Can I do recursive fetches with curl?
3.16 What certificates do I need when I use SSL?
3.17 How do I list the root dir of an FTP server?
4. Running Problems
4.1 Problems connecting to SSL servers.
@@ -520,6 +521,18 @@ FAQ
that was signed by one of the authorities in the bundle. curl comes with a
default CA cert bundle. You can override the default.
3.17 How do I list the root dir of an FTP server?
There are two ways. The way defined in the RFC is to use an encoded slash
in the first path part. List the "/tmp" dir like this:
curl ftp://ftp.sunet.se/%2ftmp/
or the not-quite-kosher-but-more-readable way, by simply starting the path
section of the URL with a slash:
curl ftp://ftp.sunet.se//tmp/
4. Running Problems
@@ -623,7 +636,10 @@ FAQ
4.6 Can you tell me what error code 142 means?
All error codes that are larger than the highest documented error code means
All curl error codes are described at the end of the man page, in the
section called "EXIT CODES".
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
appreciate a detailed bug report from you that describes how we could go
ahead and repeat this!
@@ -806,13 +822,13 @@ FAQ
When building an application that uses the static libcurl library, you must
add -DCURL_STATICLIB to your CFLAGS. Otherwise the linker will look for
dynamic import symbols. If you get linker error like "unknown symbol
__imp__curl_easy_init ..." you have linked against the wrong (static) library.
If you want to use the curl.dll and import lib, you don't need any extra CFLAGS,
but use one of the import libraries below. These are the libraries produced by
the various lib/Makefile.* files:
__imp__curl_easy_init ..." you have linked against the wrong (static)
library. If you want to use the libcurl.dll and import lib, you don't need
any extra CFLAGS, but use one of the import libraries below. These are the
libraries produced by the various lib/Makefile.* files:
Target: static lib. import lib for curl*.dll.
--------------------------------------------------------
Target: static lib. import lib for libcurl*.dll.
-----------------------------------------------------------
MingW: libcurl.a libcurldll.a
MSVC (release): libcurl.lib libcurl_imp.lib
MSVC (debug): libcurld.lib libcurld_imp.lib

View File

@@ -293,6 +293,13 @@ Win32
- Add defines to Project/Settings/C/C++/General/Preprocessor Definitions
in the curllib.dsw/curllib.dsp Visual C++ 6 IDE project.
Important (with SSL or not):
When building an application that uses the static libcurl library, you
must add '-DCURL_STATICLIB' to your CFLAGS. Otherwise the linker will
look for dynamic import symbols.
IBM OS/2
========

View File

@@ -3,58 +3,86 @@ join in and help us correct one or more of these! Also be sure to check the
changelog of the current development status, as one or more of these problems
may have been fixed since this was written!
* Test case 165 might fail on system which has libidn present, but with an
20. valgrind errors occur too often when 'make test' is used. It is because
too many third-party libs and tools have problems. When curl is built
without --disable-shared, the testing is done with a front-end script which
makes the valgrind testing include (ba)sh as well and that often causes
valgrind errors. Either we improve the valgrind error scanner a lot to
better identify (lib)curl errors only, or we disable valgrind checking by
default.
19. FTP 3rd party transfers with the multi interface doesn't work. Test:
define CURL_MULTIEASY, rebuild curl, run test case 230 - 232.
18. test case 57 has </test> that should be </client> but when corrected, the
test case fails!
16. FTP URLs passed to curl may contain NUL (0x00) in the RFC 1738 <user>,
<password>, and <fpath> components, encoded as "%00". The problem is that
curl_unescape does not detect this, but instead returns a shortened C
string. From a strict FTP protocol standpoint, NUL is a valid character
within RFC 959 <string>, so the way to handle this correctly in curl would
be to use a data structure other than a plain C string, one that can handle
embedded NUL characters. From a practical standpoint, most FTP servers
would not meaningfully support NUL characters within RFC 959 <string>,
anyway (e.g., UNIX pathnames may not contain NUL).
15. Test case 241 fails on all systems that support IPv6 but that don't have
the host name 'ip6-localhost' in /etc/hosts (or similar) since the test case
uses that host name to test the IPv6 name to address resolver.
14. Test case 165 might fail on system which has libidn present, but with an
old iconv version (2.1.3 is a known bad version), since it doesn't recognize
the charset when named ISO8859-1. Changing the name to ISO-8859-1 makes the
test pass, but instead makes it fail on Solaris hosts that use its native
iconv.
* curl version 7.12.2 fails on AIX if compiled with --enable-ares.
13. curl version 7.12.2 fails on AIX if compiled with --enable-ares.
The workaround is to combine --enable-ares with --disable-shared
* When connecting to a SOCKS proxy, the (connect) timeout is not properly
12. When connecting to a SOCKS proxy, the (connect) timeout is not properly
acknowledged after the actual TCP connect (during the SOCKS "negotiate"
phase). Pointed out by Lucas. Fix: need to select() and timeout properly.
* Using configure --disable-[protocol] may cause 'make test' to fail for
11. Using configure --disable-[protocol] may cause 'make test' to fail for
tests using the disabled protocol(s).
* To get HTTP Negotiate authentication to work fine, you need to provide a
10. To get HTTP Negotiate authentication to work fine, you need to provide a
(fake) user name (this concerns both curl and the lib) because the code
wrongly only considers authentication if there's a user name provided.
Bug report #1004841. How? http://curl.haxx.se/mail/lib-2004-08/0182.html
* --limit-rate using -d or -F does not work. This is because the limit logic
9. --limit-rate using -d or -F does not work. This is because the limit logic
is provided by the curl app in its read/write callbacks, and when doing
-d/-F the callbacks aren't used! Bug report #921395.
* Doing resumed upload over HTTP does not work with '-C -', because curl
8. Doing resumed upload over HTTP does not work with '-C -', because curl
doesn't do a HEAD first to get the initial size. This needs to be done
manually for HTTP PUT resume to work, and then '-C [index]'.
* CURLOPT_USERPWD and CURLOPT_PROXYUSERPWD have no way of providing user names
7. CURLOPT_USERPWD and CURLOPT_PROXYUSERPWD have no way of providing user names
that contain a colon. This can't be fixed easily in a backwards compatible
way without adding new options (and then, they should most probably allow
setting user name and password separately).
* libcurl ignores empty path parts in FTP URLs, whereas RFC1738 states that
6. libcurl ignores empty path parts in FTP URLs, whereas RFC1738 states that
such parts should be sent to the server as 'CWD ' (without an argument).
The only exception to this rule, is that we knowingly break this if the
empty part is first in the path, as then we use the double slashes to
indicate that the user wants to reach the root dir (this exception SHALL
remain even when this bug is fixed).
* libcurl doesn't treat the content-length of compressed data properly, as
5. libcurl doesn't treat the content-length of compressed data properly, as
it seems HTTP servers send the *uncompressed* length in that header and
libcurl thinks of it as the *compressed* lenght. Some explanations are here:
libcurl thinks of it as the *compressed* length. Some explanations are here:
http://curl.haxx.se/mail/lib-2003-06/0146.html
* IPv6 support on AIX 4.3.3 doesn't work due to a missing sockaddr_storage
4. IPv6 support on AIX 4.3.3 doesn't work due to a missing sockaddr_storage
struct. It has been reported to work on AIX 5.1 though.
* GOPHER transfers seem broken
3. GOPHER transfers seem broken
* If a HTTP server responds to a HEAD request and includes a body (thus
2. If a HTTP server responds to a HEAD request and includes a body (thus
violating the RFC2616), curl won't wait to read the response but just stop
reading and return back. If a second request (let's assume a GET) is then
immediately made to the same server again, the connection will be re-used
@@ -63,3 +91,7 @@ may have been fixed since this was written!
and havoc is what happens.
More details on this is found in this libcurl mailing list thread:
http://curl.haxx.se/mail/lib-2002-08/0000.html
1. LDAP support requires that not only the OpenLDAP shared libraries be
present at run time, but the development libraries (liblber.so and
libldap.so) as well (not applicable to Windows).

View File

@@ -36,6 +36,9 @@ TODO
* Use 'struct lifreq' and SIOCGLIFADDR instead of 'struct ifreq' and
SIOCGIFADDR on newer Solaris versions as they claim the latter is obsolete.
* Add the following to curl_easy_getinfo(): GET_HTTP_IP, GET_FTP_IP and
GET_FTP_DATA_IP. Return a string with the used IP. Suggested by Alan.
LIBCURL - multi interface
* Add a curl_multi_fdset() alternative that returns only two arrays with file
@@ -62,6 +65,12 @@ TODO
FTP
* Make the detection of (bad) %0d and %0a codes in FTP url parts earlier in
the process to avoid doing a resolve and connect in vain.
* Code overhaul to make it more state-machine like and to _never_ block on
waiting for server responses when used with the multi interface.
* Support GSS/Kerberos 5 for ftp file transfer. This will allow user
authentication and file encryption. Possible libraries and example clients
are available from MIT or Heimdal. Requsted by Markus Moeller.
@@ -96,6 +105,10 @@ TODO
This could possibly be implemented using the multi interface to queue
requests and the response data.
* When doing CONNECT to a HTTP proxy, libcurl always uses HTTP/1.0. This has
never been reported as causing trouble to anyone, but should be considered
to use the HTTP version the user has chosen.
TELNET
* Reading input (to send to the remote server) on stdin is a crappy solution
@@ -148,6 +161,22 @@ TODO
lib/ldap.c source file and get moved to the main network code so that the
multi interface and friends will work for LDAP as well.
NEW PROTOCOLS
* TFTP - RFC1350 (protocol) and RFC3617 (URI format)
Dan Fandrich: I wrote a tftp protocol module as part of the I-Boot
bootloader under a BSD-style license with attribution clause
http://download.intrinsyc.com/supported/tools/i-boot-lite/i-boot-lite-1.8/src/libs/net/tftp.c
* RTSP - RFC2326 (protocol - very HTTP-like, also contains URL description)
* SFTP/SCP/SSH (no RFCs for protocol nor URI/URL format). An implementation
should most probably use an existing ssh library, such as OpenSSH.
* RSYNC (no RFCs for protocol nor URI/URL format). An implementation should
most probably use an existing rsync library, such as librsync.
CLIENT
* "curl --sync http://example.com/feed[1-100].rss" or

View File

@@ -1,4 +1,4 @@
Online: http://curl.haxx.se/docs/httpscripting.shtml
Online: http://curl.haxx.se/docs/httpscripting.html
Date: December 9, 2004
The Art Of Scripting HTTP Requests Using Curl

View File

@@ -1,8 +1,27 @@
.\" You can view this file with:
.\" nroff -man curl-config.1
.\" Written by Daniel Stenberg
.\" **************************************************************************
.\" * _ _ ____ _
.\" * Project ___| | | | _ \| |
.\" * / __| | | | |_) | |
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
.\" * are also available at http://curl.haxx.se/docs/copyright.html.
.\" *
.\" * 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 COPYING file.
.\" *
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
.\" * KIND, either express or implied.
.\" *
.\" * $Id$
.\" **************************************************************************
.\"
.TH curl-config 1 "11 Dec 2004" "Curl 7.10" "curl-config manual"
.TH curl-config 1 "25 Jan 2004" "Curl 7.13.0" "curl-config manual"
.SH NAME
curl-config \- Get information about a libcurl installation
.SH SYNOPSIS
@@ -32,6 +51,12 @@ to link your application with libcurl.
This is the prefix used when libcurl was installed. Libcurl is then installed
in $prefix/lib and its header files are installed in $prefix/include and so
on. The prefix is set with "configure --prefix".
.IP "--protocols"
Lists what particular protocols the installed libcurl was built to support. At
the time of writing, this list may include HTTP, HTTPS, FTP, FTPS, GOPHER,
FILE, TELNET, LDAP, DICT. Do not assume any particular order. The protocols
will be listed using uppercase and are separated by newlines. There may be
none, one or several protocols in the list. (Added in 7.13.0)
.IP "--version"
Outputs version information about the installed libcurl.
.IP "--vernum"

View File

@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -21,7 +21,7 @@
.\" * $Id$
.\" **************************************************************************
.\"
.TH curl 1 "7 Dec 2004" "Curl 7.12.3" "Curl Manual"
.TH curl 1 "25 Jan 2005" "Curl 7.13.0" "Curl Manual"
.SH NAME
curl \- transfer a URL
.SH SYNOPSIS
@@ -120,9 +120,9 @@ using \fI-D/--dump-header\fP!
If this option is set more than once, the last one will be the one that's
used.
.IP "-B/--use-ascii"
Use ASCII transfer when getting an FTP file or LDAP info. For FTP, this can
also be enforced by using an URL that ends with ";type=A". This option causes
data sent to stdout to be in text mode for win32 systems.
Enable ASCII transfer when using FTP or LDAP. For FTP, this can also be
enforced by using an URL that ends with ";type=A". This option causes data
sent to stdout to be in text mode for win32 systems.
If this option is used twice, the second one will disable ASCII usage.
.IP "--basic"
@@ -330,6 +330,12 @@ document stating so (which often also describes why and more). This flag will
prevent curl from outputting that and fail silently instead.
If this option is used twice, the second will again disable silent failure.
.IP "--ftp-account [data]"
(FTP) When an FTP server asks for "account data" after user name and password
has been provided, this data is sent off using the ACCT command. (Added in
7.13.0)
If this option is used twice, the second will override the previous use.
.IP "--ftp-create-dirs"
(FTP) When an FTP URL/operation uses a path that doesn't currently exist on
the server, the standard behavior of curl is to fail. Using this option, curl
@@ -622,6 +628,9 @@ dynamically.
Write output to a local file named like the remote file we get. (Only the file
part of the remote file is used, the path is cut off.)
The remote file name to use for saving is extracted from the given URL.
Nothing else
You may use this option as many times as you have number of URLs.
.IP "--pass <phrase>"
(SSL) Pass phrase for the private key
@@ -677,9 +686,11 @@ If used as the first parameter on the command line, the \fI$HOME/.curlrc\fP
file will not be read and used as a config file.
.IP "-Q/--quote <comand>"
(FTP) Send an arbitrary command to the remote FTP server. Quote commands are
sent BEFORE the transfer is taking place. To make commands take place after a
successful transfer, prefix them with a dash '-'. You may specify any amount
of commands to be run before and after the transfer. If the server returns
sent BEFORE the transfer is taking place (just after the initial PWD command
to be exact). To make commands take place after a successful transfer, prefix
them with a dash '-'. To make commands get sent after libcurl has changed
working directory, just before the transfer command(s), prefix the command
with '+'. You may specify any amount of commands. If the server returns
failure for one of the commands, the entire operation will be aborted. You
must send syntactically correct FTP commands as RFC959 defines.
@@ -842,7 +853,8 @@ to read for untrained humans.
If this option is used several times, the last one will be used. (Added in
7.9.7)
.IP "-u/--user <user:password>"
Specify user and password to use for server authentication.
Specify user and password to use for server authentication. Overrides
\fI-n/--netrc\fP and \fI--netrc-optional\fP.
If this option is used several times, the last one will be used.
.IP "-U/--proxy-user <user:password>"
@@ -931,6 +943,10 @@ to follow location: headers.
.B http_code
The numerical code that was found in the last retrieved HTTP(S) page.
.TP
.B http_connect
The numerical code that was found in the last response (from a proxy) to a
curl CONNECT request. (Added in 7.12.4)
.TP
.B time_total
The total time, in seconds, that the full operation lasted. The time will be
displayed with millisecond resolution.
@@ -1058,6 +1074,17 @@ Forces curl to use SSL version 2 when negotiating with a remote SSL server.
.IP "-3/--sslv3"
(HTTPS)
Forces curl to use SSL version 3 when negotiating with a remote SSL server.
.IP "--3p-quote"
(FTP) Specify arbitrary commands to send to the source server. See the
\fI-Q/--quote\fP option for details. (Added in 7.13.0)
.IP "--3p-url"
(FTP) Activates a FTP 3rd party transfer. Specifies the source URL to get a
file from, while the "normal" URL will be used as target URL, the file that
will be written/created.
Note that not all FTP server allow 3rd party transfers. (Added in 7.13.0)
.IP "--3p-user"
(FTP) Specify user:password for the source URL transfer. (Added in 7.13.0)
.IP "-4/--ipv4"
If libcurl is capable of resolving an address to multiple IP versions (which
it is if it is ipv6-capable), this option tells libcurl to resolve names to

View File

@@ -10,7 +10,7 @@ EXTRA_DIST = README curlgtk.c sepheaders.c simple.c postit2.c \
post-callback.c multi-app.c multi-double.c multi-single.c \
multi-post.c fopen.c simplepost.c makefile.dj curlx.c https.c \
multi-debugcallback.c fileupload.c getinfo.c ftp3rdparty.c debug.c \
anyauthput.c
anyauthput.c htmltitle.cc htmltidy.c
all:
@echo "done"

View File

@@ -44,6 +44,8 @@ ftpgetresp.c - get the response strings from the FTP server
ftpupload.c - upload a file to a FTP server
getinfo.c - get the Content-Type from the recent transfer
getinmemory.c - download a file to memory only
htmltitle.cc - download a HTML file and extract the <title> tag from a HTML
page using libxml
http-post.c - HTTP POST
httpput.c - HTTP PUT a local file
https.c - simple HTTPS transfer

View File

@@ -16,18 +16,16 @@
/*
* This is an example showing how to transfer a file between two remote hosts.
* 7.13.0 or later required.
*/
int main(void)
{
CURL *curl;
CURLcode res;
char sourceFileName[] = "/tmp/file";
char targetFileName[] = "/tmp/curlTargetTest.dat";
char sourceHost[] = "source";
char targetHost[] = "target";
char source_url[] = "ftp://remotehost.com/path/to/source";
char target_url[] = "ftp://aotherserver.com/path/to/dest";
char sourceUserPass[] = "user:pass";
char targetUserPass[] = "user:pass";
char url[100];
@@ -42,21 +40,22 @@ int main(void)
curl = curl_easy_init();
if (curl) {
sprintf(url, "ftp://%s@%s/%s", targetUserPass, targetHost, targetFileName);
printf("%s\n", url);
curl_easy_setopt(curl, CURLOPT_URL, url);
/* The ordinary URL is the target when speaking 3rd party transfers */
curl_easy_setopt(curl, CURLOPT_URL, target_url);
/* Set a proxy host */
curl_easy_setopt(curl, CURLOPT_SOURCE_HOST, sourceHost);
/* Set a source URL */
curl_easy_setopt(curl, CURLOPT_SOURCE_URL, source_url);
/* Set a proxy user and password */
/* Set target user and password */
curl_easy_setopt(curl, CURLOPT_USERPWD, targetUserPass);
/* Set source user and password */
curl_easy_setopt(curl, CURLOPT_SOURCE_USERPWD, sourceUserPass);
/* Set a proxy full file name */
curl_easy_setopt(curl, CURLOPT_SOURCE_PATH, sourceFileName);
/* Set a proxy passive host */
curl_easy_setopt(curl, CURLOPT_PASV_HOST, 0); /* optional */
#if 0
/* FTPPORT enables PORT on the target side, instead of PASV. */
curl_easy_setopt(curl, CURLOPT_FTPPORT, ""); /* optional */
#endif
/* build a list of commands to pass to libcurl */
source_pre_cmd = curl_slist_append(source_pre_cmd, cmd);

View File

@@ -78,8 +78,12 @@ int main(int argc, char **argv)
DLL may not use the variable's memory when passed in to it from an app
like this. */
/* and give the size of the upload (optional) */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, file_info.st_size);
/* Set the size of the file to upload (optional). If you give a *_LARGE
option you MUST make sure that the type of the passed-in argument is a
curl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you must
make sure that to pass in a type 'long' argument. */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
(curl_off_t)file_info.st_size);
/* Now run off and do what you've been told! */
res = curl_easy_perform(curl);

View File

@@ -37,7 +37,7 @@ void *myrealloc(void *ptr, size_t size)
size_t
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
register int realsize = size * nmemb;
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)data;
mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1);

118
docs/examples/htmltidy.c Normal file
View File

@@ -0,0 +1,118 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
*
* Download a document and use libtidy to parse the HTML.
* Written by Jeff Pohlmeyer
*
* LibTidy => http://tidy.sourceforge.net
*
* gcc -Wall -I/usr/local/include tidycurl.c -lcurl -ltidy -o tidycurl
*
*/
#include <stdio.h>
#include <tidy/tidy.h>
#include <tidy/buffio.h>
#include <curl/curl.h>
/* curl write callback, to fill tidy's input buffer... */
uint write_cb(char *in, uint size, uint nmemb, TidyBuffer *out)
{
uint r;
r = size * nmemb;
tidyBufAppend( out, in, r );
return(r);
}
/* Traverse the document tree */
void dumpNode(TidyDoc doc, TidyNode tnod, int indent )
{
TidyNode child;
for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) )
{
ctmbstr name = tidyNodeGetName( child );
if ( name )
{
/* if it has a name, then it's an HTML tag ... */
TidyAttr attr;
printf( "%*.*s%s ", indent, indent, "<", name);
/* walk the attribute list */
for ( attr=tidyAttrFirst(child); attr; attr=tidyAttrNext(attr) ) {
printf(tidyAttrName(attr));
tidyAttrValue(attr)?printf("=\"%s\" ",
tidyAttrValue(attr)):printf(" ");
}
printf( ">\n");
}
else {
/* if it doesn't have a name, then it's probably text, cdata, etc... */
TidyBuffer buf;
tidyBufInit(&buf);
tidyNodeGetText(doc, child, &buf);
printf("%*.*s\n", indent, indent, buf.bp?(char *)buf.bp:"");
tidyBufFree(&buf);
}
dumpNode( doc, child, indent + 4 ); /* recursive */
}
}
int main(int argc, char **argv )
{
CURL *curl;
char curl_errbuf[CURL_ERROR_SIZE];
TidyDoc tdoc;
TidyBuffer docbuf = {0};
TidyBuffer tidy_errbuf = {0};
int err;
if ( argc == 2) {
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errbuf);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, no);
curl_easy_setopt(curl, CURLOPT_VERBOSE, yes);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
tdoc = tidyCreate();
tidyOptSetBool(tdoc, TidyForceOutput, yes); /* try harder */
tidyOptSetInt(tdoc, TidyWrapLen, 4096);
tidySetErrorBuffer( tdoc, &tidy_errbuf );
tidyBufInit(&docbuf);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &docbuf);
err=curl_easy_perform(curl);
if ( !err ) {
err = tidyParseBuffer(tdoc, &docbuf); /* parse the input */
if ( err >= 0 ) {
err = tidyCleanAndRepair(tdoc); /* fix any problems */
if ( err >= 0 ) {
err = tidyRunDiagnostics(tdoc); /* load tidy error buffer */
if ( err >= 0 ) {
dumpNode( tdoc, tidyGetRoot(tdoc), 0 ); /* walk the tree */
fprintf(stderr, "%s\n", tidy_errbuf.bp); /* show errors */
}
}
}
}
else
fprintf(stderr, "%s\n", curl_errbuf);
/* clean-up */
curl_easy_cleanup(curl);
tidyBufFree(&docbuf);
tidyBufFree(&tidy_errbuf);
tidyRelease(tdoc);
return(err);
}
else
printf( "usage: %s <url>\n", argv[0] );
return(0);
}

301
docs/examples/htmltitle.cc Normal file
View File

@@ -0,0 +1,301 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
*/
// Get a web page, parse it with libxml.
//
// Written by Lars Nilsson
//
// GNU C++ compile command line suggestion (edit paths accordingly):
//
// g++ -Wall -I/opt/curl/include -I/opt/libxml/include/libxml2 htmltitle.cc \
// -o htmltitle -L/opt/curl/lib -L/opt/libxml/lib -lcurl -lxml2
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <curl/curl.h>
#include <libxml/HTMLparser.h>
//
// Case-insensitive string comparison
//
#ifdef _MSC_VER
#define COMPARE(a, b) (!stricmp((a), (b)))
#else
#define COMPARE(a, b) (!strcasecmp((a), (b)))
#endif
//
// libxml callback context structure
//
struct Context
{
Context(): addTitle(false) { }
bool addTitle;
std::string title;
};
//
// libcurl variables for error strings and returned data
static char errorBuffer[CURL_ERROR_SIZE];
static std::string buffer;
//
// libcurl write callback function
//
static int writer(char *data, size_t size, size_t nmemb,
std::string *writerData)
{
if (writerData == NULL)
return 0;
writerData->append(data, size*nmemb);
return size * nmemb;
}
//
// libcurl connection initialization
//
static bool init(CURL *&conn, char *url)
{
CURLcode code;
conn = curl_easy_init();
if (conn == NULL)
{
fprintf(stderr, "Failed to create CURL connection\n");
exit(EXIT_FAILURE);
}
code = curl_easy_setopt(conn, CURLOPT_ERRORBUFFER, errorBuffer);
if (code != CURLE_OK)
{
fprintf(stderr, "Failed to set error buffer [%d]\n", code);
return false;
}
code = curl_easy_setopt(conn, CURLOPT_URL, url);
if (code != CURLE_OK)
{
fprintf(stderr, "Failed to set URL [%s]\n", errorBuffer);
return false;
}
code = curl_easy_setopt(conn, CURLOPT_FOLLOWLOCATION, 1);
if (code != CURLE_OK)
{
fprintf(stderr, "Failed to set redirect option [%s]\n", errorBuffer);
return false;
}
code = curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, writer);
if (code != CURLE_OK)
{
fprintf(stderr, "Failed to set writer [%s]\n", errorBuffer);
return false;
}
code = curl_easy_setopt(conn, CURLOPT_WRITEDATA, &buffer);
if (code != CURLE_OK)
{
fprintf(stderr, "Failed to set write data [%s]\n", errorBuffer);
return false;
}
return true;
}
//
// libxml start element callback function
//
static void startElement(void *voidContext,
const xmlChar *name,
const xmlChar **attributes)
{
Context *context = (Context *)voidContext;
if (COMPARE((char *)name, "TITLE"))
{
context->title = "";
context->addTitle = true;
}
}
//
// libxml end element callback function
//
static void endElement(void *voidContext,
const xmlChar *name)
{
Context *context = (Context *)voidContext;
if (COMPARE((char *)name, "TITLE"))
context->addTitle = false;
}
//
// Text handling helper function
//
static void handleCharacters(Context *context,
const xmlChar *chars,
int length)
{
if (context->addTitle)
context->title.append((char *)chars, length);
}
//
// libxml PCDATA callback function
//
static void characters(void *voidContext,
const xmlChar *chars,
int length)
{
Context *context = (Context *)voidContext;
handleCharacters(context, chars, length);
}
//
// libxml CDATA callback function
//
static void cdata(void *voidContext,
const xmlChar *chars,
int length)
{
Context *context = (Context *)voidContext;
handleCharacters(context, chars, length);
}
//
// libxml SAX callback structure
//
static htmlSAXHandler saxHandler =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
startElement,
endElement,
NULL,
characters,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
cdata,
NULL
};
//
// Parse given (assumed to be) HTML text and return the title
//
static void parseHtml(const std::string &html,
std::string &title)
{
htmlParserCtxtPtr ctxt;
Context context;
ctxt = htmlCreatePushParserCtxt(&saxHandler, &context, "", 0, "",
XML_CHAR_ENCODING_NONE);
htmlParseChunk(ctxt, html.c_str(), html.size(), 0);
htmlParseChunk(ctxt, "", 0, 1);
htmlFreeParserCtxt(ctxt);
title = context.title;
}
int main(int argc, char *argv[])
{
CURL *conn = NULL;
CURLcode code;
std::string title;
// Ensure one argument is given
if (argc != 2)
{
fprintf(stderr, "Usage: %s <url>\n", argv[0]);
exit(EXIT_FAILURE);
}
curl_global_init(CURL_GLOBAL_DEFAULT);
// Initialize CURL connection
if (!init(conn, argv[1]))
{
fprintf(stderr, "Connection initializion failed\n");
exit(EXIT_FAILURE);
}
// Retrieve content for the URL
code = curl_easy_perform(conn);
curl_easy_cleanup(conn);
if (code != CURLE_OK)
{
fprintf(stderr, "Failed to get '%s' [%s]\n", argv[1], errorBuffer);
exit(EXIT_FAILURE);
}
// Parse the (assumed) HTML code
parseHtml(buffer, title);
// Display the extracted title
printf("Title: %s\n", title.c_str());
return EXIT_SUCCESS;
}

View File

@@ -19,6 +19,9 @@
* line argument to the URL also given on the command line.
*
* This example also uses its own read callback.
*
* Here's an article on how to setup a PUT handler for Apache:
* http://www.apacheweek.com/features/put
*/
size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)

View File

@@ -52,7 +52,7 @@ PDFPAGES = curl_easy_cleanup.pdf curl_easy_getinfo.pdf \
CLEANFILES = $(HTMLPAGES) $(PDFPAGES)
EXTRA_DIST = $(man_MANS) $(HTMLPAGES) index.html $(PDFPAGES)
EXTRA_DIST = $(man_MANS) $(HTMLPAGES) index.html $(PDFPAGES) libcurl.m4
MAN2HTML= roffit --mandir=. < $< >$@

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file]
.\" $Id$
.\"
.TH curl_easy_getinfo 3 "14 Dec 2004" "libcurl 7.12.3" "libcurl Manual"
.TH curl_easy_getinfo 3 "22 Dec 2004" "libcurl 7.12.3" "libcurl Manual"
.SH NAME
curl_easy_getinfo - extract information from a curl handle
.SH SYNOPSIS
@@ -27,7 +27,13 @@ The following information can be extracted:
Pass a pointer to a 'char *' to receive the last used effective URL.
.IP CURLINFO_RESPONSE_CODE
Pass a pointer to a long to receive the last received HTTP or FTP code. This
option was known as CURLINFO_HTTP_CODE in libcurl 7.10.7 and earlier.
option was known as CURLINFO_HTTP_CODE in libcurl 7.10.7 and earlier. This
will be zero if no server response code has been received. Note that a proxy's
CONNECT response should be read with \fICURLINFO_HTTP_CONNECTCODE\fP and not
this.
.IP CURLINFO_HTTP_CONNECTCODE
Pass a pointer to a long to receive the last received proxy response code to a
CONNECT request.
.IP CURLINFO_FILETIME
Pass a pointer to a long to receive the remote time of the retrieved
document. If you get -1, it can be because of many reasons (unknown, the

View File

@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -21,7 +21,7 @@
.\" * $Id$
.\" **************************************************************************
.\"
.TH curl_easy_setopt 3 "29 Nov 2004" "libcurl 7.12.3" "libcurl Manual"
.TH curl_easy_setopt 3 "25 Jan 2005" "libcurl 7.13.0" "libcurl Manual"
.SH NAME
curl_easy_setopt - set options for a curl easy handle
.SH SYNOPSIS
@@ -543,11 +543,10 @@ data to figure out the size. This is the large file version of the
.IP CURLOPT_HTTPPOST
Tells libcurl you want a multipart/formdata HTTP POST to be made and you
instruct what data to pass on to the server. Pass a pointer to a linked list
of HTTP post structs as parameter. The linked list should be a fully valid
list of 'struct HttpPost' structs properly filled in. The best and most
elegant way to do this, is to use \fIcurl_formadd(3)\fP as documented. The
data in this list must remain intact until you close this curl handle again
with \fIcurl_easy_cleanup(3)\fP.
of curl_httppost structs as parameter. . The easiest way to create such a
list, is to use \fIcurl_formadd(3)\fP as documented. The data in this list
must remain intact until you close this curl handle again with
\fIcurl_easy_cleanup(3)\fP.
Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual.
@@ -752,6 +751,22 @@ Try "AUTH SSL" first, and only if that fails try "AUTH TLS"
.IP CURLFTPAUTH_TLS
Try "AUTH TLS" first, and only if that fails try "AUTH SSL"
.RE
.IP CURLOPT_SOURCE_URL
When set, it enables a FTP third party transfer, using the set URL as source,
while \fICURLOPT_URL\fP is the target.
.IP CURLOPT_SOURCE_USERPWD
Set "username:password" to use for the source connection when doing FTP third
party transfers.
.IP CURLOPT_SOURCE_QUOTE
Exactly like \fICURLOPT_QUOTE\fP, but for the source host.
.IP CURLOPT_SOURCE_PREQUOTE
Exactly like \fICURLOPT_PREQUOTE\fP, but for the source host.
.IP CURLOPT_SOURCE_POSTQUOTE
Exactly like \fICURLOPT_POSTQUOTE\fP, but for the source host.
.IP CURLOPT_FTP_ACCOUNT
Pass a pointer to a zero-terminated string (or NULL to disable). When an FTP
server asks for "account data" after user name and password has been provided,
this data is sent off using the ACCT command. (Added in 7.13.0)
.SH PROTOCOL OPTIONS
.IP CURLOPT_TRANSFERTEXT
A non-zero parameter tells the library to use ASCII mode for ftp transfers,

View File

@@ -16,13 +16,9 @@ CURLMcode curl_multi_fdset(CURLM *multi_handle,
.SH DESCRIPTION
This function extracts file descriptor information from a given multi_handle.
libcurl returns its fd_set sets. The application can use these to select()
on. The \fIcurl_multi_perform(3)\fI function should be called as soon as one
on. The \fIcurl_multi_perform(3)\fP function should be called as soon as one
of them are ready to be read from or written to.
NOTE that once this call is made, you must not remove the sets you point to,
as libcurl will need to be able to read them. It needs them after select()
calls, to know if certain sockets are readable or writable.
You should also be aware that when doing select(), you should consider using a
rather small (single-digit number of seconds) timeout and call
\fIcurl_multi_perform\fP regularly - even if no activity has been seen on the

View File

@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -21,7 +21,7 @@
.\" * $Id$
.\" **************************************************************************
.\"
.TH libcurl-tutorial 3 "18 Jun 2004" "libcurl" "libcurl programming"
.TH libcurl-tutorial 3 "25 Jan 2005" "libcurl" "libcurl programming"
.SH NAME
libcurl-tutorial \- libcurl programming tutorial
.SH "Objective"
@@ -76,6 +76,11 @@ possibly together with a few other features that can be on and off on
different libcurls.
See also the "Features libcurl Provides" further down.
.IP "autoconf macro"
When you write your configure script to detect libcurl and setup variables
accordingly, we offer a prewritten macro that probably does everything you
need in this area. See docs/libcurl/libcurl.m4 file - it includes docs on how
to use it.
.SH "Portable Code in a Portable World"
The people behind libcurl have put a considerable effort to make libcurl work
@@ -94,9 +99,9 @@ use the library. Once for your program's entire life time. This is done using
curl_global_init()
and it takes one parameter which is a bit pattern that tells libcurl what to
initialize. Using CURL_GLOBAL_ALL will make it initialize all known internal
sub modules, and might be a good default option. The current two bits that
are specified are:
initialize. Using \fICURL_GLOBAL_ALL\fP will make it initialize all known
internal sub modules, and might be a good default option. The current two bits
that are specified are:
.RS
.IP "CURL_GLOBAL_WIN32"
which only does anything on Windows machines. When used on
@@ -113,17 +118,19 @@ application so if your program or another library already does this, this
bit should not be needed.
.RE
libcurl has a default protection mechanism that detects if curl_global_init()
hasn't been called by the time curl_easy_perform() is called and if that is
the case, libcurl runs the function itself with a guessed bit pattern. Please
note that depending solely on this is not considered nice nor very good.
libcurl has a default protection mechanism that detects if
\fIcurl_global_init(3)\fP hasn't been called by the time
\fIcurl_easy_perform(3)\fP is called and if that is the case, libcurl runs the
function itself with a guessed bit pattern. Please note that depending solely
on this is not considered nice nor very good.
When the program no longer uses libcurl, it should call curl_global_cleanup(),
which is the opposite of the init call. It will then do the reversed
operations to cleanup the resources the curl_global_init() call initialized.
When the program no longer uses libcurl, it should call
\fIcurl_global_cleanup(3)\fP, which is the opposite of the init call. It will
then do the reversed operations to cleanup the resources the
\fIcurl_global_init(3)\fP call initialized.
Repeated calls to curl_global_init() and curl_global_cleanup() should be
avoided. They should only be called once each.
Repeated calls to \fIcurl_global_init(3)\fP and \fIcurl_global_cleanup(3)\fP
should be avoided. They should only be called once each.
.SH "Features libcurl Provides"
It is considered best-practice to determine libcurl features run-time rather
@@ -153,17 +160,18 @@ It returns an easy handle. Using that you proceed to the next step: setting
up your preferred actions. A handle is just a logic entity for the upcoming
transfer or series of transfers.
You set properties and options for this handle using curl_easy_setopt(). They
control how the subsequent transfer or transfers will be made. Options remain
set in the handle until set again to something different. Alas, multiple
requests using the same handle will use the same options.
You set properties and options for this handle using
\fIcurl_easy_setopt(3)\fP. They control how the subsequent transfer or
transfers will be made. Options remain set in the handle until set again to
something different. Alas, multiple requests using the same handle will use
the same options.
Many of the options you set in libcurl are "strings", pointers to data
terminated with a zero byte. Keep in mind that when you set strings with
curl_easy_setopt(), libcurl will not copy the data. It will merely point to
the data. You MUST make sure that the data remains available for libcurl to
use until finished or until you use the same option again to point to
something else.
\fIcurl_easy_setopt(3)\fP, libcurl will not copy the data. It will merely
point to the data. You MUST make sure that the data remains available for
libcurl to use until finished or until you use the same option again to point
to something else.
One of the most basic properties to set in the handle is the URL. You set
your preferred URL to transfer with CURLOPT_URL in a manner similar to:
@@ -192,37 +200,40 @@ another property:
Using that property, you can easily pass local data between your application
and the function that gets invoked by libcurl. libcurl itself won't touch the
data you pass with CURLOPT_WRITEDATA.
data you pass with \fICURLOPT_WRITEDATA\fP.
libcurl offers its own default internal callback that'll take care of the data
if you don't set the callback with CURLOPT_WRITEFUNCTION. It will then simply
output the received data to stdout. You can have the default callback write
the data to a different file handle by passing a 'FILE *' to a file opened for
writing with the CURLOPT_WRITEDATA option.
if you don't set the callback with \fICURLOPT_WRITEFUNCTION\fP. It will then
simply output the received data to stdout. You can have the default callback
write the data to a different file handle by passing a 'FILE *' to a file
opened for writing with the \fICURLOPT_WRITEDATA\fP option.
Now, we need to take a step back and have a deep breath. Here's one of those
rare platform-dependent nitpicks. Did you spot it? On some platforms[2],
libcurl won't be able to operate on files opened by the program. Thus, if you
use the default callback and pass in a an open file with CURLOPT_WRITEDATA, it
will crash. You should therefore avoid this to make your program run fine
virtually everywhere.
use the default callback and pass in a an open file with
\fICURLOPT_WRITEDATA\fP, it will crash. You should therefore avoid this to
make your program run fine virtually everywhere.
(CURLOPT_WRITEDATA was formerly known as CURLOPT_FILE. Both names still work
and do the same thing).
(\fICURLOPT_WRITEDATA\fP was formerly known as \fICURLOPT_FILE\fP. Both names
still work and do the same thing).
If you're using libcurl as a win32 DLL, you MUST use the
\fICURLOPT_WRITEFUNCTION\fP if you set \fICURLOPT_WRITEDATA\fP - or you will
experience crashes.
There are of course many more options you can set, and we'll get back to a few
of them later. Let's instead continue to the actual transfer:
success = curl_easy_perform(easyhandle);
The \fIcurl_easy_perform(3)\fP will connect to the remote site, do the
necessary commands and receive the transfer. Whenever it receives data, it
calls the callback function we previously set. The function may get one byte
at a time, or it may get many kilobytes at once. libcurl delivers as much as
possible as often as possible. Your callback function should return the number
of bytes it "took care of". If that is not the exact same amount of bytes that
was passed to it, libcurl will abort the operation and return with an error
code.
\fIcurl_easy_perform(3)\fP will connect to the remote site, do the necessary
commands and receive the transfer. Whenever it receives data, it calls the
callback function we previously set. The function may get one byte at a time,
or it may get many kilobytes at once. libcurl delivers as much as possible as
often as possible. Your callback function should return the number of bytes it
\&"took care of". If that is not the exact same amount of bytes that was
passed to it, libcurl will abort the operation and return with an error code.
When the transfer is complete, the function returns a return code that informs
you if it succeeded in its mission or not. If a return code isn't enough for
@@ -236,12 +247,12 @@ previous
.SH "Multi-threading Issues"
libcurl is completely thread safe, except for two issues: signals and alarm
handlers. Signals are needed for a SIGPIPE handler, and the alarm() Bacall
is used to catch timeouts (mostly during ENS lookup).
handlers. Signals are needed for a SIGPIPE handler, and the alarm() call is
used to deal with timeouts (during DNS lookup).
If you are accessing HTTPS or FTPS URLs in a multi-threaded manner, you are
then of course using OpenSSL multi-threaded and it has itself a few
requirements on this. Basilio, you need to provide one or two functions to
requirements on this. Basically, you need to provide one or two functions to
allow it to function properly. For all details, see this:
http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION
@@ -322,12 +333,12 @@ CURLOPT_INFILESIZE_LARGE for all known file sizes like this[1]:
curl_easy_setopt(easyhandle, CURLOPT_INFILESIZE_LARGE, file_size);
.fi
When you call curl_easy_perform() this time, it'll perform all the necessary
operations and when it has invoked the upload it'll call your supplied
callback to get the data to upload. The program should return as much data as
possible in every invoke, as that is likely to make the upload perform as
fast as possible. The callback should return the number of bytes it wrote in
the buffer. Returning 0 will signal the end of the upload.
When you call \fIcurl_easy_perform(3)\fP this time, it'll perform all the
necessary operations and when it has invoked the upload it'll call your
supplied callback to get the data to upload. The program should return as much
data as possible in every invoke, as that is likely to make the upload perform
as fast as possible. The callback should return the number of bytes it wrote
in the buffer. Returning 0 will signal the end of the upload.
.SH "Passwords"
Many protocols use or even require that user name and password are provided
@@ -466,15 +477,14 @@ then passing that list to libcurl.
While the simple examples above cover the majority of all cases where HTTP
POST operations are required, they don't do multi-part formposts. Multi-part
formposts were introduced as a better way to post (possibly large) binary
data and was first documented in the RFC1867. They're called multi-part
because they're built by a chain of parts, each being a single unit. Each
part has its own name and contents. You can in fact create and post a
multi-part formpost with the regular libcurl POST support described above, but
that would require that you build a formpost yourself and provide to
libcurl. To make that easier, libcurl provides curl_formadd(). Using this
function, you add parts to the form. When you're done adding parts, you post
the whole form.
formposts were introduced as a better way to post (possibly large) binary data
and was first documented in the RFC1867. They're called multi-part because
they're built by a chain of parts, each being a single unit. Each part has its
own name and contents. You can in fact create and post a multi-part formpost
with the regular libcurl POST support described above, but that would require
that you build a formpost yourself and provide to libcurl. To make that
easier, libcurl provides \fIcurl_formadd(3)\fP. Using this function, you add
parts to the form. When you're done adding parts, you post the whole form.
The following example sets two simple text parts with plain textual contents,
and then a file with binary contents and upload the whole thing.
@@ -527,10 +537,10 @@ post handle:
.fi
Since all options on an easyhandle are "sticky", they remain the same until
changed even if you do call curl_easy_perform(), you may need to tell curl to
go back to a plain GET request if you intend to do such a one as your next
request. You force an easyhandle to back to GET by using the CURLOPT_HTTPGET
option:
changed even if you do call \fIcurl_easy_perform(3)\fP, you may need to tell
curl to go back to a plain GET request if you intend to do such a one as your
next request. You force an easyhandle to back to GET by using the
CURLOPT_HTTPGET option:
curl_easy_setopt(easyhandle, CURLOPT_HTTPGET, TRUE);
@@ -719,7 +729,7 @@ Mozilla javascript engine in the past.
Re-cycling the same easy handle several times when doing multiple requests is
the way to go.
After each single curl_easy_perform() operation, libcurl will keep the
After each single \fIcurl_easy_perform(3)\fP operation, libcurl will keep the
connection alive and open. A subsequent request using the same easy handle to
the same host might just be able to use the already open connection! This
reduces network impact a lot.
@@ -903,8 +913,8 @@ A little example that deletes a given file before an operation:
.fi
If you would instead want this operation (or chain of operations) to happen
_after_ the data transfer took place the option to curl_easy_setopt() would
instead be called CURLOPT_POSTQUOTE and used the exact same way.
_after_ the data transfer took place the option to \fIcurl_easy_setopt(3)\fP
would instead be called CURLOPT_POSTQUOTE and used the exact same way.
The custom FTP command will be issued to the server in the same order they are
added to the list, and if a command gets an error code returned back from the
@@ -973,9 +983,9 @@ The perhaps most advanced cookie operation libcurl offers, is saving the
entire internal cookie state back into a Netscape/Mozilla formatted cookie
file. We call that the cookie-jar. When you set a file name with
CURLOPT_COOKIEJAR, that file name will be created and all received cookies
will be stored in it when curl_easy_cleanup() is called. This enabled cookies
to get passed on properly between multiple handles without any information
getting lost.
will be stored in it when \fIcurl_easy_cleanup(3)\fP is called. This enabled
cookies to get passed on properly between multiple handles without any
information getting lost.
.SH "FTP Peculiarities We Need"
@@ -1103,46 +1113,47 @@ of how to use the easy interface. The multi interface is simply a way to make
multiple transfers at the same time, by adding up multiple easy handles in to
a "multi stack".
You create the easy handles you want and you set all the options just like
you have been told above, and then you create a multi handle with
curl_multi_init() and add all those easy handles to that multi handle with
curl_multi_add_handle().
You create the easy handles you want and you set all the options just like you
have been told above, and then you create a multi handle with
\fIcurl_multi_init(3)\fP and add all those easy handles to that multi handle
with \fIcurl_multi_add_handle(3)\fP.
When you've added the handles you have for the moment (you can still add new
ones at any time), you start the transfers by call curl_multi_perform().
ones at any time), you start the transfers by call
\fIcurl_multi_perform(3)\fP.
curl_multi_perform() is asynchronous. It will only execute as little as
possible and then return back control to your program. It is designed to
never block. If it returns CURLM_CALL_MULTI_PERFORM you better call it again
soon, as that is a signal that it still has local data to send or remote data
to receive.
\fIcurl_multi_perform(3)\fP is asynchronous. It will only execute as little as
possible and then return back control to your program. It is designed to never
block. If it returns CURLM_CALL_MULTI_PERFORM you better call it again soon,
as that is a signal that it still has local data to send or remote data to
receive.
The best usage of this interface is when you do a select() on all possible
file descriptors or sockets to know when to call libcurl again. This also
makes it easy for you to wait and respond to actions on your own
application's sockets/handles. You figure out what to select() for by using
curl_multi_fdset(), that fills in a set of fd_set variables for you with the
particular file descriptors libcurl uses for the moment.
makes it easy for you to wait and respond to actions on your own application's
sockets/handles. You figure out what to select() for by using
\fIcurl_multi_fdset(3)\fP, that fills in a set of fd_set variables for you
with the particular file descriptors libcurl uses for the moment.
When you then call select(), it'll return when one of the file handles signal
action and you then call curl_multi_perform() to allow libcurl to do what it
wants to do. Take note that libcurl does also feature some time-out code so
we advice you to never use very long timeouts on select() before you call
curl_multi_perform(), which thus should be called unconditionally every now
and then even if none of its file descriptors have signaled ready. Another
precaution you should use: always call curl_multi_fdset() immediately before
the select() call since the current set of file descriptors may change when
calling a curl function.
action and you then call \fIcurl_multi_perform(3)\fP to allow libcurl to do
what it wants to do. Take note that libcurl does also feature some time-out
code so we advice you to never use very long timeouts on select() before you
call \fIcurl_multi_perform(3)\fP, which thus should be called unconditionally
every now and then even if none of its file descriptors have signaled
ready. Another precaution you should use: always call
\fIcurl_multi_fdset(3)\fP immediately before the select() call since the
current set of file descriptors may change when calling a curl function.
If you want to stop the transfer of one of the easy handles in the stack, you
can use curl_multi_remove_handle() to remove individual easy
handles. Remember that easy handles should be curl_easy_cleanup()ed.
can use \fIcurl_multi_remove_handle(3)\fP to remove individual easy
handles. Remember that easy handles should be \fIcurl_easy_cleanup(3)\fPed.
When a transfer within the multi stack has finished, the counter of running
transfers (as filled in by curl_multi_perform()) will decrease. When the
number reaches zero, all transfers are done.
transfers (as filled in by \fIcurl_multi_perform(3)\fP) will decrease. When
the number reaches zero, all transfers are done.
curl_multi_info_read() can be used to get information about completed
\fIcurl_multi_info_read(3)\fP can be used to get information about completed
transfers. It then returns the CURLcode for each easy transfer, to allow you
to figure out success on each individual transfer.

209
docs/libcurl/libcurl.m4 Normal file
View File

@@ -0,0 +1,209 @@
# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
# [ACTION-IF-YES], [ACTION-IF-NO])
# ----------------------------------------------------------
# David Shaw <dshaw@jabberwocky.com> Jan-23-2005
#
# Checks for libcurl. DEFAULT-ACTION is the string yes or no to
# specify whether to default to --with-libcurl or --without-libcurl.
# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the
# minimum version of libcurl to accept. Pass the version as a regular
# version number like 7.10.1. If not supplied, any version is
# accepted. ACTION-IF-YES is a list of shell commands to run if
# libcurl was successfully found and passed the various tests.
# ACTION-IF-NO is a list of shell commands that are run otherwise.
# Note that using --without-libcurl does run ACTION-IF-NO.
#
# This macro defines HAVE_LIBCURL if a working libcurl setup is found,
# and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary values.
# Other useful defines are LIBCURL_FEATURE_xxx where xxx are the
# various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
# where yyy are the various protocols supported by libcurl. Both xxx
# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of
# the macro for the complete list of possible defines. Shell
# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
# defined to 'yes' for those features and protocols that were found.
# Note that xxx and yyy keep the same capitalization as in the
# curl-config list (e.g. it's "HTTP" and not "http").
#
# Users may override the detected values by doing something like:
# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure
#
# For the sake of sanity, this macro assumes that any libcurl that is
# found is after version 7.7.2, the first version that included the
# curl-config script. Note that it is very important for people
# packaging binary versions of libcurl to include this script!
# Without curl-config, we can only make educated guesses as to what
# protocols are available. Specifically, we assume that all of HTTP,
# FTP, GOPHER, FILE, TELNET, LDAP, and DICT exist, and (if SSL exists)
# HTTPS is present. All of these protocols existed when libcurl was
# first created in version 7, so this is a safe assumption. If the
# version is 7.11.0 or later, FTPS is assumed to be present as well.
# FTPS existed before then, but was not yet fully standards compliant.
AC_DEFUN([LIBCURL_CHECK_CONFIG],
[
AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL])
AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4])
AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
AH_TEMPLATE([LIBCURL_PROTOCOL_GOPHER],[Defined if libcurl supports GOPHER])
AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
AC_ARG_WITH(libcurl,
AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]),
[_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
if test "$_libcurl_with" != "no" ; then
AC_PROG_AWK
_libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
_libcurl_try_link=yes
if test -d "$_libcurl_with" ; then
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi
AC_PATH_PROG([_libcurl_config],[curl-config])
if test x$_libcurl_config != "x" ; then
AC_CACHE_CHECK([for the version of libcurl],
[libcurl_cv_lib_curl_version],
[libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`])
_libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
_libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse`
if test $_libcurl_wanted -gt 0 ; then
AC_CACHE_CHECK([for libcurl >= version $2],
[libcurl_cv_lib_version_ok],
[
if test $_libcurl_version -ge $_libcurl_wanted ; then
libcurl_cv_lib_version_ok=yes
else
libcurl_cv_lib_version_ok=no
fi
])
fi
if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
if test x"$LIBCURL_CPPFLAGS" = "x" ; then
LIBCURL_CPPFLAGS=`$_libcurl_config --cflags`
fi
if test x"$LIBCURL" = "x" ; then
LIBCURL=`$_libcurl_config --libs`
fi
# All curl-config scripts support --feature
_libcurl_features=`$_libcurl_config --feature`
# Is it modern enough to have --protocols? (7.12.4)
if test $_libcurl_version -ge 461828 ; then
_libcurl_protocols=`$_libcurl_config --protocols`
fi
else
_libcurl_try_link=no
fi
unset _libcurl_wanted
fi
if test $_libcurl_try_link = yes ; then
# we didn't find curl-config, so let's see if the user-supplied
# link line (or failing that, "-lcurl") is enough.
LIBCURL=${LIBCURL-"-lcurl"}
AC_CACHE_CHECK([whether libcurl is usable],
[libcurl_cv_lib_curl_usable],
[
_libcurl_save_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
_libcurl_save_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS $LIBCURL"
AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[
/* Try and use a few common options to force a failure if we are
missing symbols or can't link. */
int x;
curl_easy_setopt(NULL,CURLOPT_URL,NULL);
x=CURL_ERROR_SIZE;
x=CURLOPT_WRITEFUNCTION;
x=CURLOPT_FILE;
x=CURLOPT_ERRORBUFFER;
x=CURLOPT_STDERR;
x=CURLOPT_VERBOSE;
]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
CPPFLAGS=$_libcurl_save_cppflags
LDFLAGS=$_libcurl_save_ldflags
unset _libcurl_save_cppflags
unset _libcurl_save_ldflags
])
if test $libcurl_cv_lib_curl_usable = yes ; then
AC_DEFINE(HAVE_LIBCURL,1,
[Define to 1 if you have a functional curl library.])
AC_SUBST(LIBCURL_CPPFLAGS)
AC_SUBST(LIBCURL)
for _libcurl_feature in $_libcurl_features ; do
AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
done
if test "x$_libcurl_protocols" = "x" ; then
# We don't have --protocols, so just assume that all
# protocols are available
_libcurl_protocols="HTTP FTP GOPHER FILE TELNET LDAP DICT"
if test x$libcurl_feature_SSL = xyes ; then
_libcurl_protocols="$_libcurl_protocols HTTPS"
# FTPS wasn't standards-compliant until version
# 7.11.0
if test $_libcurl_version -ge 461568; then
_libcurl_protocols="$_libcurl_protocols FTPS"
fi
fi
fi
for _libcurl_protocol in $_libcurl_protocols ; do
AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
done
fi
fi
unset _libcurl_try_link
unset _libcurl_version_parse
unset _libcurl_config
unset _libcurl_feature
unset _libcurl_features
unset _libcurl_protocol
unset _libcurl_protocols
unset _libcurl_version
fi
if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
# This is the IF-NO path
ifelse([$4],,:,[$4])
else
# This is the IF-YES path
ifelse([$3],,:,[$3])
fi
unset _libcurl_with
])dnl

View File

@@ -842,25 +842,15 @@ typedef enum {
/* Enable/disable the TCP Nagle algorithm */
CINIT(TCP_NODELAY, LONG, 121),
/* When doing 3rd party transfer, set the source host name with this */
CINIT(SOURCE_HOST, OBJECTPOINT, 122),
/* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
/* When doing 3rd party transfer, set the source user and password with
this */
CINIT(SOURCE_USERPWD, OBJECTPOINT, 123),
/* When doing 3rd party transfer, set the source file path with this */
CINIT(SOURCE_PATH, OBJECTPOINT, 124),
/* When doing 3rd party transfer, set the source server's port number
with this */
CINIT(SOURCE_PORT, LONG, 125),
/* When doing 3rd party transfer, decide which server that should get the
PASV command (and the other gets the PORT).
0 (default) - The target host issues PASV.
1 - The source host issues PASV */
CINIT(PASV_HOST, LONG, 126),
/* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
/* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
/* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
/* When doing 3rd party transfer, set the source pre-quote linked list
of commands with this */
@@ -885,6 +875,17 @@ typedef enum {
CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
CINIT(IOCTLDATA, OBJECTPOINT, 131),
/* To make a 3rd party transfer, set the source URL with this */
CINIT(SOURCE_URL, OBJECTPOINT, 132),
/* When doing 3rd party transfer, set the source quote linked list of
commands with this */
CINIT(SOURCE_QUOTE, OBJECTPOINT, 133),
/* zero terminated string for pass on to the FTP server when asked for
"account" info */
CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;
@@ -910,6 +911,11 @@ typedef enum {
#define CURLOPT_PASSWDDATA -4
#define CURLOPT_CLOSEFUNCTION -5
#define CURLOPT_SOURCE_HOST -6
#define CURLOPT_SOURCE_PATH -7
#define CURLOPT_SOURCE_PORT -8
#define CURLOPT_PASV_HOST -9
#else
/* This is set if CURL_NO_OLDIES is defined at compile-time */
#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
@@ -1337,7 +1343,7 @@ typedef enum {
/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
basicly all programs ever, that want to get version information. It is
meant to be a built-in version number for what kind of struct the caller
expects. If the struct ever changes, we redfine the NOW to another enum
expects. If the struct ever changes, we redefine the NOW to another enum
from above. */
#define CURLVERSION_NOW CURLVERSION_THIRD
@@ -1347,11 +1353,11 @@ typedef struct {
unsigned int version_num; /* LIBCURL_VERSION_NUM */
const char *host; /* OS/host/cpu/machine when configured */
int features; /* bitmask, see defines below */
char *ssl_version; /* human readable string */
const char *ssl_version; /* human readable string */
long ssl_version_num; /* number */
const char *libz_version; /* human readable string */
/* protocols is terminated by an entry with a NULL protoname */
const char **protocols;
const char * const *protocols;
/* The fields below this were added in CURLVERSION_SECOND */
const char *ares;

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -28,7 +28,7 @@
/* This is the version number of the libcurl package from which this header
file origins: */
#define LIBCURL_VERSION "7.12.3-CVS"
#define LIBCURL_VERSION "7.13.1-CVS"
/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
@@ -44,12 +44,12 @@
always a greater number in a more recent release. It makes comparisons with
greater than and less than work.
*/
#define LIBCURL_VERSION_NUM 0x070c03
#define LIBCURL_VERSION_NUM 0x070d01
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 12
#define LIBCURL_VERSION_PATCH 3
#define LIBCURL_VERSION_MINOR 13
#define LIBCURL_VERSION_PATCH 1
#endif /* __CURL_CURLVER_H */

View File

@@ -67,7 +67,9 @@
#include <sys/select.h>
#endif
#ifndef _WIN32_WCE
#include <sys/socket.h>
#endif
#include <sys/time.h>
#include <sys/types.h>
#endif

357
lib/Makefile.Watcom Normal file
View File

@@ -0,0 +1,357 @@
#
# Watcom / OpenWatcom / Win32 makefile for libcurl.
# G. Vanem <giva@bgnett.no>
#
# $Id$
TARGETS = libcurl_wc.lib libcurl_wc.dll libcurl_wc_imp.lib
CC = wcc386
CFLAGS = -3r -mf -d3 -hc -zff -zgf -zq -zm -s -fr=con -w2 -fpi -oilrtfm -bt=nt -bd &
-d+ -dWIN32 -dHAVE_LONGLONG -dCURL_CA_BUNDLE=getenv("CURL_CA_BUNDLE") &
-dBUILDING_LIBCURL -dWITHOUT_MM_LIB -dHAVE_SPNEGO=1 -dENABLE_IPV6 &
-dDEBUG_THREADING_GETADDRINFO -dDEBUG=1 -dCURLDEBUG -I. -I..\include
OBJ_DIR = Watcom_obj
LIB_ARG = $(OBJ_DIR)\wlib.arg
LINK_ARG = $(OBJ_DIR)\wlink.arg
OBJS = $(OBJ_DIR)\transfer.obj $(OBJ_DIR)\file.obj &
$(OBJ_DIR)\strequal.obj $(OBJ_DIR)\timeval.obj &
$(OBJ_DIR)\easy.obj $(OBJ_DIR)\base64.obj &
$(OBJ_DIR)\security.obj $(OBJ_DIR)\hostip.obj &
$(OBJ_DIR)\krb4.obj $(OBJ_DIR)\progress.obj &
$(OBJ_DIR)\memdebug.obj $(OBJ_DIR)\formdata.obj &
$(OBJ_DIR)\http_chunks.obj $(OBJ_DIR)\cookie.obj &
$(OBJ_DIR)\strtok.obj $(OBJ_DIR)\http.obj &
$(OBJ_DIR)\connect.obj $(OBJ_DIR)\sendf.obj &
$(OBJ_DIR)\llist.obj $(OBJ_DIR)\ftp.obj &
$(OBJ_DIR)\hash.obj $(OBJ_DIR)\url.obj &
$(OBJ_DIR)\multi.obj $(OBJ_DIR)\dict.obj &
$(OBJ_DIR)\content_encoding.obj $(OBJ_DIR)\if2ip.obj &
$(OBJ_DIR)\share.obj $(OBJ_DIR)\speedcheck.obj &
$(OBJ_DIR)\http_digest.obj $(OBJ_DIR)\ldap.obj &
$(OBJ_DIR)\md5.obj $(OBJ_DIR)\ssluse.obj &
$(OBJ_DIR)\http_negotiate.obj $(OBJ_DIR)\version.obj &
$(OBJ_DIR)\http_ntlm.obj $(OBJ_DIR)\getenv.obj &
$(OBJ_DIR)\inet_pton.obj $(OBJ_DIR)\escape.obj &
$(OBJ_DIR)\strtoofft.obj $(OBJ_DIR)\mprintf.obj &
$(OBJ_DIR)\strerror.obj $(OBJ_DIR)\telnet.obj &
$(OBJ_DIR)\hostares.obj $(OBJ_DIR)\netrc.obj &
$(OBJ_DIR)\hostasyn.obj $(OBJ_DIR)\getinfo.obj &
$(OBJ_DIR)\hostip4.obj $(OBJ_DIR)\hostthre.obj &
$(OBJ_DIR)\hostip6.obj $(OBJ_DIR)\inet_ntop.obj &
$(OBJ_DIR)\hostsyn.obj $(OBJ_DIR)\parsedate.obj &
$(OBJ_DIR)\select.obj
RESOURCE = $(OBJ_DIR)\libcurl.res
all: $(OBJ_DIR) $(TARGETS) .SYMBOLIC
@echo Welcome to libcurl
$(OBJ_DIR):
mkdir $(OBJ_DIR)
libcurl_wc.lib: $(OBJS) $(LIB_ARG)
wlib -q -b -c $@ @$(LIB_ARG)
libcurl_wc.dll: $(OBJS) $(RESOURCE) $(LINK_ARG)
wlink name libcurl_wc.dll @$(LINK_ARG)
clean: .SYMBOLIC
- rm -f $(OBJS) $(RESOURCE)
vclean realclean: clean .SYMBOLIC
- rm -f $(TARGETS) $(LIB_ARG) $(LINK_ARG) libcurl_wc.map
- rmdir $(OBJ_DIR)
.ERASE
$(RESOURCE): libcurl.rc
wrc -dCURLDEBUG=1 -q -r -zm -I..\include -fo=$@ libcurl.rc
.ERASE
.c{$(OBJ_DIR)}.obj:
$(CC) $[@ $(CFLAGS) -fo=$@
@echo .
$(LIB_ARG): $(__MAKEFILES__)
%create $^@
for %f in ($(OBJS)) do @%append $^@ +- %f
$(LINK_ARG): $(__MAKEFILES__)
%create $^@
@%append $^@ system nt dll
@%append $^@ file { $(OBJS) }
@%append $^@ option quiet, map, caseexact, eliminate, implib=libcurl_wc_imp.lib,
@%append $^@ res=$(RESOURCE) libpath $(%watcom)\lib386;$(%watcom)\lib386\nt
@%append $^@ library clib3r.lib, ws2_32.lib
#
# Dependencies based on "gcc -MM .."
#
$(OBJ_DIR)\file.obj: file.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h progress.h sendf.h escape.h file.h &
speedcheck.h getinfo.h transfer.h url.h memory.h ..\include\curl\mprintf.h &
memdebug.h
$(OBJ_DIR)\timeval.obj: timeval.c timeval.h setup.h config-win32.h
$(OBJ_DIR)\base64.obj: base64.c setup.h config-win32.h ..\include\curl\mprintf.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h base64.h memory.h ..\include\curl\curl.h &
memdebug.h
$(OBJ_DIR)\hostip.obj: hostip.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h share.h strerror.h url.h &
inet_ntop.h ..\include\curl\mprintf.h memory.h memdebug.h
$(OBJ_DIR)\progress.obj: progress.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h ..\include\curl\multi.h &
..\include\curl\curl.h urldata.h cookie.h formdata.h timeval.h http_chunks.h &
hostip.h hash.h llist.h sendf.h progress.h ..\include\curl\mprintf.h
$(OBJ_DIR)\formdata.obj: formdata.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h strequal.h &
memory.h ..\include\curl\mprintf.h memdebug.h
$(OBJ_DIR)\cookie.obj: cookie.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h strequal.h strtok.h sendf.h &
memory.h memdebug.h
$(OBJ_DIR)\http.obj: http.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h transfer.h sendf.h progress.h &
base64.h strequal.h ssluse.h http_digest.h http_ntlm.h http_negotiate.h &
url.h share.h http.h memory.h select.h ..\include\curl\mprintf.h memdebug.h
$(OBJ_DIR)\sendf.obj: sendf.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h ..\include\curl\multi.h &
..\include\curl\curl.h urldata.h cookie.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h connect.h &
..\include\curl\mprintf.h memory.h strerror.h memdebug.h
$(OBJ_DIR)\ftp.obj: ftp.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h urldata.h cookie.h &
formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h sendf.h &
if2ip.h progress.h transfer.h escape.h http.h ftp.h strtoofft.h &
strequal.h ssluse.h connect.h strerror.h memory.h inet_ntop.h select.h &
..\include\curl\mprintf.h memdebug.h
$(OBJ_DIR)\url.obj: url.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h netrc.h base64.h ssluse.h if2ip.h &
transfer.h sendf.h progress.h strequal.h strerror.h escape.h strtok.h &
share.h content_encoding.h http_digest.h http_negotiate.h select.h multiif.h &
ftp.h dict.h telnet.h http.h file.h ldap.h url.h connect.h inet_ntop.h &
./ca-bundle.h ..\include\curl\mprintf.h memory.h memdebug.h
$(OBJ_DIR)\dict.obj: dict.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h transfer.h sendf.h progress.h &
strequal.h dict.h ..\include\curl\mprintf.h
$(OBJ_DIR)\if2ip.obj: if2ip.c setup.h config-win32.h
$(OBJ_DIR)\speedcheck.obj: speedcheck.c setup.h config-win32.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h urldata.h cookie.h &
formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h sendf.h &
speedcheck.h
$(OBJ_DIR)\ldap.obj: ldap.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h escape.h transfer.h &
strequal.h strtok.h ldap.h memory.h ..\include\curl\mprintf.h memdebug.h
$(OBJ_DIR)\ssluse.obj: ssluse.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h url.h inet_pton.h &
ssluse.h connect.h strequal.h select.h ..\include\curl\mprintf.h
$(OBJ_DIR)\version.obj: version.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h ..\include\curl\multi.h &
..\include\curl\curl.h urldata.h cookie.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h ..\include\curl\mprintf.h
$(OBJ_DIR)\getenv.obj: getenv.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h memory.h memdebug.h
$(OBJ_DIR)\escape.obj: escape.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h memory.h &
..\include\curl\mprintf.h memdebug.h
$(OBJ_DIR)\mprintf.obj: mprintf.c setup.h config-win32.h ..\include\curl\mprintf.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h memory.h ..\include\curl\curl.h memdebug.h
$(OBJ_DIR)\telnet.obj: telnet.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h transfer.h sendf.h telnet.h &
..\include\curl\mprintf.h arpa_telnet.h memory.h select.h memdebug.h
$(OBJ_DIR)\netrc.obj: netrc.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h netrc.h strequal.h &
strtok.h memory.h ..\include\curl\mprintf.h memdebug.h
$(OBJ_DIR)\getinfo.obj: getinfo.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h urldata.h cookie.h &
formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h &
getinfo.h memory.h ssluse.h memdebug.h
$(OBJ_DIR)\transfer.obj: transfer.c setup.h config-win32.h strtoofft.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h strequal.h urldata.h &
cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h &
netrc.h content_encoding.h transfer.h sendf.h speedcheck.h progress.h &
http.h url.h getinfo.h ssluse.h http_digest.h http_ntlm.h &
http_negotiate.h share.h memory.h select.h ..\include\curl\mprintf.h &
memdebug.h
$(OBJ_DIR)\strequal.obj: strequal.c setup.h config-win32.h strequal.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h
$(OBJ_DIR)\easy.obj: easy.c setup.h config-win32.h strequal.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h urldata.h cookie.h &
formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h &
transfer.h ssluse.h url.h getinfo.h share.h memory.h progress.h &
easyif.h ..\include\curl\mprintf.h memdebug.h
$(OBJ_DIR)\security.obj: security.c setup.h config-win32.h
$(OBJ_DIR)\krb4.obj: krb4.c setup.h config-win32.h
$(OBJ_DIR)\memdebug.obj: memdebug.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h ..\include\curl\multi.h &
..\include\curl\curl.h ..\include\curl\mprintf.h urldata.h cookie.h &
formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h memory.h memdebug.h
$(OBJ_DIR)\http_chunks.obj: http_chunks.c setup.h config-win32.h urldata.h &
cookie.h ..\include\curl\curl.h ..\include\curl\curlver.h &
..\include\curl\easy.h ..\include\curl\multi.h ..\include\curl\curl.h &
formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h sendf.h &
content_encoding.h http.h memory.h ..\include\curl\mprintf.h memdebug.h
$(OBJ_DIR)\strtok.obj: strtok.c setup.h config-win32.h strtok.h
$(OBJ_DIR)\connect.obj: connect.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h if2ip.h strerror.h connect.h &
memory.h select.h memdebug.h
$(OBJ_DIR)\llist.obj: llist.c setup.h config-win32.h llist.h memory.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h memdebug.h
$(OBJ_DIR)\hash.obj: hash.c setup.h config-win32.h hash.h llist.h memory.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h memdebug.h
$(OBJ_DIR)\multi.obj: multi.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h urldata.h cookie.h &
formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h &
transfer.h url.h connect.h progress.h memory.h easyif.h multiif.h &
memdebug.h
$(OBJ_DIR)\content_encoding.obj: content_encoding.c setup.h config-win32.h urldata.h &
cookie.h ..\include\curl\curl.h ..\include\curl\curlver.h &
..\include\curl\easy.h ..\include\curl\multi.h ..\include\curl\curl.h &
formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h sendf.h &
content_encoding.h memory.h memdebug.h
$(OBJ_DIR)\share.obj: share.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h ..\include\curl\multi.h &
..\include\curl\curl.h urldata.h cookie.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h share.h memory.h memdebug.h
$(OBJ_DIR)\http_digest.obj: http_digest.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h strequal.h base64.h md5.h &
http_digest.h strtok.h url.h memory.h ..\include\curl\mprintf.h memdebug.h
$(OBJ_DIR)\md5.obj: md5.c setup.h config-win32.h md5.h
$(OBJ_DIR)\http_negotiate.obj: http_negotiate.c setup.h config-win32.h
$(OBJ_DIR)\http_ntlm.obj: http_ntlm.c setup.h config-win32.h
$(OBJ_DIR)\inet_pton.obj: inet_pton.c setup.h config-win32.h inet_pton.h
$(OBJ_DIR)\strtoofft.obj: strtoofft.c setup.h config-win32.h strtoofft.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h
$(OBJ_DIR)\strerror.obj: strerror.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h strerror.h urldata.h &
cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h llist.h &
..\include\curl\mprintf.h
$(OBJ_DIR)\hostares.obj: hostares.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h share.h strerror.h url.h &
..\include\curl\mprintf.h memory.h memdebug.h
$(OBJ_DIR)\hostasyn.obj: hostasyn.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h share.h strerror.h url.h &
..\include\curl\mprintf.h memory.h memdebug.h
$(OBJ_DIR)\hostip4.obj: hostip4.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h share.h strerror.h url.h &
..\include\curl\mprintf.h memory.h memdebug.h
$(OBJ_DIR)\hostip6.obj: hostip6.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h share.h strerror.h url.h &
..\include\curl\mprintf.h memory.h memdebug.h
$(OBJ_DIR)\hostsyn.obj: hostsyn.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h share.h strerror.h url.h &
..\include\curl\mprintf.h memory.h memdebug.h
$(OBJ_DIR)\hostthre.obj: hostthre.c setup.h config-win32.h urldata.h cookie.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h formdata.h timeval.h &
http_chunks.h hostip.h hash.h llist.h sendf.h share.h strerror.h url.h &
..\include\curl\mprintf.h inet_ntop.h memory.h memdebug.h
$(OBJ_DIR)\inet_ntop.obj: inet_ntop.c setup.h config-win32.h ..\include\curl\mprintf.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h inet_ntop.h
$(OBJ_DIR)\parsedate.obj: parsedate.c setup.h config-win32.h ..\include\curl\curl.h &
..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h
$(OBJ_DIR)\select.obj: select.c setup.h config-win32.h select.h

View File

@@ -30,7 +30,7 @@ EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos $(DSP) \
README.ares README.curlx makefile.dj config.dj libcurl.framework.make \
libcurl.plist libcurl.rc config-amigaos.h amigaos.c amigaos.h makefile.amiga \
Makefile.netware nwlib.c libcurl.imp msvcproj.head msvcproj.foot \
config-win32ce.h README.httpauth
config-win32ce.h README.httpauth Makefile.Watcom README.hostip
CLEANFILES = $(DSP)

View File

@@ -17,4 +17,4 @@ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h base64.h hostip.h \
http_chunks.h strtok.h connect.h llist.h hash.h content_encoding.h \
share.h md5.h http_digest.h http_negotiate.h http_ntlm.h ca-bundle.h \
inet_pton.h strtoofft.h strerror.h inet_ntop.h curlx.h memory.h \
setup.h transfer.h select.h
setup.h transfer.h select.h easyif.h multiif.h

View File

@@ -35,7 +35,7 @@ IMPLIB_NAME = libcurl_imp
IMPLIB_NAME_DEBUG = libcurld_imp
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-0.9.7d
OPENSSL_PATH = ../../openssl-0.9.7e
!ENDIF
!IFNDEF ZLIB_PATH
@@ -58,6 +58,8 @@ LNKDLL = link.exe /DLL
LNKLIB = link.exe /lib
LFLAGS = /nologo
SSLLIBS = libeay32.lib ssleay32.lib
ZLIBLIBSDLL= zdll.lib
ZLIBLIBS = zlib.lib
!IFDEF USEMM_LIBS
WINLIBS = wsock32.lib winmm.lib
!ELSE
@@ -72,8 +74,8 @@ CFGSET = FALSE
!IF "$(CFG)" == "release"
TARGET = $(LIB_NAME).lib
DIROBJ = .\$(CFG)
LNK = $(LNKLIB) /out:$(TARGET)
DIROBJ = $(CFG)
LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCNODBG)
CFGSET = TRUE
!ENDIF
@@ -83,9 +85,9 @@ CFGSET = TRUE
!IF "$(CFG)" == "release-zlib"
TARGET = $(LIB_NAME).lib
DIROBJ = .\$(CFG)
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LNK = $(LNKLIB) $(LFLAGSZLIB) /out:$(TARGET)
LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCNODBG) $(CFLAGSZLIB)
CFGSET = TRUE
!ENDIF
@@ -95,8 +97,8 @@ CFGSET = TRUE
!IF "$(CFG)" == "release-dll"
TARGET = $(LIB_NAME).dll
DIROBJ = .\$(CFG)
LNK = $(LNKDLL) $(WINLIBS) /out:$(TARGET) /IMPLIB:$(IMPLIB_NAME).lib
DIROBJ = $(CFG)
LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
CC = $(CCNODBG)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
@@ -107,9 +109,9 @@ RESOURCE = $(DIROBJ)\libcurl.res
!IF "$(CFG)" == "release-ssl"
TARGET = $(LIB_NAME).lib
DIROBJ = .\$(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)/out32"
LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(TARGET)
DIROBJ = $(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
CC = $(CCNODBG) $(CFLAGSSSL)
CFGSET = TRUE
!ENDIF
@@ -118,81 +120,123 @@ CFGSET = TRUE
# release-ssl-dll
!IF "$(CFG)" == "release-ssl-dll"
TARGET = $(LIB_NAME).dll
DIROBJ = .\$(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)/out32dll"
LNK = $(LNKDLL) $(SSLLIBS) $(WINLIBS) $(LFLAGSSSL) /out:$(TARGET) /IMPLIB:$(IMPLIB_NAME).lib
TARGET = $(LIB_NAME).lib
DIROBJ = $(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
CC = $(CCNODBG) $(CFLAGSSSL)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
!ENDIF
######################
# release-ssl-zlib
!IF "$(CFG)" == "release-ssl-zlib"
TARGET = $(LIB_NAME).lib
DIROBJ = .\$(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)/out32"
DIROBJ = $(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(TARGET)
LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCNODBG) $(CFLAGSSSL) $(CFLAGSZLIB)
CFGSET = TRUE
!ENDIF
######################
# release-libcurl-ssl-dll
!IF "$(CFG)" == "release-libcurl-ssl-dll"
TARGET = $(LIB_NAME).lib
DIROBJ = .\$(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)/out32dll"
LNK = $(LNKLIB) $(SSLLIBS) $(LFLAGSSSL) /out:$(TARGET)
# release-dll-ssl-dll
!IF "$(CFG)" == "release-dll-ssl-dll"
TARGET = $(LIB_NAME).dll
DIROBJ = $(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
CC = $(CCNODBG) $(CFLAGSSSL)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
!ENDIF
######################
# release-zlib-dll
!IF "$(CFG)" == "release-zlib-dll"
TARGET = $(LIB_NAME).lib
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCNODBG) $(CFLAGSZLIB)
CFGSET = TRUE
!ENDIF
######################
# release-ssl-dll-zlib-dll
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
TARGET = $(LIB_NAME).lib
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCNODBG) $(CFLAGSSSL) $(CFLAGSZLIB)
CFGSET = TRUE
!ENDIF
######################
# release-dll-zlib-dll
!IF "$(CFG)" == "release-dll-zlib-dll"
TARGET = $(LIB_NAME).dll
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
CC = $(CCNODBG) $(CFLAGSZLIB)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
!ENDIF
######################
# release-dll-ssl-dll-zlib-dll
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
TARGET = $(LIB_NAME).dll
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
CC = $(CCNODBG) $(CFLAGSSSL) $(CFLAGSZLIB)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
!ENDIF
######################
# debug
!IF "$(CFG)" == "debug"
TARGET = $(LIB_NAME_DEBUG).lib
DIROBJ = .\$(CFG)
LNK = $(LNKLIB) /out:$(TARGET)
DIROBJ = $(CFG)
LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCDEBUG)
CFGSET = TRUE
!ENDIF
######################
# debug-dll
!IF "$(CFG)" == "debug-dll"
TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = .\$(CFG)
LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(TARGET) /IMPLIB:$(IMPLIB_NAME_DEBUG).lib /PDB:$(IMPLIB_NAME_DEBUG).pdb
CC = $(CCDEBUG)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
!ENDIF
######################
# debug-ssl
#todo
!IF "$(CFG)" == "debug-ssl"
TARGET = $(LIB_NAME_DEBUG).lib
DIROBJ = .\$(CFG)
LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(TARGET)
DIROBJ = $(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
LNK = $(LNKLIB) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
CC = $(CCDEBUG) $(CFLAGSSSL)
CFGSET = TRUE
!ENDIF
######################
# debug-zlib
!IF "$(CFG)" == "debug-zlib"
TARGET = $(LIB_NAME_DEBUG).lib
DIROBJ = .\$(CFG)
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LNK = $(LNKLIB) $(LFLAGSZLIB) /out:$(TARGET)
LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCDEBUG) $(CFLAGSZLIB)
CFGSET = TRUE
!ENDIF
@@ -201,38 +245,151 @@ CFGSET = TRUE
# debug-ssl-dll
!IF "$(CFG)" == "debug-ssl-dll"
TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = .\$(CFG)
LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)/out32dll
LNK = $(LNKDLL) $(WINLIBS) $(LFLAGSSSL) /DEBUG /out:$(TARGET) /IMPLIB:$(IMPLIB_NAME_DEBUG).lib /PDB:$(IMPLIB_NAME_DEBUG).pdb
TARGET = $(LIB_NAME_DEBUG).lib
DIROBJ = $(CFG)
LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll
LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
CC = $(CCDEBUG) $(CFLAGSSSL)
CFGSET = TRUE
!ENDIF
######################
# debug-ssl-zlib
!IF "$(CFG)" == "debug-ssl-zlib"
TARGET = $(LIB_NAME_DEBUG).lib
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
LNK = $(LNKLIB) $(SSLLIBS) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCDEBUG) $(CFLAGSSSL) $(CFLAGSZLIB)
CFGSET = TRUE
!ENDIF
######################
# debug-zlib-dll
!IF "$(CFG)" == "debug-zlib-dll"
TARGET = $(LIB_NAME_DEBUG).lib
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCDEBUG) $(CFLAGSZLIB)
CFGSET = TRUE
!ENDIF
######################
# debug-ssl-dll-zlib-dll
!IF "$(CFG)" == "debug-ssl-dll-zlib-dll"
TARGET = $(LIB_NAME_DEBUG).lib
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
CC = $(CCDEBUG) $(CFLAGSSSL) $(CFLAGSZLIB)
CFGSET = TRUE
!ENDIF
######################
# debug-dll
!IF "$(CFG)" == "debug-dll"
TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = $(CFG)
LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
CC = $(CCDEBUG)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
!ENDIF
######################
# debug-dll-ssl-dll
!IF "$(CFG)" == "debug-dll-ssl-dll"
TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = $(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
CC = $(CCDEBUG) $(CFLAGSSSL)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
!ENDIF
######################
# debug-dll-zlib-dll
!IF "$(CFG)" == "debug-dll-zlib-dll"
TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
CC = $(CCDEBUG) $(CFLAGSZLIB)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
!ENDIF
######################
# debug-dll-ssl-dll-zlib-dll
!IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll"
TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
CC = $(CCDEBUG) $(CFLAGSSSL) $(CFLAGSZLIB)
CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res
!ENDIF
#######################
# Usage
#
!IF "$(CFGSET)" == "FALSE"
!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != ""
!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-zlib - release static library with zlib
!MESSAGE release-ssl - release static library with ssl
!MESSAGE release-zlib - release static library with zlib
!MESSAGE release-ssl-zlib - release static library with ssl and zlib
!MESSAGE release-ssl-dll - release dll library with ssl
!MESSAGE release-libcurl-ssl-dll - static libcurl with shared ssl
!MESSAGE release-ssl-dll - release static library with dynamic ssl
!MESSAGE release-zlib-dll - release static library with dynamic zlib
!MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib
!MESSAGE release-dll - release dynamic library
!MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl
!MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib
!MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib
!MESSAGE debug - debug static library
!MESSAGE debug-dll - debug dll
!MESSAGE debug-zlib - debug static library with zlib
!MESSAGE debug-ssl - debug static library with ssl
!MESSAGE debug-ssl-dll - debug dll library with ssl
!MESSAGE debug-zlib - debug static library with zlib
!MESSAGE debug-ssl-zlib - debug static library with ssl and zlib
!MESSAGE debug-ssl-dll - debug static library with dynamic ssl
!MESSAGE debug-zlib-dll - debug static library with dynamic zlib
!MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib
!MESSAGE debug-dll - debug dynamic library
!MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl
!MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1
!MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib
!MESSAGE <target> can be left blank in which case all is assumed
!ERROR please choose a valid configuration "$(CFG)"
!ENDIF
#######################
# Only the clean target can be used if a config was not provided.
#
!IF "$(CFGSET)" == "FALSE"
clean:
@-erase /s *.dll 2> NUL
@-erase /s *.exp 2> NUL
@-erase /s *.idb 2> NUL
@-erase /s *.lib 2> NUL
@-erase /s *.obj 2> NUL
@-erase /s *.pch 2> NUL
@-erase /s *.pdb 2> NUL
@-erase /s *.res 2> NUL
!ELSE
# A config was provided, so the library can be built.
#
X_OBJS= \
$(DIROBJ)\base64.obj \
@@ -290,9 +447,16 @@ X_OBJS= \
all : $(TARGET)
$(TARGET): $(X_OBJS)
$(LNK) $(LFLAGS) $(X_OBJS)
-xcopy $(DIROBJ)\$(LIB_NAME).dll . /y
-xcopy $(DIROBJ)\$(LIB_NAME).lib . /y
-xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y
-xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y
-xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y
-xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y
-xcopy $(DIROBJ)\*.exp . /y
-xcopy $(DIROBJ)\*.pdb . /y
$(X_OBJS): $(DIROBJ)
@@ -305,18 +469,14 @@ $(DIROBJ):
$(CC) $(CFLAGS) /Fo"$@" $<
debug-dll\libcurl.res \
debug-ssl-dll\libcurl.res \
release-libcurl-ssl-dll\libcurl.res: libcurl.rc
debug-dll-ssl-dll\libcurl.res \
debug-dll-zlib-dll\libcurl.res \
debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
rc /dCURLDEBUG=1 /Fo $@ libcurl.rc
release-dll\libcurl.res \
release-ssl-dll\libcurl.res \
release-libcurl-ssl-dll\libcurl.res: libcurl.rc
release-dll-ssl-dll\libcurl.res \
release-dll-zlib-dll\libcurl.res \
release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
rc /dCURLDEBUG=0 /Fo $@ libcurl.rc
clean:
-@erase $(DIROBJ)\*.obj
-@erase $(DIROBJ)\*.res
-@erase vc60.idb
-@erase vc60.pch
!ENDIF # End of case where a config was provided.

35
lib/README.hostip Normal file
View File

@@ -0,0 +1,35 @@
hostip.c explained
==================
The main COMPILE-TIME DEFINES to keep in mind when reading the host*.c
source file are these:
CURLRES_IPV6 - this host has getaddrinfo() and family, and thus we use
that. The host may not be able to resolve IPv6, but we don't really have to
take that into account. Hosts that aren't IPv6-enabled have CURLRES_IPV4
defined.
CURLRES_ARES - is defined if libcurl is built to use c-ares for asynchronous
name resolves. It cannot have ENABLE_IPV6 defined at the same time, as c-ares
has no ipv6 support. This can be Windows or *nix.
CURLRES_THREADED - is defined if libcurl is built to run under (native)
Windows, and then the name resolve will be done in a new thread, and the
supported asynch API will be the same as for ares-builds.
If any of the two previous are defined, CURLRES_ASYNCH is defined too. If
libcurl is not built to use an asynchronous resolver, CURLRES_SYNCH is
defined.
The host*.c sources files are split up like this:
hostip.c - method-independent resolver functions and utility functions
hostasyn.c - functions for asynchronous name resolves
hostsyn.c - functions for synchronous name resolves
hostares.c - functions for ares-using name resolves
hostthre.c - functions for threaded name resolves
hostip4.c - ipv4-specific functions
hostip6.c - ipv6-specific functions
The hostip.h is the single united header file for all this. It defines the
CURLRES_* defines based on the config*.h and setup.h defines.

View File

@@ -39,7 +39,7 @@
/*
* The telnet options represented as strings
*/
static const char *telnetoptions[]=
static const char * const telnetoptions[]=
{
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD",
"NAME", "STATUS", "TIMING MARK", "RCTE",
@@ -78,7 +78,7 @@ static const char *telnetoptions[]=
/*
* Then those numbers represented as strings:
*/
static const char *telnetcmds[]=
static const char * const telnetcmds[]=
{
"EOF", "SUSP", "ABORT", "EOR", "SE",
"NOP", "DMARK", "BRK", "IP", "AO",

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -98,6 +98,7 @@
#include "connect.h"
#include "memory.h"
#include "select.h"
#include "url.h" /* for Curl_safefree() */
/* The last #include file should be: */
#include "memdebug.h"
@@ -429,6 +430,25 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
return rc;
}
CURLcode Curl_store_ip_addr(struct connectdata *conn)
{
char addrbuf[256];
Curl_printable_address(conn->ip_addr, addrbuf, sizeof(addrbuf));
/* save the string */
Curl_safefree(conn->ip_addr_str);
conn->ip_addr_str = strdup(addrbuf);
if(!conn->ip_addr_str)
return CURLE_OUT_OF_MEMORY; /* FAIL */
#ifdef PF_INET6
if(conn->ip_addr->ai_family == PF_INET6)
conn->bits.ipv6 = TRUE;
#endif
return CURLE_OK;
}
/* Used within the multi interface. Try next IP address, return TRUE if no
more address exists */
static bool trynextip(struct connectdata *conn,
@@ -450,6 +470,8 @@ static bool trynextip(struct connectdata *conn,
/* store the new socket descriptor */
conn->sock[sockindex] = sockfd;
conn->ip_addr = ai;
Curl_store_ip_addr(conn);
return FALSE;
}
ai = ai->ai_next;
@@ -754,7 +776,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
if(data->state.used_interface == Curl_if_multi)
/* don't hang when doing multi */
timeout_per_addr = timeout_ms = 0;
timeout_per_addr = 0;
/*
* Connecting with a Curl_addrinfo chain

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -39,6 +39,8 @@ CURLcode Curl_connecthost(struct connectdata *conn,
int Curl_ourerrno(void);
CURLcode Curl_store_ip_addr(struct connectdata *conn);
#define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */
#endif

View File

@@ -128,7 +128,7 @@ inflate_stream(struct SessionHandle *data,
}
/* Done with these bytes, exit */
if (status == Z_OK && z->avail_in == 0 && z->avail_out > 0) {
if (status == Z_OK && z->avail_in == 0) {
free(decomp);
return result;
}

View File

@@ -113,6 +113,8 @@ static void freecookie(struct Cookie *co)
free(co->value);
if(co->maxage)
free(co->maxage);
if(co->version)
free(co->version);
free(co);
}

View File

@@ -136,12 +136,12 @@ CURLcode Curl_dict(struct connectdata *conn)
}
result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"MATCH "
"%s " /* database */
"%s " /* strategy */
"%s\n" /* word */
"QUIT\n",
"%s\r\n" /* word */
"QUIT\r\n",
database,
strategy,
@@ -180,11 +180,11 @@ CURLcode Curl_dict(struct connectdata *conn)
}
result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"DEFINE "
"%s " /* database */
"%s\n" /* word */
"QUIT\n",
"%s\r\n" /* word */
"QUIT\r\n",
database,
word);
if(result)
@@ -209,9 +209,9 @@ CURLcode Curl_dict(struct connectdata *conn)
ppath[i] = ' ';
}
result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"%s\n"
"QUIT\n", ppath);
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"%s\r\n"
"QUIT\r\n", ppath);
if(result)
failf(data, "Failed sending DICT request");
else

View File

@@ -82,6 +82,7 @@
#include "share.h"
#include "memory.h"
#include "progress.h"
#include "easyif.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -165,8 +166,8 @@ static void idna_init (void)
#endif /* USE_LIBIDN */
/* true globals -- for curl_global_init() and curl_global_cleanup() */
static unsigned int initialized = 0;
static long init_flags = 0;
static unsigned int initialized;
static long init_flags;
/*
* If a memory-using function (like curl_getenv) is used before
@@ -354,6 +355,89 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
return ret;
}
#ifdef CURL_MULTIEASY
/***************************************************************************
* This function is still only for testing purposes. It makes a great way
* to run the full test suite on the multi interface instead of the easy one.
***************************************************************************
*
* The *new* curl_easy_perform() is the external interface that performs a
* transfer previously setup.
*
* Wrapper-function that: creates a multi handle, adds the easy handle to it,
* runs curl_multi_perform() until the transfer is done, then detaches the
* easy handle, destroys the multi handle and returns the easy handle's return
* code. This will make everything internally use and assume multi interface.
*/
CURLcode curl_easy_perform(CURL *easy)
{
CURLM *multi;
CURLMcode mcode;
CURLcode code = CURLE_OK;
int still_running;
struct timeval timeout;
int rc;
CURLMsg *msg;
fd_set fdread;
fd_set fdwrite;
fd_set fdexcep;
int maxfd;
if(!easy)
return CURLE_BAD_FUNCTION_ARGUMENT;
multi = curl_multi_init();
if(!multi)
return CURLE_OUT_OF_MEMORY;
mcode = curl_multi_add_handle(multi, easy);
if(mcode) {
curl_multi_cleanup(multi);
return CURLE_FAILED_INIT;
}
/* we start some action by calling perform right away */
do {
while(CURLM_CALL_MULTI_PERFORM ==
curl_multi_perform(multi, &still_running));
if(!still_running)
break;
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
FD_ZERO(&fdexcep);
/* timeout once per second */
timeout.tv_sec = 1;
timeout.tv_usec = 0;
/* get file descriptors from the transfers */
curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
if(rc == -1)
/* select error */
break;
/* timeout or data to send/receive => loop! */
} while(still_running);
msg = curl_multi_info_read(multi, &rc);
if(msg)
code = msg->data.result;
mcode = curl_multi_remove_handle(multi, easy);
/* what to do if it fails? */
mcode = curl_multi_cleanup(multi);
/* what to do if it fails? */
return code;
}
#else
/*
* curl_easy_perform() is the external interface that performs a transfer
* previously setup.
@@ -388,6 +472,7 @@ CURLcode curl_easy_perform(CURL *curl)
return Curl_perform(data);
}
#endif
/*
* curl_easy_cleanup() is the external interface to cleaning/freeing the given
@@ -403,6 +488,15 @@ void curl_easy_cleanup(CURL *curl)
Curl_close(data);
}
/*
* Store a pointed to the multi handle within the easy handle's data struct.
*/
void Curl_easy_addmulti(struct SessionHandle *data,
void *multi)
{
data->multi = multi;
}
/*
* curl_easy_getinfo() is an external interface that allows an app to retrieve
* information from a performed transfer and similar.

31
lib/easyif.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef __EASYIF_H
#define __EASYIF_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* 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 COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
/*
* Prototypes for library-wide functions provided by easy.c
*/
void Curl_easy_addmulti(struct SessionHandle *data, void *multi);
#endif /* __EASYIF_H */

View File

@@ -1539,7 +1539,7 @@ void curl_formfree(struct curl_httppost *form)
char *Curl_FormBoundary(void)
{
char *retstring;
static int randomizer=0; /* this is just so that two boundaries within
static int randomizer; /* this is just so that two boundaries within
the same form won't be identical */
size_t i;

175
lib/ftp.c
View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -149,6 +149,14 @@ static void freedirs(struct FTP *ftp)
}
}
/* Returns non-zero iff the given string contains CR (0x0D) or LF (0x0A), which
are not allowed within RFC 959 <string>.
*/
static bool isBadFtpString(const char *string)
{
return strchr(string, 0x0D) != NULL || strchr(string, 0x0A) != NULL;
}
/***********************************************************************
*
* AllowServerConnect()
@@ -360,7 +368,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
/* output debug output if that is requested */
if(data->set.verbose)
Curl_debug(data, CURLINFO_HEADER_IN, line_start, perline, conn->host.dispname);
Curl_debug(data, CURLINFO_HEADER_IN, line_start, perline, conn);
/*
* We pass all response-lines to the callback function registered
@@ -474,6 +482,9 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
/* no need to duplicate them, this connectdata struct won't change */
ftp->user = conn->user;
ftp->passwd = conn->passwd;
if (isBadFtpString(ftp->user) || isBadFtpString(ftp->passwd)) {
return CURLE_URL_MALFORMAT;
}
ftp->response_time = 3600; /* set default response time-out */
#ifndef CURL_DISABLE_HTTP
@@ -582,7 +593,7 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
if(ftpcode == 530) {
/* 530 User ... access denied
(the server denies to log the specified user) */
failf(data, "Access denied: %s", &buf[4]);
failf(data, "Access denied: %03d", ftpcode);
return CURLE_FTP_ACCESS_DENIED;
}
else if(ftpcode == 331) {
@@ -599,7 +610,7 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
or
530 Sorry, the maximum number of allowed users are already connected
*/
failf(data, "not logged in: %s", &buf[4]);
failf(data, "not logged in: %03d", ftpcode);
return CURLE_FTP_USER_PASSWORD_INCORRECT;
}
else if(ftpcode/100 == 2) {
@@ -610,6 +621,23 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
infof(data, "We have successfully logged in\n");
}
else if(ftpcode == 332) {
/* 332 Please provide account info */
if(data->set.ftp_account) {
FTPSENDF(conn, "ACCT %s", data->set.ftp_account);
result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
if(!result && (ftpcode != 230)) {
failf(data, "ACCT rejected by server: %03d", ftpcode);
result = CURLE_FTP_WEIRD_PASS_REPLY; /* FIX */
}
}
else {
failf(data, "ACCT requested by none available");
result = CURLE_FTP_WEIRD_PASS_REPLY;
}
if(result)
return result;
}
else {
failf(data, "Odd return code after PASS");
return CURLE_FTP_WEIRD_PASS_REPLY;
@@ -1099,25 +1127,34 @@ CURLcode ftp_use_port(struct connectdata *conn)
*
*/
struct addrinfo hints, *res, *ai;
struct addrinfo *res, *ai;
struct sockaddr_storage ss;
socklen_t sslen;
char hbuf[NI_MAXHOST];
char hbuf[NI_MAXHOST]="";
struct sockaddr *sa=(struct sockaddr *)&ss;
unsigned char *ap;
unsigned char *pp;
char portmsgbuf[1024], tmp[1024];
enum ftpcommand { EPRT, LPRT, PORT, DONE } fcmd;
const char *mode[] = { "EPRT", "LPRT", "PORT", NULL };
int rc;
int error;
char *host=NULL;
struct Curl_dns_entry *h=NULL;
if(data->set.ftpport && (strlen(data->set.ftpport) > 1)) {
/* attempt to get the address of the given interface name */
if(!Curl_if2ip(data->set.ftpport, hbuf, sizeof(hbuf)))
/* not an interface, use the given string as host name instead */
host = data->set.ftpport;
else
host = hbuf; /* use the hbuf for host name */
} /* data->set.ftpport */
if(!host) {
/* not an interface and not a host name, get default by extracting
the IP from the control connection */
/*
* we should use Curl_if2ip? given pickiness of recent ftpd,
* I believe we should use the same address as the control connection.
*/
sslen = sizeof(ss);
rc = getsockname(conn->sock[FIRSTSOCKET], (struct sockaddr *)&ss, &sslen);
if(rc < 0) {
@@ -1125,27 +1162,27 @@ CURLcode ftp_use_port(struct connectdata *conn)
return CURLE_FTP_PORT_FAILED;
}
rc = getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf), NULL, 0,
NIFLAGS);
rc = getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf), NULL,
0, NIFLAGS);
if(rc) {
failf(data, "getnameinfo() returned %d\n", rc);
return CURLE_FTP_PORT_FAILED;
}
memset(&hints, 0, sizeof(hints));
hints.ai_family = sa->sa_family;
/*hints.ai_family = ss.ss_family;
this way can be used if sockaddr_storage is properly defined, as glibc
2.1.X doesn't do*/
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
rc = getaddrinfo(hbuf, NULL, &hints, &res);
if(rc) {
failf(data, "getaddrinfo() returned %d\n", rc);
return CURLE_FTP_PORT_FAILED;
host = hbuf; /* use this host name */
}
rc = Curl_resolv(conn, host, 0, &h);
if(rc == CURLRESOLV_PENDING)
rc = Curl_wait_for_resolv(conn, &h);
if(h) {
res = h->addr;
/* when we return from this function, we can forget about this entry
to we can unlock it now already */
Curl_resolv_unlock(data, h);
} /* (h) */
else
res = NULL; /* failure! */
portsock = CURL_SOCKET_BAD;
error = 0;
for (ai = res; ai; ai = ai->ai_next) {
@@ -1153,14 +1190,13 @@ CURLcode ftp_use_port(struct connectdata *conn)
* Workaround for AIX5 getaddrinfo() problem (it doesn't set ai_socktype):
*/
if (ai->ai_socktype == 0)
ai->ai_socktype = hints.ai_socktype;
ai->ai_socktype = SOCK_STREAM;
portsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (portsock == CURL_SOCKET_BAD) {
error = Curl_ourerrno();
continue;
}
if (bind(portsock, ai->ai_addr, ai->ai_addrlen) < 0) {
error = Curl_ourerrno();
sclose(portsock);
@@ -1177,7 +1213,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
break;
}
freeaddrinfo(res);
if (portsock == CURL_SOCKET_BAD) {
failf(data, "%s", Curl_strerror(conn,error));
return CURLE_FTP_PORT_FAILED;
@@ -1190,15 +1226,12 @@ CURLcode ftp_use_port(struct connectdata *conn)
}
#ifdef PF_INET6
if(!conn->bits.ftp_use_eprt &&
(conn->ip_addr->ai_family == PF_INET6)) {
if(!conn->bits.ftp_use_eprt && conn->bits.ipv6)
/* EPRT is disabled but we are connected to a IPv6 host, so we ignore the
request! */
request and enable EPRT again! */
conn->bits.ftp_use_eprt = TRUE;
}
#endif
for (fcmd = EPRT; fcmd != DONE; fcmd++) {
int lprtaf, eprtaf;
int alen=0, plen=0;
@@ -1528,12 +1561,10 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
char newhost[NEWHOST_BUFSIZE];
#ifdef PF_INET6
if(!conn->bits.ftp_use_epsv &&
(conn->ip_addr->ai_family == PF_INET6)) {
if(!conn->bits.ftp_use_epsv && conn->bits.ipv6)
/* EPSV is disabled but we are connected to a IPv6 host, so we ignore the
request! */
request and enable EPSV again! */
conn->bits.ftp_use_epsv = TRUE;
}
#endif
for (modeoff = (conn->bits.ftp_use_epsv?0:1);
@@ -1583,7 +1614,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
}
if(!*str) {
failf(data, "Couldn't interpret this 227-reply: %s", buf);
failf(data, "Couldn't interpret the 227-reply");
return CURLE_FTP_WEIRD_227_FORMAT;
}
@@ -1618,7 +1649,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
newport = num;
/* We must use the same IP we are already connected to */
Curl_printable_address(conn->ip_addr, newhost, NEWHOST_BUFSIZE);
snprintf(newhost, NEWHOST_BUFSIZE, "%s", conn->ip_addr_str);
}
}
else
@@ -1817,7 +1848,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
return result;
if(ftpcode>=400) {
failf(data, "Failed FTP upload:%s", buf+3);
failf(data, "Failed FTP upload: %03d", ftpcode);
/* oops, we never close the sockets! */
return CURLE_FTP_COULDNT_STOR_FILE;
}
@@ -2011,7 +2042,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
return result;
if(ftpcode != 350) {
failf(data, "Couldn't use REST: %s", buf+4);
failf(data, "Couldn't use REST: %03d", ftpcode);
return CURLE_FTP_COULDNT_USE_REST;
}
}
@@ -2125,7 +2156,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
ftp->no_transfer = TRUE; /* don't think we should download anything */
}
else {
failf(data, "%s", buf+4);
failf(data, "RETR failed: %03d", ftpcode);
return CURLE_FTP_COULDNT_RETR_FILE;
}
}
@@ -2356,7 +2387,7 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
break;
if(conn->data->set.verbose)
Curl_debug(conn->data, CURLINFO_HEADER_OUT, sptr, bytes_written, conn->host.dispname);
Curl_debug(conn->data, CURLINFO_HEADER_OUT, sptr, bytes_written, conn);
if(bytes_written != (ssize_t)write_len) {
write_len -= bytes_written;
@@ -2542,6 +2573,9 @@ static CURLcode ftp_3rdparty_pretransfer(struct connectdata *conn)
struct SessionHandle *data = conn->data;
struct connectdata *sec_conn = conn->sec_conn;
conn->xfertype = TARGET3RD;
sec_conn->xfertype = SOURCE3RD;
/* sets transfer type */
result = ftp_transfertype(conn, data->set.ftp_ascii);
if (result)
@@ -2585,7 +2619,7 @@ static CURLcode ftp_3rdparty_transfer(struct connectdata *conn)
struct connectdata *pasv_conn;
struct connectdata *port_conn;
if (data->set.pasvHost == CURL_TARGET_PASV) {
if (data->set.ftpport == NULL) {
pasv_conn = conn;
port_conn = sec_conn;
}
@@ -2601,9 +2635,11 @@ static CURLcode ftp_3rdparty_transfer(struct connectdata *conn)
/* sets the passive mode */
FTPSENDF(pasv_conn, "%s", "PASV");
result = Curl_GetFTPResponse(&nread, pasv_conn, &ftpcode);
if (result) return result;
if (result)
return result;
if (ftpcode != 227) {
failf(data, "Odd return code after PASV:%s", buf + 3);
failf(data, "Odd return code after PASV: %03d", ftpcode);
return CURLE_FTP_WEIRD_PASV_REPLY;
}
@@ -2615,7 +2651,7 @@ static CURLcode ftp_3rdparty_transfer(struct connectdata *conn)
}
if (!*str) {
failf(pasv_conn->data, "Couldn't interpret this 227-reply: %s", buf);
failf(pasv_conn->data, "Couldn't interpret the 227-reply");
return CURLE_FTP_WEIRD_227_FORMAT;
}
@@ -2629,7 +2665,7 @@ static CURLcode ftp_3rdparty_transfer(struct connectdata *conn)
return result;
if (ftpcode != 200) {
failf(data, "PORT command attempts failed:%s", buf + 3);
failf(data, "PORT command attempts failed: %03d", ftpcode);
return CURLE_FTP_PORT_FAILED;
}
@@ -2637,41 +2673,44 @@ static CURLcode ftp_3rdparty_transfer(struct connectdata *conn)
stor_cmd = data->set.ftp_append?"APPE":"STOR";
/* transfers file between remote hosts */
FTPSENDF(sec_conn, "RETR %s", data->set.source_path);
/* FIX: this should send a series of CWD commands and then RETR only the
ftp->file file. The conn->path "full path" is not unescaped. Test case
230 tests this. */
FTPSENDF(sec_conn, "RETR %s", sec_conn->path);
if(data->set.pasvHost == CURL_TARGET_PASV) {
if(!data->set.ftpport) {
result = Curl_GetFTPResponse(&nread, sec_conn, &ftpcode);
if (result)
return result;
if (ftpcode != 150) {
failf(data, "Failed RETR: %s", buf + 4);
if((ftpcode != 150) && (ftpcode != 125)) {
failf(data, "Failed RETR: %03d", ftpcode);
return CURLE_FTP_COULDNT_RETR_FILE;
}
result = Curl_ftpsendf(conn, "%s %s", stor_cmd, conn->path);
result = Curl_ftpsendf(conn, "%s %s", stor_cmd, conn->proto.ftp->file);
if(CURLE_OK == result)
result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
if (result)
return result;
if (ftpcode != 150) {
failf(data, "Failed FTP upload: %s", buf + 4);
if (ftpcode >= 400) {
failf(data, "Failed FTP upload: %03d", ftpcode);
return CURLE_FTP_COULDNT_STOR_FILE;
}
}
else {
result = Curl_ftpsendf(conn, "%s %s", stor_cmd, conn->path);
result = Curl_ftpsendf(conn, "%s %s", stor_cmd, conn->proto.ftp->file);
if(CURLE_OK == result)
result = Curl_GetFTPResponse(&nread, sec_conn, &ftpcode);
if (result)
return result;
if (ftpcode != 150) {
failf(data, "Failed FTP upload: %s", buf + 4);
if (ftpcode >= 400) {
failf(data, "Failed FTP upload: %03d", ftpcode);
return CURLE_FTP_COULDNT_STOR_FILE;
}
@@ -2679,8 +2718,8 @@ static CURLcode ftp_3rdparty_transfer(struct connectdata *conn)
if (result)
return result;
if (ftpcode != 150) {
failf(data, "Failed FTP upload: %s", buf + 4);
if((ftpcode != 150) && (ftpcode != 125)) {
failf(data, "Failed FTP upload: %03d", ftpcode);
return CURLE_FTP_COULDNT_STOR_FILE;
}
}
@@ -2715,10 +2754,9 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
ftp->dirdepth = 0;
ftp->diralloc = 5; /* default dir depth to allocate */
ftp->dirs = (char **)malloc(ftp->diralloc * sizeof(ftp->dirs[0]));
ftp->dirs = (char **)calloc(ftp->diralloc, sizeof(ftp->dirs[0]));
if(!ftp->dirs)
return CURLE_OUT_OF_MEMORY;
ftp->dirs[0] = NULL; /* to start with */
/* parse the URL path into separate path components */
while((slash_pos=strchr(cur_pos, '/'))) {
@@ -2738,6 +2776,10 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
freedirs(ftp);
return CURLE_OUT_OF_MEMORY;
}
if (isBadFtpString(ftp->dirs[ftp->dirdepth])) {
freedirs(ftp);
return CURLE_URL_MALFORMAT;
}
}
else {
cur_pos = slash_pos + 1; /* jump to the rest of the string */
@@ -2752,6 +2794,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
ftp->diralloc *= 2; /* double the size each time */
bigger = realloc(ftp->dirs, ftp->diralloc * sizeof(ftp->dirs[0]));
if(!bigger) {
ftp->dirdepth--;
freedirs(ftp);
return CURLE_OUT_OF_MEMORY;
}
@@ -2769,6 +2812,10 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
failf(data, "no memory");
return CURLE_OUT_OF_MEMORY;
}
if (isBadFtpString(ftp->file)) {
freedirs(ftp);
return CURLE_URL_MALFORMAT;
}
}
else
ftp->file=NULL; /* instead of point to a zero byte, we make it a NULL

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -50,12 +50,11 @@ hash_str(const char *key, size_t key_length)
static void
hash_element_dtor(void *user, void *element)
{
curl_hash *h = (curl_hash *) user;
curl_hash_element *e = (curl_hash_element *) element;
struct curl_hash *h = (struct curl_hash *) user;
struct curl_hash_element *e = (struct curl_hash_element *) element;
if (e->key) {
if (e->key)
free(e->key);
}
h->dtor(e->ptr);
@@ -64,7 +63,7 @@ hash_element_dtor(void *user, void *element)
/* return 1 on error, 0 is fine */
int
Curl_hash_init(curl_hash *h, int slots, curl_hash_dtor dtor)
Curl_hash_init(struct curl_hash *h, int slots, curl_hash_dtor dtor)
{
int i;
@@ -72,7 +71,7 @@ Curl_hash_init(curl_hash *h, int slots, curl_hash_dtor dtor)
h->size = 0;
h->slots = slots;
h->table = (curl_llist **) malloc(slots * sizeof(curl_llist *));
h->table = (struct curl_llist **) malloc(slots * sizeof(struct curl_llist *));
if(h->table) {
for (i = 0; i < slots; ++i) {
h->table[i] = Curl_llist_alloc((curl_llist_dtor) hash_element_dtor);
@@ -89,12 +88,12 @@ Curl_hash_init(curl_hash *h, int slots, curl_hash_dtor dtor)
return 1; /* failure */
}
curl_hash *
struct curl_hash *
Curl_hash_alloc(int slots, curl_hash_dtor dtor)
{
curl_hash *h;
struct curl_hash *h;
h = (curl_hash *) malloc(sizeof(curl_hash));
h = (struct curl_hash *) malloc(sizeof(struct curl_hash));
if (h) {
if(Curl_hash_init(h, slots, dtor)) {
/* failure */
@@ -118,11 +117,11 @@ hash_key_compare(char *key1, size_t key1_len, char *key2, size_t key2_len)
return 0;
}
static curl_hash_element *
static struct curl_hash_element *
mk_hash_element(char *key, size_t key_len, const void *p)
{
curl_hash_element *he =
(curl_hash_element *) malloc(sizeof(curl_hash_element));
struct curl_hash_element *he =
(struct curl_hash_element *) malloc(sizeof(struct curl_hash_element));
if(he) {
char *dup = strdup(key);
@@ -147,14 +146,14 @@ mk_hash_element(char *key, size_t key_len, const void *p)
/* Return the data in the hash. If there already was a match in the hash,
that data is returned. */
void *
Curl_hash_add(curl_hash *h, char *key, size_t key_len, void *p)
Curl_hash_add(struct curl_hash *h, char *key, size_t key_len, void *p)
{
curl_hash_element *he;
curl_llist_element *le;
curl_llist *l = FETCH_LIST(h, key, key_len);
struct curl_hash_element *he;
struct curl_llist_element *le;
struct curl_llist *l = FETCH_LIST(h, key, key_len);
for (le = l->head; le; le = le->next) {
he = (curl_hash_element *) le->ptr;
he = (struct curl_hash_element *) le->ptr;
if (hash_key_compare(he->key, he->key_len, key, key_len)) {
h->dtor(p); /* remove the NEW entry */
return he->ptr; /* return the EXISTING entry */
@@ -181,11 +180,11 @@ Curl_hash_add(curl_hash *h, char *key, size_t key_len, void *p)
}
void *
Curl_hash_pick(curl_hash *h, char *key, size_t key_len)
Curl_hash_pick(struct curl_hash *h, char *key, size_t key_len)
{
curl_llist_element *le;
curl_hash_element *he;
curl_llist *l = FETCH_LIST(h, key, key_len);
struct curl_llist_element *le;
struct curl_hash_element *he;
struct curl_llist *l = FETCH_LIST(h, key, key_len);
for (le = l->head;
le;
@@ -204,7 +203,7 @@ void
Curl_hash_apply(curl_hash *h, void *user,
void (*cb)(void *user, void *ptr))
{
curl_llist_element *le;
struct curl_llist_element *le;
int i;
for (i = 0; i < h->slots; ++i) {
@@ -219,7 +218,7 @@ Curl_hash_apply(curl_hash *h, void *user,
#endif
void
Curl_hash_clean(curl_hash *h)
Curl_hash_clean(struct curl_hash *h)
{
int i;
@@ -231,19 +230,19 @@ Curl_hash_clean(curl_hash *h)
}
void
Curl_hash_clean_with_criterium(curl_hash *h, void *user,
Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,
int (*comp)(void *, void *))
{
curl_llist_element *le;
curl_llist_element *lnext;
curl_llist *list;
struct curl_llist_element *le;
struct curl_llist_element *lnext;
struct curl_llist *list;
int i;
for (i = 0; i < h->slots; ++i) {
list = h->table[i];
le = list->head; /* get first list entry */
while(le) {
curl_hash_element *he = le->ptr;
struct curl_hash_element *he = le->ptr;
lnext = le->next;
/* ask the callback function if we shall remove this entry or not */
if (comp(user, he->ptr)) {
@@ -256,7 +255,7 @@ Curl_hash_clean_with_criterium(curl_hash *h, void *user,
}
void
Curl_hash_destroy(curl_hash *h)
Curl_hash_destroy(struct curl_hash *h)
{
if (!h)
return;

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -31,30 +31,31 @@
typedef void (*curl_hash_dtor)(void *);
typedef struct _curl_hash {
curl_llist **table;
struct curl_hash {
struct curl_llist **table;
curl_hash_dtor dtor;
int slots;
size_t size;
} curl_hash;
};
typedef struct _curl_hash_element {
struct curl_hash_element {
void *ptr;
char *key;
size_t key_len;
} curl_hash_element;
};
int Curl_hash_init(curl_hash *, int, curl_hash_dtor);
curl_hash *Curl_hash_alloc(int, curl_hash_dtor);
void *Curl_hash_add(curl_hash *, char *, size_t, void *);
int Curl_hash_delete(curl_hash *h, char *key, size_t key_len);
void *Curl_hash_pick(curl_hash *, char *, size_t);
void Curl_hash_apply(curl_hash *h, void *user,
int Curl_hash_init(struct curl_hash *, int, curl_hash_dtor);
struct curl_hash *Curl_hash_alloc(int, curl_hash_dtor);
void *Curl_hash_add(struct curl_hash *, char *, size_t, void *);
int Curl_hash_delete(struct curl_hash *h, char *key, size_t key_len);
void *Curl_hash_pick(struct curl_hash *, char *, size_t);
void Curl_hash_apply(struct curl_hash *h, void *user,
void (*cb)(void *user, void *ptr));
int Curl_hash_count(curl_hash *h);
void Curl_hash_clean(curl_hash *h);
void Curl_hash_clean_with_criterium(curl_hash *h, void *user, int (*comp)(void *, void *));
void Curl_hash_destroy(curl_hash *h);
int Curl_hash_count(struct curl_hash *h);
void Curl_hash_clean(struct curl_hash *h);
void Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,
int (*comp)(void *, void *));
void Curl_hash_destroy(struct curl_hash *h);
#endif

View File

@@ -249,7 +249,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
/* close the connection, since we can't return failure here without
cleaning up this connection properly */
Curl_disconnect(conn);
conn->bits.close = TRUE;
}
return rc;
@@ -291,7 +291,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname(data->state.areschannel, hostname, PF_INET,
Curl_addrinfo4_callback, conn);
(ares_host_callback)Curl_addrinfo4_callback, conn);
*waitp = TRUE; /* please wait for the response */
}

View File

@@ -108,12 +108,13 @@
*
* The storage operation locks and unlocks the DNS cache.
*/
static void addrinfo_callback(void *arg, /* "struct connectdata *" */
static CURLcode addrinfo_callback(void *arg, /* "struct connectdata *" */
int status,
void *addr)
{
struct connectdata *conn = (struct connectdata *)arg;
struct Curl_dns_entry *dns = NULL;
CURLcode rc = CURLE_OK;
conn->async.status = status;
@@ -135,13 +136,17 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */
dns = Curl_cache_addr(data, ai,
conn->async.hostname,
conn->async.port);
if(!dns)
if(!dns) {
/* failed to store, cleanup and return error */
Curl_freeaddrinfo(ai);
rc = CURLE_OUT_OF_MEMORY;
}
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
}
else
rc = CURLE_OUT_OF_MEMORY;
}
conn->async.dns = dns;
@@ -153,21 +158,22 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */
/* ipv4: The input hostent struct will be freed by ares when we return from
this function */
return rc;
}
void Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */
CURLcode Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */
int status,
struct hostent *hostent)
{
addrinfo_callback(arg, status, hostent);
return addrinfo_callback(arg, status, hostent);
}
#ifdef CURLRES_IPV6
void Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */
CURLcode Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */
int status,
struct addrinfo *ai)
{
addrinfo_callback(arg, status, ai);
return addrinfo_callback(arg, status, ai);
}
#endif

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -131,7 +131,7 @@
*/
/* These two symbols are for the global DNS cache */
static curl_hash hostname_cache;
static struct curl_hash hostname_cache;
static int host_cache_initialized;
static void freednsentry(void *freethis);
@@ -152,7 +152,7 @@ void Curl_global_host_cache_init(void)
/*
* Return a pointer to the global cache
*/
curl_hash *Curl_global_host_cache_get(void)
struct curl_hash *Curl_global_host_cache_get(void)
{
return &hostname_cache;
}
@@ -244,7 +244,7 @@ hostcache_timestamp_remove(void *datap, void *hc)
* Prune the DNS cache. This assumes that a lock has already been taken.
*/
static void
hostcache_prune(curl_hash *hostcache, int cache_timeout, time_t now)
hostcache_prune(struct curl_hash *hostcache, int cache_timeout, time_t now)
{
struct hostcache_prune_data user;
@@ -507,7 +507,7 @@ static void freednsentry(void *freethis)
/*
* Curl_mk_dnscache() creates a new DNS cache and returns the handle for it.
*/
curl_hash *Curl_mk_dnscache(void)
struct curl_hash *Curl_mk_dnscache(void)
{
return Curl_hash_alloc(7, freednsentry);
}

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -112,7 +112,7 @@ struct connectdata;
void Curl_global_host_cache_init(void);
void Curl_global_host_cache_dtor(void);
curl_hash *Curl_global_host_cache_get(void);
struct curl_hash *Curl_global_host_cache_get(void);
#define Curl_global_host_cache_use(__p) ((__p)->set.global_dns_cache)
@@ -176,7 +176,7 @@ void Curl_scan_cache_used(void *user, void *ptr);
void Curl_freeaddrinfo(Curl_addrinfo *freeaddr);
/* make a new dns cache and return the handle */
curl_hash *Curl_mk_dnscache(void);
struct curl_hash *Curl_mk_dnscache(void);
/* prune old entries from the DNS cache */
void Curl_hostcache_prune(struct SessionHandle *data);
@@ -199,12 +199,12 @@ int curl_dogetnameinfo(const struct sockaddr *sa, socklen_t salen,
/* This is the callback function that is used when we build with asynch
resolve, ipv4 */
void Curl_addrinfo4_callback(void *arg,
CURLcode Curl_addrinfo4_callback(void *arg,
int status,
struct hostent *hostent);
/* This is the callback function that is used when we build with asynch
resolve, ipv6 */
void Curl_addrinfo6_callback(void *arg,
CURLcode Curl_addrinfo6_callback(void *arg,
int status,
struct addrinfo *ai);

View File

@@ -184,11 +184,13 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
* due to a resolver timeout.
*/
HANDLE mutex_waiting = NULL;
if (!DuplicateHandle(GetCurrentProcess(), td->mutex_waiting,
GetCurrentProcess(), &mutex_waiting, 0, FALSE,
HANDLE curr_proc = GetCurrentProcess();
if (!DuplicateHandle(curr_proc, td->mutex_waiting,
curr_proc, &mutex_waiting, 0, FALSE,
DUPLICATE_SAME_ACCESS)) {
/* failed to duplicate the mutex, no point in continuing */
return 0;
return -1;
}
/* Sharing the same _iob[] element with our parent thread should
@@ -212,12 +214,10 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
SetEvent(td->event_resolved);
if (he) {
Curl_addrinfo4_callback(conn, CURL_ASYNC_SUCCESS, he);
rc = 1;
rc = Curl_addrinfo4_callback(conn, CURL_ASYNC_SUCCESS, he);
}
else {
Curl_addrinfo4_callback(conn, (int)WSAGetLastError(), NULL);
rc = 0;
rc = Curl_addrinfo4_callback(conn, (int)WSAGetLastError(), NULL);
}
TRACE(("Winsock-error %d, addr %s\n", conn->async.status,
he ? inet_ntoa(*(struct in_addr*)he->h_addr) : "unknown"));
@@ -252,14 +252,18 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
* due to a resolver timeout.
*/
HANDLE mutex_waiting = NULL;
if (!DuplicateHandle(GetCurrentProcess(), td->mutex_waiting,
GetCurrentProcess(), &mutex_waiting, 0, FALSE,
HANDLE curr_proc = GetCurrentProcess();
if (!DuplicateHandle(curr_proc, td->mutex_waiting,
curr_proc, &mutex_waiting, 0, FALSE,
DUPLICATE_SAME_ACCESS)) {
/* failed to duplicate the mutex, no point in continuing */
return 0;
return -1;
}
#ifndef _WIN32_WCE
*stderr = *td->stderr_file;
#endif
itoa(conn->async.port, service, 10);
@@ -280,10 +284,10 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
#ifdef DEBUG_THREADING_GETADDRINFO
dump_addrinfo (conn, res);
#endif
Curl_addrinfo6_callback(conn, CURL_ASYNC_SUCCESS, res);
rc = Curl_addrinfo6_callback(conn, CURL_ASYNC_SUCCESS, res);
}
else {
Curl_addrinfo6_callback(conn, (int)WSAGetLastError(), NULL);
rc = Curl_addrinfo6_callback(conn, (int)WSAGetLastError(), NULL);
TRACE(("Winsock-error %d, no address\n", conn->async.status));
}
}
@@ -383,7 +387,6 @@ static bool init_resolve_thread (struct connectdata *conn,
(LPTHREAD_START_ROUTINE) THREAD_FUNC,
conn, 0, &td->thread_id);
#else
td->thread_hnd = (HANDLE) _beginthreadex(NULL, 0, THREAD_FUNC,
conn, 0, &td->thread_id);
#endif
@@ -488,7 +491,11 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
if (!conn->async.dns) {
/* a name was not resolved */
if (td->thread_status == (DWORD)-1 || conn->async.status == NO_DATA) {
if (td->thread_status == CURLE_OUT_OF_MEMORY) {
rc = CURLE_OUT_OF_MEMORY;
failf(data, "Could not resolve host: %s", curl_easy_strerror(rc));
}
else if (td->thread_status == (DWORD)-1 || conn->async.status == NO_DATA) {
failf(data, "Resolving host timed out: %s", conn->host.name);
rc = CURLE_OPERATION_TIMEDOUT;
}
@@ -503,10 +510,8 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
destroy_thread_data(&conn->async);
if(CURLE_OK != rc)
/* close the connection, since we must not return failure from here
without cleaning up this connection properly */
Curl_disconnect(conn);
if(!conn->async.dns)
conn->bits.close = TRUE;
return (rc);
}

View File

@@ -858,8 +858,7 @@ CURLcode add_buffer_send(send_buffer *in,
if(conn->data->set.verbose)
/* this data _may_ contain binary stuff */
Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr, amount,
conn->host.dispname);
Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr, amount, conn);
*bytes_written += amount;
@@ -1140,7 +1139,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
/* output debug if that is requested */
if(data->set.verbose)
Curl_debug(data, CURLINFO_HEADER_IN, line_start, perline,
conn->host.dispname);
conn);
/* send the header to the callback */
writetype = CLIENTWRITE_HEADER;
@@ -1275,7 +1274,6 @@ CURLcode Curl_http_done(struct connectdata *conn,
{
struct SessionHandle *data;
struct HTTP *http;
(void)status; /* no use for us */
data=conn->data;
http=conn->proto.http;
@@ -1292,7 +1290,7 @@ CURLcode Curl_http_done(struct connectdata *conn,
free(buff->buffer);
free(buff);
http->send_buffer = NULL; /* cleaer the pointer */
http->send_buffer = NULL; /* clear the pointer */
}
if(HTTPREQ_POST_FORM == data->set.httpreq) {
@@ -1308,6 +1306,9 @@ CURLcode Curl_http_done(struct connectdata *conn,
else if(HTTPREQ_PUT == data->set.httpreq)
conn->bytecount = http->readbytecount + http->writebytecount;
if (status != CURLE_OK)
return (status);
if(!conn->bits.retry &&
((http->readbytecount +
conn->headerbytecount -

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -33,7 +33,7 @@
#include "memdebug.h"
void
Curl_llist_init(curl_llist *l, curl_llist_dtor dtor)
Curl_llist_init(struct curl_llist *l, curl_llist_dtor dtor)
{
l->size = 0;
l->dtor = dtor;
@@ -41,12 +41,12 @@ Curl_llist_init(curl_llist *l, curl_llist_dtor dtor)
l->tail = NULL;
}
curl_llist *
struct curl_llist *
Curl_llist_alloc(curl_llist_dtor dtor)
{
curl_llist *list;
struct curl_llist *list;
list = (curl_llist *)malloc(sizeof(curl_llist));
list = (struct curl_llist *)malloc(sizeof(struct curl_llist));
if(NULL == list)
return NULL;
@@ -59,10 +59,11 @@ Curl_llist_alloc(curl_llist_dtor dtor)
* Curl_llist_insert_next() returns 1 on success and 0 on failure.
*/
int
Curl_llist_insert_next(curl_llist *list, curl_llist_element *e, const void *p)
Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e,
const void *p)
{
curl_llist_element *ne =
(curl_llist_element *) malloc(sizeof(curl_llist_element));
struct curl_llist_element *ne =
(struct curl_llist_element *) malloc(sizeof(struct curl_llist_element));
if(!ne)
return 0;
@@ -91,7 +92,8 @@ Curl_llist_insert_next(curl_llist *list, curl_llist_element *e, const void *p)
}
int
Curl_llist_remove(curl_llist *list, curl_llist_element *e, void *user)
Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
void *user)
{
if (e == NULL || list->size == 0)
return 1;
@@ -119,7 +121,7 @@ Curl_llist_remove(curl_llist *list, curl_llist_element *e, void *user)
}
void
Curl_llist_destroy(curl_llist *list, void *user)
Curl_llist_destroy(struct curl_llist *list, void *user)
{
if(list) {
while (list->size > 0)

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -28,29 +28,33 @@
typedef void (*curl_llist_dtor)(void *, void *);
typedef struct _curl_llist_element {
struct curl_llist_element {
void *ptr;
struct _curl_llist_element *prev;
struct _curl_llist_element *next;
} curl_llist_element;
struct curl_llist_element *prev;
struct curl_llist_element *next;
};
typedef struct _curl_llist {
curl_llist_element *head;
curl_llist_element *tail;
struct curl_llist {
struct curl_llist_element *head;
struct curl_llist_element *tail;
curl_llist_dtor dtor;
size_t size;
} curl_llist;
};
void Curl_llist_init(curl_llist *, curl_llist_dtor);
curl_llist *Curl_llist_alloc(curl_llist_dtor);
int Curl_llist_insert_next(curl_llist *, curl_llist_element *, const void *);
int Curl_llist_insert_prev(curl_llist *, curl_llist_element *, const void *);
int Curl_llist_remove(curl_llist *, curl_llist_element *, void *);
int Curl_llist_remove_next(curl_llist *, curl_llist_element *, void *);
size_t Curl_llist_count(curl_llist *);
void Curl_llist_destroy(curl_llist *, void *);
void Curl_llist_init(struct curl_llist *, curl_llist_dtor);
struct curl_llist *Curl_llist_alloc(curl_llist_dtor);
int Curl_llist_insert_next(struct curl_llist *, struct curl_llist_element *,
const void *);
int Curl_llist_insert_prev(struct curl_llist *, struct curl_llist_element *,
const void *);
int Curl_llist_remove(struct curl_llist *, struct curl_llist_element *,
void *);
int Curl_llist_remove_next(struct curl_llist *, struct curl_llist_element *,
void *);
size_t Curl_llist_count(struct curl_llist *);
void Curl_llist_destroy(struct curl_llist *, void *);
#endif

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -43,6 +43,8 @@
#include "connect.h"
#include "progress.h"
#include "memory.h"
#include "easyif.h"
#include "multiif.h"
/* The last #include file should be: */
#include "memdebug.h"
@@ -106,7 +108,7 @@ struct Curl_multi {
int num_msgs; /* total amount of messages in the easy handles */
/* Hostname cache */
curl_hash *hostcache;
struct curl_hash *hostcache;
};
@@ -174,6 +176,8 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
if(easy->next)
easy->next->prev = easy;
Curl_easy_addmulti(easy_handle, multi_handle);
/* increase the node-counter */
multi->num_easy++;
@@ -207,6 +211,8 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
/* clear out the usage of the shared DNS cache */
easy->easy_handle->hostcache = NULL;
Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association
to this multi handle */
/* make the previous node point to our next */
if(easy->prev)
@@ -336,7 +342,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
gotourl = strdup(easy->easy_handle->change.url);
if(gotourl) {
easy->easy_handle->change.url_changed = FALSE;
easy->result = Curl_follow(easy->easy_handle, gotourl);
easy->result = Curl_follow(easy->easy_handle, gotourl, FALSE);
if(CURLE_OK == easy->result)
easy->state = CURLM_STATE_CONNECT;
else
@@ -456,6 +462,13 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
}
}
}
else {
/* failure detected */
Curl_posttransfer(easy->easy_handle);
Curl_done(&easy->easy_conn, easy->result);
Curl_disconnect(easy->easy_conn); /* close the connection */
easy->easy_conn = NULL; /* no more connection */
}
break;
case CURLM_STATE_DO_MORE:
@@ -500,25 +513,35 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
Curl_done(&easy->easy_conn, easy->result);
}
/* after the transfer is done, go DONE */
else if(TRUE == done) {
char *newurl;
bool retry = Curl_retry_request(easy->easy_conn, &newurl);
/* call this even if the readwrite function returned error */
Curl_posttransfer(easy->easy_handle);
/* When we follow redirects, must to go back to the CONNECT state */
if(easy->easy_conn->newurl) {
char *newurl = easy->easy_conn->newurl;
if(easy->easy_conn->newurl || retry) {
if(!retry) {
/* if the URL is a follow-location and not just a retried request
then figure out the URL here */
newurl = easy->easy_conn->newurl;
easy->easy_conn->newurl = NULL;
}
easy->result = Curl_done(&easy->easy_conn, CURLE_OK);
if(easy->result == CURLE_OK)
easy->result = Curl_follow(easy->easy_handle, newurl);
easy->result = Curl_follow(easy->easy_handle, newurl, retry);
if(CURLE_OK == easy->result) {
easy->state = CURLM_STATE_CONNECT;
result = CURLM_CALL_MULTI_PERFORM;
}
else
/* Since we "took it", we are in charge of freeing this on
failure */
free(newurl);
}
else {
/* after the transfer is done, go DONE */
easy->state = CURLM_STATE_DONE;
result = CURLM_CALL_MULTI_PERFORM;
}
@@ -584,6 +607,13 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
return result;
}
/* This is called when an easy handle is cleanup'ed that is part of a multi
handle */
void Curl_multi_rmeasy(void *multi_handle, CURL *easy_handle)
{
curl_multi_remove_handle(multi_handle, easy_handle);
}
CURLMcode curl_multi_cleanup(CURLM *multi_handle)
{
struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
@@ -600,6 +630,7 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle)
nexteasy=easy->next;
/* clear out the usage of the shared DNS cache */
easy->easy_handle->hostcache = NULL;
Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association */
if (easy->msg)
free(easy->msg);

31
lib/multiif.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef __MULTIIF_H
#define __MULTIIF_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* 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 COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
/*
* Prototypes for library-wide functions provided by multi.c
*/
void Curl_multi_rmeasy(void *multi, CURL *data);
#endif /* __MULTIIF_H */

View File

@@ -86,11 +86,14 @@
static time_t Curl_parsedate(const char *date);
static const char *wkday[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
static const char *weekday[] = { "Monday", "Tuesday", "Wednesday", "Thursday",
static const char * const wkday[] =
{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
static const char * const weekday[] =
{ "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday" };
static const char *month[]= { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
"Aug", "Sep", "Oct", "Nov", "Dec" };
static const char * const month[]=
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
struct tzinfo {
const char *name;
@@ -153,7 +156,7 @@ static const struct tzinfo tz[]= {
static int checkday(char *check, size_t len)
{
int i;
const char **what;
const char * const *what;
bool found= FALSE;
if(len > 3)
what = &weekday[0];
@@ -172,7 +175,7 @@ static int checkday(char *check, size_t len)
static int checkmonth(char *check)
{
int i;
const char **what;
const char * const *what;
bool found= FALSE;
what = &month[0];

View File

@@ -23,13 +23,14 @@
#include "setup.h"
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <errno.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -38,6 +39,15 @@
#error "We can't compile without select() support!"
#endif
#ifdef __BEOS__
/* BeOS has FD_SET defined in socket.h */
#include <socket.h>
#endif
#include <curl/curl.h>
#include "urldata.h"
#include "connect.h"
#include "select.h"
#ifdef WIN32
@@ -76,7 +86,9 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
num++;
}
do {
r = poll(pfd, num, timeout_ms);
} while((r == -1) && (errno == EINTR));
if (r < 0)
return -1;
@@ -138,7 +150,9 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
maxfd = writefd;
}
do {
r = select(maxfd + 1, &fds_read, &fds_write, &fds_err, &timeout);
} while((r == -1) && (Curl_ourerrno() == EINTR));
if (r < 0)
return -1;
@@ -175,8 +189,11 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
*/
int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
{
int r;
#ifdef HAVE_POLL_FINE
return poll(ufds, nfds, timeout_ms);
do {
r = poll(ufds, nfds, timeout_ms);
} while((r == -1) && (errno == EINTR));
#else
struct timeval timeout;
struct timeval *ptimeout;
@@ -184,7 +201,6 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
fd_set fds_write;
fd_set fds_err;
curl_socket_t maxfd;
int r;
unsigned int i;
FD_ZERO(&fds_read);
@@ -219,7 +235,9 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
ptimeout = &timeout;
}
do {
r = select(maxfd + 1, &fds_read, &fds_write, &fds_err, ptimeout);
} while((r == -1) && (Curl_ourerrno() == EINTR));
if (r < 0)
return -1;
@@ -240,7 +258,6 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
if (ufds[i].revents != 0)
r++;
}
return r;
#endif
return r;
}

View File

@@ -154,17 +154,17 @@ void Curl_infof(struct SessionHandle *data, const char *fmt, ...)
void Curl_failf(struct SessionHandle *data, const char *fmt, ...)
{
va_list ap;
size_t len;
va_start(ap, fmt);
vsnprintf(data->state.buffer, BUFSIZE, fmt, ap);
if(data->set.errorbuffer && !data->state.errorbuf) {
vsnprintf(data->set.errorbuffer, CURL_ERROR_SIZE, fmt, ap);
snprintf(data->set.errorbuffer, CURL_ERROR_SIZE, "%s", data->state.buffer);
data->state.errorbuf = TRUE; /* wrote error string */
}
if(data->set.verbose) {
size_t len;
vsnprintf(data->state.buffer, BUFSIZE, fmt, ap);
len = strlen(data->state.buffer);
if(len < BUFSIZE - 1) {
data->state.buffer[len] = '\n';
data->state.buffer[++len] = '\0';
@@ -204,8 +204,7 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn,
break;
if(data->set.verbose)
Curl_debug(data, CURLINFO_DATA_OUT, sptr, bytes_written,
conn->host.dispname);
Curl_debug(data, CURLINFO_DATA_OUT, sptr, bytes_written, conn);
if((size_t)bytes_written != write_len) {
/* if not all was written at once, we must advance the pointer, decrease
@@ -468,18 +467,22 @@ static int showit(struct SessionHandle *data, curl_infotype type,
}
int Curl_debug(struct SessionHandle *data, curl_infotype type,
char *ptr, size_t size, char *host)
char *ptr, size_t size,
struct connectdata *conn)
{
int rc;
if(data->set.printhost && host) {
if(data->set.printhost && conn && conn->host.dispname) {
char buffer[160];
const char *t=NULL;
const char *w="Data";
switch (type) {
case CURLINFO_HEADER_IN:
w = "Header";
case CURLINFO_DATA_IN:
t = "from";
break;
case CURLINFO_HEADER_OUT:
w = "Header";
case CURLINFO_DATA_OUT:
t = "to";
break;
@@ -488,7 +491,10 @@ int Curl_debug(struct SessionHandle *data, curl_infotype type,
}
if(t) {
snprintf(buffer, sizeof(buffer), "[Data %s %s]", t, host);
snprintf(buffer, sizeof(buffer), "[%s %s %s%s]", w, t,
conn->xfertype==NORMAL?"":
(conn->xfertype==SOURCE3RD?"source ":"target "),
conn->host.dispname);
rc = showit(data, CURLINFO_TEXT, buffer, strlen(buffer));
if(rc)
return rc;

View File

@@ -62,7 +62,8 @@ CURLcode Curl_write(struct connectdata *conn,
/* the function used to output verbose information */
int Curl_debug(struct SessionHandle *handle, curl_infotype type,
char *data, size_t size, char *host);
char *data, size_t size,
struct connectdata *conn);
#endif

View File

@@ -160,17 +160,6 @@ typedef unsigned char bool;
#define WIN32_LEAN_AND_MEAN /* Prevent including <winsock*.h> in <windows.h> */
#endif
#if (defined(ENABLE_IPV6) || defined(CURLDEBUG)) && defined(_MSC_VER) && \
(!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0500)
/*
* Needed to pull in the real getaddrinfo() and not the inline version
* in <wspiAPI.H> which doesn't support IPv6 (IPv4 only). <wspiAPI.H> is
* included from <ws2tcpip.h> for <= 0x0500 SDKs.
*/
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#if HAVE_WINSOCK2_H
#include <winsock2.h> /* required by telnet.c */
#endif

View File

@@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -37,19 +37,12 @@ struct Curl_share {
curl_unlock_function unlockfunc;
void *clientdata;
curl_hash *hostcache;
struct curl_hash *hostcache;
struct CookieInfo *cookies;
};
CURLSHcode Curl_share_lock (
struct SessionHandle *,
curl_lock_data,
curl_lock_access
);
CURLSHcode Curl_share_unlock (
struct SessionHandle *,
curl_lock_data
);
CURLSHcode Curl_share_lock (struct SessionHandle *, curl_lock_data,
curl_lock_access);
CURLSHcode Curl_share_unlock (struct SessionHandle *, curl_lock_data);
#endif /* __CURL_SHARE_H */

View File

@@ -1003,6 +1003,7 @@ static CURLcode verifyhost(struct connectdata *conn,
#else
struct in_addr addr;
#endif
CURLcode res = CURLE_OK;
#ifdef ENABLE_IPV6
if(conn->bits.ipv6_ip &&
@@ -1131,8 +1132,7 @@ static CURLcode verifyhost(struct connectdata *conn,
if(data->set.ssl.verifyhost > 1) {
failf(data, "SSL: certificate subject name '%s' does not match "
"target host name '%s'", peer_CN, conn->host.dispname);
OPENSSL_free(peer_CN);
return CURLE_SSL_PEER_CERTIFICATE ;
res = CURLE_SSL_PEER_CERTIFICATE;
}
else
infof(data, "\t common name: %s (does not match '%s')\n",
@@ -1140,10 +1140,11 @@ static CURLcode verifyhost(struct connectdata *conn,
}
else {
infof(data, "\t common name: %s (matched)\n", peer_CN);
}
if(peer_CN)
OPENSSL_free(peer_CN);
}
}
return CURLE_OK;
return res;
}
#endif

View File

@@ -285,7 +285,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
read or we get a EWOULDBLOCK */
do {
size_t buffersize = data->set.buffer_size?
data->set.buffer_size:BUFSIZE -1;
data->set.buffer_size:BUFSIZE;
/* receive data from the network! */
int readrc = Curl_read(conn, conn->sockfd, k->buf, buffersize, &nread);
@@ -464,7 +464,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
k->write_after_100_header = FALSE;
k->keepon |= KEEP_WRITE;
k->wkeepfd = k->writefd;
}
}
else
@@ -936,7 +935,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(data->set.verbose)
Curl_debug(data, CURLINFO_HEADER_IN,
k->p, k->hbuflen, conn->host.dispname);
k->p, k->hbuflen, conn);
result = Curl_client_write(data, writetype, k->p, k->hbuflen);
if(result)
@@ -1033,14 +1032,12 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(data->set.verbose) {
if(k->badheader) {
Curl_debug(data, CURLINFO_DATA_IN, data->state.headerbuff,
k->hbuflen, conn->host.dispname);
k->hbuflen, conn);
if(k->badheader == HEADER_PARTHEADER)
Curl_debug(data, CURLINFO_DATA_IN, k->str, nread,
conn->host.dispname);
Curl_debug(data, CURLINFO_DATA_IN, k->str, nread, conn);
}
else
Curl_debug(data, CURLINFO_DATA_IN, k->str, nread,
conn->host.dispname);
Curl_debug(data, CURLINFO_DATA_IN, k->str, nread, conn);
}
#ifndef CURL_DISABLE_HTTP
@@ -1192,7 +1189,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
go into the Expect: 100 state and await such a header */
k->wait100_after_headers = FALSE; /* headers sent */
k->write_after_100_header = TRUE; /* wait for the header */
k->wkeepfd = k->writefd; /* set the keeper variable */
k->keepon &= ~KEEP_WRITE; /* disable writing */
k->start100 = Curl_tvnow(); /* timeout count starts now */
didwhat &= ~KEEP_WRITE; /* we didn't write anything actually */
@@ -1272,7 +1268,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(data->set.verbose)
/* show the data before we change the pointer upload_fromhere */
Curl_debug(data, CURLINFO_DATA_OUT, conn->upload_fromhere,
bytes_written, conn->host.dispname);
bytes_written, conn);
if(conn->upload_present != bytes_written) {
/* we only wrote a part of the buffer (if anything), deal with it! */
@@ -1336,7 +1332,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
/* we've waited long enough, continue anyway */
k->write_after_100_header = FALSE;
k->keepon |= KEEP_WRITE;
k->wkeepfd = k->writefd;
}
}
}
@@ -1463,12 +1458,6 @@ CURLcode Curl_readwrite_init(struct connectdata *conn)
k->keepon |= KEEP_WRITE;
}
}
/* get these in backup variables to be able to restore them on each lap in
the select() loop */
k->rkeepfd = k->readfd;
k->wkeepfd = k->writefd;
}
return CURLE_OK;
@@ -1491,7 +1480,6 @@ void Curl_single_fdset(struct connectdata *conn,
if(conn->keep.keepon & KEEP_READ) {
FD_SET(conn->sockfd, read_fd_set);
*max_fd = conn->sockfd;
conn->keep.readfdp = read_fd_set; /* store the address of the set */
}
if(conn->keep.keepon & KEEP_WRITE) {
FD_SET(conn->writesockfd, write_fd_set);
@@ -1500,7 +1488,6 @@ void Curl_single_fdset(struct connectdata *conn,
to compare it nicely */
if((int)conn->writesockfd > *max_fd)
*max_fd = conn->writesockfd;
conn->keep.writefdp = write_fd_set; /* store the address of the set */
}
/* we don't use exceptions, only touch that one to prevent compiler
warnings! */
@@ -1543,9 +1530,6 @@ Transfer(struct connectdata *conn)
if(!conn->bits.getheader && conn->bits.no_body)
return CURLE_OK;
k->writefdp = &k->writefd; /* store the address of the set */
k->readfdp = &k->readfd; /* store the address of the set */
while (!done) {
int fd_read;
int fd_write;
@@ -1742,9 +1726,11 @@ static void strcpy_url(char *output, char *url)
* as given by the remote server and set up the new URL to request.
*/
CURLcode Curl_follow(struct SessionHandle *data,
char *newurl) /* this 'newurl' is the Location: string,
char *newurl, /* this 'newurl' is the Location: string,
and it must be malloc()ed before passed
here */
bool retry) /* set TRUE if this is a request retry as
opposed to a real redirect following */
{
/* Location: redirect */
char prot[16]; /* URL protocol string storage */
@@ -1758,6 +1744,7 @@ CURLcode Curl_follow(struct SessionHandle *data,
return CURLE_TOO_MANY_REDIRECTS;
}
if(!retry)
/* mark the next request as a followed location: */
data->state.this_is_a_follow = TRUE;
@@ -2051,6 +2038,8 @@ Curl_connect_host(struct SessionHandle *data,
if(CURLE_OK == res)
/* Resolved, continue with the connection */
res = Curl_async_resolved(*conn);
else
(void)Curl_disconnect(*conn);
}
if(res)
break;
@@ -2063,7 +2052,7 @@ Curl_connect_host(struct SessionHandle *data,
res = Curl_done(conn, res);
if(CURLE_OK == res) {
char *gotourl = strdup(data->change.url);
res = Curl_follow(data, gotourl);
res = Curl_follow(data, gotourl, FALSE);
if(res)
free(gotourl);
}
@@ -2073,7 +2062,32 @@ Curl_connect_host(struct SessionHandle *data,
return res;
}
/* Returns TRUE and sets '*url' if a request retry is wanted */
bool Curl_retry_request(struct connectdata *conn,
char **url)
{
bool retry = FALSE;
if((conn->keep.bytecount+conn->headerbytecount == 0) &&
conn->bits.reuse) {
/* We got no data and we attempted to re-use a connection. This might
happen if the connection was left alive when we were done using it
before, but that was closed when we wanted to read from it again. Bad
luck. Retry the same request on a fresh connect! */
infof(conn->data, "Connection died, retrying a fresh connect\n");
*url = strdup(conn->data->change.url);
conn->bits.close = TRUE; /* close this connection */
conn->bits.retry = TRUE; /* mark this as a connection we're about
to retry. Marking it this way should
prevent i.e HTTP transfers to return
error just because nothing has been
transfered! */
retry = TRUE;
}
return retry;
}
/*
* Curl_perform() is the internal high-level function that gets called by the
@@ -2086,6 +2100,7 @@ CURLcode Curl_perform(struct SessionHandle *data)
CURLcode res2;
struct connectdata *conn=NULL;
char *newurl = NULL; /* possibly a new URL to follow to! */
bool retry = FALSE;
data->state.used_interface = Curl_if_easy;
@@ -2104,7 +2119,7 @@ CURLcode Curl_perform(struct SessionHandle *data)
res = Curl_connect_host(data, &conn); /* primary connection */
if(res == CURLE_OK) {
if (data->set.source_host) /* 3rd party transfer */
if (data->set.source_url) /* 3rd party transfer */
res = Curl_pretransfersec(conn);
else
conn->sec_conn = NULL;
@@ -2115,31 +2130,15 @@ CURLcode Curl_perform(struct SessionHandle *data)
res = Curl_do(&conn);
/* for non 3rd party transfer only */
if(res == CURLE_OK && !data->set.source_host) {
if(res == CURLE_OK && !data->set.source_url) {
res = Transfer(conn); /* now fetch that URL please */
if(res == CURLE_OK) {
retry = Curl_retry_request(conn, &newurl);
if((conn->keep.bytecount+conn->headerbytecount == 0) &&
conn->bits.reuse) {
/* We got no data and we attempted to re-use a connection. This
might happen if the connection was left alive when we were done
using it before, but that was closed when we wanted to read
from it again. Bad luck. Retry the same request on a fresh
connect! */
infof(data, "Connection died, retrying a fresh connect\n");
newurl = strdup(conn->data->change.url);
conn->bits.close = TRUE; /* close this connection */
conn->bits.retry = TRUE; /* mark this as a connection we're about
to retry. Marking it this way should
prevent i.e HTTP transfers to return
error just because nothing has been
transfered! */
}
else
if(!retry)
/*
* We must duplicate the new URL here as the connection data
* may be free()ed in the Curl_done() function.
* We must duplicate the new URL here as the connection data may
* be free()ed in the Curl_done() function.
*/
newurl = conn->newurl?strdup(conn->newurl):NULL;
}
@@ -2174,7 +2173,7 @@ CURLcode Curl_perform(struct SessionHandle *data)
*/
if((res == CURLE_OK) && newurl) {
res = Curl_follow(data, newurl);
res = Curl_follow(data, newurl, retry);
if(CURLE_OK == res) {
newurl = NULL;
continue;
@@ -2243,28 +2242,26 @@ CURLcode Curl_pretransfersec(struct connectdata *conn)
CURLcode status = CURLE_OK;
struct SessionHandle *data = conn->data;
struct connectdata *sec_conn = NULL; /* secondary connection */
bool reuse_fresh_tmp = data->set.reuse_fresh;
/* update data with source host options */
char *url = aprintf( "%s://%s/", conn->protostr, data->set.source_host);
if(!url)
return CURLE_OUT_OF_MEMORY;
bool backup_reuse_fresh = data->set.reuse_fresh;
char *backup_userpwd = data->set.userpwd;
if(data->change.url_alloc)
free(data->change.url);
data->change.url_alloc = TRUE;
data->change.url = url;
data->set.ftpport = data->set.source_port;
data->set.userpwd = data->set.source_userpwd;
data->change.url_alloc = FALSE;
data->change.url = data->set.source_url;
/* We must never actually alter 'data->set' properties, so we restore the
backed up values afterwards! */
#if 0
/* if both remote hosts are the same host - create new connection */
if (strequal(conn->host.dispname, data->set.source_host))
/* NOTE: this is restored back to the original value after the connect is
done */
#endif
data->set.reuse_fresh = TRUE;
data->set.userpwd = data->set.source_userpwd;
/* secondary connection */
status = Curl_connect_host(data, &sec_conn);
if(CURLE_OK == status) {
@@ -2274,7 +2271,8 @@ CURLcode Curl_pretransfersec(struct connectdata *conn)
conn->sec_conn = sec_conn;
}
data->set.reuse_fresh = reuse_fresh_tmp;
data->set.reuse_fresh = backup_reuse_fresh;
data->set.userpwd = backup_userpwd;
return status;
}

View File

@@ -26,7 +26,7 @@ CURLcode Curl_perform(struct SessionHandle *data);
CURLcode Curl_pretransfer(struct SessionHandle *data);
CURLcode Curl_pretransfersec(struct connectdata *conn);
CURLcode Curl_posttransfer(struct SessionHandle *data);
CURLcode Curl_follow(struct SessionHandle *data, char *newurl);
CURLcode Curl_follow(struct SessionHandle *data, char *newurl, bool retry);
CURLcode Curl_readwrite(struct connectdata *conn, bool *done);
void Curl_single_fdset(struct connectdata *conn,
fd_set *read_fd_set,
@@ -36,7 +36,7 @@ void Curl_single_fdset(struct connectdata *conn,
CURLcode Curl_readwrite_init(struct connectdata *conn);
CURLcode Curl_readrewind(struct connectdata *conn);
CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp);
bool Curl_retry_request(struct connectdata *conn, char **url);
/* This sets up a forthcoming transfer */
CURLcode
Curl_Transfer (struct connectdata *data,

126
lib/url.c
View File

@@ -118,6 +118,7 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by
#include "http_digest.h"
#include "http_negotiate.h"
#include "select.h"
#include "multiif.h"
/* And now for the protocols */
#include "ftp.h"
@@ -196,6 +197,10 @@ void Curl_safefree(void *ptr)
CURLcode Curl_close(struct SessionHandle *data)
{
if(data->multi) {
/* this handle is still part of a multi handle, take care of this first */
Curl_multi_rmeasy(data->multi, data);
}
/* Loop through all open connections and kill them one by one */
while(-1 != ConnectionKillOne(data))
; /* empty loop */
@@ -774,7 +779,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
*/
data->set.cookiesession = (bool)va_arg(param, long);
break;
#endif
#endif /* CURL_DISABLE_COOKIES */
case CURLOPT_HTTPGET:
/*
@@ -813,27 +818,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
and this just changes the actual request keyword */
break;
case CURLOPT_PROXY:
/*
* Set proxy server:port to use as HTTP proxy.
*
* If the proxy is set to "" we explicitly say that we don't want to use a
* proxy (even though there might be environment variables saying so).
*
* Setting it to NULL, means no proxy but allows the environment variables
* to decide for us.
*/
if(data->change.proxy_alloc) {
/*
* The already set string is allocated, free that first
*/
data->change.proxy_alloc=FALSE;;
free(data->change.proxy);
}
data->set.set_proxy = va_arg(param, char *);
data->change.proxy = data->set.set_proxy;
break;
case CURLOPT_PROXYPORT:
/*
* Explicitly set HTTP proxy port number.
@@ -882,6 +866,27 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
break;
#endif /* CURL_DISABLE_HTTP */
case CURLOPT_PROXY:
/*
* Set proxy server:port to use as HTTP proxy.
*
* If the proxy is set to "" we explicitly say that we don't want to use a
* proxy (even though there might be environment variables saying so).
*
* Setting it to NULL, means no proxy but allows the environment variables
* to decide for us.
*/
if(data->change.proxy_alloc) {
/*
* The already set string is allocated, free that first
*/
data->change.proxy_alloc=FALSE;;
free(data->change.proxy);
}
data->set.set_proxy = va_arg(param, char *);
data->change.proxy = data->set.set_proxy;
break;
case CURLOPT_WRITEHEADER:
/*
* Custom pointer to pass the header write callback function
@@ -1355,19 +1360,12 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
break;
/*********** 3rd party transfer options ***********/
case CURLOPT_SOURCE_HOST:
case CURLOPT_SOURCE_URL:
/*
* Use SOURCE HOST
* SOURCE URL
*/
data->set.source_host = va_arg(param, char *);
data->set.printhost = (data->set.source_host != NULL);
break;
case CURLOPT_SOURCE_PORT:
/*
* Use SOURCE PORT
*/
data->set.source_port = va_arg(param, char *);
data->set.source_url = va_arg(param, char *);
data->set.printhost = (data->set.source_url != NULL);
break;
case CURLOPT_SOURCE_USERPWD:
@@ -1377,18 +1375,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.source_userpwd = va_arg(param, char *);
break;
case CURLOPT_SOURCE_PATH:
case CURLOPT_SOURCE_QUOTE:
/*
* Use SOURCE PATH
* List of RAW FTP commands to use after a connect
*/
data->set.source_path = va_arg(param, char *);
break;
case CURLOPT_PASV_HOST:
/*
* Indicates whether source or target host is passive
*/
data->set.pasvHost = va_arg(param, long)?CURL_SOURCE_PASV:CURL_TARGET_PASV;
data->set.source_quote = va_arg(param, struct curl_slist *);
break;
case CURLOPT_SOURCE_PREQUOTE:
@@ -1405,6 +1396,10 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.source_postquote = va_arg(param, struct curl_slist *);
break;
case CURLOPT_FTP_ACCOUNT:
data->set.ftp_account = va_arg(param, char *);
break;
default:
/* unknown tag and its companion, just ignore: */
result = CURLE_FAILED_INIT; /* correct this */
@@ -1422,9 +1417,6 @@ CURLcode Curl_disconnect(struct connectdata *conn)
data = conn->data;
if(conn->dns_entry)
Curl_resolv_unlock(data, conn->dns_entry); /* done with this */
#if defined(CURLDEBUG) && defined(AGGRESIVE_TEST)
/* scan for DNS cache entries still marked as in use */
Curl_hash_apply(data->hostcache,
@@ -1505,6 +1497,7 @@ CURLcode Curl_disconnect(struct connectdata *conn)
Curl_safefree(conn->allocptr.ref);
Curl_safefree(conn->allocptr.host);
Curl_safefree(conn->allocptr.cookiehost);
Curl_safefree(conn->ip_addr_str);
#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \
defined(USE_THREADING_GETADDRINFO)
@@ -1821,8 +1814,8 @@ static int handleSock5Proxy(const char *proxy_name,
return 1;
}
if ((socksreq[0] != 5) || /* version */
(socksreq[1] != 0)) { /* status */
/* ignore the first (VER) byte */
if (socksreq[1] != 0) { /* status */
failf(conn->data, "User was rejected by the SOCKS5 server (%d %d).",
socksreq[0], socksreq[1]);
return 1;
@@ -1966,6 +1959,8 @@ static CURLcode ConnectPlease(struct connectdata *conn,
conn->dns_entry = hostaddr;
conn->ip_addr = addr;
Curl_store_ip_addr(conn);
if (conn->data->set.proxytype == CURLPROXY_SOCKS5) {
return handleSock5Proxy(conn->proxyuser,
conn->proxypasswd,
@@ -1989,14 +1984,9 @@ static CURLcode ConnectPlease(struct connectdata *conn,
*/
static void verboseconnect(struct connectdata *conn)
{
struct SessionHandle *data = conn->data;
char addrbuf[256];
/* Get a printable version of the network address. */
Curl_printable_address(conn->ip_addr, addrbuf, sizeof(addrbuf));
infof(data, "Connected to %s (%s) port %d\n",
infof(conn->data, "Connected to %s (%s) port %d\n",
conn->bits.httpproxy ? conn->proxy.dispname : conn->host.dispname,
addrbuf[0] ? addrbuf : "??", conn->port);
conn->ip_addr_str, conn->port);
}
/*
@@ -2192,7 +2182,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
to not have to modify everything at once, we allocate a temporary
connection data struct and fill in for comparison purposes. */
conn = (struct connectdata *)malloc(sizeof(struct connectdata));
conn = (struct connectdata *)calloc(sizeof(struct connectdata), 1);
if(!conn) {
*in_connect = NULL; /* clear the pointer */
return CURLE_OUT_OF_MEMORY;
@@ -2202,9 +2192,6 @@ static CURLcode CreateConnection(struct SessionHandle *data,
any failure */
*in_connect = conn;
/* we have to init the struct */
memset(conn, 0, sizeof(struct connectdata));
/* and we setup a few fields in case we end up actually using this struct */
conn->data = data; /* remember our daddy */
conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */
@@ -2259,6 +2246,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if(NULL == conn->host.rawalloc)
return CURLE_OUT_OF_MEMORY;
conn->host.name = conn->host.rawalloc;
conn->host.name[0] = 0;
/*************************************************************
* Parse the URL.
@@ -2348,21 +2336,19 @@ static CURLcode CreateConnection(struct SessionHandle *data,
/* Note: if you add a new protocol, please update the list in
* lib/version.c too! */
if(checkprefix("GOPHER", conn->host.name))
if(checkprefix("GOPHER.", conn->host.name))
strcpy(conn->protostr, "gopher");
#ifdef USE_SSLEAY
else if(checkprefix("HTTPS", conn->host.name))
strcpy(conn->protostr, "https");
else if(checkprefix("FTPS", conn->host.name))
strcpy(conn->protostr, "ftps");
#endif /* USE_SSLEAY */
else if(checkprefix("FTP", conn->host.name))
else if(checkprefix("FTP.", conn->host.name))
strcpy(conn->protostr, "ftp");
else if(checkprefix("TELNET", conn->host.name))
else if(checkprefix("TELNET.", conn->host.name))
strcpy(conn->protostr, "telnet");
else if (checkprefix("DICT", conn->host.name))
else if (checkprefix("DICT.", conn->host.name))
strcpy(conn->protostr, "DICT");
else if (checkprefix("LDAP", conn->host.name))
else if (checkprefix("LDAP.", conn->host.name))
strcpy(conn->protostr, "LDAP");
else {
strcpy(conn->protostr, "http");
@@ -2433,6 +2419,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
return CURLE_OUT_OF_MEMORY;
}
#ifndef CURL_DISABLE_HTTP
/*************************************************************
* Detect what (if any) proxy to use
*************************************************************/
@@ -2597,6 +2584,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if(no_proxy)
free(no_proxy);
} /* if not using proxy */
#endif /* CURL_DISABLE_HTTP */
/*************************************************************
* No protocol part in URL was used, add it!
@@ -3535,12 +3523,16 @@ CURLcode Curl_done(struct connectdata **connp,
struct SessionHandle *data=conn->data;
/* cleanups done even if the connection is re-used */
if(conn->bits.rangestringalloc) {
free(conn->range);
conn->bits.rangestringalloc = FALSE;
}
if(conn->dns_entry) {
Curl_resolv_unlock(data, conn->dns_entry); /* done with this */
conn->dns_entry = NULL;
}
/* Cleanup possible redirect junk */
if(conn->newurl) {
free(conn->newurl);

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -188,12 +188,6 @@ typedef enum {
NTLMSTATE_LAST
} curlntlm;
/* for 3rd party transfers to decide which side that issues PASV */
typedef enum {
CURL_TARGET_PASV,
CURL_SOURCE_PASV
} curl_pasv_side;
/* Struct used for NTLM challenge-response authentication */
struct ntlmdata {
curlntlm state;
@@ -299,8 +293,9 @@ struct ConnectBits {
bool httpproxy; /* if set, this transfer is done through a http proxy */
bool user_passwd; /* do we use user+password for this connection? */
bool proxy_user_passwd; /* user+password for the proxy? */
bool ipv6_ip; /* we communicate with a remove site specified with pure IPv6
bool ipv6_ip; /* we communicate with a remote site specified with pure IPv6
IP address */
bool ipv6; /* we communicate with a site using an IPv6 address */
bool use_range;
bool rangestringalloc; /* the range string is malloc()'ed */
@@ -410,15 +405,6 @@ struct Curl_transfer_keeper {
char *uploadbuf;
curl_socket_t maxfd;
/* pointers to the actual descriptors we check */
fd_set *readfdp;
fd_set *writefdp;
/* the file descriptors to play with */
fd_set readfd;
fd_set writefd;
fd_set rkeepfd;
fd_set wkeepfd;
int keepon;
bool upload_done; /* set to TRUE when doing chunked transfer-encoding upload
@@ -465,9 +451,21 @@ struct connectdata {
#define PROT_FTPS (1<<9)
#define PROT_SSL (1<<10) /* protocol requires SSL */
/* the particular host we use, in two different ways */
/* 'dns_entry' is the particular host we use. This points to an entry in the
DNS cache and it will not get pruned while locked. It gets unlocked in
Curl_done() */
struct Curl_dns_entry *dns_entry;
Curl_addrinfo *ip_addr; /* the particular IP we connected to */
/* 'ip_addr' is the particular IP we connected to. It points to a struct
within the DNS cache, so this pointer is only valid as long as the DNS
cache entry remains locked. It gets unlocked in Curl_done() */
Curl_addrinfo *ip_addr;
/* 'ip_addr_str' is the ip_addr data as a human readable malloc()ed string.
It remains available as long as the connection does, which is longer than
the ip_addr itself. Set with Curl_store_ip_addr() when ip_addr has been
set. */
char *ip_addr_str;
char protostr[16]; /* store the protocol string in this buffer */
@@ -623,6 +621,8 @@ struct connectdata {
#endif
struct connectdata *sec_conn; /* secondary connection for 3rd party
transfer */
enum { NORMAL, SOURCE3RD, TARGET3RD } xfertype;
};
/* The end of connectdata. */
@@ -875,9 +875,11 @@ struct UserDefined {
char *cookiejar; /* dump all cookies to this file */
bool cookiesession; /* new cookie session? */
bool crlf; /* convert crlf on ftp upload(?) */
char *ftp_account; /* ftp account data */
struct curl_slist *quote; /* after connection is established */
struct curl_slist *postquote; /* after the transfer */
struct curl_slist *prequote; /* before the transfer, after type */
struct curl_slist *source_quote; /* 3rd party quote */
struct curl_slist *source_prequote; /* in 3rd party transfer mode - before
the transfer on source host */
struct curl_slist *source_postquote; /* in 3rd party transfer mode - after
@@ -910,11 +912,8 @@ struct UserDefined {
curl_off_t max_filesize; /* Maximum file size to download */
char *source_host; /* for 3rd party transfer */
char *source_port; /* for 3rd party transfer */
char *source_url; /* for 3rd party transfer */
char *source_userpwd; /* for 3rd party transfer */
char *source_path; /* for 3rd party transfer */
curl_pasv_side pasvHost; /* for 3rd party transfer indicates passive host */
/* Here follows boolean settings that define how to behave during
this session. They are STATIC, set by libcurl users or at least initially
@@ -970,7 +969,9 @@ struct UserDefined {
* 'struct urlstate' instead. */
struct SessionHandle {
curl_hash *hostcache;
struct curl_hash *hostcache;
void *multi; /* if non-NULL, points to the multi handle
struct of which this "belongs" */
struct Curl_share *share; /* Share, handles global variable mutexing */
struct UserDefined set; /* values set by the libcurl user */
struct DynamicStatic change; /* possibly modified userdefined data */

View File

@@ -146,7 +146,7 @@ char *curl_version(void)
/* data for curl_version_info */
static const char *protocols[] = {
static const char * const protocols[] = {
#ifndef CURL_DISABLE_FTP
"ftp",
#endif

View File

@@ -1,2 +1,2 @@
SYS$LIBRARY:SSL$LIBCRYPTO_SHR.EXE/SHARE
SYS$LIBRARY:SSL$LIBSSL_SHR.EXE/SHARE
SYS$LIBRARY:SSL$LIBCRYPTO_SHR32.EXE/SHARE
SYS$LIBRARY:SSL$LIBSSL_SHR32.EXE/SHARE

107
src/Makefile.Watcom Normal file
View File

@@ -0,0 +1,107 @@
#
# Watcom / OpenWatcom / Win32 makefile for cURL.
# G. Vanem <giva@bgnett.no>
#
# $Id$
#
# Set to 1 to use static lib.
# Set to 0 to use DLL and import lib.
#
STATIC = 1
CC = wcc386
CFLAGS = -3r -mf -d3 -hc -zff -zgf -zq -zm -s -fr=con -w2 -fpi -oilrtfm &
-bt=nt -d+ -dWIN32 -dHAVE_LONGLONG -dHAVE_STRTOLL -dWITHOUT_MM_LIB &
-dSIZEOF_CURL_OFF_T=8 -dCURLDEBUG -dENABLE_IPV6 -dHAVE_WINSOCK2_H &
-I..\include -I..\lib
!ifeq STATIC 0
LIBCURL = ..\lib\libcurl_wc_imp.lib
!else
CFLAGS += -dCURL_STATICLIB
LIBCURL = ..\lib\libcurl_wc.lib
!endif
OBJ_DIR = Watcom_obj
OBJS = $(OBJ_DIR)\getpass.obj $(OBJ_DIR)\homedir.obj $(OBJ_DIR)\hugehelp.obj &
$(OBJ_DIR)\main.obj $(OBJ_DIR)\urlglob.obj $(OBJ_DIR)\writeenv.obj &
$(OBJ_DIR)\writeout.obj $(OBJ_DIR)\timeval.obj
RESOURCE = $(OBJ_DIR)\curl.res
all: hugehelp.c $(OBJ_DIR) curl.exe .SYMBOLIC
@echo Welcome to cURL
hugehelp.c: hugehelp.c.cvs
copy hugehelp.c.cvs hugehelp.c
$(OBJ_DIR):
mkdir $(OBJ_DIR)
curl.exe: $(OBJS) $(RESOURCE)
wlink name $@ system nt file { $(OBJS) } &
option quiet, map, caseexact, eliminate, res=$(RESOURCE) &
libpath $(%watcom)\lib386;$(%watcom)\lib386\nt &
library $(LIBCURL), clib3r.lib, ws2_32.lib
clean: .SYMBOLIC
- rm -f $(OBJS) $(RESOURCE)
vclean realclean: clean .SYMBOLIC
- rm -f curl.exe curl.map
- rmdir $(OBJ_DIR)
$(RESOURCE): curl.rc
wrc -dCURLDEBUG=1 -q -r -zm -I..\include -fo=$@ curl.rc
.ERASE
$(OBJ_DIR)\timeval.obj: ..\lib\timeval.c
$(CC) $[@ $(CFLAGS) -fo=$@
@echo .
.ERASE
.c{$(OBJ_DIR)}.obj:
$(CC) $[@ $(CFLAGS) -fo=$@
@echo .
#
# Dependencies based on "gcc -MM .."
#
$(OBJ_DIR)/getpass.obj: getpass.c setup.h config-win32.h ..\lib\setup.h &
..\lib\config-win32.h getpass.h ..\lib\memdebug.h ..\lib\setup.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h
$(OBJ_DIR)/homedir.obj: homedir.c setup.h config-win32.h ..\lib\setup.h &
..\lib\config-win32.h homedir.h ..\lib\memdebug.h ..\lib\setup.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\easy.h &
..\include\curl\multi.h ..\include\curl\curl.h
$(OBJ_DIR)/hugehelp.obj: hugehelp.c setup.h config-win32.h ..\lib\setup.h &
..\lib\config-win32.h hugehelp.h ../../../zlib-1.2.1/zlib.h &
../../../zlib-1.2.1/zconf.h
$(OBJ_DIR)/main.obj: main.c setup.h config-win32.h ..\lib\setup.h &
..\lib\config-win32.h ..\include\curl\curl.h ..\include\curl\curlver.h &
..\include\curl\easy.h ..\include\curl\multi.h ..\include\curl\curl.h &
urlglob.h writeout.h getpass.h homedir.h hugehelp.h version.h &
..\include\curl\curlver.h ..\lib\curlx.h ..\include\curl\mprintf.h &
..\lib\strequal.h ..\lib\strtoofft.h ..\lib\setup.h ..\lib\timeval.h &
..\lib\memdebug.h
$(OBJ_DIR)/urlglob.obj: urlglob.c setup.h config-win32.h ..\lib\setup.h &
..\lib\config-win32.h ..\include\curl\curl.h ..\include\curl\curlver.h &
..\include\curl\easy.h ..\include\curl\multi.h ..\include\curl\curl.h &
..\include\curl\mprintf.h urlglob.h ..\lib\memdebug.h ..\lib\setup.h
$(OBJ_DIR)/writeenv.obj: writeenv.c setup.h config-win32.h ..\lib\setup.h &
..\lib\config-win32.h
$(OBJ_DIR)/writeout.obj: writeout.c setup.h config-win32.h ..\lib\setup.h &
..\lib\config-win32.h ..\include\curl\curl.h ..\include\curl\curlver.h &
..\include\curl\easy.h ..\include\curl\multi.h ..\include\curl\curl.h &
..\include\curl\mprintf.h writeout.h

View File

@@ -43,7 +43,7 @@ EXTRA_DIST = mkhelp.pl makefile.dj Makefile.vc6 Makefile.b32 Makefile.m32 \
Makefile.riscos config.h.in macos/curl.mcp.xml.sit.hqx \
macos/MACINSTALL.TXT macos/src/curl_GUSIConfig.cpp \
macos/src/macos_main.cpp config-amigaos.h makefile.amiga curl.rc \
Makefile.netware Makefile.inc
Makefile.netware Makefile.inc Makefile.Watcom
MANPAGE=$(top_srcdir)/docs/curl.1
README=$(top_srcdir)/docs/MANUAL

View File

@@ -20,27 +20,29 @@ ZLIB_PATH = ../../zlib-1.2.1
!ENDIF
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-0.9.7d
OPENSSL_PATH = ../../openssl-0.9.7e
!ENDIF
########################################################
## Nothing more to do below this line!
CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
ZLIBLIBS = zlib.lib
SSLINC = /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
CFLAGSSSL = /DUSE_SSLEAY
LFLAGSSSL = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSLLIBS = libeay32.lib ssleay32.lib gdi32.lib
ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)"
ZLIB_LIBS = zlib.lib
ZLIB_IMP_LIBS = zdll.lib
SSL_CFLAGS = /DUSE_SSLEAY
SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib
## Release
CCR = cl.exe /MD /O2 /DNDEBUG
LINKR = link.exe /incremental:no /libpath:../lib
LINKR = link.exe /incremental:no /libpath:"../lib"
RCR = rc.exe /dCURLDEBUG=0
## Debug
CCD = cl.exe /MDd /Gm /ZI /Od /D_DEBUG /GZ
LINKD = link.exe /incremental:yes /debug /libpath:../lib
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
RCD = rc.exe /dCURLDEBUG=1
CFLAGS = /I../lib /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c
@@ -70,53 +72,109 @@ DEBUG_OBJS= \
maind.obj \
curld.res
#################################################
# release-zlib (static libcurl + zlib)
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(CFLAGSZLIB) /DCURL_STATICLIB
LINKLIBS = libcurl.lib $(ZLIBLIBS)
LINKLIBS_DEBUG = libcurld.lib $(ZLIBLIBS)
LFLAGS = $(LFLAGS) $(LFLAGSZLIB)
!ENDIF
#################################################
# release-ssl (static libcurl + ssl)
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(CFLAGSSSL) /DCURL_STATICLIB
LINKLIBS = libcurl.lib $(SSLLIBS)
LINKLIBS_DEBUG = libcurld.lib $(SSLLIBS)
LFLAGS = $(LFLAGS) $(LFLAGSSSL)
!ENDIF
#################################################
# release-libcurl-ssl-dll (libcurl.dll + ssl)
!IF "$(CFG)" == "release-libcurl-ssl-dll"
CFLAGS = $(CFLAGS) $(CFLAGSSSL)
LINKLIBS = libcurl_imp.lib $(SSLLIBS)
LINKLIBS_DEBUG = libcurld_imp.lib $(SSLLIBS)
LFLAGS = $(LFLAGS) $(LFLAGSSSL)
!ENDIF
#################################################
# release-ssl-zlib (static libcurl + ssl + zlib)
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(CFLAGSSSL) $(CFLAGSZLIB) /DCURL_STATICLIB
LINKLIBS = libcurl.lib $(SSLLIBS) $(ZLIBLIBS)
LINKLIBS_DEBUG = libcurld.lib $(SSLLIBS) $(ZLIBLIBS)
LFLAGS = $(LFLAGS) $(LFLAGSSSL) $(LFLAGSZLIB)
!ENDIF
#################################################
# If CFG not specified, use static libs
!IF "$(CFG)." == "."
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = libcurl.lib
LINKLIBS_DEBUG = libcurld.lib
#################################################
# release dynamic library
!IF "$(CFG)" == "release-dll"
LINKLIBS = libcurl_imp.lib
LINKLIBS_DEBUG = libcurld_imp.lib
!ENDIF
#################################################
# release static library with zlib
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = libcurl.lib $(ZLIB_LIBS)
LINKLIBS_DEBUG = libcurld.lib $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with ssl
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = libcurl.lib $(SSL_LIBS)
LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl
!IF "$(CFG)" == "release-dll-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
LINKLIBS = libcurl_imp.lib $(SSL_LIBS)
LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with ssl and zlib
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl
!IF "$(CFG)" == "release-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = libcurl.lib $(SSL_LIBS)
LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic zlib
!IF "$(CFG)" == "release-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = libcurl.lib $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = libcurld.lib $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic zlib
!IF "$(CFG)" == "release-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = libcurl_imp.lib $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = libcurld_imp.lib $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = libcurl_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
@@ -172,15 +230,10 @@ curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc
clean:
-@erase $(RELEASE_OBJS)
-@erase $(DEBUG_OBJS)
-@erase vc60.idb
-@erase vc60.pdb
-@erase vc60.pch
-@erase vc70.idb
-@erase vc70.pch
-@erase curl.ilk
-@erase curl.pdb
distrib: clean
-@erase $(PROGRAM_NAME)
@-erase $(PROGRAM_NAME) 2> NUL
@-erase $(RELEASE_OBJS) 2> NUL
@-erase $(DEBUG_OBJS) 2> NUL
@-erase *.idb 2> NUL
@-erase *.pdb 2> NUL
@-erase *.pch 2> NUL
@-erase *.ilk 2> NUL

View File

@@ -1,117 +0,0 @@
/* src/config.h. Generated automatically by configure. */
/* Define cpu-machine-OS */
#undef OS
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <io.h> header file. */
#undef HAVE_IO_H
/* Define if you have strdup() */
#undef HAVE_STRDUP
/* Define if you have utime() */
#undef HAVE_UTIME
/* Define if you have the <utime.h> header file */
#undef HAVE_UTIME_H
/* Define if you have the <sys/utime.h> header file */
#undef HAVE_SYS_UTIME_H
/* Define if you have the <sys/types.h> header file */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <sys/select.h> header file */
#undef HAVE_SYS_SELECT_H
/* Define if you have the <sys/socket.h> header file */
#undef HAVE_SYS_SOCKET_H
/* Define if you have the <sys/poll.h> header file */
#undef HAVE_SYS_POLL_H
/* Define if you have the `poll' function. */
#undef HAVE_POLL
/* Define if you have a good `poll' function that can wait on NULL. */
#undef HAVE_POLL_FINE
/* Define if you can write to argc[] strings */
#undef HAVE_WRITABLE_ARGV
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if you have the `getpass_r' function. */
#undef HAVE_GETPASS_R
/* Define to 1 if you have the `tcgetattr' function. */
#undef HAVE_TCGETATTR
/* Define to 1 if you have the `tcsetattr' function. */
#undef HAVE_TCSETATTR
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define to 1 if you have the `getpwuid' function. */
#undef HAVE_GETPWUID
/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define to 1 if you have the `strtoll' function. */
#undef HAVE_STRTOLL
/* The size of a `curl_off_t', as computed by sizeof. */
#undef SIZEOF_CURL_OFF_T
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* If zlib is available */
#undef HAVE_LIBZ
/* Define if you have the <limits.h> header file */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* type to use in place of socklen_t if not defined */
#undef socklen_t
/* Define to 1 if you want the built-in manual */
#undef USE_MANUAL
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE
/* Define to 1 if you have the `pipe' function. */
#undef HAVE_PIPE

View File

@@ -1,47 +1,61 @@
/* ============================================================================
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Redistribution and use are freely permitted provided that:
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* 1) This header remain in tact.
* 2) The prototypes for getpass and getpass_r are not changed from:
* char *getpass(const char *prompt)
* char *getpass_r(const char *prompt, char* buffer, int buflen)
* 3) This source code is not used outside of this(getpass.c) file.
* 4) Any changes to this(getpass.c) source code are made publicly available.
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
* 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 COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
*
* The spirit of this license is to allow use of this source code in any
* project be it open or closed but still encourage the use of the open,
* library based equivilents.
*
* Author(s):
* Angus Mackay <amackay@gus.ml.org>
* Daniel Stenberg <daniel@haxx.se>
*/
***************************************************************************/
#include "setup.h" /* setup.h is required for read() prototype */
/* This file is a reimplementation of the previous one, due to license
problems. */
#include "setup.h"
#ifndef HAVE_GETPASS_R
/* this file is only for systems without getpass_r() */
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "getpass.h"
#ifndef WIN32
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#else
#ifdef HAVE_TERMIO_H
#include <termio.h>
#endif
#endif
/* The last #include file should be: */
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG)
#include "memdebug.h"
#endif
#ifdef VMS
#include <stdio.h>
#include <string.h>
/* VMS implementation */
#include descrip
#include starlet
#include iodef
@@ -78,139 +92,16 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
}
return buffer; /* we always return success */
}
#else /* VMS */
#ifdef HAVE_TERMIOS_H
# if !defined(HAVE_TCGETATTR) && !defined(HAVE_TCSETATTR)
# undef HAVE_TERMIOS_H
# endif
#endif
#ifndef RETSIGTYPE
# define RETSIGTYPE void
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <signal.h>
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#else
# ifdef HAVE_TERMIO_H
# include <termio.h>
# else
# endif
#endif
/* The last #include file should be: */
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG)
#include "memdebug.h"
#endif
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
FILE *infp;
char infp_fclose = 0;
FILE *outfp;
RETSIGTYPE (*sigint)(int);
#ifdef SIGTSTP
RETSIGTYPE (*sigtstp)(int);
#endif
size_t bytes_read;
int infd;
int outfd;
#ifdef HAVE_TERMIOS_H
struct termios orig;
struct termios noecho;
#else
# ifdef HAVE_TERMIO_H
struct termio orig;
struct termio noecho;
# else
# endif
#endif
sigint = signal(SIGINT, SIG_IGN);
#ifdef SIGTSTP
sigtstp = signal(SIGTSTP, SIG_IGN);
#endif
infp=fopen("/dev/tty", "r");
if( NULL == infp )
infp = stdin;
else
infp_fclose = 1;
outfp = stderr;
infd = fileno(infp);
outfd = fileno(outfp);
/* dissable echo */
#ifdef HAVE_TERMIOS_H
tcgetattr(outfd, &orig);
noecho = orig;
noecho.c_lflag &= ~ECHO;
tcsetattr(outfd, TCSANOW, &noecho);
#else
# ifdef HAVE_TERMIO_H
ioctl(outfd, TCGETA, &orig);
noecho = orig;
noecho.c_lflag &= ~ECHO;
ioctl(outfd, TCSETA, &noecho);
# else
# endif
#endif
fputs(prompt, outfp);
fflush(outfp);
bytes_read=read(infd, buffer, buflen);
buffer[bytes_read > 0 ? (bytes_read -1) : 0] = '\0';
/* print a new line if needed */
#ifdef HAVE_TERMIOS_H
fputs("\n", outfp);
#else
# ifdef HAVE_TERMIO_H
fputs("\n", outfp);
# else
# endif
#endif
/*
* reset term charectaristics, use TCSAFLUSH incase the
* user types more than buflen
*/
#ifdef HAVE_TERMIOS_H
tcsetattr(outfd, TCSAFLUSH, &orig);
#else
# ifdef HAVE_TERMIO_H
ioctl(outfd, TCSETA, &orig);
# else
# endif
#endif
signal(SIGINT, sigint);
#ifdef SIGTSTP
signal(SIGTSTP, sigtstp);
#endif
if(infp_fclose)
fclose(infp);
return buffer; /* we always return success */
}
#define DONE
#endif /* VMS */
#else /* WIN32 */
#include <stdio.h>
#ifdef WIN32
/* Windows implementation */
#include <conio.h>
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
size_t i;
printf("%s", prompt);
fputs(prompt, stderr);
for(i=0; i<buflen; i++) {
buffer[i] = getch();
@@ -230,15 +121,96 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
return buffer; /* we always return success */
}
#define DONE
#endif /* WIN32 */
#ifndef DONE /* not previously provided */
#ifdef HAVE_TERMIOS_H
#define struct_term struct termios
#else
#ifdef HAVE_TERMIO_H
#define struct_term struct termio
#else
#undef struct_term
#endif
#endif
#endif /* ifndef HAVE_GETPASS_R */
#if 0
/* for consistensy, here's the old-style function: */
char *getpass(const char *prompt)
static bool ttyecho(bool enable, int fd)
{
static char buf[256];
return getpass_r(prompt, buf, sizeof(buf));
}
#ifdef struct_term
static struct_term withecho;
static struct_term noecho;
#endif
if(!enable) {
/* dissable echo by extracting the current 'withecho' mode and remove the
ECHO bit and set back the struct */
#ifdef HAVE_TERMIOS_H
tcgetattr(fd, &withecho);
noecho = withecho;
noecho.c_lflag &= ~ECHO;
tcsetattr(fd, TCSANOW, &noecho);
#else /* HAVE_TERMIOS_H */
#ifdef HAVE_TERMIO_H
ioctl(fd, TCGETA, &withecho);
noecho = withecho;
noecho.c_lflag &= ~ECHO;
ioctl(fd, TCSETA, &noecho);
#else /* HAVE_TERMIO_H */
/* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H, we can't disable echo! */
(void)fd; /* prevent compiler warning on unused variable */
return FALSE; /* not disabled */
#endif
#endif
return TRUE; /* disabled */
}
else {
/* re-enable echo, assumes we disabled it before (and set the structs we
now use to reset the terminal status) */
#ifdef HAVE_TERMIOS_H
tcsetattr(fd, TCSAFLUSH, &withecho);
#else /* HAVE_TERMIOS_H */
#ifdef HAVE_TERMIO_H
ioctl(fd, TCSETA, &withecho);
#else
/* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H */
return FALSE; /* not enabled */
#endif
#endif
return TRUE; /* enabled */
}
}
char *getpass_r(const char *prompt, /* prompt to display */
char *password, /* buffer to store password in */
size_t buflen) /* size of buffer to store password in */
{
ssize_t nread;
bool disabled;
int fd=open("/dev/tty", O_RDONLY);
if(-1 == fd)
fd = 1; /* use stdin if the tty couldn't be used */
disabled = ttyecho(FALSE, fd); /* disable terminal echo */
fputs(prompt, stderr);
nread=read(fd, password, buflen);
if(nread > 0)
password[--nread]=0; /* zero terminate where enter is stored */
else
password[0]=0; /* got nothing */
if(disabled) {
/* if echo actually was disabled, add a newline */
fputs("\n", stderr);
ttyecho(TRUE, fd); /* enable echo */
}
if(1 != fd)
close(fd);
return password; /* return pointer to buffer */
}
#endif /* DONE */
#endif /* HAVE_GETPASS_R */

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -400,13 +400,12 @@ static void help(void)
" --socks <host[:port]> Use SOCKS5 proxy on given host + port",
" --stderr <file> Where to redirect stderr. - means stdout",
" -t/--telnet-option <OPT=val> Set telnet option",
" --trace <file> Dump a network/debug trace to the given file",
" --trace <file> Write a debug trace to the given file",
" --trace-ascii <file> Like --trace but without the hex output",
" -T/--upload-file <file> Transfer/upload <file> to remote site",
" --url <URL> Another way to specify URL to work with",
" -u/--user <user[:password]> Specify user and password to use",
" Overrides -n and --netrc-optional",
" -U/--proxy-user <user[:password]> Specify Proxy authentication",
" -T/--upload-file <file> Transfer <file> to remote site",
" --url <URL> Spet URL to work with",
" -u/--user <user[:password]> Set server user and password",
" -U/--proxy-user <user[:password]> Set proxy user and password",
" -v/--verbose Make the operation more talkative",
" -V/--version Show version number and quit",
#ifdef __DJGPP__
@@ -422,6 +421,9 @@ static void help(void)
" -1/--tlsv1 Use TLSv1 (SSL)",
" -2/--sslv2 Use SSLv2 (SSL)",
" -3/--sslv3 Use SSLv3 (SSL)",
" --3p-quote like -Q for the source URL for 3rd party transfer (F)",
" --3p-url source URL to activate 3rd party transfer (F)",
" --3p-user user and password for source 3rd party transfer (F)",
" -4/--ipv4 Resolve name to IPv4 address",
" -6/--ipv6 Resolve name to IPv6 address",
" -#/--progress-bar Display transfer progress as a progress bar",
@@ -540,6 +542,13 @@ struct Configurable {
long req_retry; /* number of retries */
long retry_delay; /* delay between retries (in seconds) */
long retry_maxtime; /* maximum time to keep retrying */
char *tp_url; /* third party URL */
char *tp_user; /* third party userpwd */
struct curl_slist *tp_quote;
struct curl_slist *tp_postquote;
struct curl_slist *tp_prequote;
char *ftp_account; /* for ACCT */
};
/* global variable to hold info about libcurl */
@@ -863,7 +872,6 @@ static int formparse(char *input,
ptr++;
if(curlx_strnequal("type=", ptr, 5)) {
/* set type pointer */
type = &ptr[5];
@@ -878,10 +886,14 @@ static int formparse(char *input,
/* now point beyond the content-type specifier */
sep = (char *)type + strlen(major)+strlen(minor)+1;
if(*sep) {
*sep=0; /* zero terminate type string */
ptr=sep+1;
}
else
ptr = NULL; /* end */
}
else if(curlx_strnequal("filename=", ptr, 9)) {
filename = &ptr[9];
ptr=strchr(filename, FORM_TYPE_SEPARATOR);
@@ -1237,6 +1249,11 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
{"$g", "retry", TRUE},
{"$h", "retry-delay", TRUE},
{"$i", "retry-max-time", TRUE},
{"$j", "3p-url", TRUE},
{"$k", "3p-user", TRUE},
{"$l", "3p-quote", TRUE},
{"$m", "ftp-account", TRUE},
{"0", "http1.0", FALSE},
{"1", "tlsv1", FALSE},
{"2", "sslv2", FALSE},
@@ -1583,7 +1600,40 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
case 'i': /* --retry-max-time */
if(str2num(&config->retry_maxtime, nextarg))
return PARAM_BAD_NUMERIC;
break;
case 'j': /* --3p-url */
GetStr(&config->tp_url, nextarg);
break;
case 'k': /* --3p-user */
GetStr(&config->tp_user, nextarg);
break;
case 'l': /* --3p-quote */
/* QUOTE commands to send to source FTP server */
err = PARAM_OK;
switch(nextarg[0]) {
case '-':
/* prefixed with a dash makes it a POST TRANSFER one */
nextarg++;
err = add2list(&config->tp_postquote, nextarg);
break;
case '+':
/* prefixed with a plus makes it a just-before-transfer one */
nextarg++;
err = add2list(&config->tp_prequote, nextarg);
break;
default:
err = add2list(&config->tp_quote, nextarg);
break;
}
if(err)
return err;
break;
/* break */
case 'm': /* --ftp-account */
GetStr(&config->ftp_account, nextarg);
break;
}
break;
case '#': /* added 19990617 larsa */
@@ -2023,7 +2073,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
break;
case 'V':
{
const char **proto;
const char * const *proto;
printf(CURL_ID "%s\n", curl_version());
if (curlinfo->protocols) {
@@ -2779,10 +2829,20 @@ static void free_config_fields(struct Configurable *config)
free(config->capath);
if(config->cookiejar)
free(config->cookiejar);
if(config->tp_url)
free(config->tp_url);
if(config->tp_user)
free(config->tp_user);
if(config->ftp_account)
free(config->ftp_account);
curl_slist_free_all(config->quote); /* checks for config->quote == NULL */
curl_slist_free_all(config->postquote); /* */
curl_slist_free_all(config->headers); /* */
curl_slist_free_all(config->prequote);
curl_slist_free_all(config->postquote);
curl_slist_free_all(config->tp_quote);
curl_slist_free_all(config->tp_prequote);
curl_slist_free_all(config->tp_postquote);
curl_slist_free_all(config->headers);
}
#if defined(WIN32) && !defined(__CYGWIN32__)
@@ -2873,8 +2933,14 @@ operate(struct Configurable *config, int argc, char *argv[])
/* this sends all memory debug messages to a logfile named memdump */
env = curlx_getenv("CURL_MEMDEBUG");
if(env) {
/* use the value as file name */
char *s = strdup(env);
curl_free(env);
curl_memdebug("memdump");
curl_memdebug(s);
free(s);
/* this weird strdup() and stuff here is to make the curl_free() get
called before the memdebug() as otherwise the memdebug tracing will
with tracing a free() without an alloc! */
}
env = curlx_getenv("CURL_MEMLIMIT");
if(env) {
@@ -3487,6 +3553,7 @@ operate(struct Configurable *config, int argc, char *argv[])
curl_easy_setopt(curl, CURLOPT_CRLF, config->crlf);
curl_easy_setopt(curl, CURLOPT_QUOTE, config->quote);
curl_easy_setopt(curl, CURLOPT_POSTQUOTE, config->postquote);
curl_easy_setopt(curl, CURLOPT_PREQUOTE, config->prequote);
curl_easy_setopt(curl, CURLOPT_WRITEHEADER,
config->headerfile?&heads:NULL);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, config->cookiefile);
@@ -3599,6 +3666,14 @@ operate(struct Configurable *config, int argc, char *argv[])
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
}
/* curl 7.13.0 */
curl_easy_setopt(curl, CURLOPT_SOURCE_URL, config->tp_url);
curl_easy_setopt(curl, CURLOPT_SOURCE_USERPWD, config->tp_user);
curl_easy_setopt(curl, CURLOPT_SOURCE_PREQUOTE, config->tp_prequote);
curl_easy_setopt(curl, CURLOPT_SOURCE_POSTQUOTE, config->tp_postquote);
curl_easy_setopt(curl, CURLOPT_SOURCE_QUOTE, config->tp_quote);
curl_easy_setopt(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);
retry_numretries = config->req_retry;
retrystart = curlx_tvnow();
@@ -3787,9 +3862,6 @@ show_error:
if(headerfilep)
fclose(headerfilep);
if (httpgetfields)
free(httpgetfields);
if(url)
free(url);
@@ -3832,6 +3904,9 @@ show_error:
} /* while-loop through all URLs */
quit_curl:
if (httpgetfields)
free(httpgetfields);
if (config->engine)
free(config->engine);

View File

@@ -49,7 +49,7 @@
#endif
#endif
#ifdef CURLDEBUG
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG)
/* This is an ugly hack for CURLDEBUG conditions only. We need to include
the file here, since it might set the _FILE_OFFSET_BITS define, which must
be set BEFORE all normal system headers. */

View File

@@ -314,7 +314,7 @@ int glob_url(URLGlob** glob, char* url, int *urlnum, FILE *error)
if(NULL == glob_buffer)
return CURLE_OUT_OF_MEMORY;
glob_expand = (URLGlob*)malloc(sizeof(URLGlob));
glob_expand = (URLGlob*)calloc(sizeof(URLGlob), 1);
if(NULL == glob_expand) {
free(glob_buffer);
return CURLE_OUT_OF_MEMORY;

View File

@@ -52,6 +52,7 @@ typedef enum {
VAR_SPEED_DOWNLOAD,
VAR_SPEED_UPLOAD,
VAR_HTTP_CODE,
VAR_HTTP_CODE_PROXY,
VAR_HEADER_SIZE,
VAR_REQUEST_SIZE,
VAR_EFFECTIVE_URL,
@@ -71,6 +72,7 @@ struct variable {
static const struct variable replacements[]={
{"url_effective", VAR_EFFECTIVE_URL},
{"http_code", VAR_HTTP_CODE},
{"http_connect", VAR_HTTP_CODE_PROXY},
{"time_total", VAR_TOTAL_TIME},
{"time_namelookup", VAR_NAMELOOKUP_TIME},
{"time_connect", VAR_CONNECT_TIME},
@@ -127,6 +129,12 @@ void ourWriteOut(CURL *curl, char *writeinfo)
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &longinfo))
fprintf(stream, "%03ld", longinfo);
break;
case VAR_HTTP_CODE_PROXY:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE,
&longinfo))
fprintf(stream, "%03ld", longinfo);
break;
case VAR_HEADER_SIZE:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &longinfo))

View File

@@ -187,7 +187,14 @@ This verfies that this data was passed to stdout.
<file name="log/filename">
the file's contents must be identical to this
</file>
<stripfile>
One perl op per line that operates on the file before being compared. This is
pretty advanced. Example: "s/^EPRT .*/EPRT stripped/"
</stripfile>
<upload>
the contents of the upload data curl should have sent
</upload>
<valgrind>
disable - disables the valgrind log check for this test
</valgrind>
</verify>

View File

@@ -30,7 +30,9 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
test193 test194 test195 test196 test197 test198 test515 test516 \
test517 test518 test210 test211 test212 test220 test221 test222 \
test223 test224 test206 test207 test208 test209 test213 test240 \
test241 test242 test519 test214 test215 test216
test241 test242 test519 test214 test215 test216 test217 test218 \
test199 test225 test226 test227 test230 test231 test232 test228 \
test229
# The following tests have been removed from the dist since they no longer
# work. We need to fix the test suite's FTPS server first, then bring them

View File

@@ -32,7 +32,7 @@ the
PUT
feature
</file>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -1,6 +1,6 @@
#
# Server-side
<reply name="1">
<reply>
<data>
total 20
drwxr-xr-x 8 98 98 512 Oct 22 13:06 .
@@ -28,7 +28,7 @@ FTP dir list PASV
<command>
ftp://%HOSTIP:%FTPPORT/
</command>
</test>
</client>
#
# Verify data after the test has been "shot"

View File

@@ -26,7 +26,7 @@ FTP dir list, PORT with specified IP
<command>
ftp://%HOSTIP:%FTPPORT/ -P %HOSTIP
</command>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -21,11 +21,11 @@ FTP RETR PASV
<command>
ftp://%HOSTIP:%FTPPORT/102
</command>
</test>
<file name="log/ftpserver.cmd">
REPLY EPSV 500 no such command
</file>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -21,22 +21,22 @@ FTP RETR PORT with CWD
<command>
ftp://%HOSTIP:%FTPPORT/a/path/103 -P -
</command>
</test>
</client>
# Verify data after the test has been "shot"
<verify>
<strip>
^PORT .*
^EPRT.*
^LPRT.*
</strip>
<strippart>
s/^LPRT.*[\n]//
s/^EPRT.*[\n]//
s/^(PORT 127,0,0,1,)([0-9,]+)/$1/
</strippart>
<protocol>
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
CWD a
CWD path
PORT 127,0,0,1,246,33
PORT 127,0,0,1,
TYPE I
SIZE 103
RETR 103

View File

@@ -16,7 +16,7 @@ FTP --head to get file size only
<command>
ftp://%HOSTIP:%FTPPORT/a/path/103 --head
</command>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -25,7 +25,7 @@ ftp://userdude:passfellow@%HOSTIP:%FTPPORT/103 --use-ascii
REPLY EPSV 500 no such command
REPLY SIZE 500 no such command
</file>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -21,7 +21,7 @@ FTP GET with type=A style ASCII URL using %20 codes
<command>
"ftp://%HOSTIP:%FTPPORT//path%20with%20%20spaces//and%20things2/106;type=A"
</command>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -18,7 +18,7 @@ works
<command>
ftp://%HOSTIP:%FTPPORT/107 -T log/test107.txt
</command>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -19,7 +19,7 @@ ftp://%HOSTIP:%FTPPORT/CWD/STOR/RETR/108 -T log/upload108 -P -
Moooooooooooo
upload this
</file>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -19,7 +19,7 @@ ftp://%HOSTIP:%FTPPORT/109 -T log/upload109 --append
Moooooooooooo
upload this
</file>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -45,7 +45,7 @@ simple HTTP Location: following
<command>
http://%HOSTIP:%HTTPPORT/want/11 -L
</command>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -23,7 +23,7 @@ ftp://%HOSTIP:%FTPPORT/110 -C 20
<file name="log/ftpserver.cmd">
REPLY EPSV 500 no such command
</file>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -16,7 +16,7 @@ FTP download resume beyond file size
<command>
ftp://%HOSTIP:%FTPPORT/111 -C 2000
</command>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

View File

@@ -18,7 +18,7 @@ this is the *****crap******** that we're gonna upload
worx?
</file>
</test>
</client>
# Verify data after the test has been "shot"
<verify>

Some files were not shown because too many files have changed in this diff Show More