Compare commits

..

265 Commits

Author SHA1 Message Date
Daniel Stenberg
4b1782c371 7.16.4 preps 2007-07-10 21:36:30 +00:00
Gunter Knauf
f84642197f added better CodeWarrior detection (forgot to add with previos version). 2007-07-09 02:00:39 +00:00
Gunter Knauf
ec1b7a0eea added better CodeWarrior detection;
added defines for setlocale().
2007-07-08 23:19:24 +00:00
Gunter Knauf
4b0e48cb4e added better CodeWarrior detection;
moved autounload flag so that its used for both lib architectures.
2007-07-08 23:18:47 +00:00
Gunter Knauf
41df67fc2c added better CodeWarrior detection. 2007-07-08 23:17:56 +00:00
Gunter Knauf
932d38323f removed some obsolete include paths and defines. 2007-07-07 16:26:02 +00:00
Daniel Stenberg
74ad8516d7 Thomas J. Moore made it build with less warnings 2007-07-06 22:14:29 +00:00
Daniel Stenberg
ed4a16dbd1 Gavrie Philipson's change, updated numbers 2007-07-06 21:56:42 +00:00
Daniel Stenberg
e2bac4fe6f add note about windows and dlls with CURLOPT_WRITEDATA 2007-07-06 20:14:03 +00:00
Gunter Knauf
836ffbfc22 fixed NetWare CLIB implementation of getpass_r() 2007-07-06 14:58:59 +00:00
James Housley
7fd4f82a45 Gavrie Philipson provided a patch that will use a more specific error
message for an scp:// upload failure.  If libssh2 has his matching
patch, then the error message return by the server will be used instead
of a more generic error.
2007-07-05 12:48:34 +00:00
Dan Fandrich
598bc3968e Add -a when running torture tests now that it's supported. 2007-07-05 01:38:00 +00:00
James Housley
29357151af Fix spelling error in error message 2007-07-04 22:54:29 +00:00
Gunter Knauf
6606ae6fe0 add test for gettimeofday() so that HAVE_GETTIMEOFDAY gets defined. 2007-07-04 17:20:19 +00:00
Gunter Knauf
9f21f74fbd enabled ares build. 2007-07-04 13:45:46 +00:00
Gunter Knauf
3760180320 although the check for HAVE_STRUCT_TIMEVAL solved the redefine it is incorrect; lets see if a check for HAVE_GETTIMEOFDAY also works; if gettimeofday() is present then we can assume we have the timezone struct too. 2007-07-04 10:54:15 +00:00
Gunter Knauf
056af4c9ac added check for sys/param.h. 2007-07-04 09:01:40 +00:00
Gunter Knauf
07bf3c86b6 trial to catch problem with Daniels cross-mingw ares builds. 2007-07-03 18:18:40 +00:00
Gunter Knauf
4182803bc2 added NetWare CLIB-own header to solve gcc warnings. 2007-07-03 16:21:57 +00:00
Gunter Knauf
7509ef6b4e few minor changes to make ares compile for NetWare CLIB architecture. 2007-07-03 16:00:36 +00:00
Gunter Knauf
70f8068d4d fixed rule to build libcares when needed. 2007-07-03 00:50:40 +00:00
Gunter Knauf
a7513a8521 changed to build for CLIB / LIBC. 2007-07-03 00:42:11 +00:00
Gunter Knauf
3f7e541415 added libcares to static build if ares enabled. 2007-07-03 00:12:03 +00:00
Daniel Stenberg
f7e9a21c53 contributors from the 7.16.3 release notes 2007-07-02 22:04:36 +00:00
Gunter Knauf
f1537d45ca sync'd with lib makefile changes: use var for awk; fixed RECV* / SEND* defines; debug var can be overwritten; added better compiler path handling. 2007-07-02 18:50:18 +00:00
Gunter Knauf
5a051617f3 some more makefile tweaks and hacks to deal with both lib architectures. 2007-07-02 18:42:14 +00:00
James Housley
55cd28283c Fix problem with the indenting noticed by Pavel 2007-07-02 17:22:51 +00:00
Gunter Knauf
924665c84c ignore make error when trying to copy curl.pdf which isnt in CVS. 2007-07-01 22:17:07 +00:00
Daniel Stenberg
fcfffbe2f2 mention the old name 2007-07-01 22:03:47 +00:00
Daniel Stenberg
54967d2a3a Thomas J. Moore provided a patch that introduces Kerberos5 support in
libcurl. This also makes the options change name to --krb (from --krb4) and
CURLOPT_KRBLEVEL (from CURLOPT_KRB4LEVEL) but the old names are still
2007-07-01 22:01:18 +00:00
Daniel Stenberg
667fd9a60b Song Ma helped me verify and extend a fix for doing FTP over a SOCKS4/5 proxy 2007-07-01 21:28:14 +00:00
Gunter Knauf
892a24f4c4 changed RECV_* / SEND_* defines to correctly reflect NetWare APIs;
some more minor Makefile tidyups.
2007-07-01 21:06:41 +00:00
Gunter Knauf
f7676e9667 disabled 64bit type for CLIB build which removes compiler runtime dependency. 2007-07-01 16:55:37 +00:00
Gunter Knauf
8727803cf8 updated NetWare docu. 2007-07-01 12:09:25 +00:00
Gunter Knauf
73e13ef19d added lib architecture to NLM description. 2007-07-01 01:33:51 +00:00
Gunter Knauf
e983cd5cd3 added HAVE_SYS_IOCTL_H define; added gcc runtime. 2007-06-30 23:53:54 +00:00
Gunter Knauf
ca3e5a6322 moved includes to setup.h so that the project headers also pick them up (eleminate gcc warning). 2007-06-30 23:45:57 +00:00
Gunter Knauf
c4931601c6 fixed path to Metrowerks tools and runtime since they changed between compiler versions. 2007-06-30 21:20:24 +00:00
Gunter Knauf
857492ac9e minor patches to enable building for NetWare CLIB.
sent by Dmitry Mityugov.
2007-06-30 20:16:03 +00:00
Gunter Knauf
afdfa4bed2 minor patches to enable building for NetWare CLIB.
sent by Dmitry Mityugov.
2007-06-30 20:08:13 +00:00
Gunter Knauf
3fc6faf1ae enabled building for NetWare CLIB architecture. 2007-06-30 20:02:51 +00:00
Gunter Knauf
c8a47bf662 revert previous patch since it turned out that older cp dont know this switch, argh! 2007-06-28 22:31:18 +00:00
James Housley
aed0cc6f2a Using fdopen() is a more correct way to implement the CURLOPT_NEW_FILE_PREMS
file.c, but the debug interface was missing.  This adds the routines needed
to make the memory debuging work for fdopen().
2007-06-28 11:11:29 +00:00
Daniel Stenberg
d500c468fc reality sync 2007-06-28 10:47:05 +00:00
Gunter Knauf
5df5a2aa54 fixed nasty cp warnings about not beeing able to preserve ownership. 2007-06-28 01:20:30 +00:00
Daniel Stenberg
9ca688c8e7 James Bursa's improvement 2007-06-27 21:35:17 +00:00
Daniel Stenberg
8edbe262d9 fix little flaw that could make the transfer loop end prematurely 2007-06-27 21:29:29 +00:00
James Housley
4cd7f85410 Add two new options for the SFTP/SCP/FILE protocols: CURLOPT_NEW_FILE_PERMS
and CURLOPT_NEW_DIRECTORY_PERMS.  These control the premissions for files
and directories created on the remote server.  CURLOPT_NEW_FILE_PERMS
defaults to 0644 and CURLOPT_NEW_DIRECTORY_PERMS defaults to 0755
2007-06-27 20:15:48 +00:00
Gunter Knauf
edd35cab5c removed trailing spaces. 2007-06-27 10:14:00 +00:00
Gunter Knauf
a2060effed fixed wrong var name 2007-06-27 10:12:48 +00:00
Daniel Stenberg
33b9daaa4c add an FTP rename example to 3.7 2007-06-26 21:53:46 +00:00
Daniel Stenberg
62f0f5571d Robert Iakobashvili re-arranged the internal hash code to work with a custom
hash function for different hashes, and also expanded the default size for
the socket hash table used in multi handles to greatly enhance speed when
very many connections are added and the socket API is used.
2007-06-26 21:09:28 +00:00
James Housley
7a360de49d The results for a list only directory should be sent to the callback 2007-06-26 20:23:10 +00:00
James Housley
1be4557694 ftp_list_only mode should list all file types, not just directories. 2007-06-26 19:12:58 +00:00
Daniel Stenberg
6a21738704 gah, adding missing braces, removed silly debug output, added new debug output 2007-06-25 14:17:52 +00:00
Daniel Stenberg
974fa1242a Adjusted how libcurl treats HTTP 1.1 responses without content-lenth or
chunked encoding (that also lacks "Connection: close"). It now simply
assumes that the connection WILL be closed to signal the end, as that is how
RFC2616 section 4.4 point #5 says we should behave.
2007-06-25 13:58:14 +00:00
Daniel Stenberg
3dff58b3aa fix the version string as well 2007-06-25 13:52:16 +00:00
Daniel Stenberg
abf8589f0d start working towards 7.16.4 2007-06-25 09:34:44 +00:00
Daniel Stenberg
b8d006b9d7 7.16.3 2007-06-25 09:18:16 +00:00
Daniel Stenberg
af4edf10f5 As reported by "Tro" in http://curl.haxx.se/mail/lib-2007-06/0161.html and
http://curl.haxx.se/mail/lib-2007-06/0238.html, libcurl didn't properly do
no-body requests on FTP files on re-used connections properly, or at least
it didn't provide the info back in the header callback properly in the
subsequent requests.
2007-06-24 19:32:33 +00:00
Gunter Knauf
0f9e209534 added netware install target 2007-06-22 21:10:41 +00:00
Gunter Knauf
2aed8946b0 made debug flag settable from outside; add allways debug stuff when DB != NDEBUG 2007-06-22 21:10:17 +00:00
Daniel Stenberg
03b03f7b60 remove annoying debug output 2007-06-22 20:24:11 +00:00
Daniel Stenberg
a1b650ad7b Gerrit Bruchhuser pointed out a warning that the Intel(R) Thread Checker
tool reports and it was indeed a legitimate one and it is one fixed. It was
a use of a share without doing the proper locking first.
2007-06-21 14:23:38 +00:00
Daniel Stenberg
d978f85d55 Adam Piggott filed bug report #1740263
(http://curl.haxx.se/bug/view.cgi?id=1740263). Adam discovered that when
getting a large amount of URLs with curl, they were fetched slower and
slower... which turned out to be because the --libcurl data collecting which
wrongly always was enabled, but no longer is...
2007-06-20 21:57:28 +00:00
James Housley
6e7f47da5b If the creation of rsa and rsa_pub fail due to memory, don't try
other authentication methods.  Terminate with a memory error.
2007-06-20 11:30:35 +00:00
James Housley
277bab0c7b Check both variables, not the same one twice. Pointed out by Colin Hogben 2007-06-19 13:23:21 +00:00
Daniel Stenberg
fc3c5dae87 and fix another flaw in the singlecwd case when we get ftp://site.com/, also
from the #1739100 bug report
2007-06-19 12:33:28 +00:00
Daniel Stenberg
891dffb528 extra precaution to make PATH_MAX always be defined 2007-06-19 11:50:08 +00:00
James Housley
f0b361ecc1 Change rsa and rsa_pub from static arrays in ssh_conn to be dynamically
allocated when needed
2007-06-19 11:31:33 +00:00
James Housley
df7eed16dd If LIBSSH2DEBUG was defined "i" was undefined 2007-06-18 22:28:40 +00:00
Daniel Stenberg
61db4f3e2a Robson Braga Araujo filed bug report #1739100
(http://curl.haxx.se/bug/view.cgi?id=1739100) that mentioned that libcurl
could not actually list the contents of the root directory of a given FTP
server if the login directory isn't root. I fixed the problem and added three
test cases (one is disabled for now since I identified KNOWN_BUGS #44, we
cannot use --ftp-method nocwd and list ftp directories).
2007-06-18 21:09:32 +00:00
Daniel Stenberg
fe85ae15f3 make the ftp-method multicwd case possible to LIST the root directory of a
server!
2007-06-18 21:04:45 +00:00
Daniel Stenberg
cc26cc5dcd Test listing of root dir with the three ftp-methods. KNOWN_BUGS #44 make me
disable test 351 by default by I add the test case anyway to make it easier
to work on this problem in the future.
2007-06-18 21:04:05 +00:00
Daniel Stenberg
eb965e2a13 44. --ftp-method nocwd does not handle URLs ending with a slash properly (it
should list the contents of that directory). See test case 351.
2007-06-18 21:03:14 +00:00
Daniel Stenberg
4e35395d0e Daniel Johnson reported the tests now run fine on OS X! 2007-06-18 08:57:13 +00:00
James Housley
b61b420cb8 Curl_ssh_connect() was using an uninitialized variable in one location.
Caught by the auto-builds
2007-06-16 16:58:02 +00:00
Daniel Stenberg
b0aa11fde7 Tom Regner added /usr/lib/misc to the path to scan for sftp to make the
sftp tests run fine on gentoo
2007-06-14 21:16:08 +00:00
Daniel Stenberg
b691102ec7 Shmulik Regev fixed a flaw in the multi interface that occurred when doing
HTTP CONNECT over a proxy
2007-06-14 14:42:21 +00:00
Daniel Stenberg
2785fe7f61 s/HAVE_POLL/HAVE_SYS_POLL_H 2007-06-14 14:15:21 +00:00
James Housley
db5d4bd811 Remove duplicate code that was left in as part of 1.35. This code
only affected sftp_sendquote() for the "chgrp/chmod/chown" commands.

This also fixed failure of test 614 on a system that previously failed.
2007-06-14 13:22:00 +00:00
Daniel Stenberg
dc3b3c6916 Make our own definitions of the POLL* defiens and the pollfd struct only get
done if the sys/poll.h file is missing, as we have seen machines with poll()
present but without the header file and machines that don't get HAVE_POLL
defined but that do have the sys/poll.h header file...
2007-06-14 11:21:48 +00:00
James Housley
82d3f97659 BUG FIX: When reading a directory listing that contains symlinks
with the latest libssh2, the listing would be truncated at the symlink.
Fix by looping on LIBSSH2_ERROR_EAGAIN, like the rest of the calls.
2007-06-14 10:36:53 +00:00
Daniel Stenberg
235632ed2c Tom Regner provided a patch and worked together with James Housley, so now
CURLOPT_FTP_CREATE_MISSING_DIRS works for SFTP connections as well as FTP
ones.
2007-06-13 20:17:35 +00:00
Daniel Stenberg
68330c86e7 Rich Rauenzahn filed bug report #1733119
(http://curl.haxx.se/bug/view.cgi?id=1733119) and we collaborated on the fix.
The problem is that for 64bit HPUX builds, several socket-related functions
would still assume int (32 bit) arguments and not socklen_t (64 bit) ones.
2007-06-13 20:08:19 +00:00
James Housley
f37dc9168a Restore functionality mistakenly removed in the previous commit 2007-06-13 17:13:44 +00:00
James Housley
17798ed740 Update documentation to reflect SFTP's ability to create directories on
upload.  Some text provieded by Tom Regner
2007-06-13 15:02:34 +00:00
Gisle Vanem
05ba9f9fcd libssh2_session_free() returns void. Fix "#endif". 2007-06-13 14:01:48 +00:00
James Housley
96f4af4db9 Commit Tom Regner's code for SFTP create missing directories. This patch
uses the --ftp-create-dirs flag to control if cURL will try and create
directories that are specified in an upload path, but don't exist.
2007-06-13 12:15:23 +00:00
James Housley
3ec7f8a25a Add a define to protect the state machine from older versions of libssh2,
ie 0.14, that don't know about newer constants used in the state machine.
2007-06-13 11:27:41 +00:00
Daniel Stenberg
375cdf89ad With lots of help from Rich Rauenza(?) in bug #1733119, we introduce a fairly
complicated work-around for 64bit HPUX compiles. We do the fix using inline
static functions to make them follow the header file properly and thus get
used fine in the test suite too etc.
2007-06-12 21:39:21 +00:00
James Housley
ab7e7144ef * Updates for the latest version of libssh2, specifically
libssh2_sftp_shutdown() and libssh2_session_free() can now return
  LIBSSH2_ERROR_EAGAIN.

* Fix the _send() and _recv() return values so non-blocking works
2007-06-12 21:32:45 +00:00
James Housley
6f59e19b91 While connect and transfer works fine in non-blocking mode for the test
suite, transfer fails in the real world.  So after connect set to blocking
as full non-blocking is migrated out.
2007-06-12 16:15:20 +00:00
Daniel Stenberg
7800b56dc8 mention James current work on ssh 2007-06-12 13:51:57 +00:00
James Housley
73c13220ee Prevent the state machine from getting stuck in SSH_AUTH_HOST_INIT 2007-06-12 13:47:32 +00:00
James Housley
99e0597c7b Convert Curl_ssh_connect() to run in a state machine for
LIBSSH2_APINO >= 200706012030.  More to come...
2007-06-12 12:31:10 +00:00
Daniel Stenberg
3247ac1918 remove unused field in the state struct 2007-06-12 08:15:02 +00:00
Dan Fandrich
c45d44fee9 Wait longer for servers to start up since the ssh server needs to generate
keys the first time (which can take a while on a slow or loaded host).
Enforce a longer startup wait time for the ssh client SOCKS server, too.
Check for an error code from startnew() when starting any server.
2007-06-11 17:53:10 +00:00
Dan Fandrich
1e718a515a We do not use RSA keys in the test suite. 2007-06-11 17:49:25 +00:00
Daniel Stenberg
d23d686de2 restore the correct timeout time that my previous commit broke 2007-06-11 13:35:33 +00:00
Daniel Stenberg
c8677e9d3f Properly wait for the c-ares resolve to complete, hopefully the cure for
bug #1733955
2007-06-11 13:32:49 +00:00
Daniel Stenberg
a32eaffa77 Daniel Black's clarfication about the NTLM support 2007-06-11 07:27:02 +00:00
Gisle Vanem
1dcb99f0f7 constify 'hostname' in init_thread_sync_data(). Simply clear
the whole 'tsd' structure on exit in destroy_thread_sync_data().
2007-06-11 04:33:21 +00:00
Gisle Vanem
03bc2d34da Squelsh some warnings for libssh older than 0.1.5. 2007-06-11 04:07:51 +00:00
Dan Fandrich
477e27f99d Fixed the test harness so that it actually kills the ssh being used as
the SOCKS server.
2007-06-08 18:56:05 +00:00
Dan Fandrich
6a84d492f1 Improved compatibility with perl 5.0 on the 'open' calls. 2007-06-08 17:32:24 +00:00
Dan Fandrich
873d95a34c Incorporated Daniel Black's test706 and test707 SOCKS test cases. 2007-06-08 17:21:40 +00:00
Dan Fandrich
1500e95839 Improved compatibility with perl 5.0 on the 'open' calls. 2007-06-08 17:03:50 +00:00
James Housley
4f8ebd1673 Curl_scp_done() needs to call libssh2_channel_free() to prevent a
memory leak, and it is the right thing to do.
2007-06-08 16:19:21 +00:00
James Housley
cd4e6fbcac Fix to work with the latest CVS version of libssh2
* As of (LIBSSH2_APINO >= 200706012030) there are not *nb() functions
* As of (LIBSSH2_APINO >= 200706012030) most libssh2_*() functions
  can return LIBSSH2_ERROR_EAGAIN to indicate that the call would block.

To make the code work as previously, blocking, all the code has been
updated so that when (LIBSSH2_APINO >= 200706012030) it loops simulating
blocking.  This allows the existing code to function and not hold up
the upcoming release.
2007-06-08 16:02:57 +00:00
Daniel Stenberg
2fd2ca9dac start working on 1.4.1 2007-06-08 09:01:33 +00:00
Daniel Stenberg
82d6240e7d 1.4.0 preps 2007-06-08 08:46:28 +00:00
Dan Fandrich
ad80490711 Changed the opens to work on older versions of perl.
Redirect ssh output to ssh.log
2007-06-07 22:42:26 +00:00
Dan Fandrich
38b490a310 Fixed a compiler warning on uClibc. 2007-06-07 22:24:53 +00:00
Daniel Stenberg
2ea052336f bug #1720605, There seems to be a problem when connecting to the Microsoft telnet server 2007-06-07 21:56:03 +00:00
Daniel Stenberg
3b9eefca89 Daniel S (6 June 2007)
- -s/--silent can now be used to toggle off the silence again if used a second
  time.

Daniel S (5 June 2007)
- Added Daniel Black's work that adds the first few SOCKS test cases. I also
  fixed two minor SOCKS problems to make the test cases run fine.
2007-06-07 21:47:29 +00:00
Dan Fandrich
073a6cea45 Renamed the sshd log file to sshd.log.
Added more options to the ssh config file to improve the consistency of
the test environment.
Force a rewrite of the ssh config files on every invocation.
Changed the opens to work on older versions of perl.
2007-06-07 21:42:33 +00:00
Dan Fandrich
345ffd1163 Cleaned up SOCKS tests. Use a magic port number instead of killserver
to do nonlistening server tests, like other tests.
2007-06-07 20:14:00 +00:00
Dan Fandrich
f0ffb35d55 Fixed some problems in starting SSH for use in SOCKS. 2007-06-07 19:49:09 +00:00
Daniel Stenberg
b4d2fbae6d make -s/--silent properly toggle as it is documented 2007-06-06 20:08:40 +00:00
Daniel Stenberg
42a2138d11 the revert 2007-06-05 13:53:10 +00:00
Daniel Stenberg
e86dfd9688 added 703: a socks5 version of 702 2007-06-05 13:52:34 +00:00
Daniel Stenberg
a466b31574 Daniel Black's test suite fixes and initial test cases for SOCKS4/5 using
openssh
2007-06-05 13:50:59 +00:00
Daniel Stenberg
48064f8dee if we read zero bytes from the proxy, the connection is broken and we need
to bail out
2007-06-05 13:42:23 +00:00
Daniel Stenberg
e71378d3c8 mark connect failures as non-connected when ConnectPlease() fails, like when
a connection through a socks proxy doesn't work
2007-06-05 13:41:50 +00:00
Daniel Stenberg
90d40aff72 Revered Ashish Sharma's multiple entries patch, as it caused memory madness 2007-06-04 21:33:02 +00:00
Daniel Stenberg
30808dca40 minor edit since getting an ID seems pointless when failure happens 2007-06-04 21:26:30 +00:00
Daniel Stenberg
8629620b1c fix the bad bad bad mess this caused on name resolves returning more than
one name... Reported by James Bursa
2007-06-04 21:04:14 +00:00
Daniel Stenberg
25d2a27c64 Brad Spencer found and fixed three flaws in the code, found with the new
gcc 4.2.0 warning: -Waddress
2007-06-02 20:09:23 +00:00
Daniel Stenberg
b084dc8760 Brad House fixed VS2005 compiler warnings due to time_t being 64bit.
He also made recent Microsoft compilers use _strdup() instead of strdup().
2007-06-02 19:48:29 +00:00
Daniel Stenberg
2ae9536d32 Ashish Sharma provided a patch for supporting multiple entries in the
/etc/hosts file. Patch edited for coding style and functionality by me
(Daniel).
2007-06-02 19:42:25 +00:00
Daniel Stenberg
f5713dbb2e ares_destroy_options() and ares_save_options() man pages by Brad House 2007-06-02 19:32:30 +00:00
Daniel Stenberg
b10ff9791b ouch, two conditionals were turned backwards! 2007-06-01 21:24:34 +00:00
Daniel Stenberg
86a25239ec do the update timer stuff even when CURLM_CALL_MULTI_PERFORM is returned 2007-06-01 21:01:57 +00:00
Daniel Stenberg
4c663ba9a8 When transferring 500 downloads in parallel with a c-ares enabled build only
to find that it crashed miserably, and this was due to some select()isms left
in the code. This was due to API restrictions in c-ares 1.3.x, but with the
upcoming c-ares 1.4.0 this is no longer the case so now libcurl runs much
better with c-ares and the multi interface with > 1024 file descriptors in
use.
2007-05-31 11:34:32 +00:00
Daniel Stenberg
713c9f8602 Feng Tu made (lib)curl support "upload" resuming work for file:// URLs. 2007-05-31 08:59:44 +00:00
Daniel Stenberg
14b9b823e6 make next version 1.4.0 2007-05-30 21:45:56 +00:00
Daniel Stenberg
6a674ded0e first take at detecting a random device and seeding the random key using data
from it in randomize_key()
2007-05-30 21:37:17 +00:00
Daniel Stenberg
2faba57c85 Shmulik Regev brought cryptographically secure transaction IDs 2007-05-30 21:11:10 +00:00
Daniel Stenberg
79d59ec97b Brad House added ares_save_options() and ares_destroy_options() that can be
used to keep options for later re-usal when ares_init_options() is used.
2007-05-30 20:49:14 +00:00
Daniel Stenberg
a49e78d9b7 Added CURLMOPT_MAXCONNECTS which is a curl_multi_setopt() option for setting
the maximum size of the connection cache maximum size of the multi handle.
2007-05-30 20:04:44 +00:00
Yang Tse
9583b51d80 In case of test failure, try not to show log files of other tests 2007-05-30 17:15:05 +00:00
Daniel Stenberg
670273968c added ares_process_fd() to allow applications to ask for processing on
specific sockets and thus avoiding select() and associated functions/macros.
This function will be used by upcoming libcurl releases for this very
reason. It also made me export the ares_socket_t type in the public ares.h
header file, since ares_process_fd() uses that type for two of the arguments.
2007-05-30 12:58:47 +00:00
Daniel Stenberg
b6820b2674 remove really annoying debug output that makes life miserable when you do
hundreds of parallel transfers...
2007-05-30 09:24:06 +00:00
Daniel Stenberg
b9a6dfab03 When working with a problem Stefan Becker had, I found an off-by-one buffer
overwrite in Curl_select(). While fixing it, I also improved its performance
somewhat by changing calloc to malloc and breaking out of a loop earlier
(when possible).
2007-05-26 22:09:08 +00:00
Daniel Stenberg
8bd7197a8f Primarily this fixes an off-by-one buffer overwrite (rare but still existing).
I also switched from calloc() to malloc() as a minor performance boost since
the rest of the code fills in the structs fine anyway - and they must for the
case when we use the stack-based auto variable array instead of the allocated
one.

I made the loop filling in poll_fds[] break when poll_nfds is reached as a
minor speed improvement.
2007-05-26 22:02:29 +00:00
Daniel Stenberg
ebb5e1db4b Clarify a bit about the fact that easy handles remain in the multi stack when
transfers are done and need to be removed and closed or re-added.
2007-05-26 20:50:00 +00:00
Daniel Stenberg
4702807da8 make it a WARNING since this hits people hard in their faces 2007-05-26 20:47:33 +00:00
Daniel Stenberg
fe1fe64fd4 Rob Crittenden fixed bug #1705802
(http://curl.haxx.se/bug/view.cgi?id=1705802), which was filed by Daniel
Black identifying several FTP-SSL test cases fail when we build libcurl with
NSS for TLS/SSL. Listed as #42 in KNOWN_BUGS.
2007-05-25 21:56:27 +00:00
Daniel Stenberg
9d904ee41b updated 2007-05-25 21:20:39 +00:00
Daniel Stenberg
fcc3e2ca34 Ravi Pratap fixed a flaw in the init_by_resolv_conf() function for windows
that could cause it to return a bad return code.
2007-05-25 21:11:28 +00:00
Daniel Stenberg
c25da51913 Song Ma filed bug report #1724016
(http://curl.haxx.se/bug/view.cgi?id=1724016) noticing that downloading
glob-ranges for TFTP was broken in CVS.
2007-05-24 21:11:18 +00:00
Daniel Stenberg
05ab8d291c stay within 80 cols 2007-05-24 21:11:00 +00:00
Daniel Stenberg
70b1900dd1 'mytx' in bug report #1723194 (http://curl.haxx.se/bug/view.cgi?id=1723194)
pointed out that the warnf() function in the curl tool didn't properly deal
with the cases when excessively long words were used in the string to chop
up.
2007-05-24 20:58:25 +00:00
Daniel Stenberg
380e132da3 TFTP transfers are also blocking 2007-05-23 12:59:12 +00:00
Daniel Stenberg
f2eb3c1f79 fix the formatting of the trailing list 2007-05-23 12:51:52 +00:00
Daniel Stenberg
96c093f27c Andre Guibert de Bruet fixed a memory leak when PKCS #12 parsing failed 2007-05-22 20:46:51 +00:00
Daniel Stenberg
a9d49769ff Andre Guibert de Bruet fixed a memory leak in the function that verifies the
peer's name in the SSL certificate when built for OpenSSL. The leak happens
for libcurls with CURL_DOES_CONVERSIONS enabled that fail to convert the CN
name from UTF8.
2007-05-22 19:51:44 +00:00
Daniel Stenberg
d7616d8a0a WaitForSingleObject() uses a millisecond timeout and CURL_TIMEOUT_RESOLVE is
counted in seconds...
2007-05-20 22:11:47 +00:00
Daniel Stenberg
826bbfc01c better fix for the dl/ul counters 2007-05-18 10:40:43 +00:00
Daniel Stenberg
250f9670b7 Feng Tu reported that curl -w did wrong on TFTP transfers in
bug report #1715394 (http://curl.haxx.se/bug/view.cgi?id=1715394), and the
transfer-related info "variables" were indeed overwritten with zeroes wrongly
and have now been adjusted. The upload size still isn't accurate.
2007-05-18 10:32:48 +00:00
Daniel Stenberg
ed4936fd30 bail out with error codes on failures 2007-05-18 10:12:57 +00:00
Daniel Stenberg
4dd2628093 they spell five with a v... 2007-05-17 21:41:02 +00:00
Daniel Stenberg
8479785620 Feng Tu pointed out a division by zero error in the TFTP connect timeout
code for timeouts less than fice seconds, and also provided a fix for it.
2007-05-17 21:40:08 +00:00
Dan Fandrich
0427e94465 Added support for compiling under Minix 3.1.3 using ACK. 2007-05-17 06:04:44 +00:00
Dan Fandrich
09fd3b4935 Match file times occurring in the morning. 2007-05-16 17:45:53 +00:00
Dan Fandrich
3fef839f75 Added call to setvbuf (disabled by default for speed) to flush the
memdebug log file after every line and avoid losing the last few log
entries if curl crashes.
2007-05-15 00:36:56 +00:00
Dan Fandrich
ea43bb013b Added support for quote commands before a transfer using SFTP and test
case 614.
Allow SFTP quote commands chmod, chown, chgrp to set a value of 0.
2007-05-15 00:28:50 +00:00
Dan Fandrich
b0a4c992e7 Added SFTP directory listing test case 613. 2007-05-14 22:03:42 +00:00
Dan Fandrich
85707460e5 Added FTPS upload tests 408 and 409. 2007-05-10 20:03:20 +00:00
Dan Fandrich
41ba7666f0 Kristian Gunstone fixed a problem where overwriting an uploaded file with
sftp didn't truncate it first, which would corrupt the file if the new
file was shorter than the old.
2007-05-09 18:24:27 +00:00
Dan Fandrich
4367e0513a Added the list of SFTP post-quote commands, and fixed a few typos. 2007-05-09 18:05:14 +00:00
Dan Fandrich
ed998270aa Added FTPS test cases 406 and 407 2007-05-08 22:14:30 +00:00
Daniel Stenberg
1b7f00b2a6 CURLE_FTP_COULDNT_STOR_FILE is now known as CURLE_UPLOAD_FAILED. This is
because I just made SCP uploads return this value if the file size of
the upload file isn't given with CURLOPT_INFILESIZE*. Docs updated to
reflect this news, and a define for the old name was added to the public
header file.
2007-05-08 11:34:31 +00:00
Daniel Stenberg
ad19f95f15 James Bursa fixed a bug in the multi handle code that made the connection
cache grow a bit too much, beyond the normal 4 * easy_handles.
2007-05-07 07:07:55 +00:00
Daniel Stenberg
bcfe3cb231 extended the description for the curl_multi_socket_action() change 2007-05-06 08:14:42 +00:00
Daniel Stenberg
805a5dcac8 42. Daniel Black filed bug report #1705802 where he accurately mentions that
several FTP-SSL test cases fail when we build libcurl with NSS for TLS/SSL:
  http://curl.haxx.se/bug/view.cgi?id=1705802
2007-05-03 20:50:07 +00:00
Dan Fandrich
0b67ee7bad Fixed a few typos. 2007-05-03 19:12:45 +00:00
Daniel Stenberg
9298037639 document the new 200alias behaviour 2007-05-03 12:30:33 +00:00
Daniel Stenberg
f7472075d7 Anders Gustafsson remarked that requiring CURLOPT_HTTP_VERSION set to 1.0
when CURLOPT_HTTP200ALIASES is used to avoid the problem mentioned below is
not very nice if the client wants to be able to use _either_ a HTTP 1.1
server or one within the aliases list... so starting now, libcurl will
simply consider 200-alias matches the to be HTTP 1.0 compliant.
2007-05-02 20:42:02 +00:00
Dan Fandrich
9f72db13c4 Fixed an out of memory handling issue with HTTP pipelines. 2007-05-02 19:13:56 +00:00
Daniel Stenberg
acc4868b78 Tobias Rundstrom reported a problem they experienced with xmms2 and recent
libcurls, which turned out to be the 25-nov-2006 change which treats HTTP
responses without Content-Length or chunked encoding as without bodies. We
now added the conditional that the above mentioned response is only without
body if the response is HTTP 1.1.
2007-05-02 17:35:47 +00:00
Daniel Stenberg
1afb67e31b - Jeff Pohlmeyer improved the hiperfifo.c example to use the
CURLMOPT_TIMERFUNCTION callback option.
2007-05-02 13:52:38 +00:00
Daniel Stenberg
2f0539d880 - Set the timeout for easy handles to expire really soon after addition or
when CURLM_CALL_MULTI_PERFORM is returned from curl_multi_socket*/perform,
  to make applications using only curl_multi_socket() to properly function
  when adding easy handles "on the fly". Bug report and test app provided by
  Michael Wallner.
2007-05-02 13:47:56 +00:00
Daniel Stenberg
6f7d0a7cbd Merged _all_ old changelogs into the single CHANGES.0 file. Having a new one
for every year is giving us too many files! I also split out the changes
from 2006 from CHANGES to CHANGES.0 now.
2007-05-02 13:14:56 +00:00
Daniel Stenberg
3d513f7ab1 spell and language fix 2007-05-02 11:14:55 +00:00
Dan Fandrich
6c8e6549d0 Check the return code from curl_multi_add_handle() 2007-05-02 06:02:13 +00:00
Dan Fandrich
eec105daba Fixed a logic error in the last patch and another out of memory issue.
Reduce the scope of some variables.
2007-05-02 00:50:06 +00:00
Dan Fandrich
19a80add95 Improved behaviour in out of memory conditions. 2007-05-01 20:52:05 +00:00
Dan Fandrich
93844f64ef Use memcpy instead of strcpy to improve performance. 2007-05-01 20:50:50 +00:00
Daniel Stenberg
60588b2455 brlcad on #curl provided this patch (edited by me) since "configure will fail
looking for a C++ preprocessor on libtool-using projects" with the factory-
installed libtool version on Mac OS X.
2007-04-30 21:47:58 +00:00
Dan Fandrich
5187faeeb9 Improved the test harness to allow running test servers on other than
the default port numbers, allowing more than one test suite to run
simultaneously on the same host.
2007-04-30 20:15:33 +00:00
Dan Fandrich
1228ec9fbb Fixed some tests to stop hard-coding the port number. 2007-04-30 19:05:48 +00:00
Dan Fandrich
717adfeb96 Rearranged some allocs so they will be freed correctly in the error path. 2007-04-29 07:04:29 +00:00
Daniel Stenberg
503557e5ce Peter O'Gorman fixed libcurl to not init GnuTLS as early as we did before,
since it then inits libgcrypt and libgcrypt is being evil and EXITS the
application if it fails to get a fine random seed. That's really not a nice
thing to do by a library.
2007-04-28 21:01:30 +00:00
Daniel Stenberg
f611f42dcf Frank Hempel fixed a curl_easy_duphandle() crash on a handle that had
been removed from a multi handle, and then fixed another flaw that prevented
curl_easy_duphandle() to work even after the first fix - the handle was
still marked as using the multi interface.
2007-04-28 20:27:07 +00:00
Daniel Stenberg
7a0e0c36c5 Move the explictit free of the range string to Curl_close() from Curl_disconnect()
since it easy-handle related and not connection-related.
2007-04-27 08:30:48 +00:00
Daniel Stenberg
61edee979f oops, this was supposed to be properly removed 2007-04-27 08:19:48 +00:00
Daniel Stenberg
7a343a3f60 As a follow-up to the removal of the free of the range data in Curl_done() - this
moves and re-arranges how range/resume is setup and freed.
2007-04-27 08:18:47 +00:00
Daniel Stenberg
b4d3c4a76c Peter O'Gorman found a problem with SCP downloads when the downloaded file
was 16385 bytes (16K+1) and it turned out we didn't properly always "suck
out" all data from libssh2. The effect being that libcurl would hang on the
socket waiting for data when libssh2 had in fact already read it all...
2007-04-26 21:30:29 +00:00
Dan Fandrich
f213d0db98 Added support in runtests.pl for "!n" test numbers to disable individual tests. 2007-04-25 23:18:52 +00:00
Dan Fandrich
6e835ef3aa Fixed an out of memory handling issue. 2007-04-25 20:54:02 +00:00
Daniel Stenberg
ed8cb57151 Sonia Subramanian brought our attention to a problem that happens if you set
the CURLOPT_RESUME_FROM or CURLOPT_RANGE options and an existing connection
in the connection cache is closed to make room for the new one when you call
curl_easy_perform(). It would then wrongly free range-related data in the
connection close funtion.
2007-04-25 20:20:15 +00:00
Dan Fandrich
9bdb05b4d6 When displaying log files, truncate the really longs ones such as you
would get from a torture test.
2007-04-25 20:09:32 +00:00
Yang Tse
94b253fde7 Steve Little's fixes to allow compilation on VMS 64-bit mode 2007-04-25 03:00:10 +00:00
Dan Fandrich
61d7e720a5 Treat log files and -k the same when running torture tests as when not. 2007-04-24 23:28:57 +00:00
Dan Fandrich
17507eac85 Clear out FTP server options before each new client.
Wait for child processes to die to avoid creating zombies.
2007-04-24 21:30:39 +00:00
Daniel Stenberg
bc1ae973da Robert Iakobashvili made the 'master_buffer' get allocated first once it is
can/will be used as it then makes the common cases save 16KB of data for each
easy handle that isn't used for pipelining.
2007-04-24 10:18:06 +00:00
Dan Fandrich
6a35841b2e Added tests 610-612 to test more SFTP post-quote commands. 2007-04-23 23:00:38 +00:00
Dan Fandrich
28dde78dde Added <postcheck> support to the test harness. 2007-04-23 22:58:45 +00:00
Dan Fandrich
37171809f6 Mention NSS, <postcmd> commands 2007-04-23 21:18:30 +00:00
Dan Fandrich
3398eca7c3 Changed another nonexistent host name to be under the haxx.se domain
to guarantee against it ever being valid.
2007-04-23 01:51:02 +00:00
Yang Tse
3616912d22 Avoid an unnecessary call to gettimeofday() when
using custom timeout values.
2007-04-22 18:17:46 +00:00
Daniel Stenberg
0abccc676d --without-ssl disables OpenSSL only 2007-04-22 09:37:05 +00:00
Daniel Stenberg
a93af43974 - Song Ma's warning if -r/--range is given with a "bad" range, also noted in
the man page now.
2007-04-22 09:31:27 +00:00
Daniel Stenberg
0bbc759c0c configure fix and new mirror 2007-04-22 08:51:11 +00:00
Daniel Stenberg
56a5c49ac0 clarify a bit on the follow-redirect logic and when curl switches from POST
to GET on redirect
2007-04-22 08:05:40 +00:00
Daniel Stenberg
02267eba4c shell script assigns should not have spaces, hopefully fixes bug #1705177 2007-04-22 07:36:12 +00:00
Daniel Stenberg
cea9695bcf Daniel Black filed bug #1704675 (http://curl.haxx.se/bug/view.cgi?id=1704675)
identifying a double-free problem in the SSL-dealing layer, telling GnuTLS to
free NULL credentials on closedown after a failure and a bad #ifdef for NSS
when closing down SSL.
2007-04-21 21:32:31 +00:00
Daniel Stenberg
92039629c7 Curl_ssl_close(): mark the connection as not using SSL anymore, to better
survive getting called twice
2007-04-21 21:24:53 +00:00
Gunter Knauf
c8d3327e92 fixed ARFLAGS for CodeWarrior build. 2007-04-21 15:32:35 +00:00
Dan Fandrich
043070f90e Changed an error message slightly so it can be caught easier by the
autobuild logs scanner.
2007-04-20 17:16:32 +00:00
Daniel Stenberg
36626c4b6e ifndef check the CURL_MAX_WRITE_SIZE define to allow this value to easier be
changed at build time (from command line or similar)
2007-04-20 07:19:36 +00:00
Yang Tse
7f33aae067 initialize pending_ms to zero to avoid compiler warning:
'pending_ms' may be used uninitialized in this function
2007-04-20 01:58:15 +00:00
Yang Tse
61022f3817 - Save one call to curlx_tvnow(), which calls gettimeofday(), in each of
Curl_socket_ready(), Curl_poll() and Curl_select() when these are called
  with a zero timeout or a timeout value indicating a blocking call should
  be performed.

  These unnecessary calls to gettimeofday() got introduced in 7.16.2 when
  fixing 'timeout would restart when signal caught while awaiting socket
  events' on 20 March 2007.

- Move some loop breaking logic from the while clause into the loop,
  avoiding compiler warning 'assignment within conditional expression'
2007-04-20 00:07:19 +00:00
Daniel Stenberg
bf648fcfc3 keep lines < 80 columns 2007-04-19 20:20:48 +00:00
Yang Tse
b0e909329e fix comment and line spacing 2007-04-19 20:16:28 +00:00
Dan Fandrich
ae3d5949b8 Various test file cleanups, including using <servercmd> instead of writing
directly to ftpserver.cmd and removing unneeded empty sections.
2007-04-18 20:22:01 +00:00
Daniel Stenberg
c234b9d04b clarify the comment about libssh2_sftp_write's return type 2007-04-18 20:15:22 +00:00
Daniel Stenberg
7a86740afd - James Housley made SFTP uploads use libssh2's non-blocking API (if available) 2007-04-18 20:11:47 +00:00
Daniel Stenberg
8e719e3ef5 - Prevent the internal progress meter from updating more frequently than once
per second.
2007-04-18 20:02:41 +00:00
Dan Fandrich
66fc5498d2 Added test cases 296, 297 and 298 to test --ftp-method handling 2007-04-18 06:30:28 +00:00
Gunter Knauf
f30ae93a1f added ranlib when library is created with ar. 2007-04-16 20:54:56 +00:00
Gisle Vanem
365e8eb78e No need for USE_MANUAL. Use select_s() instead of select().
Added ares_getopt.o to program sample objects.
2007-04-16 16:52:56 +00:00
Daniel Stenberg
76627b322e - Robert Iakobashvil added curl_multi_socket_action() to libcurl, which is a
function that deprecates the curl_multi_socket() function. Using the new
  function the application tell libcurl what action that was found in the
  socket that it passes in. This gives a significant performance boost as it
  allows libcurl to avoid a call to poll()/select() for every call to
  curl_multi_socket*().
2007-04-16 16:34:08 +00:00
Yang Tse
827228bd69 move linkage var declarations to ares_getopt.h 2007-04-16 15:35:34 +00:00
Gunter Knauf
69c5506b69 use Makefile.inc to determine sources. 2007-04-16 13:53:58 +00:00
Gunter Knauf
3a2e623fc8 ares_getopt() command-line parser function does not belong to actual c-ares library. It is just a convinience source code helper function for use in example programs adig.c and ahost.c 2007-04-16 13:17:26 +00:00
Daniel Stenberg
8aa9f01ed8 Jay Austin added "DH PARAMETERS" to the stunnel.pem certificate 2007-04-16 11:55:43 +00:00
Yang Tse
b0b6a853f6 ares_getopt() command-line parser function does not belong to actual
c-ares library. It is just a convinience source code helper function
for use in example programs adig.c and ahost.c
2007-04-16 09:08:15 +00:00
Yang Tse
0563a7a923 ares_getopt() command-line parser function does not belong to actual
c-ares library. It is just a convinience source code helper function
for use in example programs adig.c and ahost.c
2007-04-16 09:01:16 +00:00
Dan Fandrich
945ba7cb7e Minor updates to --help output 2007-04-15 06:24:43 +00:00
Daniel Stenberg
e3dab1bea2 jayjwa added the "DH PARAMETERS" to make this work with recent stunnels 2007-04-14 20:29:09 +00:00
Daniel Stenberg
9c369c695d updates 2007-04-14 20:27:11 +00:00
Gunter Knauf
011ccbc31a removed unneeded brackets with NetWare implementation. 2007-04-14 16:55:17 +00:00
Gunter Knauf
f1596698ae ups - c&p error. 2007-04-14 16:45:43 +00:00
Gunter Knauf
c60b52ab43 use system-own getpassword() function on NetWare. 2007-04-14 16:38:13 +00:00
Dan Fandrich
71a0d50f48 Added test cases 294 and 295 to test --ftp-account handling 2007-04-13 20:59:15 +00:00
Yang Tse
8d2a0fe85b Fix test case 534 which started to fail 2007-04-13 due to the existance
of a new host on the net with the same silly domain the test was using
for a host which was supposed not to exist.
2007-04-13 11:35:19 +00:00
Yang Tse
b039d883e5 proper fix for compiler warning 2007-04-13 08:45:07 +00:00
Yang Tse
b3401ddbad Take in account that it can be built with compiler debug info and
without the curl memory debugging leak detection code enabled.
2007-04-13 08:22:56 +00:00
Yang Tse
038fe54e21 fix compiler warning 2007-04-13 07:57:31 +00:00
Daniel Stenberg
4b5a65455e update! 2007-04-12 21:53:18 +00:00
Daniel Stenberg
2566a5d4da add a 'vc8' target that (re-)builds the */Makefile.vc8 files 2007-04-12 20:41:24 +00:00
Daniel Stenberg
c38c339480 Song Ma found a memory leak in the if2ip code if you pass in an interface
name longer than the name field of the ifreq struct (typically 6 bytes), as
then it wouldn't close the used dummy socket.
2007-04-12 20:09:19 +00:00
Yang Tse
ea74b4b8e1 update MSVC project files with ares_getopt() 2007-04-12 19:14:00 +00:00
Yang Tse
2364066be0 use ares_getopt for all platforms 2007-04-12 19:01:19 +00:00
Yang Tse
b36376e12d add ares_getopt prototype 2007-04-12 18:59:46 +00:00
Yang Tse
8aae15b630 Rename function as ares_getopt() 2007-04-12 18:06:41 +00:00
Yang Tse
88bf2a2dc7 Replace tabs with spaces 2007-04-12 17:45:57 +00:00
Yang Tse
45847c5324 Add file ares_getopt.c
Original file name getopt.c  Initial import into the c-ares source tree
on 2007-04-11.  Lifted from version 5.2 of the 'Open Mash' project with
the modified BSD license, BSD license without the advertising clause.
2007-04-12 16:53:59 +00:00
Dan Fandrich
70cce4cddd Work around an out of memory situation in Curl_ftp_done instead of
returning an error code, to allow connections to be torn down
cleanly since this function can be called AFTER an OOM situation
has already been reached.
2007-04-12 01:26:02 +00:00
Daniel Stenberg
42c0ac2008 start working on 7.16.3 2007-04-11 13:32:59 +00:00
Daniel Stenberg
70ddabbfb0 restart towards 7.16.3 2007-04-11 13:31:51 +00:00
Daniel Stenberg
e3716938bd add recent contributors 2007-04-11 13:30:09 +00:00
238 changed files with 18439 additions and 13375 deletions

1456
CHANGES

File diff suppressed because it is too large Load Diff

11527
CHANGES.0

File diff suppressed because it is too large Load Diff

View File

@@ -1,835 +0,0 @@
Daniel (28 December 1999):
- Tim Verhoeven correctly identified that curl
doesn't support URL formatted file names when getting ftp. Now, there's a
problem with getting very weird file names off FTP servers. RFC 959 defines
that the file name syntax to use should be the same as in the native OS of
the server. Since we don't know the peer server system we currently just
translate the URL syntax into plain letters. It is still better and with
the solaris 2.6-supplied ftp server it works with spaces in the file names.
Daniel (27 December 1999):
- When curl parsed cookies straight off a remote site, it corrupted the input
data, which, if the downloaded headers were stored made very odd characters
in the saved data. Correctly identified and reported by Paul Harrington.
Daniel (13 December 1999):
- General cleanups in the library interface. There had been some bad kludges
added during times of stress and I did my best to clean them off. It was
both regarding the lib API as well as include file confusions.
Daniel (3 December 1999):
- A small --stderr bug was reported by Eetu Ojanen...
- who also brought the suggestion of extending the -X flag to ftp list as
well. So, now it is and the long option is now --request instead. It is
only for ftp list for now (and the former http stuff too of course).
Lars J. Aas (24 November 1999):
- Patched curl to compile and build under BeOS. Doesn't work yet though!
- Corrected the Makefile.am files to allow putting object files in
different directories than the sources.
Version 6.3.1
Daniel (23 November 1999):
- I've had this major disk crash. My good old trust-worthy source disk died
along with the machine that hosted it. Thank goodness most of all the
things I've done are either backed up elsewhere or stored in this CVS
server!
- Michael S. Steuer pointed out a bug in the -F handling
that made curl hang if you posted an empty variable such as '-F name='. It
was one of those old bugs that never have worked properly...
- Jason Baietto pointed out a general flaw in the HTTP
download. Curl didn't complain if it was prematurely aborted before the
entire download was completed. It does now.
Daniel (19 November 1999):
- Chris Maltby very accurately criticized the lack of
return code checks on the fwrite() calls. I did a thorough check for all
occurrences and corrected this.
Daniel (17 November 1999):
- Paul Harrington pointed out that the -m/--max-time option
doesn't work for the slow system calls like gethostbyname()... I don't have
any good fix yet, just a slightly less bad one that makes curl exit hard
when the timeout is reached.
- Bjorn Reese helped me point out a possible problem that might be the reason
why Thomas Hurst experience problems in his Amiga version.
Daniel (12 November 1999):
- I found a crash in the new cookie file parser. It crashed when you gave
a plain http header file as input...
Version 6.3
Daniel (10 November 1999):
- I kind of found out that the HTTP time-conditional GETs (-z) aren't always
respected by the web server and the document is therefore sent in whole
again, even though it doesn't match the requested condition. After reading
section 13.3.4 of RFC 2616, I think I'm doing the right thing now when I do
my own check as well. If curl thinks the condition isn't met, the transfer
is aborted prematurely (after all the headers have been received).
- After comments from Robert Linden I also rewrote some parts of the man page
to better describe how the -F works.
- Michael Anti put up a new curl download mirror in
China: http://www.pshowing.com/curl/
- I added the list of download mirrors to the README file
- I did add more explanations to the man page
Daniel (8 November 1999):
- I made the -b/--cookie option capable of reading netscape formatted cookie
files as well as normal http-header files. It should be able to
transparently figure out what kind of file it got as input.
Daniel (29 October 1999):
- Another one of Sebastiaan van Erk's ideas (that has been requested before
but I seem to have forgotten who it was), is to add support for ranges in
FTP downloads. As usual, one request is just a request, when they're two
it is a demand. I've added simple support for X-Y style fetches. X has to
be the lower number, though you may omit one of the numbers. Use the -r/
--range switch (previously HTTP-only).
- Sebastiaan van Erk suggested that curl should be
able to show the file size of a specified file. I think this is a splendid
idea and the -I flag is now working for FTP. It displays the file size in
this manner:
Content-Length: XXXX
As it resembles normal headers, and leaves us the opportunity to add more
info in that display if we can come up with more in the future! It also
makes sense since if you access ftp through a HTTP proxy, you'd get the
file size the same way.
I changed the order of the QUOTE command executions. They're now executed
just after the login and before any other command. I made this to enable
quote commands to run before the -I stuff is done too.
- I found out that -D/--dump-header and -V/--version weren't documented in
the man page.
- Many HTTP/1.1 servers do not support ranges. Don't ask me why. I did add
some text about this in the man page for the range option. The thread in
the mailing list that started this was initiated by Michael Anti.
- I get reports about nroff crashes on solaris 2.6+ when displaying the curl
man page. Switch to gnroff instead, it is reported to work(!). Adam Barclay
reported and brought the suggestion.
- In a dialogue with Johannes G. Kristinsson we came
up with the idea to let -H/--header specified headers replace the
internally generated headers, if you happened to select to add a header
that curl normally uses by itself. The advantage with this is not entirely
obvious, but in Johannes' case it means that he can use another Host: than
the one curl would set.
Daniel (27 October 1999):
- Jongki Suwandi brought a nice patch for (yet another) crash when following
a location:. This time you had to follow a https:// server's redirect to
get the core.
Version 6.2
Daniel (21 October 1999):
- I think I managed to remove the suspicious (nil) that has been seen just
before the "Host:" in HTTP requests when -v was used.
- I found out that if you followed a location: when using a proxy, without
having specified http:// in the URL, the protocol part was added once again
when moving to the next URL! (The protocol part has to be added to the
URL when going through a proxy since it has no protocol-guessing system
such as curl has.)
- Benjamin Ritcey reported a core dump under solaris 2.6
with OpenSSL 0.9.4. It turned out this was due to a bad free() in main.c
that occurred after the download was done and completed.
- Benjamin found ftp downloads to show the first line of the download meter
to get written twice, and I removed that problem. It was introduced with
the multiple URL support.
- Dan Zitter correctly pointed out that curl 6.1 and earlier versions didn't
honor RFC 2616 chapter 4 section 2, "Message Headers": "...Field names are
case-insensitive..." HTTP header parsing assumed a certain casing. Dan
also provided me with a patch that corrected this, which I took the liberty
of editing slightly.
- Dan Zitter also provided a nice patch for config.guess to better recognize
the Mac OS X
- Dan also corrected a minor problem in the lib/Makefile that caused linking
to fail on OS X.
Daniel (19 October 1999):
- Len Marinaccio came up with some problems with curl. Since Windows has a
crippled shell, it can't redirect stderr and that causes trouble. I added
--stderr today which allows the user to redirect the stderr stream to a
file or stdout.
Daniel (18 October 1999):
- The configure script now understands the '--without-ssl' flag, which now
totally disable SSL/https support. Previously it wasn't possible to force
the configure script to leave SSL alone. The previous functionality has
been retained. Troy Engel helped test this new one.
Version 6.1
Daniel (17 October 1999):
- I ifdef'ed or commented all the zlib stuff in the sources and configure
script. It turned out we needed to mock more with zlib than I initially
thought, to make it capable of downloading compressed HTTP documents and
uncompress them on the fly. I didn't mean the zlib parts of curl to become
more than minor so this means I halt the zlib expedition for now and wait
until someone either writes the code or zlib gets updated and better
adjusted for this kind of usage. I won't get into details here, but a
short a summary is suitable:
- zlib can't automatically detect whether to use zlib or gzip
decompression methods.
- zlib is very neat for reading gzipped files from a file descriptor,
although not as nice for reading buffer-based data such as we would
want it.
- there are still some problems with the win32 version when reading from
a file descriptor if that is a socket
Daniel (14 October 1999):
- Moved the (external) include files for libcurl into a subdirectory named
curl and adjusted all #include lines to use <curl/XXXX> to maintain a
better name space and control of the headers. This has been requested.
Daniel (12 October 1999):
- I modified the 'maketgz' script to perform a 'make' too before a release
archive is put together in an attempt to make the time stamps better and
hopefully avoid the double configure-running that use to occur.
Daniel (11 October 1999):
- Applied J<>rn's patches that fixes zlib for mingw32 compiles as well as
some other missing zlib #ifdef and more text on the multiple URL docs in
the man page.
Version 6.1beta
Daniel (6 October 1999):
- Douglas E. Wegscheid sent me a patch that made the exact same thing as I
just made: the -d switch is now capable of reading post data from a named
file or stdin. Use it similarly to the -F. To read the post data from a
given file:
curl -d @path/to/filename www.postsite.com
or let curl read it out from stdin:
curl -d @- www.postit.com
J<>rn Hartroth (3 October 1999):
- Brought some more patches for multiple URL functionality. The MIME
separation ideas are almost scrapped now, and a custom separator is being
used instead. This is still compile-time "flagged".
Daniel
- Updated curl.1 with multiple URL info.
Daniel (30 September 1999):
- Felix von Leitner brought openssl-check fixes for configure.in to work
out-of-the-box when the openssl files are installed in the system default
dirs.
Daniel (28 September 1999)
- Added libz functionality. This should enable decompressing gzip, compress
or deflate encoding HTTP documents. It also makes curl send an accept that
it accepts that kind of encoding. Compressed contents usually shortens
download time. I *need* someone to tell me a site that uses compressed HTTP
documents so that I can test this out properly.
- As a result of the adding of zlib awareness, I changed the version string
a little. I plan to add openldap version reporting in there too.
Daniel (17 September 1999)
- Made the -F option allow stdin when specifying files. By using '-' instead
of file name, the data will be read from stdin.
Version 6.0
Daniel (13 September 1999)
- Added -X/--http-request <request> to enable any HTTP command to be sent.
Do not that your server has to support the exact string you enter. This
should possibly a string like DELETE or TRACE.
- Applied Douglas' mingw32-fixes for the makefiles.
Daniel (10 September 1999)
- Douglas E. Wegscheid pointed out a problem. Curl didn't check the FTP
servers return code properly after the --quote commands were issued. It
took anything non 200 as an error, when all 2XX codes should be accepted as
OK.
- Sending cookies to the same site in multiple lines like curl used to do
turned out to be bad and breaking the cookie specs. Curl now sends all
cookies on a single Cookie: line. Curl is not yet RFC 2109 compliant, but I
doubt that many servers do use that syntax (yet).
Daniel (8 September 1999)
- J<>rn helped me make sure it still compiles nicely with mingw32 under win32.
Daniel (7 September 1999)
- FTP upload through proxy is now turned into a HTTP PUT. Requested by
Stefan Kanthak.
- Added the ldap files to the .m32 makefile.
Daniel (3 September 1999)
- Made cookie matching work while using HTTP proxy.
Bjorn Reese (31 August 1999)
- Passed his ldap:// patch. Note that this requires the openldap shared
library to be installed and that LD_LIBRARY_PATH points to the
directory where the lib will be found when curl is run with a
ldap:// URL.
J<>rn Hartroth (31 August 1999)
- Made the Mingw32 makefiles into single files.
- Made file:// work for Win32. The same code is now used for unix as well for
performance reasons.
Douglas E. Wegscheid (30 August 1999)
- Patched the Mingw32 makefiles for SSL builds.
Matthew Clarke (30 August 1999)
- Made a cool patch for configure.in to allow --with-ssl to specify the
root dir of the openssl installation, as in
./configure --with-ssl=/usr/ssl_here
- Corrected the 'reconf' script to work better with some shells.
J<>rn Hartroth (26 August 1999)
- Fixed the Mingw32 makefiles in lib/ and corrected the file.c for win32
compiles.
Version 5.11
Daniel (25 August 1999)
- John Weismiller pointed out a bug in the header-line
realloc() system in download.c.
- I added lib/file.[ch] to offer a first, simple, file:// support. It
probably won't do much good on win32 system at this point, but I see it
as a start.
- Made the release archives get a Makefile in the root dir, which can be
used to start the compiling/building process easier. I haven't really
changed any INSTALL text yet, I wanted to get some feed-back on this
first.
Daniel (17 August 1999)
- Another Location: bug. Curl didn't do proper relative locations if the
original URL had cgi-parameters that contained a slash. Nusu's page
again.
- Corrected the NO_PROXY usage. It is a list of substrings that if one of
them matches the tail of the host name it should connect to, curl should
not use a proxy to connect there. Pointed out to me by Douglas
E. Wegscheid. I also changed the README text a little regarding this.
Daniel (16 August 1999)
- Fixed a memory bug with http-servers that sent Location: to a Location:
page. Nusu's page showed this too.
- Made cookies work a lot better. Setting the same cookie name several times
used to add more cookies instead of replacing the former one which it
should've. Nusu <nus at intergorj.ro> brought me an URL that made this
painfully visible...
Troy (15 August 1999)
- Brought new .spec files as well as a patch for configure.in that lets the
configure script find the openssl files better, even when the include
files are in /usr/include/openssl
Version 5.10
Daniel (13 August 1999)
- SSL_CTX_set_default_passwd_cb() has been modified in the 0.9.4 version of
OpenSSL. Now why couldn't they simply add a *new* function instead of
modifying the parameters of an already existing function? This way, we get
a compiler warning if compiling with 0.9.4 but not with earlier. So, I had
to come up with a #if construction that deals with this...
- Made curl output the SSL version number get displayed properly with 0.9.4.
Troy (12 August 1999)
- Added MingW32 (GCC-2.95) support under Win32. The INSTALL file was also
a bit rearranged.
Daniel (12 August 1999)
- I had to copy a good <arpa/telnet.h> include file into the curl source
tree to enable the silly win32 systems to compile. The distribution rights
allows us to do that as long as the file remains unmodified.
- I corrected a few minor things that made the compiler complain when
-Wall -pedantic was used.
- I'm moving the official curl web page to http://curl.haxx.nu. I think it
will make it easier to remember as it is a lot shorter and less cryptic.
The old one still works and shows the same info.
Daniel (11 August 1999)
- Albert Chin-A-Young mailed me another correction for NROFF in the
configure.in that is supposed to be better for IRIX users.
Daniel (10 August 1999)
- Albert Chin-A-Young helped me with some stupid Makefile things, as well as
some fiddling with the getdate.c stuff that he had problems with under
HP-UX v10. getdate.y will now be compiled into getdate.c if the appropriate
yacc or bison is found by the configure script. Since this is slightly new,
we need to test the output getdate.c with win32 systems to make sure it
still compiles there.
Daniel (5 August 1999)
- I've just setup a new mailing list with the intention to keep discussions
around libcurl development in it. I mainly expect it to be for thoughts and
brainstorming around a "next generation" library, rather than nitpicking
about the current implementation or details in the current libcurl.
To join our happy bunch of future-looking geeks, enter 'subscribe
<address>' in the body of a mail and send it to
libcurl-request@listserv.fts.frontec.se. Curl bug reports, the usual curl
talk and everything else should still be kept in this mailing list. I've
started to archive this mailing list and have put the libcurl web page at
www.fts.frontec.se/~dast/libcurl/.
- Stefan Kanthak contacted me regarding a few problems in the configure
script which he discovered when trying to make curl compile and build under
Siemens SINIX-Z V5.42B2004!
- Marcus Klein very accurately informed me that src/version.h was not present
in the CVS repository. Oh, how silly...
- Linus Nielsen rewrote the telnet:// part and now curl offers limited telnet
support. If you run curl like 'curl telnet://host' you'll get all output on
the screen and curl will read input from stdin. You'll be able to login and
run commands etc, but since the output is buffered, expect to get a little
weird output.
This is still in its infancy and it might get changed. We need your
feed-back and input in how this is best done.
WIN32 NOTE: I bet we'll get problems when trying to compile the current
lib/telnet.c on win32, but I think we can sort them out in time.
- David Sanderson reported that FORCE_ALLOCA_H or HAVE_ALLOCA_H must be
defined for getdate.c to compile properly on HP-UX 11.0. I updated the
configure script to check for alloca.h which should make it.
Daniel (4 August 1999)
- I finally got to understand Marcus Klein's ftp download resume problem,
which turns out to be due to different outputs from different ftp
servers. It makes ftp download resuming a little trickier, but I've made
some modifications I really believe will work for most ftp servers and I do
hope you report if you have problems with this!
- Added text about file transfer resuming to README.curl.
Daniel (2 August 1999)
- Applied a progress-bar patch from Lars J. Aas. It offers
a new styled progress bar enabled with -#/--progress-bar.
T. Yamada <tai at imasy.or.jp> (30 July 1999)
- It breaks with segfault when 1) curl is using .netrc to obtain
username/password (option '-n'), and 2) is automatically redirected to
another location (option '-L').
There is a small bug in lib/url.c (block starting from line 641), which
tries to take out username/password from user- supplied command-line
argument ('-u' option). This block is never executed on first attempt since
CONF_USERPWD bit isn't set at first, but curl later turns it on when it
checks for CONF_NETRC bit. So when curl tries to redo everything due to
redirection, it segfaults trying to access *data->userpwd.
Version 5.9.1
Daniel (30 July 1999)
- Steve Walch pointed out that there is a memory leak in the formdata
functions. I added a FormFree() function that is now used and supposed to
correct this flaw.
- Mark Wotton reported:
'curl -L https://www.cwa.com.au/' core dumps. I managed to cure this by
correcting the cleanup procedure. The bug seems to be gone with my OpenSSL
0.9.2b, although still occurs when I run the ~100 years old SSLeay 0.8.0. I
don't know whether it is curl or SSLeay that is to blame for that.
- Marcus Klein:
Reported an FTP upload resume bug that I really can't repeat nor understand.
I leave it here so that it won't be forgotten.
Daniel (29 July 1999)
- Costya Shulyupin suggested support for longer URLs when following Location:
and I could only agree and fix it!
- Leigh Purdie found a problem in the upload/POST department. It turned out
that http.c accidentaly cleared the pointer instead of the byte counter
when supposed to.
- Costya Shulyupin pointed out a problem with port numbers and Location:. If
you had a server at a non-standard port that redirected to an URL using a
standard port number, curl still used that first port number.
- Ralph Beckmann pointed out a problem when using both CONF_FOLLOWLOCATION
and CONF_FAILONERROR simultaneously. Since the CONF_FAILONERROR exits on
the 302-code that the follow location header outputs it will never show any
html on location: pages. I have now made it look for >=400 codes if
CONF_FOLLOWLOCATION is set.
- 'struct slist' is now renamed to 'struct curl_slist' (as suggested by Ralph
Beckmann).
- Joshua Swink and Rick Welykochy were the first to point out to me that the
latest OpenSSL package now have moved the standard include path. It is now
in /usr/local/ssl/include/openssl and I have now modified the --enable-ssl
option for the configure script to use that as the primary path, and I
leave the former path too to work with older packages of OpenSSL too.
Daniel (9 June 1999)
- I finally understood the IRIX problem and now it seem to compile on it!
I am gonna remove those #define strcasecmp() things once and for all now.
Daniel (4 June 1999)
- I adjusted the FTP reply 227 parser to make the PASV command work better
with more ftp servers. Appearantly the Roxen Challanger server replied
something curl 5.9 could deal with! :-( Reported by Ashley Reid-Montanaro
and Mark Butler brought a solution for it.
Daniel (26 May 1999)
- Rearranged. README is new, the old one is now README.curl and I added a
README.libcurl with text I got from Ralph Beckmann.
- I also updated the INSTALL text.
Daniel (25 May 1999)
- David Jonathan Lowsky correctly pointed out that curl didn't properly deal
with form posting where the variable shouldn't have any content, as in curl
-F "form=" www.site.com. It was now fixed.
Version 5.9
Daniel (22 May 1999)
- I've got a bug report from Aaron Scarisbrick in which he states he has some
problems with -L under FreeBSD 3.0. I have previously got another bug
report from Stefan Grether which points at an error with similar sympthoms
when using win32. I made the allocation of the new url string a bit faster
and different, don't know if it actually improves anything though...
Daniel (20 May 1999)
- Made the cookie parser deal with CRLF newlines too.
Daniel (19 May 1999)
- Download() didn't properly deal with failing return codes from the sread()
function. Adam Coyne found the problem in the win32 version, and Troy Engel
helped me out isolating it.
Daniel (16 May 1999)
- Richard Adams pointed out a bug I introduced in 5.8. --dump-header doesn't
work anymore! :-/ I fixed it now.
- After a suggestion by Joshua Swink I added -S / --show-error to force curl
to display the error message in case of an error, even if -s/--silent was
used.
Daniel (10 May 1999)
- I moved the stuff concerning HTTP, DICT and TELNET it their own source
files now. It is a beginning on my clean-up of the sources to make them
layer all those protocols better to enable more to be added easier in the
future!
- Leon Breedt sent me some files I've not put into the main curl
archive. They're for creating the Debian package thingie. He also sent me a
debian package that I've made available for download at the web page
Daniel (9 May 1999)
- Made it compile on cygwin too.
Troy Engel (7 May 1999)
- Brought a series of patches to allow curl to compile smoothly on MSVC++ 6
again!
Daniel (6 May 1999)
- I changed the #ifdef HAVE_STRFTIME placement for the -z code so that it
will be easier to discover systems that don't have that function and thus
can't use -z successfully. Made the strftime() get used if WIN32 is defined
too.
Version 5.8
Daniel (5 May 1999)
- I've had it with this autoconf/automake mess. It seems to work allright
for most people who don't have automake installed, but for those who have
there are problems all over.
I've got like five different bug reports on this only the last
week... Claudio Neves and Federico Bianchi and root <duggerj001 at
hawaii.rr.com> are some of them reporting this.
Currently, I have no really good fix since I want to use automake myself to
generate the Makefile.in files. I've found out that the @SHELL@-problems
can often be fixed by manually invoking 'automake' in the archive root
before you run ./configure... I've hacked my maketgz script now to fiddle
a bit with this and my tests seem to work better than before at least!
Daniel (4 May 1999)
- mkhelp.pl has been doing badly lately. I corrected a case problem in
the regexes.
- I've now remade the -o option to not touch the file unless it needs to.
I had to do this to make -z option really fine, since now you can make a
curl fetch and use a local copy's time when downloading to that file, as
in:
curl -z dump -o dump remote.site.com/file.html
This will only get the file if the remote one is newer than the local.
I'm aware that this alters previous behaviour a little. Some scripts out
there may depend on that the file is always touched...
- Corrected a bug in the SSLv2/v3 selection.
- Felix von Leitner requested that curl should be able to send
"If-Modified-Since" headers, which indeed is a fair idea. I implemented it
right away! Try -z <expression> where expression is a full GNU date
expression or a file name to get the date from!
Stephan Lagerholm (30 Apr 1999)
- Pointed out a problem with the src/Makefile for FreeBSD. The RM variable
isn't set and causes the make to fail.
Daniel (26 April 1999)
- Am I silly or what? Irving Wolfe pointed out to me that the curl version
number was not set properly. Hasn't been since 5.6. This was due to a bug
in my maketgz script!
David Eriksson (25 Apr 1999)
- Found a bug in cookies.c that made it crash at times.
Version 5.7.1
Doug Kaufman (23 Apr 1999)
- Brought two sunos 4 fixes. One of them being the hostip.c fix mentioned
below and the other one a correction in include/stdcheaders.h
- Added a paragraph about compiling with the US-version of openssl to the
INSTALL file.
Daniel
- New mailing list address. Info updated on the web page as well as in the
README file
Greg Onufer (20 Apr 1999)
- hostip.c didn't compile properly on SunOS 5.5.1.
It needs an #include <sys/types.h>
Version 5.7
Daniel (Apr 20 1999)
- Decided to upload a non-beta version right now!
- Made curl support any-length HTTP headers. The destination buffer is now
simply enlarged every time it turns out to be too small!
- Added the FAQ file to the archive. Still a bit smallish, but it is a
start.
Eric Thelin (15 Apr 1999)
- Made -D accept '-' instead of filename to write to stdout.
Version 5.6.3beta
Daniel (Apr 12 1999)
- Changed two #ifdef WIN32 to better #ifdef <errorcode> when connect()ing
in url.c and ftp.c. Makes cygwin32 deal with them better too. We should
try to get some decent win32-replacement there. Anyone?
- The old -3/--crlf option is now ONLY --crlf!
- I changed the "SSL fix" to a more lame one, but that doesn't remove as
much functionality. Now I've enabled the lib to select what SSL version it
should try first. Appearantly some older SSL-servers don't like when you
talk v3 with them so you need to be able to force curl to talk v2 from the
start. The fix dated April 6 and posted on the mailing list forced curl to
use v2 at all times using a modern OpenSSL version, but we don't really
want such a crippled solution.
- Marc Boucher sent me a patch that corrected a math error for the
"Curr.Speed" progress meter.
- Eric Thelin sent me a patch that enables '-K -' to read a config file from
stdin.
- I found out we didn't close the file properly before so I added it!
Daniel (Apr 9 1999)
- Yu Xin pointed out a problem with ftp download resume. It didn't work at
all! ;-O
Daniel (Apr 6 1999)
- Corrected the version string part generated for the SSL version.
- I found a way to make some other SSL page work with openssl 0.9.1+ that
previously didn't (ssleay 0.8.0 works with it though!). Trying to get
some real info from the OpenSSL guys to see how I should do to behave the
best way. SSLeay 0.8.0 shouldn't be that much in use anyway these days!
Version 5.6.2beta
Daniel (Apr 4 1999)
- Finally have curl more cookie "aware". Now read carefully. This is how
it works.
To make curl read cookies from an already existing file, in plain header-
format (like from the headers of a previous fetch) invoke curl with the
-b flag like:
curl -b file http://site/foo.html
Curl will then use all cookies it finds matching. The old style that sets
a single cookie with -b is still supported and is used if the string
following -b includes a '=' letter, as in "-b name=daniel".
To make curl read the cookies sent in combination with a location: (which
sites often do) point curl to read a non-existing file at first (i.e
to start with no existing cookies), like:
curl -b nowhere http://site/setcookieandrelocate.html
- Added a paragraph in the TODO file about the SSL problems recently
reported. Evidently, some kind of SSL-problem curl may need to address.
- Better "Location:" following.
Douglas E. Wegscheid (Tue, 30 Mar 1999)
- A subsecond display patch.
Daniel (Mar 14 1999)
- I've separated the version number of libcurl and curl now. To make
things a little easier, I decided to start the curl numbering from
5.6 and the former version number known as "curl" is now the one
set for libcurl.
- Removed the 'enable-no-pass' from configure, I doubt anyone wanted
that.
- Made lots of tiny adjustments to compile smoothly with cygwin under
win32. It's a killer for porting this to win32, bye bye VC++! ;-)
Compiles and builds out-of-the-box now. See the new wordings in
INSTALL for details.
- Beginning experiments with downloading multiple document from a http
server while remaining connected.
Version 5.6beta
Daniel (Mar 13 1999)
- Since I've changed so much, I thought I'd just go ahead and implement the
suggestion from Douglas E. Wegscheid. -D or --dump-header is now storing
HTTP headers separately in the specified file.
- Added new text to INSTALL on what to do to build this on win32 now.
- Aaargh. I had to take a step back and prefix the shared #include files
in the sources with "../include/" to please VC++...
Daniel (Mar 12 1999)
- Split the url.c source into many tiny sources for better readability
and smaller size.
Daniel (Mar 11 1999)
- Started to change stuff for a move to make libcurl and a more separate
curl application that uses the libcurl. Made the libcurl sources into
the new lib directory while the curl application will remain in src as
before. New makefiles, adjusted configure script and so.
libcurl.a built quickly and easily. I better make a better interface to
the lib functions though.
The new root dir include/ is supposed to contain the public information
about the new libcurl. It is a little ugly so far :-)
Daniel (Mar 1 1999)
- Todd Kaufmann sent me a good link to Netscape's cookie spec as well as the
info that RFC 2109 specifies how to use them. The link is now in the
README and the RFC in the RESOURCES.
Daniel (Feb 23 1999)
- Finally made configure accept --with-ssl to look for SSL libs and includes
in the "standard" place /usr/local/ssl...
Daniel (Feb 22 1999)
- Verified that curl linked fine with OpenSSL 0.9.1c which seems to be
the most recent.
Henri Gomez (Fri Feb 5 1999)
- Sent in an updated curl-ssl.spec. I still miss the script that builds an
RPM automatically...
Version 5.5.1
Mark Butler (27 Jan 1999)
- Corrected problems in Download().
Danitel Stenberg (25 Jan 1999)
- Jeremie Petit pointed out a few flaws in the source that prevented it from
compile warning free with the native compiler under Digital Unix v4.0d.
Version 5.5
Daniel Stenberg (15 Jan 1999)
- Added Bjorns small text to the README about the DICT protocol.
Daniel Stenberg (11 Jan 1999)
- <jswink at softcom.net> reported about the win32-versioin: "Doesn't use
ALL_PROXY environment variable". Turned out to be because of the static-
buffer nature of the win32 environment variable calls!
Bjorn Reese (10 Jan 1999)
- I have attached a simple addition for the DICT protocol (RFC 2229).
It performs dictionary lookups. The output still needs to be better
formatted.
To test it try (the exact format, and more examples are described in
the RFC)
dict://dict.org/m:hello
dict://dict.org/m:hello::soundex
Vicente Garcia (10 Jan 1999)
- Corrected the progress meter for files larger than 20MB.
Daniel Stenberg (7 Jan 1999)
- Corrected the -t and -T help texts. They claimed to be FTP only.
Version 5.4
Daniel Stenberg
(7 Jan 1999)
- Irving Wolfe reported that curl -s didn't always supress the progress
reporting. It was the form post that autoamtically always switched it on
again. This is now corrected!
(4 Jan 1999)
- Andreas Kostyrka suggested I'd add PUT and he helped me out to test it. If
you use -t or -T now on a http or https server, PUT will be used for file
upload.
I removed the former use of -T with HTTP. I doubt anyone ever really used
that.
(4 Jan 1999)
- Erik Jacobsen found a width bug in the mprintf() function. I corrected it
now.
(4 Jan 1999)
- As John V. Chow pointed out to me, curl accepted very limited URL sizes. It
should now accept path parts that are up to at least 4096 bytes.
- Somehow I screwed up when applying the AIX fix from Gilbert Ramirez, so
I redid that now.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -234,6 +234,10 @@ netware-clean:
$(MAKE) -C lib -f Makefile.netware clean
$(MAKE) -C src -f Makefile.netware clean
netware-install:
$(MAKE) -C lib -f Makefile.netware install
$(MAKE) -C src -f Makefile.netware install
unix: all
unix-ssl: ssl
@@ -241,3 +245,8 @@ unix-ssl: ssl
linux: all
linux-ssl: ssl
vc8:
echo "generate VC8 makefiles"
sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e 's#/GZ#/RTC1#' -e 's/wsock32.lib/wsock32.lib bufferoverflowu.lib/g' -e 's/VC6/VC8/g' lib/Makefile.vc6 > lib/Makefile.vc8
sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e 's#/GZ#/RTC1#' -e 's/wsock32.lib/wsock32.lib bufferoverflowu.lib/g' -e 's/VC6/VC8/g' src/Makefile.vc6 > src/Makefile.vc8

View File

@@ -1,56 +1,30 @@
Curl and libcurl 7.16.2
Curl and libcurl 7.16.4
Public curl release number: 98
Releases counted from the very beginning: 125
Public curl release number: 100
Releases counted from the very beginning: 126
Available command line options: 118
Available curl_easy_setopt() options: 141
Number of public functions in libcurl: 54
Amount of public web site mirrors: 38
Available curl_easy_setopt() options: 143
Number of public functions in libcurl: 55
Amount of public web site mirrors: 39
Number of known libcurl bindings: 35
Number of contributors: 539
Number of contributors: 572
This release includes the following changes:
o added CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS
o added CURLOPT_HTTP_CONTENT_DECODING, CURLOPT_HTTP_TRANSFER_DECODING and
--raw
o added support for using the NSS library for TLS/SSL
o changed default anonymous FTP password
o changed the CURLOPT_FTP_SSL_CCC option to handle active and passive
CCC shutdown
o added the --ftp-ssl-ccc-mode command line option
o includes VC8 Makefiles in the release archive
o --ftp-ssl-control is now honoured on ftps:// URLs
o added experimental CURL_ACKNOWLEDGE_EINTR symbol definition check
o --key and new --pubkey options for SSH public key file logins
o --pass now works for a SSH public key file, too
o select (2) support no longer needed to build the library if poll() used
o CURLOPT_POSTQUOTE works for SFTP
o added CURLOPT_NEW_FILE_PERMS and CURLOPT_NEW_DIRECTORY_PERMS
o improved hashing of sockets for the multi_socket API
o ftp kerberos5 support added
This release includes the following bugfixes:
o in testsuite, update test cookies expiration from 2007-Feb-1 to year 2035
o socks5 works
o builds fine with VC2005
o CURLOPT_RANGE set to NULL resets the range for FTP
o curl_multi_remove_handle() rare crash
o passive FTP transfers work with SOCKS
o multi interface HTTPS connection re-use memory leak
o libcurl.m4's --with-libcurl is improved
o curl-config --libs and libcurl.pc no longer list unnecessary dependencies
o fixed an issue with CCC not working on some servers
o several HTTP pipelining problems
o HTTP CONNECT thru a proxy is now less blocking when the multi interface is
used
o HTTP Digest header parsing fix for unquoted last word ending with CRLF
o CURLOPT_PORT, HTTP proxy, re-using connections and non-HTTP protocols
o CURLOPT_INTERFACE for ipv6
o use-after-free issue with HTTP transfers with the multi interface
o the progress callback can get called more frequently
o timeout would restart when signal caught while awaiting socket events
o curl -f with user+password embedded in the URL
o 26 flaws identified by coverity.com
o builds on QNX 6 again
o adjusted how libcurl treats HTTP 1.1 responses without content-lenth or
chunked encoding
o fixed the 10-at-a-time.c example
o FTP over SOCKS proxy
o improved error messages on SCP upload failures
o security flaw (http://curl.haxx.se/docs/adv_20070710.html) in which libcurl
failed to properly reject some outdated or not yet valid server certificates
when built with GnuTLS
This release includes the following known bugs:
@@ -58,21 +32,16 @@ This release includes the following known bugs:
Other curl-related news:
o pycurl 7.16.1 was released: http://pycurl.sf.net/
o
New curl mirrors:
o http://curl.basemirror.de is a new mirror in Germany
o http://curl.xxtracker.org is a new mirror in The Netherlands
o
This release would not have looked like this without help, code, reports and
advice from friends like these:
Yang Tse, Manfred Schwarb, Michael Wallner, Jeff Pohlmeyer, Shmulik Regev,
Rob Crittenden, Robert A. Monat, Dan Fandrich, Duncan Mac-Vicar Prett,
Michal Marek, Robson Braga Araujo, Ian Turner, Linus Nielsen Feltzing,
Ravi Pratap, Adam D. Moss, Jose Kahan, Hang Kin Lau, Justin Fletcher,
Robert Iakobashvili, Bryan Henderson, Eygene Ryabinkin, Daniel Johnson,
Matt Kraai, Nick Zitzmann, Rob Jones
Robert Iakobashvili, James Housley, G<>nter Knauf, James Bursa, Song Ma,
Thomas J. Moore, Gavrie Philipson, Kees Cook
Thanks! (and sorry if I forgot to mention someone)

View File

@@ -20,3 +20,9 @@ Brad Spencer
Ravi Pratap
William Ahern
Bram Matthys
Michael Wallner
Vlad Dinulescu
Brad House
Shmulik Regev
Ashish Sharma
Brad Spencer

View File

@@ -1,16 +1,107 @@
Changelog for the c-ares project
* February 19
Version 1.4.0 (June 8, 2007)
* June 4 2007 (Daniel Stenberg)
- James Bursa reported a major memory problem when resolving multi-IP names
and I found and fixed the problem. It was added by Ashish Sharma's patch
two days ago.
When I then tried to verify multiple entries in /etc/hosts after my fix, I
got another segfault and decided this code was not ripe for inclusion and I
reverted the patch.
* June 2 2007
- Brad Spencer found and fixed three flaws in the code, found with the new
gcc 4.2.0 warning: -Waddress
- Brad House fixed VS2005 compiler warnings due to time_t being 64bit.
He also made recent Microsoft compilers use _strdup() instead of strdup().
- Brad House's man pages for ares_save_options() and ares_destroy_options()
were added.
- Ashish Sharma provided a patch for supporting multiple entries in the
/etc/hosts file. Patch edited for coding style and functionality by me
(Daniel).
* May 30 2007
- Shmulik Regev brought cryptographically secure transaction IDs:
The c-ares library implementation uses a DNS "Transaction ID" field that is
seeded with a pseudo random number (based on gettimeofday) which is
incremented (++) between consecutive calls and is therefore rather
predictable. In general, predictability of DNS Transaction ID is a well
known security problem (e.g.
http://bak.spc.org/dms/archive/dns_id_attack.txt) and makes a c-ares based
implementation vulnerable to DNS poisoning. Credit goes to Amit Klein
(Trusteer) for identifying this problem.
The patch I wrote changes the implementation to use a more secure way of
generating unique IDs. It starts by obtaining a key with reasonable entropy
which is used with an RC4 stream to generate the cryptographically secure
transaction IDs.
Note that the key generation code (in ares_init:randomize_key) has two
versions, the Windows specific one uses a cryptographically safe function
provided (but undocumented :) by the operating system (described at
http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx). The
default implementation is a bit naive and uses the standard 'rand'
function. Surely a better way to generate random keys exists for other
platforms.
The patch can be tested by using the adig utility and using the '-s' option.
- Brad House added ares_save_options() and ares_destroy_options() that can be
used to keep options for later re-usal when ares_init_options() is used.
Problem: Calling ares_init() for each lookup can be unnecessarily resource
intensive. On windows, it must LoadLibrary() or search the registry
on each call to ares_init(). On unix, it must read and parse
multiple files to obtain the necessary configuration information. In
a single-threaded environment, it would make sense to only
ares_init() once, but in a heavily multi-threaded environment, it is
undesirable to ares_init() and ares_destroy() for each thread created
and track that.
Solution: Create ares_save_options() and ares_destroy_options() functions to
retrieve and free options obtained from an initialized channel. The
options populated can be used to pass back into ares_init_options(),
it should populate all needed fields and not retrieve any information
from the system. Probably wise to destroy the cache every minute or
so to prevent the data from becoming stale.
- Daniel S added ares_process_fd() to allow applications to ask for processing
on specific sockets and thus avoiding select() and associated
functions/macros. This function will be used by upcoming libcurl releases
for this very reason. It also made me export the ares_socket_t type in the
public ares.h header file, since ares_process_fd() uses that type for two of
the arguments.
* May 25 2007
- Ravi Pratap fixed a flaw in the init_by_resolv_conf() function for windows
that could cause it to return a bad return code.
* April 16 2007
- Yang Tse: Provide ares_getopt() command-line parser function as a source
code helper function, not belonging to the actual c-ares library.
* February 19 2007
- Vlad Dinulescu added ares_parse_ns_reply().
* February 13
* February 13 2007
- Yang Tse: Fix failure to get the search sequence of /etc/hosts and
DNS from /etc/nsswitch.conf, /etc/host.conf or /etc/svc.conf when
/etc/resolv.conf did not exist or was unable to read it.
* November 22
* November 22 2006
- Install ares_dns.h too
@@ -18,7 +109,7 @@
struct, and there are domain/search entries in /etc/resolv.conf, the domains
of the options struct will be overridden.
* November 6
* November 6 2006
- Yang Tse removed a couple of potential zero size memory allocations.

View File

@@ -11,7 +11,7 @@ MSVCFILES = vc/adig/adig.dep vc/adig/adig.dsp vc/vc.dsw vc/ahost/ahost.dep \
# adig and ahost are just sample programs and thus not mentioned with the
# regular sources and headers
EXTRA_DIST = CHANGES README.cares Makefile.inc adig.c ahost.c $(man_MANS) \
$(MSVCFILES) AUTHORS config-win32.h
$(MSVCFILES) AUTHORS config-win32.h RELEASE-NOTES
VER=-version-info 1:0:0

View File

@@ -21,7 +21,7 @@ CFLAGS += -DWATT32 -DHAVE_AF_INET6 -DHAVE_PF_INET6 -DHAVE_FIONBIO \
-DRECV_TYPE_ARG1='int' -DRECV_TYPE_ARG2='void*' \
-DRECV_TYPE_ARG3='int' -DRECV_TYPE_ARG4='int' \
-DRECV_TYPE_RETV='int' -DHAVE_STRUCT_TIMEVAL \
-UHAVE_CONFIG_H
-Dselect=select_s -UHAVE_CONFIG_H
LDFLAGS = -s
@@ -38,7 +38,6 @@ endif
ifeq ($(USE_ZLIB),1)
EX_LIBS += $(ZLIB_ROOT)/libz.a
CFLAGS += -DUSE_MANUAL
endif
ifeq ($(USE_IDNA),1)
@@ -55,10 +54,10 @@ all: $(OBJ_DIR) libcares.a ahost.exe adig.exe
libcares.a: $(OBJECTS)
ar rs $@ $?
ahost.exe: ahost.c $(OBJ_HACK)
ahost.exe: ahost.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS)
adig.exe: adig.c $(OBJ_HACK)
adig.exe: adig.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS)
clean:

View File

@@ -18,5 +18,5 @@ MANPAGES= ares_destroy.3 ares_expand_name.3 ares_expand_string.3 ares_fds.3 \
ares_parse_a_reply.3 ares_parse_ptr_reply.3 ares_process.3 \
ares_query.3 ares_search.3 ares_send.3 ares_strerror.3 ares_timeout.3 \
ares_version.3 ares_cancel.3 ares_parse_aaaa_reply.3 ares_getnameinfo.3 \
ares_getsock.3 ares_parse_ns_reply.3
ares_getsock.3 ares_parse_ns_reply.3 \
ares_destroy_options.3 ares_save_options.3

View File

@@ -5,27 +5,30 @@
## Use: make -f Makefile.m32 [demos]
##
## Quick hack by Guenter; comments to: /dev/nul
CC = gcc
RANLIB = ranlib
#
########################################################
## Nothing more to do below this line!
LIB=libcares.a
CC=gcc
CFLAGS=-O2 -Wall
LDFLAGS=-s
LIBS=-lwsock32
LIB = libcares.a
MANPAGES := $(patsubst %.c,%.o,$(wildcard ares_*.3))
CC = gcc
LD = gcc
RANLIB = ranlib
#RM = rm -f
OBJS := $(patsubst %.c,%.o,$(wildcard ares_*.c))
OBJS += windows_port.o inet_ntop.o inet_net_pton.o bitncmp.o
CFLAGS = -O2 -Wall
LDFLAGS = -s
LIBS = -lwsock32
$(LIB): ${OBJS}
ar cru $@ ${OBJS}
${RANLIB} $@
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
OBJLIB := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
$(LIB): $(OBJLIB)
ar cru $@ $^
$(RANLIB) $@
all: $(LIB) demos
@@ -34,16 +37,13 @@ demos: adig.exe ahost.exe
tags:
etags *.[ch]
adig.exe: adig.o $(LIB)
${CC} ${LDFLAGS} -o $@ adig.o $(LIB) ${LIBS}
%.exe: %.o ares_getopt.o $(LIB)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
ahost.exe: ahost.o $(LIB)
${CC} ${LDFLAGS} -o $@ ahost.o $(LIB) ${LIBS}
${OBJS}: ares.h ares_dns.h ares_private.h
$(OBJLIB): ares.h ares_dns.h ares_private.h
.c.o:
${CC} -c ${CFLAGS} $<
$(CC) $(CFLAGS) -c $<
check:
@@ -61,8 +61,8 @@ install:
done)
clean:
rm -f ${OBJS} $(LIB) adig.o adig.exe ahost.o ahost.exe
$(RM) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe
distclean: clean
rm -f config.cache config.log config.status Makefile
$(RM) config.cache config.log config.status Makefile

View File

@@ -1,7 +1,7 @@
#################################################################
# $Id$
#
## Makefile for building libares (NetWare version - gnu make)
## Makefile for building libcares (NetWare version - gnu make)
## Use: make -f Makefile.netware
##
## Comments to: Guenter Knauf http://www.gknw.de/phpbb
@@ -35,10 +35,10 @@ ifndef LIBARCH
LIBARCH = LIBC
endif
# must be equal to DEBUG or NDEBUG
# must be equal to NDEBUG or DEBUG, CURLDEBUG
ifndef DB
DB = NDEBUG
# DB = DEBUG
# DB = CURLDEBUG
endif
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
OPT = -O2
@@ -51,12 +51,20 @@ endif
# Include the version info retrieved from curlver.h
-include $(OBJDIR)/version.inc
# The following line defines your compiler.
# The following lines defines your compiler.
ifdef CWFolder
METROWERKS = $(CWFolder)
endif
ifdef METROWERKS
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
CC = mwccnlm
else
CC = gcc
endif
# a native win32 awk can be downloaded from here:
# http://www.gknw.net/development/prgtools/awk-20050424.zip
AWK = awk
YACC = bison -y
CP = cp -afv
# RM = rm -f
@@ -70,10 +78,11 @@ CFLAGS = $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
ifeq ($(CC),mwccnlm)
LD = mwldnlm
LDFLAGS = -nostdlib $(PRELUDE) $(OBJS) $(<:.def=.o) -o $@ -commandfile
LDFLAGS = -nostdlib $(PRELUDE) $(OBJEXE) $(<:.def=.o) -o $@ -commandfile
AR = mwldnlm
ARFLAGS = -type library -w nocmdline $(OBJDIR)/*.o -o
ARFLAGS = -nostdlib -type library -o
LIBEXT = lib
#RANLIB =
CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586
CFLAGS += -relax_pointers
#CFLAGS += -w on
@@ -81,8 +90,10 @@ ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
CFLAGS += -align 4
else
PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
# PRELUDE = $(SDK_CLIB)/imports/clibpre.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
CFLAGS += -align 1
endif
else
@@ -91,12 +102,16 @@ LDFLAGS = -T
AR = ar
ARFLAGS = -cq
LIBEXT = a
RANLIB = ranlib
CFLAGS += -fno-builtin -fpcc-struct-return -fno-strict-aliasing
CFLAGS += -Wall -Wno-format -Wno-uninitialized # -pedantic
ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
else
PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
# PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
PRELUDE = $(NDK_ROOT)/pre/prelude.o
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
endif
endif
@@ -106,14 +121,14 @@ SDK_CLIB = $(NDK_ROOT)/nwsdk
SDK_LIBC = $(NDK_ROOT)/libc
ifeq ($(LIBARCH),LIBC)
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
INCLUDES += -I$(SDK_LIBC)/include
# INCLUDES += -I$(SDK_LIBC)/include/nks
# INCLUDES += -I$(SDK_LIBC)/include/winsock
CFLAGS += -D_POSIX_SOURCE
# CFLAGS += -D__ANSIC__
else
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
INCLUDES += -I$(SDK_CLIB)/include/nlm
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
CFLAGS += -DNETDB_USE_INTERNET
# INCLUDES += -I$(SDK_CLIB)/include
endif
CFLAGS += -I. $(INCLUDES)
@@ -132,7 +147,8 @@ endif
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES)))
OBJLIB := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES)))
OBJEXE = $(OBJLIB) $(OBJDIR)/ares_getopt.o
.PHONY: lib nlm prebuild dist install clean
@@ -143,7 +159,7 @@ nlm: prebuild $(TARGETS)
prebuild: $(OBJDIR) $(OBJDIR)/version.inc config.h arpa/nameser.h
dist: all
-$(RM) $(OBJS) $(OBJDIR)/*.map $(OBJDIR)/*.ncv
-$(RM) $(OBJLIB) $(OBJDIR)/*.map $(OBJDIR)/*.ncv
-$(RM) $(OBJDIR)/*.def $(OBJDIR)/*.xdc $(OBJDIR)/version.inc
install: $(INSTDIR) all
@@ -158,12 +174,15 @@ clean:
-$(RM) -r $(OBJDIR)
-$(RM) -r arpa
%.$(LIBEXT): $(OBJS)
%.$(LIBEXT): $(OBJLIB)
@echo Creating $@
@-$(RM) $@
@$(AR) $(ARFLAGS) $@ $^
ifdef RANLIB
@$(RANLIB) $@
endif
%.nlm: $(OBJDIR)/%.def $(OBJDIR)/%.o $(OBJDIR)/%.xdc $(OBJS)
%.nlm: $(OBJDIR)/%.def $(OBJDIR)/%.o $(OBJDIR)/%.xdc $(OBJEXE)
@echo Linking $@
@-$(RM) $@
@$(LD) $(LDFLAGS) $<
@@ -180,7 +199,7 @@ $(OBJDIR)/%.o: %.c
$(OBJDIR)/version.inc: ares_version.h $(OBJDIR)
@echo Creating $@
@awk -f ../packages/NetWare/get_ver.awk $< > $@
@$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@
$(OBJDIR)/%.xdc: Makefile.netware
@echo Creating $@
@@ -247,7 +266,7 @@ ifdef IMPORTS
@echo $(DL)import $(IMPORTS)$(DL) >> $@
endif
ifeq ($(LD),nlmconv)
@echo $(DL)input $(OBJS)$(DL) >> $@
@echo $(DL)input $(OBJEXE)$(DL) >> $@
@echo $(DL)input $(PRELUDE)$(DL) >> $@
@echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
endif
@@ -261,25 +280,77 @@ config.h: Makefile.netware
@echo $(DL)#ifndef NETWARE$(DL) >> $@
@echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
@echo $(DL)#endif$(DL) >> $@
@echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@
@echo $(DL)#define VERSION "$(LIBCARES_VERSION_STR)"$(DL) >> $@
@echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_NAMESER_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
ifeq ($(LIBARCH),CLIB)
@echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@
@echo $(DL)#define MAXHOSTNAMELEN 256$(DL) >> $@
@echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define DL_LDAP_FILE "ldapsdk.nlm"$(DL) >> $@
@echo $(DL)#define socklen_t int$(DL) >> $@
@echo $(DL)#define strncasecmp strnicmp$(DL) >> $@
@echo $(DL)#define strcasecmp stricmp$(DL) >> $@
else
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
@echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
@echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@
endif
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_NAMESER_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
@echo $(DL)#define HAVE_LL 1$(DL) >> $@
@echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_RECV 1$(DL) >> $@
@@ -290,46 +361,26 @@ config.h: Makefile.netware
@echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
ifdef NW_WINSOCK
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
else

View File

@@ -124,11 +124,11 @@ $(DEF_FILE): $(OBJECTS) Makefile.VC6
@echo ares_gettimeofday >> $@
@echo ares_parse_aaaa_reply >> $@
ahost.exe: $(OBJ_DIR) $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\getopt.obj cares_imp.lib
link $(LDFLAGS) -out:$@ $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\getopt.obj cares_imp.lib $(EX_LIBS)
ahost.exe: $(OBJ_DIR) $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib
link $(LDFLAGS) -out:$@ $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib $(EX_LIBS)
adig.exe: $(OBJ_DIR) $(OBJ_DIR)\adig.obj $(OBJ_DIR)\getopt.obj cares_imp.lib
link $(LDFLAGS) -out:$@ $(OBJ_DIR)\adig.obj $(OBJ_DIR)\getopt.obj cares_imp.lib $(EX_LIBS)
adig.exe: $(OBJ_DIR) $(OBJ_DIR)\adig.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib
link $(LDFLAGS) -out:$@ $(OBJ_DIR)\adig.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib $(EX_LIBS)
clean:
- del $(OBJ_DIR)\*.obj *.ilk *.pdb *.pbt *.pbi *.pbo *._xe *.map
@@ -216,7 +216,7 @@ $(OBJ_DIR)\ares_parse_aaaa_reply.obj: ares_parse_aaaa_reply.c setup.h \
setup_once.h nameser.h ares.h ares_dns.h inet_net_pton.h ares_private.h \
ares_ipv6.h
$(OBJ_DIR)\ares_parse_ns_reply.obj: ares_parse_ns_reply.c setup.h \
$(OBJ_DIR)\ares_parse_ns_reply.obj: ares_parse_ns_reply.c setup.h \
setup_once.h nameser.h ares.h ares_dns.h ares_private.h ares_ipv6.h
$(OBJ_DIR)\ares_getnameinfo.obj: ares_getnameinfo.c setup.h setup_once.h \
@@ -229,3 +229,5 @@ $(OBJ_DIR)\bitncmp.obj: bitncmp.c bitncmp.h
$(OBJ_DIR)\inet_ntop.obj: inet_ntop.c setup.h setup_once.h nameser.h \
ares_ipv6.h inet_ntop.h
$(OBJ_DIR)\ares_getopt.obj: ares_getopt.c ares_getopt.h

9
ares/RELEASE-NOTES Normal file
View File

@@ -0,0 +1,9 @@
This is what's new and changed in the c-ares 1.4.1 release:
o
Thanks go to these friendly people for their efforts and contributions:
Have fun!

View File

@@ -32,9 +32,6 @@
#endif
#include <netdb.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include <stdio.h>
#include <stdlib.h>
@@ -45,6 +42,7 @@
#include "ares.h"
#include "ares_dns.h"
#include "inet_ntop.h"
#include "ares_getopt.h"
#ifdef WATT32
#undef WIN32 /* Redefined in MingW headers */
@@ -55,11 +53,6 @@
#define T_SRV 33 /* server selection */
#endif
#ifndef optind
extern int optind;
extern char *optarg;
#endif
struct nv {
const char *name;
int value;
@@ -163,7 +156,7 @@ int main(int argc, char **argv)
options.flags = ARES_FLAG_NOCHECKRESP;
options.servers = NULL;
options.nservers = 0;
while ((c = getopt(argc, argv, "df:s:c:t:T:U:")) != -1)
while ((c = ares_getopt(argc, argv, "df:s:c:t:T:U:")) != -1)
{
switch (c)
{

View File

@@ -34,19 +34,11 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include "ares.h"
#include "ares_dns.h"
#include "inet_ntop.h"
#include "inet_net_pton.h"
#ifndef optind
extern int optind;
extern char *optarg;
#endif
#include "ares_getopt.h"
#ifndef HAVE_STRUCT_IN6_ADDR
struct in6_addr
@@ -73,7 +65,7 @@ int main(int argc, char **argv)
WSAStartup(wVersionRequested, &wsaData);
#endif
while ((c = getopt(argc,argv,"dt:h")) != -1)
while ((c = ares_getopt(argc,argv,"dt:h")) != -1)
{
switch (c)
{

View File

@@ -20,12 +20,15 @@
#include <sys/types.h>
#if defined(_AIX) || defined(NETWARE)
#if defined(_AIX) || (defined(NETWARE) && defined(__NOVELL_LIBC__))
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
libc5-based Linux systems. Only include it on system that are known to
require it! */
#include <sys/select.h>
#endif
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
#include <sys/bsdskt.h>
#endif
#if defined(WATT32)
#include <netinet/in.h>
@@ -94,6 +97,7 @@ extern "C" {
#define ARES_OPT_DOMAINS (1 << 7)
#define ARES_OPT_LOOKUPS (1 << 8)
#define ARES_OPT_SOCK_STATE_CB (1 << 9)
#define ARES_OPT_SORTLIST (1 << 10)
/* Nameinfo flag values */
#define ARES_NI_NOFQDN (1 << 0)
@@ -136,6 +140,22 @@ extern "C" {
#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
ARES_GETSOCK_MAXNUM)))
/*
* Typedef our socket type
*/
#ifndef ares_socket_typedef
#ifdef WIN32
typedef SOCKET ares_socket_t;
#define ARES_SOCKET_BAD INVALID_SOCKET
#else
typedef int ares_socket_t;
#define ARES_SOCKET_BAD -1
#endif
#define ares_socket_typedef
#endif /* ares_socket_typedef */
#ifdef WIN32
typedef void (*ares_sock_state_cb)(void *data,
SOCKET socket,
@@ -148,6 +168,8 @@ typedef void (*ares_sock_state_cb)(void *data,
int writable);
#endif
struct apattern;
struct ares_options {
int flags;
int timeout;
@@ -162,6 +184,8 @@ struct ares_options {
char *lookups;
ares_sock_state_cb sock_state_cb;
void *sock_state_cb_data;
struct apattern *sortlist;
int nsort;
};
struct hostent;
@@ -179,6 +203,8 @@ typedef void (*ares_nameinfo_callback)(void *arg, int status,
int ares_init(ares_channel *channelptr);
int ares_init_options(ares_channel *channelptr, struct ares_options *options,
int optmask);
int ares_save_options(ares_channel channel, struct ares_options *options, int *optmask);
void ares_destroy_options(struct ares_options *options);
void ares_destroy(ares_channel channel);
void ares_cancel(ares_channel channel);
void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
@@ -200,6 +226,8 @@ int ares_getsock(ares_channel channel, int *socks, int numsocks);
struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
struct timeval *tv);
void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds);
void ares_process_fd(ares_channel channel, ares_socket_t read_fd,
ares_socket_t write_fd);
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
int rd, unsigned char **buf, int *buflen);

View File

@@ -183,6 +183,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
free(hostent->h_addr_list);
free(hostent);
}
*host = NULL;
return ARES_ENOMEM;
}

View File

@@ -20,6 +20,19 @@
#include "ares.h"
#include "ares_private.h"
void ares_destroy_options(struct ares_options *options)
{
int i;
free(options->servers);
for (i = 0; i < options->ndomains; i++)
free(options->domains[i]);
free(options->domains);
if(options->sortlist)
free(options->sortlist);
free(options->lookups);
}
void ares_destroy(ares_channel channel)
{
int i;

View File

@@ -0,0 +1,39 @@
.\" $Id$
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Permission to use, copy, modify, and distribute this
.\" software and its documentation for any purpose and without
.\" fee is hereby granted, provided that the above copyright
.\" notice appear in all copies and that both that copyright
.\" notice and this permission notice appear in supporting
.\" documentation, and that the name of M.I.T. not be used in
.\" advertising or publicity pertaining to distribution of the
.\" software without specific, written prior permission.
.\" M.I.T. makes no representations about the suitability of
.\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty.
.\"
.TH ARES_DESTROY_OPTIONS 3 "1 June 2007"
.SH NAME
ares_destroy_options \- Destroy options initialized with ares_save_options
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_destroy_options(struct ares_options *\fIoptions\fP)
.fi
.SH DESCRIPTION
The
.B ares_destroy_options
function destroys the options struct identified by
.IR options ,
freeing all memory allocated by ares_save_options.
.SH SEE ALSO
.BR ares_save_options (3),
.BR ares_init_options (3)
.SH AUTHOR
Brad House
.br
Copyright 1998 by the Massachusetts Institute of Technology.

View File

@@ -33,7 +33,8 @@ void ares_free_hostent(struct hostent *host)
for (p = host->h_aliases; *p; p++)
free(*p);
free(host->h_aliases);
free(host->h_addr_list[0]);
free(host->h_addr_list[0]); /* no matter if there is one or many entries,
there is only one malloc for all of them */
free(host->h_addr_list);
free(host);
}

View File

@@ -295,7 +295,11 @@ static char *lookup_service(unsigned short port, int flags,
#endif
#else
/* Lets just hope the OS uses TLS! */
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
sep = getservbyport(port, (char*)proto);
#else
sep = getservbyport(port, proto);
#endif
#endif
}
if (sep && sep->s_name)

123
ares/ares_getopt.c Normal file
View File

@@ -0,0 +1,123 @@
/*
* Original file name getopt.c Initial import into the c-ares source tree
* on 2007-04-11. Lifted from version 5.2 of the 'Open Mash' project with
* the modified BSD license, BSD license without the advertising clause.
*
* $Id$
*/
/*
* getopt.c --
*
* Standard UNIX getopt function. Code is from BSD.
*
* Copyright (c) 1987-2001 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* A. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* B. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* C. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS 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 REGENTS OR CONTRIBUTORS 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.
*/
/* #if !defined(lint)
* static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94";
* #endif
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ares_getopt.h"
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt, /* character checked for validity */
optreset; /* reset getopt */
char *optarg; /* argument associated with option */
#define BADCH (int)'?'
#define BADARG (int)':'
#define EMSG (char *)""
/*
* ares_getopt --
* Parse argc/argv argument vector.
*/
int
ares_getopt(int nargc, char * const nargv[], const char *ostr)
{
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
if (optreset || !*place) { /* update scanning pointer */
optreset = 0;
if (optind >= nargc || *(place = nargv[optind]) != '-') {
place = EMSG;
return (EOF);
}
if (place[1] && *++place == '-') { /* found "--" */
++optind;
place = EMSG;
return (EOF);
}
} /* option letter okay? */
if ((optopt = (int)*place++) == (int)':' ||
!(oli = strchr(ostr, optopt))) {
/*
* if the user didn't specify '-' as an option,
* assume it means EOF.
*/
if (optopt == (int)'-')
return (EOF);
if (!*place)
++optind;
if (opterr && *ostr != ':')
(void)fprintf(stderr,
"%s: illegal option -- %c\n", __FILE__, optopt);
return (BADCH);
}
if (*++oli != ':') { /* don't need argument */
optarg = NULL;
if (!*place)
++optind;
}
else { /* need an argument */
if (*place) /* no white space */
optarg = place;
else if (nargc <= ++optind) { /* no arg */
place = EMSG;
if (*ostr == ':')
return (BADARG);
if (opterr)
(void)fprintf(stderr,
"%s: option requires an argument -- %c\n",
__FILE__, optopt);
return (BADCH);
}
else /* white space */
optarg = nargv[optind];
place = EMSG;
++optind;
}
return (optopt); /* dump back option letter */
}

41
ares/ares_getopt.h Normal file
View File

@@ -0,0 +1,41 @@
#ifndef ARES_GETOPT_H
#define ARES_GETOPT_H
/*
* Copyright (c) 1987-2001 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* A. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* B. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* C. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS 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 REGENTS OR CONTRIBUTORS 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.
*/
int ares_getopt(int nargc, char * const nargv[], const char *ostr);
extern char *optarg;
extern int optind;
extern int opterr;
#endif /* ARES_GETOPT_H */

View File

@@ -23,7 +23,10 @@
#include <malloc.h>
#else
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -61,7 +64,7 @@
#undef WIN32 /* Redefined in MingW/MSVC headers */
#endif
static int init_by_options(ares_channel channel, struct ares_options *options,
static int init_by_options(ares_channel channel, const struct ares_options *options,
int optmask);
static int init_by_environment(ares_channel channel);
static int init_by_resolv_conf(ares_channel channel);
@@ -72,6 +75,8 @@ static int config_nameserver(struct server_state **servers, int *nservers,
static int set_search(ares_channel channel, const char *str);
static int set_options(ares_channel channel, const char *str);
static const char *try_option(const char *p, const char *q, const char *opt);
static void init_id_key(rc4_key* key,int key_data_len);
#ifndef WIN32
static int sortlist_alloc(struct apattern **sortlist, int *nsort, struct apattern *pat);
static int ip_addr(const char *s, int len, struct in_addr *addr);
@@ -84,6 +89,12 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
static char *try_config(char *s, const char *opt);
#endif
#define ARES_CONFIG_CHECK(x) (x->lookups && x->nsort > -1 && \
x->nservers > -1 && \
x->ndomains > -1 && \
x->ndots > -1 && x->timeout > -1 && \
x->tries > -1)
int ares_init(ares_channel *channelptr)
{
return ares_init_options(channelptr, NULL, 0);
@@ -96,7 +107,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
int i;
int status = ARES_SUCCESS;
struct server_state *server;
struct timeval tv;
#ifdef CURLDEBUG
const char *env = getenv("CARES_MEMDEBUG");
@@ -197,22 +207,85 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
server->qtail = NULL;
}
/* Choose a somewhat random query ID. The main point is to avoid
* collisions with stale queries. An attacker trying to spoof a DNS
* answer also has to guess the query ID, but it's only a 16-bit
* field, so there's not much to be done about that.
*/
gettimeofday(&tv, NULL);
channel->next_id = (unsigned short)
((tv.tv_sec ^ tv.tv_usec ^ getpid()) & 0xffff);
init_id_key(&channel->id_key, ARES_ID_KEY_LEN);
channel->next_id = ares__generate_new_id(&channel->id_key);
channel->queries = NULL;
*channelptr = channel;
return ARES_SUCCESS;
}
static int init_by_options(ares_channel channel, struct ares_options *options,
/* Save options from initialized channel */
int ares_save_options(ares_channel channel, struct ares_options *options,
int *optmask)
{
int i;
/* Zero everything out */
memset(options, 0, sizeof(struct ares_options));
if (!ARES_CONFIG_CHECK(channel))
return ARES_ENODATA;
(*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TIMEOUT|ARES_OPT_TRIES|ARES_OPT_NDOTS|
ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB|
ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS|
ARES_OPT_SORTLIST);
/* Copy easy stuff */
options->flags = channel->flags;
options->timeout = channel->timeout;
options->tries = channel->tries;
options->ndots = channel->ndots;
options->udp_port = channel->udp_port;
options->tcp_port = channel->tcp_port;
options->sock_state_cb = channel->sock_state_cb;
options->sock_state_cb_data = channel->sock_state_cb_data;
/* Copy servers */
options->servers =
malloc(channel->nservers * sizeof(struct server_state));
if (!options->servers && channel->nservers != 0)
return ARES_ENOMEM;
for (i = 0; i < channel->nservers; i++)
options->servers[i] = channel->servers[i].addr;
options->nservers = channel->nservers;
/* copy domains */
options->domains = malloc(channel->ndomains * sizeof(char *));
if (!options->domains)
return ARES_ENOMEM;
for (i = 0; i < channel->ndomains; i++)
{
options->ndomains = i;
options->domains[i] = strdup(channel->domains[i]);
if (!options->domains[i])
return ARES_ENOMEM;
}
options->ndomains = channel->ndomains;
/* copy lookups */
options->lookups = strdup(channel->lookups);
if (!options->lookups)
return ARES_ENOMEM;
/* copy sortlist */
options->sortlist = malloc(channel->nsort * sizeof(struct apattern));
if (!options->sortlist)
return ARES_ENOMEM;
for (i = 0; i < channel->nsort; i++)
{
memcpy(&(options->sortlist[i]), &(channel->sortlist[i]),
sizeof(struct apattern));
}
options->nsort = channel->nsort;
return ARES_SUCCESS;
}
static int init_by_options(ares_channel channel,
const struct ares_options *options,
int optmask)
{
int i;
@@ -282,6 +355,19 @@ static int init_by_options(ares_channel channel, struct ares_options *options,
return ARES_ENOMEM;
}
/* copy sortlist */
if ((optmask & ARES_OPT_SORTLIST) && channel->nsort == -1)
{
channel->sortlist = malloc(options->nsort * sizeof(struct apattern));
if (!channel->sortlist)
return ARES_ENOMEM;
for (i = 0; i < options->nsort; i++)
{
memcpy(&(channel->sortlist[i]), &(options->sortlist[i]), sizeof(struct apattern));
}
channel->nsort = options->nsort;
}
return ARES_SUCCESS;
}
@@ -555,6 +641,10 @@ DhcpNameServer
if (status == ARES_SUCCESS)
status = ARES_EOF;
else
/* Catch the case when all the above checks fail (which happens when there
is no network card or the cable is unplugged) */
status = ARES_EFILE;
#elif defined(__riscos__)
@@ -611,6 +701,10 @@ DhcpNameServer
int linesize;
int error;
/* Don't read resolv.conf and friends if we don't have to */
if (ARES_CONFIG_CHECK(channel))
return ARES_SUCCESS;
fp = fopen(PATH_RESOLV_CONF, "r");
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
@@ -968,7 +1062,7 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
ipbufpfx[0] = '\0';
/* Lets see if it is CIDR */
/* First we'll try IPv6 */
if ((bits = ares_inet_net_pton(AF_INET6, ipbufpfx ? ipbufpfx : ipbuf,
if ((bits = ares_inet_net_pton(AF_INET6, ipbufpfx[0] ? ipbufpfx : ipbuf,
&pat.addr.addr6,
sizeof(pat.addr.addr6))) > 0)
{
@@ -978,7 +1072,7 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
if (!sortlist_alloc(sortlist, nsort, &pat))
return ARES_ENOMEM;
}
if (ipbufpfx &&
if (ipbufpfx[0] &&
(bits = ares_inet_net_pton(AF_INET, ipbufpfx, &pat.addr.addr4,
sizeof(pat.addr.addr4))) > 0)
{
@@ -991,7 +1085,7 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
/* See if it is just a regular IP */
else if (ip_addr(ipbuf, (int)(q-str), &pat.addr.addr4) == 0)
{
if (ipbufpfx)
if (ipbufpfx[0])
{
memcpy(ipbuf, str, (int)(q-str));
ipbuf[(int)(q-str)] = '\0';
@@ -1175,3 +1269,79 @@ static void natural_mask(struct apattern *pat)
pat->mask.addr.addr4.s_addr = htonl(IN_CLASSC_NET);
}
#endif
/* initialize an rc4 key. If possible a cryptographically secure random key
is generated using a suitable function (for example win32's RtlGenRandom as
described in
http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx
otherwise the code defaults to cross-platform albeit less secure mechanism
using rand
*/
static void randomize_key(unsigned char* key,int key_data_len)
{
int randomized = 0;
int counter=0;
#ifdef WIN32
HMODULE lib=LoadLibrary("ADVAPI32.DLL");
if (lib) {
BOOLEAN (APIENTRY *pfn)(void*, ULONG) =
(BOOLEAN (APIENTRY *)(void*,ULONG))GetProcAddress(lib,"SystemFunction036");
if (pfn && pfn(key,key_data_len) )
randomized = 1;
FreeLibrary(lib);
}
#else /* !WIN32 */
#ifdef RANDOM_FILE
char buffer[256];
FILE *f = fopen(RANDOM_FILE, "rb");
if(f) {
size_t i;
size_t rc = fread(buffer, key_data_len, 1, f);
for(i=0; i<rc && counter < key_data_len; i++)
key[counter++]=buffer[i];
fclose(f);
}
#endif
#endif /* WIN32 */
if ( !randomized ) {
for (;counter<key_data_len;counter++)
key[counter]=rand() % 256;
}
}
static void init_id_key(rc4_key* key,int key_data_len)
{
unsigned char index1;
unsigned char index2;
unsigned char* state;
short counter;
unsigned char *key_data_ptr = 0;
key_data_ptr = calloc(1,key_data_len);
randomize_key(key->state,key_data_len);
state = &key->state[0];
for(counter = 0; counter < 256; counter++)
state[counter] = counter;
key->x = 0;
key->y = 0;
index1 = 0;
index2 = 0;
for(counter = 0; counter < 256; counter++)
{
index2 = (key_data_ptr[index1] + state[counter] +
index2) % 256;
ARES_SWAP_BYTE(&state[counter], &state[index2]);
index1 = (index1 + 1) % key_data_len;
}
free(key_data_ptr);
}
short ares__generate_new_id(rc4_key* key)
{
short r;
ares__rc4(key, (unsigned char *)&r, sizeof(r));
return r;
}

View File

@@ -80,6 +80,8 @@
#endif
#define ARES_ID_KEY_LEN 31
#include "ares_ipv6.h"
struct send_request {
@@ -156,6 +158,13 @@ struct apattern {
unsigned short type;
};
typedef struct rc4_key
{
unsigned char state[256];
unsigned char x;
unsigned char y;
} rc4_key;
struct ares_channeldata {
/* Configuration data */
int flags;
@@ -176,6 +185,8 @@ struct ares_channeldata {
/* ID to use for next query */
unsigned short next_id;
/* key to use when generating new ids */
rc4_key id_key;
/* Active queries */
struct query *queries;
@@ -184,10 +195,15 @@ struct ares_channeldata {
void *sock_state_cb_data;
};
void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len);
void ares__send_query(ares_channel channel, struct query *query, time_t now);
void ares__close_sockets(ares_channel channel, struct server_state *server);
int ares__get_hostent(FILE *fp, int family, struct hostent **host);
int ares__read_line(FILE *fp, char **buf, int *bufsize);
short ares__generate_new_id(rc4_key* key);
#define ARES_SWAP_BYTE(a,b) \
{ unsigned char swapByte = *(a); *(a) = *(b); *(b) = swapByte; }
#define SOCK_STATE_CALLBACK(c, s, r, w) \
do { \

View File

@@ -24,16 +24,16 @@ ares_process \- Process events for name resolution
.B void ares_process(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP,
.B fd_set *\fIwrite_fds\fP)
.fi
.PP
.B void ares_process_fd(ares_channel \fIchannel\fP,
.B ares_socket_t \fIread_fd\fP,
.B ares_socket_t \fIwrite_fd\fP)
.fi
.SH DESCRIPTION
The
.B ares_process
function handles input/output events and timeouts associated with
queries pending on the name service channel identified by
The \fBares_process(3)\fP function handles input/output events and timeouts
associated with queries pending on the name service channel identified by
.IR channel .
The file descriptor sets pointed to by
.I read_fds
and
.I write_fds
The file descriptor sets pointed to by \fIread_fds\fP and \fIwrite_fds\fP
should have file descriptors set in them according to whether the file
descriptors specified by \fIares_fds(3)\fP are ready for reading and writing.
(The easiest way to determine this information is to invoke
@@ -44,6 +44,11 @@ The
.B ares_process
function will invoke callbacks for pending queries if they complete
successfully or fail.
\fBares_process_fd(3)\fP works the same way but acts and operates only on the
specific file descriptors (sockets) you pass in to the function. Use
ARES_SOCKET_BAD for "no action". This function is of course provided to allow
users of c-ares to void select() in their applications and within c-ares.
.SS EXAMPLE
The following code fragment waits for all pending queries on a channel
to complete:

View File

@@ -56,13 +56,14 @@
static int try_again(int errnum);
static void write_tcp_data(ares_channel channel, fd_set *write_fds,
time_t now);
static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now);
ares_socket_t write_fd, time_t now);
static void read_tcp_data(ares_channel channel, fd_set *read_fds,
ares_socket_t read_fd, time_t now);
static void read_udp_packets(ares_channel channel, fd_set *read_fds,
time_t now);
ares_socket_t read_fd, time_t now);
static void process_timeouts(ares_channel channel, time_t now);
static void process_answer(ares_channel channel, unsigned char *abuf,
int alen, int whichserver, int tcp, int now);
int alen, int whichserver, int tcp, time_t now);
static void handle_error(ares_channel channel, int whichserver, time_t now);
static struct query *next_server(ares_channel channel, struct query *query, time_t now);
static int open_tcp_socket(ares_channel channel, struct server_state *server);
@@ -80,12 +81,30 @@ void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
time_t now;
time(&now);
write_tcp_data(channel, write_fds, now);
read_tcp_data(channel, read_fds, now);
read_udp_packets(channel, read_fds, now);
write_tcp_data(channel, write_fds, ARES_SOCKET_BAD, now);
read_tcp_data(channel, read_fds, ARES_SOCKET_BAD, now);
read_udp_packets(channel, read_fds, ARES_SOCKET_BAD, now);
process_timeouts(channel, now);
}
/* Something interesting happened on the wire, or there was a timeout.
* See what's up and respond accordingly.
*/
void ares_process_fd(ares_channel channel,
ares_socket_t read_fd, /* use ARES_SOCKET_BAD or valid
file descriptors */
ares_socket_t write_fd)
{
time_t now;
time(&now);
write_tcp_data(channel, NULL, write_fd, now);
read_tcp_data(channel, NULL, read_fd, now);
read_udp_packets(channel, NULL, read_fd, now);
process_timeouts(channel, now);
}
/* Return 1 if the specified error number describes a readiness error, or 0
* otherwise. This is mostly for HP-UX, which could return EAGAIN or
* EWOULDBLOCK. See this man page
@@ -114,7 +133,10 @@ static int try_again(int errnum)
/* If any TCP sockets select true for writing, write out queued data
* we have for them.
*/
static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
static void write_tcp_data(ares_channel channel,
fd_set *write_fds,
ares_socket_t write_fd,
time_t now)
{
struct server_state *server;
struct send_request *sendreq;
@@ -124,14 +146,27 @@ static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
ssize_t wcount;
size_t n;
if(!write_fds && (write_fd == ARES_SOCKET_BAD))
/* no possible action */
return;
for (i = 0; i < channel->nservers; i++)
{
/* Make sure server has data to send and is selected in write_fds. */
/* Make sure server has data to send and is selected in write_fds or
write_fd. */
server = &channel->servers[i];
if (!server->qhead || server->tcp_socket == ARES_SOCKET_BAD
|| !FD_ISSET(server->tcp_socket, write_fds))
if (!server->qhead || server->tcp_socket == ARES_SOCKET_BAD)
continue;
if(write_fds) {
if(!FD_ISSET(server->tcp_socket, write_fds))
continue;
}
else {
if(server->tcp_socket != write_fd)
continue;
}
/* Count the number of send queue items. */
n = 0;
for (sendreq = server->qhead; sendreq; sendreq = sendreq->next)
@@ -218,20 +253,33 @@ static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
* allocate a buffer if we finish reading the length word, and process
* a packet if we finish reading one.
*/
static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now)
static void read_tcp_data(ares_channel channel, fd_set *read_fds,
ares_socket_t read_fd, time_t now)
{
struct server_state *server;
int i;
ssize_t count;
if(!read_fds && (read_fd == ARES_SOCKET_BAD))
/* no possible action */
return;
for (i = 0; i < channel->nservers; i++)
{
/* Make sure the server has a socket and is selected in read_fds. */
server = &channel->servers[i];
if (server->tcp_socket == ARES_SOCKET_BAD ||
!FD_ISSET(server->tcp_socket, read_fds))
if (server->tcp_socket == ARES_SOCKET_BAD)
continue;
if(read_fds) {
if(!FD_ISSET(server->tcp_socket, read_fds))
continue;
}
else {
if(server->tcp_socket != read_fd)
continue;
}
if (server->tcp_lenbuf_pos != 2)
{
/* We haven't yet read a length word, so read that (or
@@ -294,22 +342,34 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now)
/* If any UDP sockets select true for reading, process them. */
static void read_udp_packets(ares_channel channel, fd_set *read_fds,
time_t now)
ares_socket_t read_fd, time_t now)
{
struct server_state *server;
int i;
ssize_t count;
unsigned char buf[PACKETSZ + 1];
if(!read_fds && (read_fd == ARES_SOCKET_BAD))
/* no possible action */
return;
for (i = 0; i < channel->nservers; i++)
{
/* Make sure the server has a socket and is selected in read_fds. */
server = &channel->servers[i];
if (server->udp_socket == ARES_SOCKET_BAD ||
!FD_ISSET(server->udp_socket, read_fds))
if (server->udp_socket == ARES_SOCKET_BAD)
continue;
if(read_fds) {
if(!FD_ISSET(server->udp_socket, read_fds))
continue;
}
else {
if(server->udp_socket != read_fd)
continue;
}
count = sread(server->udp_socket, buf, sizeof(buf));
if (count == -1 && try_again(SOCKERRNO))
continue;
@@ -338,7 +398,7 @@ static void process_timeouts(ares_channel channel, time_t now)
/* Handle an answer from a server. */
static void process_answer(ares_channel channel, unsigned char *abuf,
int alen, int whichserver, int tcp, int now)
int alen, int whichserver, int tcp, time_t now)
{
int id, tc, rcode;
struct query *query;

View File

@@ -39,6 +39,64 @@ struct qquery {
static void qcallback(void *arg, int status, unsigned char *abuf, int alen);
void ares__rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
{
unsigned char x;
unsigned char y;
unsigned char* state;
unsigned char xorIndex;
short counter;
x = key->x;
y = key->y;
state = &key->state[0];
for(counter = 0; counter < buffer_len; counter ++)
{
x = (x + 1) % 256;
y = (state[x] + y) % 256;
ARES_SWAP_BYTE(&state[x], &state[y]);
xorIndex = (state[x] + state[y]) % 256;
buffer_ptr[counter] ^= state[xorIndex];
}
key->x = x;
key->y = y;
}
static struct query* find_query_by_id(ares_channel channel, int id)
{
int qid;
struct query* q;
DNS_HEADER_SET_QID(((unsigned char*)&qid), id);
/* Find the query corresponding to this packet. */
for (q = channel->queries; q; q = q->next)
{
if (q->qid == qid)
return q;
}
return NULL;
}
/* a unique query id is generated using an rc4 key. Since the id may already
be used by a running query (as infrequent as it may be), a lookup is
performed per id generation. In practice this search should happen only
once per newly generated id
*/
static int generate_unique_id(ares_channel channel)
{
int id;
do {
id = ares__generate_new_id(&channel->id_key);
} while (find_query_by_id(channel,id));
return id;
}
void ares_query(ares_channel channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg)
{
@@ -50,13 +108,14 @@ void ares_query(ares_channel channel, const char *name, int dnsclass,
rd = !(channel->flags & ARES_FLAG_NORECURSE);
status = ares_mkquery(name, dnsclass, type, channel->next_id, rd, &qbuf,
&qlen);
channel->next_id++;
if (status != ARES_SUCCESS)
{
callback(arg, status, NULL, 0);
return;
}
channel->next_id = generate_unique_id(channel);
/* Allocate and fill in the query structure. */
qquery = malloc(sizeof(struct qquery));
if (!qquery)

49
ares/ares_save_options.3 Normal file
View File

@@ -0,0 +1,49 @@
.\" $Id$
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.\" Permission to use, copy, modify, and distribute this
.\" software and its documentation for any purpose and without
.\" fee is hereby granted, provided that the above copyright
.\" notice appear in all copies and that both that copyright
.\" notice and this permission notice appear in supporting
.\" documentation, and that the name of M.I.T. not be used in
.\" advertising or publicity pertaining to distribution of the
.\" software without specific, written prior permission.
.\" M.I.T. makes no representations about the suitability of
.\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty.
.\"
.TH ARES_SAVE_OPTIONS 3 "1 June 2007"
.SH NAME
ares_save_options \- Save configuration values obtained from initialized ares_channel
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_save_options(ares_channel \fIchannel\fP, struct ares_options *\fIoptions\fP, int *\fIoptmask\fP)
.fi
.SH DESCRIPTION
The
.B ares_save_options
function saves the channel data identified by
.IR channel ,
into the options struct identified by
.IR options ,
and saves the mask of options which are set to the integer
pointer (passed by reference) identified by
.IR optmask .
The resultant options and optmask are then able to be
passed directly to ares_init_options. When the options
are no longer needed, ares_destroy_options should be called
to free any associated memory.
.SH SEE ALSO
.BR ares_destroy_options (3),
.BR ares_init_options (3)
.SH AUTHOR
Brad House
.br
Copyright 1998 by the Massachusetts Institute of Technology.

View File

@@ -31,7 +31,8 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
{
struct query *query;
time_t now;
int offset, min_offset;
time_t offset, min_offset; /* these use time_t since some 32 bit systems
still use 64 bit time_t! (like VS2005) */
/* No queries, no timeout (and no fetch of the current time). */
if (!channel->queries)
@@ -57,7 +58,7 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
*/
if (min_offset != -1 && (!maxtv || min_offset <= maxtv->tv_sec))
{
tvbuf->tv_sec = min_offset;
tvbuf->tv_sec = (long)min_offset;
tvbuf->tv_usec = 0;
return tvbuf;
}

View File

@@ -4,12 +4,12 @@
#define ARES__VERSION_H
#define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 3
#define ARES_VERSION_PATCH 3
#define ARES_VERSION_MINOR 4
#define ARES_VERSION_PATCH 1
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.3.3-CVS"
#define ARES_VERSION_STR "1.4.1-CVS"
#ifdef __cplusplus
extern "C" {

View File

@@ -337,6 +337,7 @@ AC_CHECK_HEADERS(
sys/select.h \
sys/socket.h \
sys/ioctl.h \
sys/param.h \
netdb.h \
netinet/in.h \
net/if.h \
@@ -600,6 +601,7 @@ AC_CHECK_MEMBER(struct addrinfo.ai_flags,
AC_CHECK_FUNCS( bitncmp \
gettimeofday \
if_indextoname,
dnl if found
[],
@@ -785,4 +787,20 @@ AC_C_BIGENDIAN(
[AC_MSG_WARN([couldn't figure out endianess, assuming little endian!])]
)
dnl Check for user-specified random device
AC_ARG_WITH(random,
AC_HELP_STRING([--with-random=FILE],
[read randomness from FILE (default=/dev/urandom)]),
[ RANDOM_FILE="$withval" ],
[
dnl Check for random device
AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
]
)
if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
AC_SUBST(RANDOM_FILE)
AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
[a suitable file/device to read random data from])
fi
AC_OUTPUT(Makefile)

View File

@@ -32,7 +32,9 @@ struct iovec
int ares_writev (SOCKET s, const struct iovec *vector, size_t count);
#define writev(s,vect,count) ares_writev(s,vect,count)
#ifndef HAVE_GETTIMEOFDAY
struct timezone { int dummy; };
#endif
int ares_gettimeofday(struct timeval *tv, struct timezone *tz);
#define gettimeofday(tv,tz) ares_gettimeofday(tv,tz)

View File

@@ -3,7 +3,7 @@
/* $Id$ */
/* Copyright (C) 2004 - 2005 by Daniel Stenberg et al
/* Copyright (C) 2004 - 2007 by Daniel Stenberg et al
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
@@ -117,18 +117,6 @@
#undef VERSION
#undef PACKAGE
/*
* Typedef our socket type
*/
#ifdef USE_WINSOCK
typedef SOCKET ares_socket_t;
#define ARES_SOCKET_BAD INVALID_SOCKET
#else
typedef int ares_socket_t;
#define ARES_SOCKET_BAD -1
#endif
/*
* Assume a few thing unless they're set by configure
*/
@@ -156,6 +144,11 @@ int ares_strcasecmp(const char *s1, const char *s2);
same */
#define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
#define strcasecmp(a,b) ares_strcasecmp(a,b)
#ifdef _MSC_VER
# if _MSC_VER >= 1400
# define strdup(a) _strdup(a)
# endif
#endif
#endif
/* IPv6 compatibility */

View File

@@ -337,5 +337,26 @@ typedef int sig_atomic_t;
#endif
/*
* Actually use __32_getpwuid() on 64-bit VMS builds for getpwuid()
*/
#if defined(VMS) && \
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
#define getpwuid __32_getpwuid
#endif
/*
* Macro argv_item_t hides platform details to code using it.
*/
#ifdef VMS
#define argv_item_t __char_ptr32
#else
#define argv_item_t char *
#endif
#endif /* __SETUP_ONCE_H */

View File

@@ -49,7 +49,7 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\areslib\Release"
!ELSEIF "$(CFG)" == "adig - Win32 Debug"
@@ -65,15 +65,15 @@ LINK32=link.exe
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\areslib\Debug"
!ENDIF
@@ -91,12 +91,16 @@ SOURCE=..\..\adig.c
# End Source File
# Begin Source File
SOURCE=..\..\getopt.c
SOURCE=..\..\ares_getopt.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\ares_getopt.h
# End Source File
# End Group
# Begin Group "Resource Files"

View File

@@ -48,7 +48,7 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\areslib\Release"
!ELSEIF "$(CFG)" == "ahost - Win32 Debug"
@@ -63,15 +63,15 @@ LINK32=link.exe
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\areslib\Debug"
!ENDIF
@@ -87,10 +87,18 @@ LINK32=link.exe
SOURCE=..\..\ahost.c
# End Source File
# Begin Source File
SOURCE=..\..\ares_getopt.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\ares_getopt.h
# End Source File
# End Group
# Begin Group "Resource Files"

View File

@@ -118,12 +118,16 @@ AC_LIBTOOL_WIN32_DLL
dnl skip libtool C++ and Fortran compiler checks
m4_ifdef([AC_PROG_CXX], [m4_undefine([AC_PROG_CXX])])
m4_defun([AC_PROG_CXX],[])
m4_ifdef([AC_PROG_CXXCPP], [m4_undefine([AC_PROG_CXXCPP])])
m4_defun([AC_PROG_CXXCPP],[true])
m4_ifdef([AC_PROG_F77], [m4_undefine([AC_PROG_F77])])
m4_defun([AC_PROG_F77],[])
dnl skip libtool C++ and Fortran linker checks
m4_ifdef([AC_LIBTOOL_CXX], [m4_undefine([AC_LIBTOOL_CXX])])
m4_defun([AC_LIBTOOL_CXX],[])
m4_ifdef([AC_LIBTOOL_CXXCPP], [m4_undefine([AC_LIBTOOL_CXXCPP])])
m4_defun([AC_LIBTOOL_CXXCPP],[true])
m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])])
m4_defun([AC_LIBTOOL_F77],[])
@@ -200,6 +204,9 @@ dnl The install stuff has already been taken care of by the automake stuff
dnl AC_PROG_INSTALL
AC_PROG_MAKE_SET
dnl check if there's a way to force code inline
AC_C_INLINE
dnl **********************************************************************
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
dnl and ws2tcpip.h take precedence over any other further checks which
@@ -412,6 +419,21 @@ then
)
fi
if test "$HAVE_GETHOSTBYNAME" != "1"
then
dnl This is for Minix 3.1
AC_MSG_CHECKING([for gethostbyname for Minix 3])
AC_TRY_LINK([
/* Older Minix versions may need <net/gen/netdb.h> here instead */
#include <netdb.h>],
[gethostbyname("www.dummysite.com");],
[ dnl worked!
AC_MSG_RESULT([yes])
HAVE_GETHOSTBYNAME="1"],
AC_MSG_RESULT(no)
)
fi
if test "$HAVE_GETHOSTBYNAME" != "1"
then
dnl This is for eCos with a stubbed DNS implementation
@@ -888,7 +910,7 @@ dnl Default to no CA bundle
ca="no"
AC_ARG_WITH(ssl,dnl
AC_HELP_STRING([--with-ssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
AC_HELP_STRING([--without-ssl], [disable SSL]),
AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
OPT_SSL=$withval)
if test X"$OPT_SSL" != Xno; then
@@ -1337,7 +1359,7 @@ if test "$OPENSSL_ENABLED" != "1"; then
[
AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
AC_SUBST(USE_GNUTLS, [1])
GNUTLS_ENABLED = 1
GNUTLS_ENABLED=1
USE_GNUTLS="yes"
curl_ssl_msg="enabled (GnuTLS)"
],
@@ -2031,10 +2053,10 @@ fi
dnl set variable for use in automakefile(s)
AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
AC_MSG_CHECKING([whether to enable ares])
AC_MSG_CHECKING([whether to enable c-ares])
AC_ARG_ENABLE(ares,
AC_HELP_STRING([--enable-ares=PATH],[Enable ares for name lookups])
AC_HELP_STRING([--disable-ares],[Disable ares for name lookups]),
AC_HELP_STRING([--enable-ares=PATH],[Enable c-ares for name lookups])
AC_HELP_STRING([--disable-ares],[Disable c-ares for name lookups]),
[ case "$enableval" in
no)
AC_MSG_RESULT(no)
@@ -2042,10 +2064,10 @@ AC_HELP_STRING([--disable-ares],[Disable ares for name lookups]),
*) AC_MSG_RESULT(yes)
if test "x$IPV6_ENABLED" = "x1"; then
AC_MSG_NOTICE([ares may not work properly with ipv6])
AC_MSG_NOTICE([c-ares may not work properly with ipv6])
fi
AC_DEFINE(USE_ARES, 1, [Define if you want to enable ares support])
AC_DEFINE(USE_ARES, 1, [Define if you want to enable c-ares support])
dnl substitute HAVE_ARES for curl-config and similar
HAVE_ARES="1"
AC_SUBST(HAVE_ARES)
@@ -2090,7 +2112,8 @@ void curl_domalloc() { }
int main(void)
{
ares_channel channel;
ares_cancel(channel);
ares_cancel(channel); /* added in 1.2.0 */
ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
return 0;
}
],

View File

@@ -1,4 +1,4 @@
Updated: February 11, 2007 (http://curl.haxx.se/docs/faq.html)
Updated: June 26, 2007 (http://curl.haxx.se/docs/faq.html)
_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
@@ -446,6 +446,10 @@ FAQ
curl -O ftp://download.com/coolfile -Q '-DELE coolfile'
or rename a file after upload:
curl -T infile ftp://upload.com/dir/ -Q "-RNFR infile" -Q "-RNTO newname"
3.8 How do I tell curl to follow HTTP redirects?
Curl does not follow so-called redirects by default. The Location: header
@@ -755,7 +759,9 @@ FAQ
4.9 Curl can't authenticate to the server that requires NTLM?
This is supported in curl 7.10.6 or later. No earlier curl version knows
of this magic.
of this magic. Later versions require the OpenSSL or Microsoft Windows
libraries to provide this functionality. Using GnuTLS or NSS libraries will
not provide NTLM authentication functionality in curl.
NTLM is a Microsoft proprietary protocol. Proprietary formats are evil. You
should not use such ones.

View File

@@ -33,6 +33,7 @@ libcurl supports
- supports large files (>2GB and >4GB) both upload/download
- replacable memory functions (malloc, free, realloc, etc)
- asynchronous name resolving (*6)
- both a push and a pull style interface
HTTP
- HTTP/1.1 compliant (optionally uses 1.0)
@@ -40,6 +41,7 @@ HTTP
- PUT
- HEAD
- POST
- Pipelining
- multipart formpost (RFC1867-style)
- authentication: Basic, Digest, NTLM(*1), GSS-Negotiate/Negotiate(*3) and
SPNEGO (*4) to server and proxy
@@ -71,7 +73,7 @@ HTTPS (*1)
FTP
- download
- authentication
- kerberos4 (*5)
- kerberos4 (*5), kerberos5 (*3)
- active/passive using PORT, EPRT, PASV or EPSV
- single file size information (compare to HTTP HEAD)
- 'type=' URL support
@@ -94,6 +96,13 @@ FTPS (*1)
- explicit "AUTH TSL" and "AUTH SSL" usage to "upgrade" plain ftp://
connection to use SSL for both or one of the connections
SCP (*8)
- both password and public key auth
SFTP (*8)
- both password and public key auth
- with custom commands sent before/after the transfer
TFTP
- download / upload
@@ -116,10 +125,11 @@ FILE
FOOTNOTES
=========
*1 = requires OpenSSL, GnuTLS or NSS
*1 = requires OpenSSL, GnuTLS, NSS or yassl
*2 = requires OpenLDAP
*3 = requires a GSSAPI-compliant library, such as Heimdal or similar.
*4 = requires FBopenssl
*5 = requires a krb4 library, such as the MIT one or similar.
*6 = requires c-ares
*7 = requires OpenSSL or NSS, as GnuTLS only supports SSLv3 and TLSv1
*8 = requires libssh2

View File

@@ -484,17 +484,26 @@ NetWare
http://www.gknw.net/development/prgtools/
- recent Novell LibC SDK available from:
http://developer.novell.com/ndk/libc.htm
- optional zlib sources (at the moment only dynamic linking with zlib.imp);
- or recent Novell CLib SDK available from:
http://developer.novell.com/ndk/clib.htm
- optional zlib sources (static or dynamic linking with zlib.imp);
sources with NetWare Makefile can be obtained from:
http://www.gknw.net/mirror/zlib/
- optional OpenSSL sources (version 0.9.8 or later which builds with BSD);
- optional OpenSSL sources (version 0.9.8 or later build with BSD sockets);
you can find precompiled packages at:
http://www.gknw.net/development/ossl/netware/
for CLIB-based builds OpenSSL needs to be extended to build with BSD
sockets (currently only a winsock-based CLIB build is supported);
- optional SSH2 sources (version 0.15 or later);
Set a search path to your compiler, linker and tools; on Linux make
sure that the var OSTYPE contains the string 'linux'; and then type
sure that the var OSTYPE contains the string 'linux'; set the var
NDKBASE to point to the base of your Novell NDK; and then type
'make netware' from the top source directory; other tagets available
are 'netware-ssl', 'netware-ssl-zlib', 'netware-zlib' and 'netware-ares';
if you need other combinations you can control the build with the
environment variables WITH_SSL, WITH_ZLIB, WITH_ARES and ENABLE_IPV6.
environment variables WITH_SSL, WITH_ZLIB, WITH_ARES, WITH_SSH2, and
ENABLE_IPV6; you can set LINK_STATIC=1 to link curl.nlm statically.
I found on some Linux systems (RH9) that OS detection didnt work although
a 'set | grep OSTYPE' shows the var present and set; I simply overwrote it
with 'OSTYPE=linux-rh9-gnu' and the detection in the Makefile worked...
@@ -577,21 +586,32 @@ eCos
Minix
=====
curl can be compiled on Minix 3 using gcc (ACK has a few problems due
to mismatched headers and libraries as of ver. 3.1.2). The gcc and bash
packages must be installed first. The default heap size allocated to
bash is inadequate for running configure and will result in out of memory
errors. Increase it with the command:
curl can be compiled on Minix 3 using gcc or ACK (starting with
ver. 3.1.3). The gcc and bash packages must be installed first.
The default heap size allocated to bash is inadequate for running
configure and will result in out of memory errors. Increase it with
the command:
chmem =2048000 /usr/local/bin/bash
Make sure gcc and bash are in the PATH then configure curl with a
command like this:
Make sure gcc and bash are in the PATH with the command:
./configure GREP=/usr/bin/grep AR=/usr/gnu/bin/gar --disable-ldap
export PATH=/usr/gnu/bin:$PATH
then configure curl with a command like this:
./configure CC=gcc GREP=grep AR=/usr/gnu/bin/gar --disable-ldap
Then simply run 'make'.
To compile with the ACK C compiler:
chmem =1024000 /usr/lib/em_cemcom.ansi
chmem =512000 /usr/lib/i386/as
./configure CC=cc LD=cc GREP=grep CPPFLAGS=-D_POSIX_SOURCE=1 \
--disable-ldap
make
CROSS COMPILE
=============
@@ -728,7 +748,7 @@ PORTS
- i386 FreeBSD
- i386 HURD
- i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4, 2.6
- i386 MINIX 3.1.2
- i386 MINIX 3.1
- i386 NetBSD
- i386 Novell NetWare
- i386 OS/2

View File

@@ -3,14 +3,17 @@ 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!
44. --ftp-method nocwd does not handle URLs ending with a slash properly (it
should list the contents of that directory). See test case 351.
43. There seems to be a problem when connecting to the Microsoft telnet server.
http://curl.haxx.se/bug/view.cgi?id=1720605
41. When doing an operation over FTP that requires the ACCT command (but not
when logging in), the operation will fail since libcurl doesn't detect this
and thus fails to issue the correct command:
http://curl.haxx.se/bug/view.cgi?id=1693337
40. Mac OS X test failures (Daniel Johnson)
http://curl.haxx.se/mail/lib-2007-03/0095.html
39. Steffen Rumler's Race Condition in Curl_proxyCONNECT:
http://curl.haxx.se/mail/lib-2007-01/0045.html

View File

@@ -809,18 +809,19 @@ CUSTOM OUTPUT
curl -w 'We downloaded %{size_download} bytes\n' www.download.com
KERBEROS4 FTP TRANSFER
KERBEROS FTP TRANSFER
Curl supports kerberos4 for FTP transfers. You need the kerberos package
installed and used at curl build time for it to be used.
Curl supports kerberos4 and kerberos5/GSSAPI for FTP transfers. You need
the kerberos package installed and used at curl build time for it to be
used.
First, get the krb-ticket the normal way, like with the kauth tool. Then use
curl in way similar to:
First, get the krb-ticket the normal way, like with the kinit/kauth tool.
Then use curl in way similar to:
curl --krb4 private ftp://krb4site.com -u username:fakepwd
curl --krb private ftp://krb4site.com -u username:fakepwd
There's no use for a password on the -u switch, but a blank one will make
curl ask for one and you already entered the real password to kauth.
curl ask for one and you already entered the real password to kinit/kauth.
TELNET

View File

@@ -4,6 +4,8 @@
If you have contributed but are missing here, please let us know!
Adam D. Moss
Adam Piggott
Adrian Schuur
Alan Pinstein
Albert Chin-A-Young
@@ -20,7 +22,9 @@ Alexander Zhuravlev
Alexey Simak
Alexis Carvalho
Amol Pattekar
Anders Gustafsson
Andi Jahja
Andre Guibert de Bruet
Andreas Damm
Andreas Ntaflos
Andreas Olsson
@@ -92,6 +96,8 @@ Dan Fandrich
Dan Nelson
Dan Torop
Dan Zitter
Daniel Black
Daniel Johnson
Daniel Stenberg
Daniel at touchtunes
Darryl House
@@ -99,6 +105,7 @@ Dave Dribin
Dave Halbakken
Dave Hamilton
Dave May
Dave Vasilevsky
David Byron
David Cohen
David Eriksson
@@ -135,6 +142,7 @@ Douglas E. Wegscheid
Douglas R. Horner
Dov Murik
Duane Cathey
Duncan Mac-Vicar Prett
Dustin Boswell
Dylan Ellicott
Dylan Salisbury
@@ -156,11 +164,14 @@ Erwan Legrand
Erwin Authried
Eugene Kotlyarov
Evan Jordan
Eygene Ryabinkin
Fabrizio Ammollo
Fedor Karpelevitch
Felix von Leitner
Feng Tu
Florian Schoppmann
Forrest Cahoon
Frank Hempel
Frank Keeney
Frank Ticheler
Fred New
@@ -173,6 +184,7 @@ Georg Huettenegger
Georg Wicherski
Gerd v. Egidy
Gerhard Herre
Gerrit Bruchh<68>user
Giaslas Georgios
Gilad
Gilbert Ramirez Jr.
@@ -191,6 +203,7 @@ Gwenole Beauchesne
G<EFBFBD>tz Babin-Ebell
G<EFBFBD>nter Knauf
Hamish Mackenzie
Hang Kin Lau
Hanno Kranzhoff
Hans Steegers
Hardeep Singh
@@ -200,6 +213,7 @@ Henrik Storner
Hzhijun
Ian Ford
Ian Gulliver
Ian Turner
Ian Wilkes
Ignacio Vazquez-Abrams
Igor Polyakov
@@ -224,6 +238,7 @@ Jan Kunder
Jared Lundell
Jari Sundell
Jason S. Priebe
Jay Austin
Jaz Fresh
Jean Jacques Drouin
Jean-Claude Chauve
@@ -254,6 +269,7 @@ Jonas Forsman
Jonatan Lander
Jonathan Hseu
Jongki Suwandi
Jose Kahan
Josh Kapell
Juan F. Codagnone
Juan Ignacio Herv<72>s
@@ -262,6 +278,7 @@ Jukka Pihl
Julian Noble
Jun-ichiro itojun Hagino
Jurij Smakov
Justin Fletcher
J<EFBFBD>rg Mueller-Tolk
J<EFBFBD>rn Hartroth
Kai Sommerfeld
@@ -284,6 +301,7 @@ Kjetil Jacobsen
Klevtsov Vadim
Kris Kennaway
Krishnendu Majumdar
Kristian Gunstone
Kristian K<>hntopp
Kyle Sallee
Lachlan O'Dea
@@ -309,6 +327,7 @@ Luke Call
Luong Dinh Dung
Maciej Karpiuk
Maciej W. Rozycki
Manfred Schwarb
Marc Boucher
Marcelo Juchem
Marcin Konicki
@@ -330,6 +349,7 @@ Maruko
Massimiliano Ziccardi
Mathias Axelsson
Mats Lidell
Matt Kraai
Matt Veenstra
Matt Witherspoon
Matthew Blain
@@ -364,6 +384,7 @@ Neil Spring
Nic Roets
Nick Gimbrone
Nick Humfrey
Nick Zitzmann
Nico Baggus
Nicolas Berloquin
Nicolas Croiset
@@ -394,6 +415,7 @@ Pete Su
Peter Bray
Peter Forret
Peter Heuchert
Peter O'Gorman
Peter Pentchev
Peter Silva
Peter Su
@@ -423,6 +445,7 @@ Rene Bernhardt
Rene Rebe
Ricardo Cadime
Rich Gray
Rich Rauenzahn
Richard Archer
Richard Atterer
Richard Bramante
@@ -432,9 +455,14 @@ Richard Gorton
Richard Prescott
Rick Jones
Rick Richardson
Rob Crittenden
Rob Jones
Rob Stanzel
Robert A. Monat
Robert D. Young
Robert Foreman
Robert Iakobashvil
Robert Iakobashvili
Robert Olson
Robert Weaver
Robin Kay
@@ -469,6 +497,8 @@ Siddhartha Prakash Jain
Simon Dick
Simon Josefsson
Simon Liu
Song Ma
Sonia Subramanian
Spiridonoff A.V
Stadler Stephan
Stefan Esser
@@ -480,6 +510,7 @@ Stephen More
Sterling Hughes
Steve Green
Steve Lhomme
Steve Little
Steve Marx
Steve Oliphant
Steven Bazyl
@@ -497,6 +528,7 @@ Tim Baker
Tim Bartley
Tim Costello
Tim Sneddon
Tobias Rundstr<74>m
Toby Peterson
Todd Kulesza
Todd Vierling
@@ -504,6 +536,7 @@ Tom Benoist
Tom Lee
Tom Mattison
Tom Moers
Tom Regner
Tom Zerucha
Tomas Pospisek
Tomas Szepe

View File

@@ -216,7 +216,8 @@ local directory hierarchy as needed. This option creates the dirs mentioned
with the -o option, nothing else. If the -o file name uses no dir or if the
dirs it mentions already exist, no dir will be created.
To create remote directories when using FTP, try \fI--ftp-create-dirs\fP.
To create remote directories when using FTP or SFTP, try
\fI--ftp-create-dirs\fP.
.IP "--crlf"
(FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).
@@ -370,7 +371,7 @@ normal cases when a HTTP server fails to deliver a document, it returns an
HTML document stating so (which often also describes why and more). This flag
will prevent curl from outputting that and return error 22.
This method is not fail-safe and there are occasions where non-succesful
This method is not fail-safe and there are occasions where non-successful
response codes will slip through, especially when authentication is involved
(response codes 401 and 407).
@@ -382,7 +383,7 @@ has been provided, this data is sent off using the ACCT command. (Added in
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
(FTP) When an FTP or SFTP 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
will instead attempt to create missing directories.
@@ -592,13 +593,14 @@ private key is. DER, PEM and ENG are supported. If not specified, PEM is
assumed.
If this option is used several times, the last one will be used.
.IP "--krb4 <level>"
(FTP) Enable kerberos4 authentication and use. The level must be entered and
.IP "--krb <level>"
(FTP) Enable Kerberos authentication and use. The level must be entered and
should be one of 'clear', 'safe', 'confidential' or 'private'. Should you use
a level that is not one of these, 'private' will instead be used.
This option requires that the library was built with kerberos4 support. This
is not very common. Use \fI-V/--version\fP to see if your curl supports it.
This option requires that the library was built with kerberos4 or GSSAPI
(GSS-Negotiate) support. This is not very common. Use \fI-V/--version\fP to
see if your curl supports it.
If this option is used several times, the last one will be used.
.IP "-K/--config <config file>"
@@ -689,7 +691,7 @@ subdirectories and symbolic links.
If this option is used twice, the second will again disable list only.
.IP "--local-port <num>[-num]"
Set a prefered number or range of local port numbers to use for the
Set a preferred number or range of local port numbers to use for the
connection(s). Note that port numbers by nature is a scarce resource that
will be busy at times so setting this range to something too narrow might
cause unnecessary connection setup failures. (Added in 7.15.2)
@@ -704,6 +706,11 @@ able to intercept the user+password. See also \fI--location-trusted\fP on how
to change this. You can limit the amount of redirects to follow by using the
\fI--max-redirs\fP option.
When curl follows a redirect and the request is not a plain GET (for example
POST or PUT), it will do the following request with a GET if the HTTP response
was 301, 302, or 303. If the response code was any other 3xx code, curl will
re-send the following request using the same unmodified method.
If this option is used twice, the second will again disable location following.
.IP "--location-trusted"
(HTTP/HTTPS) Like \fI-L/--location\fP, but will allow sending the name +
@@ -867,7 +874,7 @@ separate file.
If this option is used several times, the last one will be used.
.IP "-P/--ftp-port <address>"
(FTP) Reverses the initiator/listener roles when connecting with ftp. This
switch makes Curl use the PORT command instead of PASV. In practice, PORT
switch makes Curl use the PORT command instead of PASV. In practise, PORT
tells the server to connect to the client's specified address and port, while
PASV asks the server for an ip address and port to connect to. <address>
should be one of:
@@ -891,14 +898,18 @@ If used as the first parameter on the command line, the \fIcurlrc\fP config
file will not be read and used. See the \fI-K/--config\fP for details on the
default config file search path.
.IP "-Q/--quote <command>"
(FTP) Send an arbitrary command to the remote FTP server. Quote commands are
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.
(FTP/SFTP) Send an arbitrary command to the remote FTP or SFTP server. Quote
commands are sent BEFORE the transfer is taking place (just after the
initial PWD command in an FTP transfer, 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 '+' (this
is only supported for FTP). You may specify any number 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 to FTP servers, or one of the following commands (with
appropriate arguments) to SFTP servers: chgrp, chmod, chown, ln, mkdir,
rename, rm, rmdir, symlink.
This option can be used multiple times.
.IP "--random-file <file>"
@@ -936,6 +947,10 @@ specifies two separate 100 bytes ranges(*)(H)
(*) = NOTE that this will cause the server to reply with a multipart
response!
Only digit characters (0-9) are valid in 'start' and 'stop' of range syntax
\&'start-stop'. If a non-digit character is given in the range, the server's
response will be indeterminable, depending on different server's configuration.
You should also be aware that many HTTP/1.1 servers do not have this feature
enabled, so that when you attempt to get a range, you'll instead get the whole
document.
@@ -1082,7 +1097,7 @@ If this option is used several times, each occurrence will toggle it on/off.
Specify user and password to use for server authentication. Overrides
\fI-n/--netrc\fP and \fI--netrc-optional\fP.
If you use an SSPI-enabled curl binary and do NTLM autentication, you can
If you use an SSPI-enabled curl binary and do NTLM authentication, you can
force curl to pick up the user name and password from your environment by
simply specifying a single colon with this option: "-u :".
@@ -1090,7 +1105,7 @@ If this option is used several times, the last one will be used.
.IP "-U/--proxy-user <user:password>"
Specify user and password to use for proxy authentication.
If you use an SSPI-enabled curl binary and do NTLM autentication, you can
If you use an SSPI-enabled curl binary and do NTLM authentication, you can
force curl to pick up the user name and password from your environment by
simply specifying a single colon with this option: "-U :".
@@ -1139,7 +1154,7 @@ Automatic decompression of compressed files over HTTP is supported.
.IP "NTLM"
NTLM authentication is supported.
.IP "GSS-Negotiate"
Negotiate authentication is supported.
Negotiate authentication and krb5 for ftp is supported.
.IP "Debug"
This curl uses a libcurl built with Debug. This enables more error-tracking
and memory debugging etc. For curl-developers only!
@@ -1458,7 +1473,7 @@ Internal error. A function was called in a bad order.
.IP 45
Interface error. A specified outgoing interface could not be used.
.IP 46
Bad password entered. An error was signaled when the password was entered.
Bad password entered. An error was signalled when the password was entered.
.IP 47
Too many redirects. When following redirects, curl hit the maximum amount.
.IP 48

View File

@@ -13,7 +13,10 @@
* Written by Michael Wallner
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <curl/multi.h>
static const char *urls[] = {
@@ -106,6 +109,10 @@ int main(void)
cm = curl_multi_init();
/* we can optionally limit the total amount of connections this multi handle
uses */
curl_multi_setopt(cm, CURLMOPT_MAXCONNECTS, MAX);
for (C = 0; C < MAX; ++C) {
init(cm, C);
}
@@ -123,20 +130,24 @@ int main(void)
return EXIT_FAILURE;
}
/* In a real-world program you OF COURSE check the return that maxfd is
bigger than -1 so that the call to select() below makes sense! */
if (curl_multi_timeout(cm, &L)) {
fprintf(stderr, "E: curl_multi_timeout\n");
return EXIT_FAILURE;
}
if (L == -1)
L = 100;
T.tv_sec = L/1000;
T.tv_usec = (L%1000)*1000;
if (M == -1) {
sleep(L / 1000);
} else {
T.tv_sec = L/1000;
T.tv_usec = (L%1000)*1000;
if (0 > select(M+1, &R, &W, &E, &T)) {
fprintf(stderr, "E: select\n");
return EXIT_FAILURE;
if (0 > select(M+1, &R, &W, &E, &T)) {
fprintf(stderr, "E: select(%i,,,,%li): %i: %s\n",
M+1, L, errno, strerror(errno));
return EXIT_FAILURE;
}
}
}
@@ -155,6 +166,8 @@ int main(void)
}
if (C < CNT) {
init(cm, C++);
U++; /* just to prevent it from remaining at 0 if there are more
URLs to get */
}
}
}

View File

@@ -46,6 +46,8 @@ int main(int argc, char **argv)
/* Get a file listing from sunet */
curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.sunet.se/");
curl_easy_setopt(curl, CURLOPT_WRITEDATA, ftpfile);
/* If you intend to use this on windows with a libcurl DLL, you must use
CURLOPT_WRITEFUNCTION as well */
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_response);
curl_easy_setopt(curl, CURLOPT_WRITEHEADER, respfile);
res = curl_easy_perform(curl);

View File

@@ -92,18 +92,15 @@ typedef struct _SockInfo {
/* Update the event timer after curl_multi library calls */
static void update_timeout(GlobalInfo *g)
static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
{
long timeout_ms;
struct timeval timeout;
curl_multi_timeout(g->multi, &timeout_ms);
if(timeout_ms < 0)
return;
timeout.tv_sec = timeout_ms/1000;
timeout.tv_usec = (timeout_ms%1000)*1000;
fprintf(MSG_OUT, "multi_timer_cb: Setting timeout to %ld ms\n", timeout_ms);
evtimer_add(&g->timer_event, &timeout);
return 0;
}
@@ -185,9 +182,7 @@ static void event_cb(int fd, short kind, void *userp)
} while (rc == CURLM_CALL_MULTI_PERFORM);
mcode_or_die("event_cb: curl_multi_socket", rc);
check_run_count(g);
if(g->still_running) {
update_timeout(g);
} else {
if ( g->still_running <= 0 ) {
fprintf(MSG_OUT, "last transfer done, kill timeout\n");
if (evtimer_pending(&g->timer_event, NULL)) {
evtimer_del(&g->timer_event);
@@ -210,7 +205,6 @@ static void timer_cb(int fd, short kind, void *userp)
} while (rc == CURLM_CALL_MULTI_PERFORM);
mcode_or_die("timer_cb: curl_multi_socket", rc);
check_run_count(g);
if ( g->still_running ) { update_timeout(g); }
}
@@ -406,10 +400,11 @@ int main(int argc, char **argv)
evtimer_set(&g.timer_event, timer_cb, &g);
curl_multi_setopt(g.multi, CURLMOPT_SOCKETFUNCTION, sock_cb);
curl_multi_setopt(g.multi, CURLMOPT_SOCKETDATA, &g);
curl_multi_setopt(g.multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb);
curl_multi_setopt(g.multi, CURLMOPT_TIMERDATA, &g);
do {
rc = curl_multi_socket_all(g.multi, &g.still_running);
} while (CURLM_CALL_MULTI_PERFORM == rc);
update_timeout(&g);
event_dispatch();
curl_multi_cleanup(g.multi);
return 0;

View File

@@ -39,7 +39,7 @@ this function AFTER a performed transfer if you want to get transfer- oriented
data.
You should not free the memory returned by this function unless it is
explictly mentioned below.
explicitly mentioned below.
.SH AVAILABLE INFORMATION
The following information can be extracted:
.IP CURLINFO_EFFECTIVE_URL

View File

@@ -345,7 +345,7 @@ A non-zero parameter tells the library to fail silently if the HTTP code
returned is equal to or larger than 400. The default action would be to return
the page normally, ignoring that code.
This method is not fail-safe and there are occasions where non-succesful
This method is not fail-safe and there are occasions where non-successful
response codes will slip through, especially when authentication is involved
(response codes 401 and 407).
@@ -445,7 +445,7 @@ not an order. You cannot be guaranteed to actually get the given size. (Added
in 7.10)
This size is by default set as big as possible (CURL_MAX_WRITE_SIZE), so it
only makse sense to use this option if you want it smaller.
only makes sense to use this option if you want it smaller.
.IP CURLOPT_PORT
Pass a long specifying what remote port number to connect to, instead of the
one specified in the URL or the default port for the used protocol.
@@ -649,7 +649,7 @@ When setting \fICURLOPT_POST\fP to a non-zero value, it will automatically set
\fICURLOPT_NOBODY\fP to 0 (since 7.14.1).
If you issue a POST request and then want to make a HEAD or GET using the same
re-used handle, you must explictly set the new request type using
re-used handle, you must explicitly set the new request type using
\fICURLOPT_NOBODY\fP or \fICURLOPT_HTTPGET\fP or similar.
.IP CURLOPT_POSTFIELDS
Pass a char * as parameter, which should be the full data to post in an HTTP
@@ -736,10 +736,9 @@ The linked list should be a fully valid list of struct curl_slist structs, and
be properly filled in. Use \fIcurl_slist_append(3)\fP to create the list and
\fIcurl_slist_free_all(3)\fP to clean up an entire list.
The alias itself is not parsed for any version strings. So if your alias is
\&"MYHTTP/9.9", Libcurl will not treat the server as responding with HTTP
version 9.9. Instead Libcurl will use the value set by option
\fICURLOPT_HTTP_VERSION\fP.
The alias itself is not parsed for any version strings. Before libcurl 7.16.3,
Libcurl used the value set by option \fICURLOPT_HTTP_VERSION\fP, but starting
with 7.16.3 the protocol is assumed to match HTTP 1.0 when an alias matched.
.IP CURLOPT_COOKIE
Pass a pointer to a zero terminated string as parameter. It will be used to
set a cookie in the http request. The format of the string should be
@@ -811,6 +810,7 @@ it thinks fit.
Enforce HTTP 1.0 requests.
.IP CURL_HTTP_VERSION_1_1
Enforce HTTP 1.1 requests.
.RE
.IP CURLOPT_IGNORE_CONTENT_LENGTH
Ignore the Content-Length header. This is useful for Apache 1.x (and similar
servers) which will report incorrect content length for files over 2
@@ -827,7 +827,6 @@ Pass a long to tell libcurl how to act on transfer decoding. If set to zero,
transfer decoding will be disabled, if set to 1 it is enabled
(default). libcurl does chunked transfer decoding by default unless this
option is set to zero. (added in 7.16.2)
.RE
.SH FTP OPTIONS
.IP CURLOPT_FTPPORT
Pass a pointer to a zero terminated string as parameter. It will be used to
@@ -840,19 +839,20 @@ address. Default FTP operations are passive, and thus won't use PORT.
You disable PORT again and go back to using the passive version by setting
this option to NULL.
.IP CURLOPT_QUOTE
Pass a pointer to a linked list of FTP commands to pass to the server prior to
your ftp request. This will be done before any other FTP commands are issued
(even before the CWD command). The linked list should be a fully valid list of
'struct curl_slist' structs properly filled in. Use \fIcurl_slist_append(3)\fP
to append strings (commands) to the list, and clear the entire list afterwards
with \fIcurl_slist_free_all(3)\fP. Disable this operation again by setting a
NULL to this option.
Pass a pointer to a linked list of FTP or SFTP commands to pass to
the server prior to your ftp request. This will be done before any
other commands are issued (even before the CWD command for FTP). The
linked list should be a fully valid list of 'struct curl_slist' structs
properly filled in with text strings. Use \fIcurl_slist_append(3)\fP
to append strings (commands) to the list, and clear the entire list
afterwards with \fIcurl_slist_free_all(3)\fP. Disable this operation
again by setting a NULL to this option.
.IP CURLOPT_POSTQUOTE
Pass a pointer to a linked list of FTP commands to pass to the server after
your ftp transfer request. The linked list should be a fully valid list of
struct curl_slist structs properly filled in as described for
\fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this
option.
Pass a pointer to a linked list of FTP or SFTP commands to pass to the
server after your ftp transfer request. The linked list should be a
fully valid list of struct curl_slist structs properly filled in as
described for \fICURLOPT_QUOTE\fP. Disable this operation again by
setting a NULL to this option.
.IP CURLOPT_PREQUOTE
Pass a pointer to a linked list of FTP commands to pass to the server after
the transfer type is set. The linked list should be a fully valid list of
@@ -890,6 +890,11 @@ If the server is an IPv6 host, this option will have no effect as of 7.12.3.
Pass a long. If the value is non-zero, curl will attempt to create any remote
directory that it fails to CWD into. CWD is the command that changes working
directory. (Added in 7.10.7)
This setting also applies to SFTP-connections. curl will attempt to create
the remote directory if it can't obtain a handle to the target-location. The
creation will fail if a file of the same name as the directory to create
already exists or lack of permissions prevents creation. (Added in 7.16.3)
.IP CURLOPT_FTP_RESPONSE_TIMEOUT
Pass a long. Causes curl to set a timeout period (in seconds) on the amount
of time that the server is allowed to take in order to generate a response
@@ -1036,6 +1041,9 @@ When uploading a file to a remote site, this option should be used to tell
libcurl what the expected size of the infile is. This value should be passed
as a long. See also \fICURLOPT_INFILESIZE_LARGE\fP.
For uploading using SCP, this option or \fICURLOPT_INFILESIZE_LARGE\fP is
mandatory.
Note that this option does not limit how much data libcurl will actually send,
as that is controlled entirely by what the read callback returns.
.IP CURLOPT_INFILESIZE_LARGE
@@ -1043,6 +1051,8 @@ When uploading a file to a remote site, this option should be used to tell
libcurl what the expected size of the infile is. This value should be passed
as a curl_off_t. (Added in 7.11.0)
For uploading using SCP, this option or \fICURLOPT_INFILESIZE\fP is mandatory.
Note that this option does not limit how much data libcurl will actually send,
as that is controlled entirely by what the read callback returns.
.IP CURLOPT_UPLOAD
@@ -1124,10 +1134,10 @@ speed. (Added in 7.15.5)
.IP CURLOPT_MAXCONNECTS
Pass a long. The set number will be the persistent connection cache size. The
set amount will be the maximum amount of simultaneously open connections that
libcurl may cache. Default is 5, and there isn't much point in changing this
value unless you are perfectly aware of how this work and changes libcurl's
behaviour. This concerns connection using any of the protocols that support
persistent connections.
libcurl may cache in this easy handle. Default is 5, and there isn't much
point in changing this value unless you are perfectly aware of how this work
and changes libcurl's behaviour. This concerns connection using any of the
protocols that support persistent connections.
When reaching the maximum limit, curl closes the oldest one in the cache to
prevent the number of open connections to increase.
@@ -1135,6 +1145,10 @@ prevent the number of open connections to increase.
If you already have performed transfers with this curl handle, setting a
smaller MAXCONNECTS than before may cause open connections to get closed
unnecessarily.
Note that if you add this easy handle to a multi handle, this setting is not
being acknowledged, but you must instead use \fIcurl_multi_setopt(3)\fP and
the \fICURLMOPT_MAXCONNECTS\fP option.
.IP CURLOPT_CLOSEPOLICY
(Obsolete) This option does nothing.
.IP CURLOPT_FRESH_CONNECT
@@ -1356,12 +1370,14 @@ this to 1 to enable it. By default all transfers are done using the
cache. Note that while nothing ever should get hurt by attempting to reuse SSL
session-IDs, there seem to be broken SSL implementations in the wild that may
require you to disable this in order for you to succeed. (Added in 7.16.0)
.IP CURLOPT_KRB4LEVEL
Pass a char * as parameter. Set the krb4 security level, this also enables
krb4 awareness. This is a string, 'clear', 'safe', 'confidential' or
\&'private'. If the string is set but doesn't match one of these, 'private'
will be used. Set the string to NULL to disable kerberos4. The kerberos
support only works for FTP.
.IP CURLOPT_KRBLEVEL
Pass a char * as parameter. Set the kerberos security level for FTP; this
also enables kerberos awareness. This is a string, 'clear', 'safe',
'confidential' or \&'private'. If the string is set but doesn't match one
of these, 'private' will be used. Set the string to NULL to disable kerberos
support for FTP.
(This option was known as CURLOPT_KRB4LEVEL up to 7.16.3)
.SH SSH OPTIONS
.IP CURLOPT_SSH_AUTH_TYPES
Pass a long set to a bitmask consisting of one or more of
@@ -1387,6 +1403,17 @@ this curl handle use the data from the shared handle instead of keeping the
data to itself. This enables several curl handles to share data. If the curl
handles are used simultaneously, you \fBMUST\fP use the locking methods in the
share handle. See \fIcurl_share_setopt(3)\fP for details.
.IP CURLOPT_NEW_FILE_PERMS
Pass a long as a parameter, containing the value of the permissions that will
be assigned to newly created files on the remote server. The default value is
\fI0644\fP, but any valid value can be used. The only protocols that can use
this are \fIsftp://\fP, \fIscp://\fP and \fIfile://\fP. (Added in 7.16.4)
.IP CURLOPT_NEW_DIRECTORY_PERMS
Pass a long as a parameter, containing the value of the permissions that will
be assigned to newly created directories on the remote server. The default
value is \fI0755\fP, but any valid value can be used. The only protocols that
can use this are \fIsftp://\fP, \fIscp://\fP and \fIfile://\fP.
(Added in 7.16.4)
.SH TELNET OPTIONS
.IP CURLOPT_TELNETOPTIONS
Provide a pointer to a curl_slist with variables to pass to the telnet

View File

@@ -25,8 +25,8 @@ queue so calling this function again will not return the same message
again. It will instead return new messages at each new invoke until the queue
is emptied.
The data the returned pointer points to will not survive calling
\fIcurl_multi_cleanup(3)\fP, \fIcurl_multi_remove_handle(3)\fP or
\fBWARNING:\fP The data the returned pointer points to will not survive
calling \fIcurl_multi_cleanup(3)\fP, \fIcurl_multi_remove_handle(3)\fP or
\fIcurl_easy_cleanup(3)\fP.
The 'CURLMsg' struct is very simple and only contain very basic information.

View File

@@ -56,6 +56,22 @@ Pass a pointer to whatever you want passed to the
\fBcurl_multi_timer_callback\fP's third argument, the userp pointer. This is
not used by libcurl but only passed-thru as-is. Set the callback pointer with
\fICURLMOPT_TIMERFUNCTION\fP. (Added in 7.16.0)
.IP CURLMOPT_MAXCONNECTS
Pass a long. The set number will be used as the maximum amount of
simultaneously open connections that libcurl may cache. Default is 10, and
libcurl will enlarge the size for each added easy handle to make it fit 4
times the number of added easy handles.
By setting this option, you can prevent the cache size to grow beyond the
limit set by you.
When the cache is full, curl closes the oldest one in the cache to prevent the
number of open connections to increase.
This option is for the multi handle's use only, when using the easy interface
you should instead use the \fICURLOPT_MAXCONNECTS\fP option.
(Added in 7.16.3)
.SH RETURNS
The standard CURLMcode for multi interface error codes. Note that it returns a
CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl

View File

@@ -4,29 +4,40 @@
.SH NAME
curl_multi_socket \- reads/writes available data
.SH SYNOPSIS
.nf
#include <curl/curl.h>
CURLMcode curl_multi_socket_action(CURLM * multi_handle,
curl_socket_t sockfd, int ev_bitmask,
int *running_handles);
CURLMcode curl_multi_socket(CURLM * multi_handle, curl_socket_t sockfd,
int *running_handles);
CURLMcode curl_multi_socket_all(CURLM *multi_handle,
int *running_handles);
.fi
.SH DESCRIPTION
Alternative versions of \fIcurl_multi_perform(3)\fP that allows the
application to pass in one of the file descriptors/sockets that have been
detected to have \&"action" on them and let libcurl perform. This allows
libcurl to not have to scan through all possible file descriptors to check for
action. When the application has detected action on a socket handled by
libcurl, it should call \fIcurl_multi_socket(3)\fP with the \fBsockfd\fP
argument set to the socket with the action.
application to pass in the file descriptor/socket that has been detected to
have \&"action" on it and let libcurl perform. This allows libcurl to not have
to scan through all possible file descriptors to check for action. When the
application has detected action on a socket handled by libcurl, it should call
\fIcurl_multi_socket_action(3)\fP with the \fBsockfd\fP argument set to the
socket with the action. When the events on a socket are known, they can be
passed as an events bitmask \fBev_bitmask\fP by first setting \fBev_bitmask\fP
to 0, and then adding using bitwise OR (|) any combination of events to be
choosen from CURL_CSELECT_IN, CURL_CSELECT_OUT or CURL_CSELECT_ERR. When the
events on a socket are unknown, pass 0 instead, and libcurl will test the
descriptor internally.
At return, the int \fBrunning_handles\fP points to will contain the number of
still running easy handles within the multi handle. When this number reaches
zero, all transfers are complete/done. Note that when you call
\fIcurl_multi_socket(3)\fP on a specific socket and the counter decreases by
one, it DOES NOT necessarily mean that this exact socket/transfer is the one
that completed. Use \fIcurl_multi_info_read(3)\fP to figure out which easy
handle that completed.
\fIcurl_multi_socket_action(3)\fP on a specific socket and the counter
decreases by one, it DOES NOT necessarily mean that this exact socket/transfer
is the one that completed. Use \fIcurl_multi_info_read(3)\fP to figure out
which easy handle that completed.
The curl_multi_socket functions inform the application about updates in the
socket (file descriptor) status by doing none, one or multiple calls to the
@@ -44,6 +55,10 @@ wait for socket actions \- at most \- before doing the timeout action: call
the \fBcurl_multi_socket(3)\fP function with the \fBsockfd\fP argument set to
CURL_SOCKET_TIMEOUT.
Usage of \fIcurl_multi_socket(3)\fP is depricated, whereas the function is
equivalent to \fIcurl_multi_socket_action(3)\fP, when \fBev_bitmask\fP is set
to 0.
.SH "CALLBACK DETAILS"
The socket \fBcallback\fP function uses a prototype like this
@@ -115,12 +130,15 @@ callback is called.
7. Wait for action on any of libcurl's sockets
8, When action happens, call curl_multi_socket() for the socket(s) that got
8, When action happens, call curl_multi_socket_action() for the socket(s) that got
action.
9. Go back to step 6.
.SH AVAILABILITY
This function was added in libcurl 7.15.4, although not deemed stable yet.
This function was added in libcurl 7.15.4, although deemed stablesince 7.16.0.
\fIcurl_multi_socket(3)\fP is deprecated, use
\fIcurl_multi_socket_action(3)\fP instead!
.SH "SEE ALSO"
.BR curl_multi_cleanup "(3), " curl_multi_init "(3), "
.BR curl_multi_fdset "(3), " curl_multi_info_read "(3)"

View File

@@ -1,8 +1,27 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" $Id$
.\" **************************************************************************
.\" * _ _ ____ _
.\" * Project ___| | | | _ \| |
.\" * / __| | | | |_) | |
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2007, 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 libcurl-errors 3 "9 Feb 2005" "libcurl 7.13.1" "libcurl errors"
.TH libcurl-errors 3 "8 May 2007" "libcurl 7.16.3" "libcurl errors"
.SH NAME
libcurl-errors \- error codes in libcurl
.SH DESCRIPTION
@@ -86,9 +105,10 @@ An error occurred when writing received data to a local file, or an error was
returned to libcurl from a write callback.
.IP "CURLE_MALFORMAT_USER (24)"
This is never returned by current libcurl.
.IP "CURLE_FTP_COULDNT_STOR_FILE (25)"
FTP couldn't STOR file. The server denied the STOR operation. The error buffer
usually contains the server's explanation to this.
.IP "CURLE_UPLOAD_FAILED (25)"
Failed starting the upload. For FTP, the server typcially denied the STOR
command. The error buffer usually contains the server's explanation to this.
(This error code was formerly known as CURLE_FTP_COULDNT_STOR_FILE.)
.IP "CURLE_READ_ERROR (26)"
There was a problem reading a local file or an error returned by the read
callback.

View File

@@ -104,6 +104,12 @@ get more messages until the message queue is empty. The information you
receive there includes an easy handle pointer which you may use to identify
which easy handle the information regards.
When a single transfer is completed, the easy handle is still left added to
the multi stack. You need to first remove the easy handle with
\fIcurl_multi_remove_handle(3)\fP and then close it with
\fIcurl_easy_cleanup(3)\fP, or possibly set new options to it and add it again
with \fIcurl_multi_add_handle(3)\fP to start another transfer.
When all transfers in the multi stack are done, cleanup the multi handle with
\fIcurl_multi_cleanup(3)\fP. Be careful and please note that you \fBMUST\fP
invoke separate \fIcurl_easy_cleanup(3)\fP calls on every single easy handle
@@ -125,10 +131,13 @@ A few areas in the code are still using blocking code, even when used from the
multi interface. While we certainly want and intend for these to get fixed in
the future, you should be aware of the following current restrictions:
.nf
- Name resolves on non-windows unless c-ares is used
- GnuTLS SSL connections
- Active FTP connections
- HTTP proxy CONNECT operations
- SCP and SFTP connections
- SFTP transfers
- TFTP transfers
- file:// transfers
.fi

View File

@@ -151,7 +151,7 @@ extern "C" {
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
libc5-based Linux systems. Only include it on system that are known to
require it! */
#if defined(_AIX) || defined(NETWARE) || defined(__NetBSD__) || defined(__minix)
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || defined(__minix)
#include <sys/select.h>
#endif
@@ -210,9 +210,13 @@ typedef int (*curl_progress_callback)(void *clientp,
double ultotal,
double ulnow);
#ifndef CURL_MAX_WRITE_SIZE
/* Tests have proven that 20K is a very bad buffer size for uploads on
Windows, while 16K for some odd reason performed a lot better. */
Windows, while 16K for some odd reason performed a lot better.
We do the ifndef check to allow this value to easier be changed at build
time for those who feel adventurous. */
#define CURL_MAX_WRITE_SIZE 16384
#endif
typedef size_t (*curl_write_callback)(char *buffer,
size_t size,
@@ -327,7 +331,7 @@ typedef enum {
CURLE_HTTP_RETURNED_ERROR, /* 22 */
CURLE_WRITE_ERROR, /* 23 */
CURLE_MALFORMAT_USER, /* 24 - NOT USED */
CURLE_FTP_COULDNT_STOR_FILE, /* 25 - failed FTP upload */
CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
CURLE_READ_ERROR, /* 26 - could open/read from file */
CURLE_OUT_OF_MEMORY, /* 27 */
/* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
@@ -418,6 +422,7 @@ typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
/* backwards compatibility with older names */
#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
#endif
typedef enum {
@@ -731,10 +736,12 @@ typedef enum {
/* Set the interface string to use as outgoing network interface */
CINIT(INTERFACE, OBJECTPOINT, 62),
/* Set the krb4 security level, this also enables krb4 awareness. This is a
* string, 'clear', 'safe', 'confidential' or 'private'. If the string is
* set but doesn't match one of these, 'private' will be used. */
CINIT(KRB4LEVEL, OBJECTPOINT, 63),
/* Set the krb4/5 security level, this also enables krb4/5 awareness. This
* is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
* is set but doesn't match one of these, 'private' will be used. */
CINIT(KRBLEVEL, OBJECTPOINT, 63),
/* This is for compatibility with older curl releases */
#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
/* Set if we should verify the peer in ssl handshake, set 1 to verify. */
CINIT(SSL_VERIFYPEER, LONG, 64),
@@ -1071,6 +1078,11 @@ typedef enum {
CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
CINIT(HTTP_CONTENT_DECODING, LONG, 158),
/* Permission used when creating new files and directories on the remote
server for protocols that support it, SFTP/SCP/FILE */
CINIT(NEW_FILE_PERMS, LONG, 159),
CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;

View File

@@ -28,13 +28,13 @@
/* This is the version number of the libcurl package from which this header
file origins: */
#define LIBCURL_VERSION "7.16.2-CVS"
#define LIBCURL_VERSION "7.16.4-CVS"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 16
#define LIBCURL_VERSION_PATCH 2
#define LIBCURL_VERSION_PATCH 4
/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
@@ -51,7 +51,7 @@
and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work.
*/
#define LIBCURL_VERSION_NUM 0x071002
#define LIBCURL_VERSION_NUM 0x071004
/*
* This is the date and time when the full source package was created. The

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
@@ -224,6 +224,10 @@ CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
#define CURL_CSELECT_IN 0x01
#define CURL_CSELECT_OUT 0x02
#define CURL_CSELECT_ERR 0x04
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
int what, /* see above */
@@ -249,9 +253,21 @@ typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
int *running_handles);
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
curl_socket_t s,
int ev_bitmask,
int *running_handles);
CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
int *running_handles);
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
/* This macro below was added in 7.16.3 to push users who recompile to use
the new curl_multi_socket_action() instead of the old curl_multi_socket()
*/
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
#endif
/*
* Name: curl_multi_timeout()
*
@@ -293,6 +309,9 @@ typedef enum {
/* This is the argument passed to the timer callback */
CINIT(TIMERDATA, OBJECTPOINT, 5),
/* maximum number of entries in the connection cache */
CINIT(MAXCONNECTS, LONG, 6),
CURLMOPT_LASTENTRY /* the last unused */
} CURLMoption;

View File

@@ -4,6 +4,7 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \
ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c \
netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c \
krb5.c \
memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c multi.c \
content_encoding.c share.c http_digest.c md5.c http_negotiate.c \
http_ntlm.c inet_pton.c strtoofft.c strerror.c hostares.c hostasyn.c \

View File

@@ -19,6 +19,8 @@ ifndef ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.3
endif
ARES_LIB = ../ares
CC = gcc
AR = ar
RM = rm -f
@@ -30,6 +32,11 @@ STRIP = strip -g
INCLUDES = -I. -I../include
CFLAGS = -g -O2 -DBUILDING_LIBCURL -DHAVE_LONGLONG
ifdef ARES
INCLUDES += -I$(ARES_LIB)
CFLAGS += -DUSE_ARES
DLL_LIBS += -L$(ARES_LIB) -lcares
endif
ifdef SSH2
INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H

View File

@@ -25,7 +25,7 @@ endif
# Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-0.14
LIBSSH2_PATH = ../../libssh2-0.15
endif
ifndef INSTDIR
@@ -36,7 +36,7 @@ endif
TARGET = libcurl
VERSION = $(LIBCURL_VERSION)
COPYR = Copyright (C) 1996 - 2007, Daniel Stenberg, <daniel@haxx.se>
DESCR = cURL libcurl $(LIBCURL_VERSION_STR) - http://curl.haxx.se
DESCR = cURL libcurl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - http://curl.haxx.se
MTSAFE = YES
STACK = 64000
SCREEN = none
@@ -47,10 +47,10 @@ ifndef LIBARCH
LIBARCH = LIBC
endif
# must be equal to DEBUG or NDEBUG
# must be equal to NDEBUG or DEBUG, CURLDEBUG
ifndef DB
DB = NDEBUG
# DB = DEBUG
# DB = CURLDEBUG
endif
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
OPT = -O2
@@ -60,15 +60,19 @@ else
OBJDIR = debug
endif
# Include the version info retrieved from curlver.h
-include $(OBJDIR)/version.inc
# The following line defines your compiler.
# The following lines defines your compiler.
ifdef CWFolder
METROWERKS = $(CWFolder)
endif
ifdef METROWERKS
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
CC = mwccnlm
else
CC = gcc
endif
# a native win32 awk can be downloaded from here:
# http://www.gknw.net/development/prgtools/awk-20050424.zip
AWK = awk
YACC = bison -y
CP = cp -afv
@@ -78,6 +82,12 @@ CP = cp -afv
# http://www.gknw.net/development/prgtools/mkxdc.zip
MPKXDC = mkxdc
# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH))
# Include the version info retrieved from curlver.h
-include $(OBJDIR)/version.inc
# Global flags for all compilers
CFLAGS = $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
@@ -85,8 +95,9 @@ ifeq ($(CC),mwccnlm)
LD = mwldnlm
LDFLAGS = -nostdlib $(PRELUDE) $(OBJL) -o $@ -commandfile
AR = mwldnlm
ARFLAGS = -type library -w nocmdline $(OBJS) -o
ARFLAGS = -nostdlib -type library -o
LIBEXT = lib
#RANLIB =
CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586
CFLAGS += -relax_pointers
#CFLAGS += -w on
@@ -94,8 +105,10 @@ ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
CFLAGS += -align 4
else
PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
# PRELUDE = $(SDK_CLIB)/imports/clibpre.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
CFLAGS += -align 1
endif
else
@@ -104,12 +117,16 @@ LDFLAGS = -T
AR = ar
ARFLAGS = -cq
LIBEXT = a
RANLIB = ranlib
CFLAGS += -fno-builtin -fpcc-struct-return -fno-strict-aliasing
CFLAGS += -Wall # -pedantic
ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
else
PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
# PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
PRELUDE = $(NDK_ROOT)/pre/prelude.o
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
endif
endif
@@ -126,15 +143,15 @@ INCLUDES = -I$(CURL_INC) -I$(CURL_LIB)
ifdef WITH_ARES
INCLUDES += -I$(ARES_LIB)
LDLIBS = $(ARES_LIB)/libcares.$(LIBEXT)
LDLIBS += $(ARES_LIB)/libcares.$(LIBEXT)
endif
ifdef WITH_ZLIB
INCLUDES += -I$(ZLIB_PATH)
ifdef LINK_STATIC
LDLIBS += $(ZLIB_PATH)/nw/libz.$(LIBEXT)
LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT)
else
MODULES += libz.nlm
IMPORTS += @$(ZLIB_PATH)/nw/libz.imp
IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp
endif
endif
ifdef WITH_SSH2
@@ -147,23 +164,25 @@ else
endif
endif
ifdef WITH_SSL
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_libc -I$(OPENSSL_PATH)/outinc_nw_libc/openssl
LDLIBS += $(OPENSSL_PATH)/out_nw_libc/ssl.$(LIBEXT)
LDLIBS += $(OPENSSL_PATH)/out_nw_libc/crypto.$(LIBEXT)
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT)
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
IMPORTS += GetProcessSwitchCount RunningProcess
endif
ifeq ($(LIBARCH),LIBC)
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
INCLUDES += -I$(SDK_LIBC)/include
# INCLUDES += -I$(SDK_LIBC)/include/nks
# INCLUDES += -I$(SDK_LIBC)/include/winsock
# INCLUDES += -I$(SDK_LDAP)/libc/inc
CFLAGS += -D_POSIX_SOURCE
# CFLAGS += -D__ANSIC__
else
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
INCLUDES += -I$(SDK_CLIB)/include/nlm
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
# INCLUDES += -I$(SDK_CLIB)/include
# INCLUDES += -I$(SDK_LDAP)/clib/inc
CFLAGS += -DNETDB_USE_INTERNET
# for now disable LDAP unless we have coded a CLIB dynaloader.
DISABLE_LDAP = 1
endif
CFLAGS += $(INCLUDES)
@@ -240,6 +259,9 @@ $(TARGET).$(LIBEXT): $(OBJS)
@echo Creating $@
@-$(RM) $@
@$(AR) $(ARFLAGS) $@ $^
ifdef RANLIB
@$(RANLIB) $@
endif
$(TARGET).nlm: $(OBJDIR)/$(TARGET).def $(OBJL) $(XDCDATA)
@echo Linking $@
@@ -269,13 +291,14 @@ ifdef SCREEN
else
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
endif
ifeq ($(DB),DEBUG)
ifneq ($(DB),NDEBUG)
@echo $(DL)debug$(DL) >> $@
endif
@echo $(DL)threadname "$(TARGET)"$(DL) >> $@
ifdef XDCDATA
@echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
endif
@echo $(DL)flag_on 64$(DL) >> $@
ifeq ($(LIBARCH),CLIB)
@echo $(DL)start _Prelude$(DL) >> $@
@echo $(DL)exit _Stop$(DL) >> $@
@@ -288,7 +311,6 @@ ifeq ($(LIBARCH),CLIB)
# @echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
@echo $(DL)module clib$(DL) >> $@
else
@echo $(DL)flag_on 64$(DL) >> $@
@echo $(DL)pseudopreemption$(DL) >> $@
@echo $(DL)start _LibCPrelude$(DL) >> $@
@echo $(DL)exit _LibCPostlude$(DL) >> $@
@@ -327,24 +349,78 @@ config.h: Makefile.netware
@echo $(DL)#ifndef NETWARE$(DL) >> $@
@echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
@echo $(DL)#endif$(DL) >> $@
@echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@
@echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@
@echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
ifeq ($(LIBARCH),CLIB)
@echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@
@echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@
@echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define socklen_t int$(DL) >> $@
@echo $(DL)#define DL_LDAP_FILE "ldapsdk.nlm"$(DL) >> $@
else
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
@echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
@echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@
ifdef ENABLE_IPV6
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
endif
endif
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
@echo $(DL)#define HAVE_LL 1$(DL) >> $@
@echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_RECV 1$(DL) >> $@
@echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
@@ -354,52 +430,28 @@ config.h: Makefile.netware
@echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
ifdef DISABLE_LDAP
@echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@
else
@echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@
endif
ifdef ENABLE_IPV6
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
endif
ifdef NW_WINSOCK
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
@@ -458,6 +510,7 @@ endif
info: $(OBJDIR)/version.inc
@echo Configured to build $(TARGET) with these options:
@echo libarchitecture: $(LIBARCH)
@echo curl version: $(LIBCURL_VERSION_STR)
@echo compiler/linker: $(CC) / $(LD)
ifdef CABUNDLE
@@ -489,7 +542,7 @@ else
@echo ipv6 support: no
endif
$(LIBCARES):
$(ARES_LIB)/libcares.$(LIBEXT):
$(MAKE) -C $(ARES_LIB) -f Makefile.netware lib

View File

@@ -12,8 +12,7 @@ c-ares:
http://daniel.haxx.se/projects/c-ares/
NOTE
The latest libcurl version requires c-ares 1.3.2 or later to work
flawlessly.
The latest libcurl version requires c-ares 1.4.0 or later.
Once upon the time libcurl built fine with the "original" ares. That is no
longer true. You need to use c-ares.

View File

@@ -59,7 +59,7 @@ static void decodeQuantum(unsigned char *dest, const char *src)
char *found;
for(i = 0; i < 4; i++) {
if((found = strchr(table64, src[i])))
if((found = strchr(table64, src[i])) != NULL)
x = (x << 6) + (unsigned int)(found - table64);
else if(src[i] == '=')
x = (x << 6);
@@ -252,7 +252,7 @@ size_t Curl_base64_encode(struct SessionHandle *data,
#define TEST_NEED_SUCK
void *suck(int *);
int main(int argc, char **argv, char **envp)
int main(int argc, argv_item_t argv[], char **envp)
{
char *base64;
size_t base64Len;
@@ -293,7 +293,7 @@ int main(int argc, char **argv, char **envp)
#define TEST_NEED_SUCK
void *suck(int *);
int main(int argc, char **argv, char **envp)
int main(int argc, argv_item_t argv[], char **envp)
{
char *base64;
int base64Len;

View File

@@ -59,10 +59,13 @@
#include <stdlib.h> /* required for free() prototype, without it, this crashes */
#endif /* on macos 68K */
#if (defined(HAVE_FIONBIO) && defined(__NOVELL_LIBC__))
#if (defined(HAVE_FIONBIO) && defined(NETWARE))
#include <sys/filio.h>
#endif
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#ifdef NETWARE
#ifndef __NOVELL_LIBC__
NETDB_DEFINE_CONTEXT
#endif
#undef in_addr_t
#define in_addr_t unsigned long
#endif
@@ -206,7 +209,7 @@ int waitconnect(curl_socket_t sockfd, /* socket */
/* timeout, no connect today */
return WAITCONN_TIMEOUT;
if(rc & CSELECT_ERR)
if(rc & CURL_CSELECT_ERR)
/* error condition caught */
return WAITCONN_FDSET_ERROR;
@@ -432,16 +435,15 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
#endif
if( -1 == getsockopt(sockfd, SOL_SOCKET, SO_ERROR,
(void *)&err, &errSize))
if (0 != getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize))
err = SOCKERRNO;
#ifdef _WIN32_WCE
/* Always returns this error, bug in CE? */
if(WSAENOPROTOOPT==err)
err=0;
/* Old WinCE versions don't support SO_ERROR */
if (WSAENOPROTOOPT == err) {
SET_SOCKERRNO(0);
err = 0;
}
#endif
if ((0 == err) || (EISCONN == err))
/* we are connected, awesome! */
rc = TRUE;
@@ -782,6 +784,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
int num_addr;
Curl_addrinfo *ai;
Curl_addrinfo *curr_addr;
int timeout_set = 0;
struct timeval after;
struct timeval before = Curl_tvnow();
@@ -789,36 +792,39 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
/*************************************************************
* Figure out what maximum time we have left
*************************************************************/
long timeout_ms= DEFAULT_CONNECT_TIMEOUT;
long timeout_ms;
long timeout_per_addr;
*connected = FALSE; /* default to not connected */
if(data->set.timeout || data->set.connecttimeout) {
long has_passed;
/* if a timeout is set, use the most restrictive one */
/* Evaluate in milliseconds how much time that has passed */
has_passed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle);
if (data->set.timeout > 0)
timeout_set += 1;
if (data->set.connecttimeout > 0)
timeout_set += 2;
#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
/* get the most strict timeout of the ones converted to milliseconds */
if(data->set.timeout && data->set.connecttimeout) {
if (data->set.timeout < data->set.connecttimeout)
timeout_ms = data->set.timeout;
else
timeout_ms = data->set.connecttimeout;
}
else if(data->set.timeout)
switch (timeout_set) {
case 1:
timeout_ms = data->set.timeout;
break;
case 2:
timeout_ms = data->set.connecttimeout;
break;
case 3:
if (data->set.timeout < data->set.connecttimeout)
timeout_ms = data->set.timeout;
else
timeout_ms = data->set.connecttimeout;
break;
default:
timeout_ms = DEFAULT_CONNECT_TIMEOUT;
break;
}
/* subtract the passed time */
timeout_ms -= has_passed;
if (timeout_set > 0) {
/* if a timeout was already set, substract elapsed time */
timeout_ms -= Curl_tvdiff(before, data->progress.t_startsingle);
if(timeout_ms < 0) {
/* a precaution, no need to continue if time already is up */
failf(data, "Connection time-out");

View File

@@ -420,11 +420,14 @@ CURLcode curl_easy_perform(CURL *easy)
timeout.tv_sec = 1;
timeout.tv_usec = 0;
/* get file descriptors from the transfers */
/* Old deprecated style: get file descriptors from the transfers */
curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
rc = Curl_select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
/* The way is to extract the sockets and wait for them without using
select. This whole alternative version should probably rather use the
curl_multi_socket() approach. */
if(rc == -1)
/* select error */
break;
@@ -511,6 +514,10 @@ void Curl_easy_addmulti(struct SessionHandle *data,
void *multi)
{
data->multi = multi;
if (multi == NULL)
/* the association is cleared, mark the easy handle as not used by an
interface */
data->state.used_interface = Curl_if_none;
}
void Curl_easy_initHandleData(struct SessionHandle *data)
@@ -636,8 +643,8 @@ CURL *curl_easy_duphandle(CURL *incurl)
if(fail) {
if(outcurl) {
if((outcurl->state.connc->type == CONNCACHE_PRIVATE) &&
outcurl->state.connc)
if(outcurl->state.connc &&
(outcurl->state.connc->type == CONNCACHE_PRIVATE))
Curl_rm_connc(outcurl->state.connc);
if(outcurl->state.headerbuff)
free(outcurl->state.headerbuff);
@@ -724,6 +731,8 @@ void curl_easy_reset(CURL *curl)
data->set.ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth
type */
data->set.new_file_perms = 0644; /* Default permissions */
data->set.new_directory_perms = 0755; /* Default permissions */
}
#ifdef CURL_DOES_CONVERSIONS

View File

@@ -198,6 +198,8 @@ static CURLcode file_upload(struct connectdata *conn)
size_t nwrite;
curl_off_t bytecount = 0;
struct timeval now = Curl_tvnow();
struct_stat file_stat;
char* buf2;
/*
* Since FILE: doesn't do the full init, we need to provide some extra
@@ -213,7 +215,25 @@ static CURLcode file_upload(struct connectdata *conn)
if(!dir[1])
return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */
fp = fopen(file->path, "wb");
if(data->reqdata.resume_from)
fp = fopen( file->path, "ab" );
else {
int fd;
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,
conn->data->set.new_file_perms);
#else /* !(WIN32 || MSDOS || __EMX__) */
fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC,
conn->data->set.new_file_perms);
#endif /* !(WIN32 || MSDOS || __EMX__) */
if (fd < 0) {
failf(data, "Can't open %s for writing", file->path);
return CURLE_WRITE_ERROR;
}
fp = fdopen(fd, "wb");
}
if(!fp) {
failf(data, "Can't open %s for writing", file->path);
return CURLE_WRITE_ERROR;
@@ -223,6 +243,17 @@ static CURLcode file_upload(struct connectdata *conn)
/* known size of data to "upload" */
Curl_pgrsSetUploadSize(data, data->set.infilesize);
/* treat the negative resume offset value as the case of "-" */
if(data->reqdata.resume_from < 0){
if(stat(file->path, &file_stat)){
fclose(fp);
failf(data, "Can't get the size of %s", file->path);
return CURLE_WRITE_ERROR;
}
else
data->reqdata.resume_from = (curl_off_t)file_stat.st_size;
}
while (res == CURLE_OK) {
int readcount;
res = Curl_fillreadbuffer(conn, BUFSIZE, &readcount);
@@ -234,8 +265,24 @@ static CURLcode file_upload(struct connectdata *conn)
nread = (size_t)readcount;
/*skip bytes before resume point*/
if(data->reqdata.resume_from) {
if( (curl_off_t)nread <= data->reqdata.resume_from ) {
data->reqdata.resume_from -= nread;
nread = 0;
buf2 = buf;
}
else {
buf2 = buf + data->reqdata.resume_from;
nread -= data->reqdata.resume_from;
data->reqdata.resume_from = 0;
}
}
else
buf2 = buf;
/* write the data to the target */
nwrite = fwrite(buf, 1, nread, fp);
nwrite = fwrite(buf2, 1, nread, fp);
if(nwrite != nread) {
res = CURLE_SEND_ERROR;
break;

299
lib/ftp.c
View File

@@ -75,7 +75,7 @@
#include "socks.h"
#include "ftp.h"
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
#include "krb4.h"
#endif
@@ -184,27 +184,46 @@ static bool isBadFtpString(const char *string)
*/
static CURLcode AllowServerConnect(struct connectdata *conn)
{
int timeout_ms;
long timeout_ms;
struct SessionHandle *data = conn->data;
curl_socket_t sock = conn->sock[SECONDARYSOCKET];
struct timeval now = Curl_tvnow();
long timespent = Curl_tvdiff(Curl_tvnow(), now);
long timeout = data->set.connecttimeout?data->set.connecttimeout:
(data->set.timeout?data->set.timeout: 0);
int timeout_set = 0;
if(timeout) {
timeout -= timespent;
if(timeout<=0) {
/* if a timeout is set, use the most restrictive one */
if (data->set.timeout > 0)
timeout_set += 1;
if (data->set.connecttimeout > 0)
timeout_set += 2;
switch (timeout_set) {
case 1:
timeout_ms = data->set.timeout;
break;
case 2:
timeout_ms = data->set.connecttimeout;
break;
case 3:
if (data->set.timeout < data->set.connecttimeout)
timeout_ms = data->set.timeout;
else
timeout_ms = data->set.connecttimeout;
break;
default:
timeout_ms = 60000; /* 60 seconds default timeout */
break;
}
if (timeout_set > 0) {
/* if a timeout was already set, substract elapsed time */
timeout_ms -= Curl_tvdiff(Curl_tvnow(), conn->now);
if(timeout_ms < 0) {
failf(data, "Timed out before server could connect to us");
return CURLE_OPERATION_TIMEDOUT;
}
}
/* We allow the server 60 seconds to connect to us, or a custom timeout.
Note the typecast here. */
timeout_ms = (timeout?(int)timeout:60000);
switch (Curl_socket_ready(sock, CURL_SOCKET_BAD, timeout_ms)) {
switch (Curl_socket_ready(sock, CURL_SOCKET_BAD, (int)timeout_ms)) {
case -1: /* error */
/* let's die here */
failf(data, "Error while waiting for server connect");
@@ -300,8 +319,17 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
ftpc->cache_size = 0; /* zero the size just in case */
}
else {
int res = Curl_read(conn, sockfd, ptr, BUFSIZE-ftpc->nread_resp,
&gotbytes);
int res;
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
enum protection_level prot = conn->data_prot;
conn->data_prot = 0;
#endif
res = Curl_read(conn, sockfd, ptr, BUFSIZE-ftpc->nread_resp,
&gotbytes);
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = prot;
#endif
if(res < 0)
/* EWOULDBLOCK */
return CURLE_OK; /* return */
@@ -341,6 +369,9 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
the line isn't really terminated until the LF comes */
/* output debug output if that is requested */
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
if(!conn->sec_complete)
#endif
if(data->set.verbose)
Curl_debug(data, CURLINFO_HEADER_IN,
ftpc->linestart_resp, (size_t)perline, conn);
@@ -395,18 +426,18 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
if(!result)
code = atoi(buf);
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
/* handle the security-oriented responses 6xx ***/
/* FIXME: some errorchecking perhaps... ***/
switch(code) {
case 631:
Curl_sec_read_msg(conn, buf, prot_safe);
code = Curl_sec_read_msg(conn, buf, prot_safe);
break;
case 632:
Curl_sec_read_msg(conn, buf, prot_private);
code = Curl_sec_read_msg(conn, buf, prot_private);
break;
case 633:
Curl_sec_read_msg(conn, buf, prot_confidential);
code = Curl_sec_read_msg(conn, buf, prot_confidential);
break;
default:
/* normal ftp stuff we pass through! */
@@ -534,7 +565,17 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
ftpc->cache_size = 0; /* zero the size just in case */
}
else {
int res = Curl_read(conn, sockfd, ptr, BUFSIZE-*nreadp, &gotbytes);
int res;
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
enum protection_level prot = conn->data_prot;
conn->data_prot = 0;
#endif
res = Curl_read(conn, sockfd, ptr, BUFSIZE-*nreadp,
&gotbytes);
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = prot;
#endif
if(res < 0)
/* EWOULDBLOCK */
continue; /* go looping again */
@@ -574,6 +615,9 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
the line isn't really terminated until the LF comes */
/* output debug output if that is requested */
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
if(!conn->sec_complete)
#endif
if(data->set.verbose)
Curl_debug(data, CURLINFO_HEADER_IN,
line_start, (size_t)perline, conn);
@@ -627,18 +671,18 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
if(!result)
code = atoi(buf);
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
/* handle the security-oriented responses 6xx ***/
/* FIXME: some errorchecking perhaps... ***/
switch(code) {
case 631:
Curl_sec_read_msg(conn, buf, prot_safe);
code = Curl_sec_read_msg(conn, buf, prot_safe);
break;
case 632:
Curl_sec_read_msg(conn, buf, prot_private);
code = Curl_sec_read_msg(conn, buf, prot_private);
break;
case 633:
Curl_sec_read_msg(conn, buf, prot_confidential);
code = Curl_sec_read_msg(conn, buf, prot_confidential);
break;
default:
/* normal ftp stuff we pass through! */
@@ -1234,9 +1278,8 @@ static CURLcode ftp_state_post_rest(struct connectdata *conn)
struct FTP *ftp = conn->data->reqdata.proto.ftp;
struct SessionHandle *data = conn->data;
if(ftp->no_transfer || conn->bits.no_body) {
if(ftp->no_transfer) {
/* doesn't transfer any data */
ftp->no_transfer = TRUE;
/* still possibly do PRE QUOTE jobs */
state(conn, FTP_RETR_PREQUOTE);
@@ -1592,7 +1635,9 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
if(ptr) {
newport = (unsigned short)(num & 0xffff);
if (conn->bits.tunnel_proxy)
if (conn->bits.tunnel_proxy ||
data->set.proxytype == CURLPROXY_SOCKS5 ||
data->set.proxytype == CURLPROXY_SOCKS4)
/* proxy tunnel -> use other host info because ip_addr_str is the
proxy address not the ftp host */
snprintf(newhost, sizeof(newhost), "%s", conn->host.name);
@@ -1644,7 +1689,9 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
infof(data, "Skips %d.%d.%d.%d for data connection, uses %s instead\n",
ip[0], ip[1], ip[2], ip[3],
conn->ip_addr_str);
if (conn->bits.tunnel_proxy)
if (conn->bits.tunnel_proxy ||
data->set.proxytype == CURLPROXY_SOCKS5 ||
data->set.proxytype == CURLPROXY_SOCKS4)
/* proxy tunnel -> use other host info because ip_addr_str is the
proxy address not the ftp host */
snprintf(newhost, sizeof(newhost), "%s", conn->host.name);
@@ -2277,14 +2324,7 @@ static CURLcode ftp_state_loggedin(struct connectdata *conn)
CURLcode result = CURLE_OK;
#ifdef HAVE_KRB4
if(conn->data->set.krb4) {
/* We are logged in, asked to use Kerberos. Set the requested
* protection level
*/
if(conn->sec_complete)
/* BLOCKING */
Curl_sec_set_protection_level(conn);
if(conn->data->set.krb) {
/* We may need to issue a KAUTH here to have access to the files
* do it if user supplied a password
*/
@@ -2331,7 +2371,8 @@ static CURLcode ftp_state_user_resp(struct connectdata *conn,
struct ftp_conn *ftpc = &conn->proto.ftpc;
(void)instate; /* no use for this yet */
if((ftpcode == 331) && (ftpc->state == FTP_USER)) {
/* some need password anyway, and others just return 2xx ignored */
if((ftpcode == 331 || ftpcode/100 == 2) && (ftpc->state == FTP_USER)) {
/* 331 Password required for ...
(the server requires to send the user's password too) */
NBFTPSENDF(conn, "PASS %s", ftp->passwd?ftp->passwd:"");
@@ -2439,15 +2480,15 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
}
/* We have received a 220 response fine, now we proceed. */
#ifdef HAVE_KRB4
if(data->set.krb4) {
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
if(data->set.krb) {
/* If not anonymous login, try a secure login. Note that this
procedure is still BLOCKING. */
Curl_sec_request_prot(conn, "private");
/* We set private first as default, in case the line below fails to
set a valid level */
Curl_sec_request_prot(conn, data->set.krb4_level);
Curl_sec_request_prot(conn, data->set.krb_level);
if(Curl_sec_login(conn) != 0)
infof(data, "Logging in with password in cleartext!\n");
@@ -2996,8 +3037,6 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature
int ftpcode;
CURLcode result=CURLE_OK;
bool was_ctl_valid = ftpc->ctl_valid;
size_t flen;
size_t dlen;
char *path;
char *path_to_use = data->reqdata.path;
struct Curl_transfer_keeper *k = &data->reqdata.keep;
@@ -3043,26 +3082,30 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature
/* get the "raw" path */
path = curl_easy_unescape(data, path_to_use, 0, NULL);
if(!path)
return CURLE_OUT_OF_MEMORY;
flen = ftp->file?strlen(ftp->file):0; /* file is "raw" already */
dlen = strlen(path)-flen;
if(dlen && !ftpc->cwdfail) {
ftpc->prevpath = path;
if(flen)
/* if 'path' is not the whole string */
ftpc->prevpath[dlen]=0; /* terminate */
infof(data, "Remembering we are in dir %s\n", ftpc->prevpath);
}
else {
if(!path) {
/* out of memory, but we can limp along anyway (and should try to
* since we're in the out of memory cleanup path) */
ftpc->prevpath = NULL; /* no path */
free(path);
} else {
size_t flen = ftp->file?strlen(ftp->file):0; /* file is "raw" already */
size_t dlen = strlen(path)-flen;
if(dlen && !ftpc->cwdfail) {
ftpc->prevpath = path;
if(flen)
/* if 'path' is not the whole string */
ftpc->prevpath[dlen]=0; /* terminate */
infof(data, "Remembering we are in dir %s\n", ftpc->prevpath);
}
else {
ftpc->prevpath = NULL; /* no path */
free(path);
}
}
/* free the dir tree and file parts */
freedirs(conn);
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
Curl_sec_fflush_fd(conn, conn->sock[SECONDARYSOCKET]);
#endif
@@ -3330,7 +3373,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
DEBUGF(infof(data, "DO-MORE phase starts\n"));
if(!ftp->no_transfer && !conn->bits.no_body) {
if(!ftp->no_transfer) {
/* a transfer is about to take place */
if(data->set.upload) {
@@ -3394,6 +3437,13 @@ CURLcode ftp_perform(struct connectdata *conn,
DEBUGF(infof(conn->data, "DO phase starts\n"));
if(conn->bits.no_body) {
/* requested no body means no transfer... */
struct FTP *ftp = conn->data->reqdata.proto.ftp;
ftp->no_transfer = TRUE;
}
*dophase_done = FALSE; /* not done yet */
/* start the first command in the DO phase */
@@ -3465,16 +3515,21 @@ CURLcode Curl_nbftpsendf(struct connectdata *conn,
const char *fmt, ...)
{
ssize_t bytes_written;
char s[256];
/* may still not be big enough for some krb5 tokens */
#define SBUF_SIZE 1024
char s[SBUF_SIZE];
size_t write_len;
char *sptr=s;
CURLcode res = CURLE_OK;
struct SessionHandle *data = conn->data;
struct ftp_conn *ftpc = &conn->proto.ftpc;
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
enum protection_level data_sec = conn->data_prot;
#endif
va_list ap;
va_start(ap, fmt);
vsnprintf(s, 250, fmt, ap);
vsnprintf(s, SBUF_SIZE-3, fmt, ap);
va_end(ap);
strcat(s, "\r\n"); /* append a trailing CRLF */
@@ -3492,8 +3547,14 @@ CURLcode Curl_nbftpsendf(struct connectdata *conn,
}
#endif /* CURL_DOES_CONVERSIONS */
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = prot_cmd;
#endif
res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len,
&bytes_written);
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = data_sec;
#endif
if(CURLE_OK != res)
return res;
@@ -3526,14 +3587,17 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
const char *fmt, ...)
{
ssize_t bytes_written;
char s[256];
char s[SBUF_SIZE];
size_t write_len;
char *sptr=s;
CURLcode res = CURLE_OK;
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
enum protection_level data_sec = conn->data_prot;
#endif
va_list ap;
va_start(ap, fmt);
vsnprintf(s, 250, fmt, ap);
vsnprintf(s, SBUF_SIZE-3, fmt, ap);
va_end(ap);
strcat(s, "\r\n"); /* append a trailing CRLF */
@@ -3550,8 +3614,14 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
#endif /* CURL_DOES_CONVERSIONS */
while(1) {
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = prot_cmd;
#endif
res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len,
&bytes_written);
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = data_sec;
#endif
if(CURLE_OK != res)
break;
@@ -3670,9 +3740,14 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
case FTPFILE_SINGLECWD:
/* get the last slash */
if(!path_to_use[0]) {
/* no dir, no file */
ftpc->dirdepth = 0;
ftp->file = NULL;
break;
}
slash_pos=strrchr(cur_pos, '/');
if(slash_pos || !*cur_pos) {
ftpc->dirdepth = 1; /* we consider it to be a single dir */
ftpc->dirs = (char **)calloc(1, sizeof(ftpc->dirs[0]));
if(!ftpc->dirs)
return CURLE_OUT_OF_MEMORY;
@@ -3681,9 +3756,10 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
slash_pos?(int)(slash_pos-cur_pos):1,
NULL);
if(!ftpc->dirs[0]) {
free(ftpc->dirs);
freedirs(conn);
return CURLE_OUT_OF_MEMORY;
}
ftpc->dirdepth = 1; /* we consider it to be a single dir */
ftp->file = slash_pos ? slash_pos+1 : cur_pos; /* rest is file name */
}
else
@@ -3698,55 +3774,61 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
if(!ftpc->dirs)
return CURLE_OUT_OF_MEMORY;
/* parse the URL path into separate path components */
while ((slash_pos = strchr(cur_pos, '/')) != NULL) {
/* 1 or 0 to indicate absolute directory */
bool absolute_dir = (bool)((cur_pos - data->reqdata.path > 0) &&
(ftpc->dirdepth == 0));
/* we have a special case for listing the root dir only */
if(strequal(path_to_use, "/")) {
cur_pos++; /* make it point to the zero byte */
ftpc->dirs[0] = strdup("/");
ftpc->dirdepth++;
}
else {
/* parse the URL path into separate path components */
while ((slash_pos = strchr(cur_pos, '/')) != NULL) {
/* 1 or 0 to indicate absolute directory */
bool absolute_dir = (bool)((cur_pos - data->reqdata.path > 0) &&
(ftpc->dirdepth == 0));
/* seek out the next path component */
if (slash_pos-cur_pos) {
/* we skip empty path components, like "x//y" since the FTP command
CWD requires a parameter and a non-existant parameter a) doesn't
work on many servers and b) has no effect on the others. */
int len = (int)(slash_pos - cur_pos + absolute_dir);
ftpc->dirs[ftpc->dirdepth] = curl_easy_unescape(conn->data,
cur_pos - absolute_dir,
len, NULL);
if (!ftpc->dirs[ftpc->dirdepth]) { /* run out of memory ... */
failf(data, "no memory");
freedirs(conn);
return CURLE_OUT_OF_MEMORY;
/* seek out the next path component */
if (slash_pos-cur_pos) {
/* we skip empty path components, like "x//y" since the FTP command
CWD requires a parameter and a non-existant parameter a) doesn't
work on many servers and b) has no effect on the others. */
int len = (int)(slash_pos - cur_pos + absolute_dir);
ftpc->dirs[ftpc->dirdepth] =
curl_easy_unescape(conn->data, cur_pos - absolute_dir, len, NULL);
if (!ftpc->dirs[ftpc->dirdepth]) { /* run out of memory ... */
failf(data, "no memory");
freedirs(conn);
return CURLE_OUT_OF_MEMORY;
}
if (isBadFtpString(ftpc->dirs[ftpc->dirdepth])) {
free(ftpc->dirs[ftpc->dirdepth]);
freedirs(conn);
return CURLE_URL_MALFORMAT;
}
}
if (isBadFtpString(ftpc->dirs[ftpc->dirdepth])) {
free(ftpc->dirs[ftpc->dirdepth]);
freedirs(conn);
return CURLE_URL_MALFORMAT;
else {
cur_pos = slash_pos + 1; /* jump to the rest of the string */
continue;
}
}
else {
cur_pos = slash_pos + 1; /* jump to the rest of the string */
continue;
}
cur_pos = slash_pos + 1; /* jump to the rest of the string */
if(++ftpc->dirdepth >= ftpc->diralloc) {
/* enlarge array */
char *bigger;
ftpc->diralloc *= 2; /* double the size each time */
bigger = realloc(ftpc->dirs, ftpc->diralloc * sizeof(ftpc->dirs[0]));
if(!bigger) {
freedirs(conn);
return CURLE_OUT_OF_MEMORY;
}
ftpc->dirs = (char **)bigger;
if(++ftpc->dirdepth >= ftpc->diralloc) {
/* enlarge array */
char *bigger;
ftpc->diralloc *= 2; /* double the size each time */
bigger = realloc(ftpc->dirs, ftpc->diralloc * sizeof(ftpc->dirs[0]));
if(!bigger) {
freedirs(conn);
return CURLE_OUT_OF_MEMORY;
}
ftpc->dirs = (char **)bigger;
}
}
}
ftp->file = cur_pos; /* the rest is the file name */
}
if(*ftp->file) {
if(ftp->file && *ftp->file) {
ftp->file = curl_easy_unescape(conn->data, ftp->file, 0, NULL);
if(NULL == ftp->file) {
freedirs(conn);
@@ -3762,8 +3844,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
ftp->file=NULL; /* instead of point to a zero byte, we make it a NULL
pointer */
if(data->set.upload && !ftp->file &&
(!ftp->no_transfer || conn->bits.no_body)) {
if(data->set.upload && !ftp->file && !ftp->no_transfer) {
/* We need a file name when uploading. Return error! */
failf(data, "Uploading to a URL without a file name!");
return CURLE_URL_MALFORMAT;
@@ -3775,8 +3856,10 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
/* prevpath is "raw" so we convert the input path before we compare the
strings */
char *path = curl_easy_unescape(conn->data, data->reqdata.path, 0, NULL);
if(!path)
if(!path) {
freedirs(conn);
return CURLE_OUT_OF_MEMORY;
}
dlen = strlen(path) - (ftp->file?strlen(ftp->file):0);
if((dlen == strlen(ftpc->prevpath)) &&

View File

@@ -63,7 +63,7 @@ static void tls_log_func(int level, const char *str)
fprintf(stderr, "|<%d>| %s", level, str);
}
#endif
static bool gtls_inited = FALSE;
/*
* Custom push and pull callback functions used by GNU TLS to read and write
* to the socket. These functions are simple wrappers to send() and recv()
@@ -85,17 +85,33 @@ static ssize_t Curl_gtls_pull(void *s, void *buf, size_t len)
/* Global GnuTLS init, called from Curl_ssl_init() */
int Curl_gtls_init(void)
{
gnutls_global_init();
#ifdef GTLSDEBUG
gnutls_global_set_log_function(tls_log_func);
gnutls_global_set_log_level(2);
#endif
/* Unfortunately we can not init here, things like curl --version will
* fail to work if there is no egd socket available because libgcrypt
* will EXIT the application!!
* By doing the actual init later (before actually trying to use GnuTLS),
* we can at least provide basic info etc.
*/
return 1;
}
static int _Curl_gtls_init(void)
{
int ret = 1;
if (!gtls_inited) {
ret = gnutls_global_init()?0:1;
#ifdef GTLSDEBUG
gnutls_global_set_log_function(tls_log_func);
gnutls_global_set_log_level(2);
#endif
gtls_inited = TRUE;
}
return ret;
}
int Curl_gtls_cleanup(void)
{
gnutls_global_deinit();
if (gtls_inited)
gnutls_global_deinit();
return 1;
}
@@ -132,7 +148,8 @@ static CURLcode handshake(struct connectdata *conn,
{
struct SessionHandle *data = conn->data;
int rc;
if (!gtls_inited)
_Curl_gtls_init();
do {
rc = gnutls_handshake(session);
@@ -227,6 +244,7 @@ Curl_gtls_connect(struct connectdata *conn,
void *ssl_sessionid;
size_t ssl_idsize;
if (!gtls_inited) _Curl_gtls_init();
/* GnuTLS only supports TLSv1 (and SSLv3?) */
if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) {
failf(data, "GnuTLS does not support SSLv2");
@@ -402,6 +420,43 @@ Curl_gtls_connect(struct connectdata *conn,
else
infof(data, "\t common name: %s (matched)\n", certbuf);
/* Check for time-based validity */
clock = gnutls_x509_crt_get_expiration_time(x509_cert);
if(clock == (time_t)-1) {
failf(data, "server cert expiration date verify failed");
return CURLE_SSL_CONNECT_ERROR;
}
if(clock < time(NULL)) {
if (data->set.ssl.verifypeer) {
failf(data, "server certificate expiration date has passed.");
return CURLE_SSL_PEER_CERTIFICATE;
}
else
infof(data, "\t server certificate expiration date FAILED\n");
}
else
infof(data, "\t server certificate expiration date OK\n");
clock = gnutls_x509_crt_get_activation_time(x509_cert);
if(clock == (time_t)-1) {
failf(data, "server cert activation date verify failed");
return CURLE_SSL_CONNECT_ERROR;
}
if(clock > time(NULL)) {
if (data->set.ssl.verifypeer) {
failf(data, "server certificate not activated yet.");
return CURLE_SSL_PEER_CERTIFICATE;
}
else
infof(data, "\t server certificate activation date FAILED\n");
}
else
infof(data, "\t server certificate activation date OK\n");
/* Show:
- ciphers used
@@ -502,7 +557,8 @@ static void close_one(struct connectdata *conn,
gnutls_bye(conn->ssl[index].session, GNUTLS_SHUT_RDWR);
gnutls_deinit(conn->ssl[index].session);
}
gnutls_certificate_free_credentials(conn->ssl[index].cred);
if(conn->ssl[index].cred)
gnutls_certificate_free_credentials(conn->ssl[index].cred);
}
void Curl_gtls_close(struct connectdata *conn)

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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,20 +33,6 @@
/* this must be the last include file */
#include "memdebug.h"
static unsigned long
hash_str(const char *key, size_t key_length)
{
char *end = (char *) key + key_length;
unsigned long h = 5381;
while (key < end) {
h += h << 5;
h ^= (unsigned long) *key++;
}
return h;
}
static void
hash_element_dtor(void *user, void *element)
{
@@ -63,10 +49,20 @@ hash_element_dtor(void *user, void *element)
/* return 1 on error, 0 is fine */
int
Curl_hash_init(struct curl_hash *h, int slots, curl_hash_dtor dtor)
Curl_hash_init(struct curl_hash *h,
int slots,
hash_function hfunc,
comp_function comparator,
curl_hash_dtor dtor)
{
int i;
if (!slots || !hfunc || !comparator ||!dtor) {
return 1; /* failure */
}
h->hash_func = hfunc;
h->comp_func = comparator;
h->dtor = dtor;
h->size = 0;
h->slots = slots;
@@ -89,13 +85,20 @@ Curl_hash_init(struct curl_hash *h, int slots, curl_hash_dtor dtor)
}
struct curl_hash *
Curl_hash_alloc(int slots, curl_hash_dtor dtor)
Curl_hash_alloc(int slots,
hash_function hfunc,
comp_function comparator,
curl_hash_dtor dtor)
{
struct curl_hash *h;
if (!slots || !hfunc || !comparator ||!dtor) {
return NULL; /* failure */
}
h = (struct curl_hash *) malloc(sizeof(struct curl_hash));
if (h) {
if(Curl_hash_init(h, slots, dtor)) {
if(Curl_hash_init(h, slots, hfunc, comparator, dtor)) {
/* failure */
free(h);
h = NULL;
@@ -105,26 +108,16 @@ Curl_hash_alloc(int slots, curl_hash_dtor dtor)
return h;
}
static int
hash_key_compare(char *key1, size_t key1_len, char *key2, size_t key2_len)
{
if (key1_len == key2_len &&
*key1 == *key2 &&
memcmp(key1, key2, key1_len) == 0) {
return 1;
}
return 0;
}
static struct curl_hash_element *
mk_hash_element(char *key, size_t key_len, const void *p)
mk_hash_element(void *key, size_t key_len, const void *p)
{
struct curl_hash_element *he =
(struct curl_hash_element *) malloc(sizeof(struct curl_hash_element));
if(he) {
char *dup = malloc(key_len);
void *dup = malloc(key_len);
if(dup) {
/* copy the key */
memcpy(dup, key, key_len);
@@ -142,22 +135,20 @@ mk_hash_element(char *key, size_t key_len, const void *p)
return he;
}
#define find_slot(__h, __k, __k_len) (hash_str(__k, __k_len) % (__h)->slots)
#define FETCH_LIST(x,y,z) x->table[find_slot(x, y, z)]
#define FETCH_LIST(x,y,z) x->table[x->hash_func(y, z, x->slots)]
/* Return the data in the hash. If there already was a match in the hash,
that data is returned. */
void *
Curl_hash_add(struct curl_hash *h, char *key, size_t key_len, void *p)
Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p)
{
struct curl_hash_element *he;
struct curl_llist_element *le;
struct curl_llist *l = FETCH_LIST(h, key, key_len);
struct curl_llist *l = FETCH_LIST (h, key, key_len);
for (le = l->head; le; le = le->next) {
he = (struct curl_hash_element *) le->ptr;
if (hash_key_compare(he->key, he->key_len, key, key_len)) {
if (h->comp_func(he->key, he->key_len, key, key_len)) {
h->dtor(p); /* remove the NEW entry */
return he->ptr; /* return the EXISTING entry */
}
@@ -183,7 +174,7 @@ Curl_hash_add(struct curl_hash *h, char *key, size_t key_len, void *p)
}
/* remove the identified hash entry, returns non-zero on failure */
int Curl_hash_delete(struct curl_hash *h, char *key, size_t key_len)
int Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len)
{
struct curl_llist_element *le;
struct curl_hash_element *he;
@@ -191,7 +182,7 @@ int Curl_hash_delete(struct curl_hash *h, char *key, size_t key_len)
for (le = l->head; le; le = le->next) {
he = le->ptr;
if (hash_key_compare(he->key, he->key_len, key, key_len)) {
if (h->comp_func(he->key, he->key_len, key, key_len)) {
Curl_llist_remove(l, le, (void *) h);
return 0;
}
@@ -200,7 +191,7 @@ int Curl_hash_delete(struct curl_hash *h, char *key, size_t key_len)
}
void *
Curl_hash_pick(struct curl_hash *h, char *key, size_t key_len)
Curl_hash_pick(struct curl_hash *h, void *key, size_t key_len)
{
struct curl_llist_element *le;
struct curl_hash_element *he;
@@ -208,7 +199,7 @@ Curl_hash_pick(struct curl_hash *h, char *key, size_t key_len)
for (le = l->head; le; le = le->next) {
he = le->ptr;
if (hash_key_compare(he->key, he->key_len, key, key_len)) {
if (h->comp_func(he->key, he->key_len, key, key_len)) {
return he->ptr;
}
}
@@ -282,6 +273,34 @@ Curl_hash_destroy(struct curl_hash *h)
free(h);
}
size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num)
{
char* key_str = (char *) key;
char *end = (char *) key_str + key_length;
unsigned long h = 5381;
while (key_str < end) {
h += h << 5;
h ^= (unsigned long) *key_str++;
}
return (h % slots_num);
}
size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2, size_t key2_len)
{
char *key1 = (char *)k1;
char *key2 = (char *)k2;
if (key1_len == key2_len &&
*key1 == *key2 &&
memcmp(key1, key2, key1_len) == 0) {
return 1;
}
return 0;
}
#if 0 /* useful function for debugging hashes and their contents */
void Curl_hash_print(struct curl_hash *h,
void (*func)(void *))

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
@@ -29,10 +29,29 @@
#include "llist.h"
/* Hash function prototype */
typedef size_t (*hash_function) (void* key,
size_t key_length,
size_t slots_num);
/*
Comparator function prototype. Compares two keys.
*/
typedef size_t (*comp_function) (void* key1,
size_t key1_len,
void*key2,
size_t key2_len);
typedef void (*curl_hash_dtor)(void *);
struct curl_hash {
struct curl_llist **table;
/* Hash function to be used for this hash table */
hash_function hash_func;
/* Comparator function to compare keys */
comp_function comp_func;
curl_hash_dtor dtor;
int slots;
size_t size;
@@ -45,11 +64,20 @@ struct curl_hash_element {
};
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);
int Curl_hash_init(struct curl_hash *h,
int slots,
hash_function hfunc,
comp_function comparator,
curl_hash_dtor dtor);
struct curl_hash *Curl_hash_alloc(int slots,
hash_function hfunc,
comp_function comparator,
curl_hash_dtor dtor);
void *Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p);
int Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len);
void *Curl_hash_pick(struct curl_hash *, void * key, size_t key_len);
void Curl_hash_apply(struct curl_hash *h, void *user,
void (*cb)(void *user, void *ptr));
int Curl_hash_count(struct curl_hash *h);
@@ -58,4 +86,8 @@ void Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,
int (*comp)(void *, void *));
void Curl_hash_destroy(struct curl_hash *h);
size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num);
size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2,
size_t key2_len);
#endif

View File

@@ -125,6 +125,69 @@ int Curl_resolv_getsock(struct connectdata *conn,
return max;
}
/*
* ares_waitperform()
*
* 1) Ask ares what sockets it currently plays with, then
* 2) wait for the timeout period to check for action on ares' sockets.
* 3) tell ares to act on all the sockets marked as "with action"
*
* return number of sockets it worked on
*/
static int ares_waitperform(struct connectdata *conn, int timeout_ms)
{
struct SessionHandle *data = conn->data;
int nfds;
int bitmask;
int socks[ARES_GETSOCK_MAXNUM];
struct pollfd pfd[ARES_GETSOCK_MAXNUM];
int m;
int i;
int num;
bitmask = ares_getsock(data->state.areschannel, socks, ARES_GETSOCK_MAXNUM);
for(i=0; i < ARES_GETSOCK_MAXNUM; i++) {
pfd[i].events = 0;
m=0;
if(ARES_GETSOCK_READABLE(bitmask, i)) {
pfd[i].fd = socks[i];
pfd[i].events |= POLLRDNORM|POLLIN;
m=1;
}
if(ARES_GETSOCK_WRITABLE(bitmask, i)) {
pfd[i].fd = socks[i];
pfd[i].events |= POLLWRNORM|POLLOUT;
m=1;
}
pfd[i].revents=0;
if(!m)
break;
}
num = i;
if(num)
nfds = Curl_poll(pfd, num, timeout_ms);
else
nfds = 0;
if(!nfds)
/* Call ares_process() unconditonally here, even if we simply timed out
above, as otherwise the ares name resolve won't timeout! */
ares_process_fd(data->state.areschannel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
else {
/* move through the descriptors and ask for processing on them */
for(i=0; i < num; i++)
ares_process_fd(data->state.areschannel,
pfd[i].revents & (POLLRDNORM|POLLIN)?
pfd[i].fd:ARES_SOCKET_BAD,
pfd[i].revents & (POLLWRNORM|POLLOUT)?
pfd[i].fd:ARES_SOCKET_BAD);
}
return nfds;
}
/*
* Curl_is_resolved() is called repeatedly to check if a previous name resolve
* request has completed. It should also make sure to time-out if the
@@ -135,25 +198,12 @@ int Curl_resolv_getsock(struct connectdata *conn,
CURLcode Curl_is_resolved(struct connectdata *conn,
struct Curl_dns_entry **dns)
{
fd_set read_fds, write_fds;
struct timeval tv={0,0};
struct SessionHandle *data = conn->data;
int nfds;
FD_ZERO(&read_fds);
FD_ZERO(&write_fds);
nfds = ares_fds(data->state.areschannel, &read_fds, &write_fds);
(void)Curl_select(nfds, &read_fds, &write_fds, NULL,
(struct timeval *)&tv);
/* Call ares_process() unconditonally here, even if we simply timed out
above, as otherwise the ares name resolve won't timeout! */
ares_process(data->state.areschannel, &read_fds, &write_fds);
*dns = NULL;
ares_waitperform(conn, 0);
if(conn->async.done) {
/* we're done, kill the ares handle */
if(!conn->async.dns) {
@@ -194,28 +244,20 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
/* Wait for the name resolve query to complete. */
while (1) {
int nfds=0;
fd_set read_fds, write_fds;
struct timeval *tvp, tv, store;
int count;
struct timeval now = Curl_tvnow();
long timediff;
store.tv_sec = (int)timeout/1000;
store.tv_usec = (timeout%1000)*1000;
FD_ZERO(&read_fds);
FD_ZERO(&write_fds);
nfds = ares_fds(data->state.areschannel, &read_fds, &write_fds);
if (nfds == 0)
/* no file descriptors means we're done waiting */
break;
tvp = ares_timeout(data->state.areschannel, &store, &tv);
count = Curl_select(nfds, &read_fds, &write_fds, NULL, tvp);
if ((count < 0) && (SOCKERRNO != EINVAL))
break;
ares_process(data->state.areschannel, &read_fds, &write_fds);
/* use the timeout period ares returned to us above */
ares_waitperform(conn, tv.tv_sec * 1000 + tv.tv_usec/1000);
if(conn->async.done)
break;
timediff = Curl_tvdiff(Curl_tvnow(), now); /* spent time */
timeout -= timediff?timediff:1; /* always deduct at least 1 */

View File

@@ -131,7 +131,8 @@ static void freednsentry(void *freethis);
void Curl_global_host_cache_init(void)
{
if (!host_cache_initialized) {
Curl_hash_init(&hostname_cache, 7, freednsentry);
Curl_hash_init(&hostname_cache, 7, Curl_hash_str, Curl_str_key_compare,
freednsentry);
host_cache_initialized = 1;
}
}
@@ -537,7 +538,7 @@ static void freednsentry(void *freethis)
*/
struct curl_hash *Curl_mk_dnscache(void)
{
return Curl_hash_alloc(7, freednsentry);
return Curl_hash_alloc(7, Curl_hash_str, Curl_str_key_compare, freednsentry);
}
#ifdef CURLRES_ADDRINFO_COPY
@@ -574,6 +575,8 @@ void Curl_freeaddrinfo(Curl_addrinfo *ai)
/* walk over the list and free all entries */
while(ai) {
next = ai->ai_next;
if(ai->ai_canonname)
free(ai->ai_canonname);
free(ai);
ai = next;
}
@@ -598,6 +601,14 @@ struct namebuf {
Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port)
{
Curl_addrinfo *ai;
#if defined(VMS) && \
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
#pragma pointer_size save
#pragma pointer_size short
#pragma message disable PTRMISMATCH
#endif
struct hostent *h;
struct in_addr *addrentry;
struct namebuf buffer;
@@ -624,10 +635,16 @@ Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port)
/* Now store the dotted version of the address */
snprintf((char *)h->h_name, 16, "%s", hostname);
#if defined(VMS) && \
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
#pragma pointer_size restore
#pragma message enable PTRMISMATCH
#endif
ai = Curl_he2ai(h, port);
return ai;
}
#endif
#endif /* CURLRES_IPV4 || CURLRES_ARES */

View File

@@ -26,9 +26,9 @@
#include "setup.h"
#include "hash.h"
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#ifdef NETWARE
#undef in_addr_t
#define in_addr_t uint32_t
#define in_addr_t unsigned long
#endif
/*

View File

@@ -284,7 +284,12 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
* which the gethostbyname() is the preferred() function.
*/
else {
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
NETDB_DEFINE_CONTEXT
h = gethostbyname((char*)hostname);
#else
h = gethostbyname(hostname);
#endif
if (!h)
infof(conn->data, "gethostbyname(2) failed for %s\n", hostname);
#endif /*HAVE_GETHOSTBYNAME_R */
@@ -375,6 +380,9 @@ Curl_addrinfo *Curl_he2ai(const struct hostent *he, int port)
and use that area to store the address */
ai->ai_addr = (struct sockaddr *) ((char*)ai + sizeof(Curl_addrinfo));
/* FIXME: need to free this eventually */
ai->ai_canonname = strdup(he->h_name);
/* leave the rest of the struct filled with zero */
addr = (struct sockaddr_in *)ai->ai_addr; /* storage area for this info */

View File

@@ -279,9 +279,10 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
/* the given address is numerical only, prevent a reverse lookup */
hints.ai_flags = AI_NUMERICHOST;
}
#if 0 /* removed nov 8 2005 before 7.15.1 */
else
hints.ai_flags = AI_CANONNAME;
#ifdef HAVE_GSSAPI
if(conn->data->set.krb)
/* if krb is used, we (might) need the canonical host name */
hints.ai_flags |= AI_CANONNAME;
#endif
if(port) {

View File

@@ -179,28 +179,21 @@ struct thread_sync_data {
static
void destroy_thread_sync_data(struct thread_sync_data * tsd)
{
if (tsd->hostname) {
if (tsd->hostname)
free(tsd->hostname);
tsd->hostname = NULL;
}
if (tsd->event_terminate) {
if (tsd->event_terminate)
CloseHandle(tsd->event_terminate);
tsd->event_terminate = NULL;
}
if (tsd->mutex_terminate) {
if (tsd->mutex_terminate)
CloseHandle(tsd->mutex_terminate);
tsd->mutex_terminate = NULL;
}
if (tsd->mutex_waiting) {
if (tsd->mutex_waiting)
CloseHandle(tsd->mutex_waiting);
tsd->mutex_waiting = NULL;
}
memset(tsd,0,sizeof(*tsd));
}
/* Initialize resolver thread synchronization data */
static
BOOL init_thread_sync_data(struct thread_data * td,
char * hostname,
const char * hostname,
struct thread_sync_data * tsd)
{
HANDLE curr_proc = GetCurrentProcess();
@@ -293,6 +286,7 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
* due to a resolver timeout.
*/
struct thread_sync_data tsd = { 0,0,0,NULL };
if (!init_thread_sync_data(td, conn->async.hostname, &tsd)) {
/* thread synchronization data initialization failed */
return (unsigned)-1;
@@ -353,6 +347,7 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
* due to a resolver timeout.
*/
struct thread_sync_data tsd = { 0,0,0,NULL };
if (!init_thread_sync_data(td, conn->async.hostname, &tsd)) {
/* thread synchronization data initialization failed */
return -1;
@@ -595,7 +590,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
timeout =
conn->data->set.connecttimeout ? conn->data->set.connecttimeout :
conn->data->set.timeout ? conn->data->set.timeout :
CURL_TIMEOUT_RESOLVE; /* default name resolve timeout */
CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */
ticks = GetTickCount();
/* wait for the thread to resolve the name */

View File

@@ -98,8 +98,10 @@ char *Curl_if2ip(const char *interface, char *buf, int buf_size)
struct ifreq req;
size_t len = strlen(interface);
memset(&req, 0, sizeof(req));
if(len >= sizeof(req.ifr_name))
if(len >= sizeof(req.ifr_name)) {
sclose(dummy);
return NULL; /* this can't be a fine interface name */
}
memcpy(req.ifr_name, interface, len+1);
req.ifr_addr.sa_family = AF_INET;
#ifdef IOCTL_3_ARGS

View File

@@ -42,6 +42,10 @@
#include "inet_ntop.h"
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
NETINET_DEFINE_CONTEXT
#endif
#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
/* this platform has a inet_ntoa_r() function, but no proto declared anywhere
so we include our own proto to make compilers happy */

View File

@@ -116,7 +116,7 @@ inet_pton4(const char *src, unsigned char *dst)
if (val > 255)
return (0);
*tp = val;
*tp = (unsigned char)val;
if (! saw_digit) {
if (++octets > 4)
return (0);

View File

@@ -40,7 +40,12 @@ struct Curl_sec_client_mech {
#define AUTH_CONTINUE 1
#define AUTH_ERROR 2
#ifdef HAVE_KRB4
extern struct Curl_sec_client_mech Curl_krb4_client_mech;
#endif
#ifdef HAVE_GSSAPI
extern struct Curl_sec_client_mech Curl_krb5_client_mech;
#endif
CURLcode Curl_krb_kauth(struct connectdata *conn);
int Curl_sec_fflush_fd(struct connectdata *conn, int fd);

301
lib/krb5.c Normal file
View File

@@ -0,0 +1,301 @@
/* GSSAPI/krb5 support for FTP - loosely based on old krb4.c
*
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS 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 INSTITUTE OR CONTRIBUTORS 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. */
#include "setup.h"
#ifndef CURL_DISABLE_FTP
#ifdef HAVE_GSSAPI
#include <stdlib.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#include <string.h>
#include <gssapi/gssapi.h>
#include <gssapi/gssapi_generic.h>
#include <gssapi/gssapi_krb5.h>
#include "urldata.h"
#include "base64.h"
#include "ftp.h"
#include "sendf.h"
#include "krb4.h"
#include "memory.h"
/* The last #include file should be: */
#include "memdebug.h"
#define LOCAL_ADDR (&conn->local_addr)
#define REMOTE_ADDR conn->ip_addr->ai_addr
static int
krb5_check_prot(void *app_data, int level)
{
app_data = NULL; /* prevent compiler warning */
if(level == prot_confidential)
return -1;
return 0;
}
static int
krb5_decode(void *app_data, void *buf, int len, int level,
struct connectdata *conn)
{
gss_ctx_id_t *context = app_data;
OM_uint32 maj, min;
gss_buffer_desc enc, dec;
/* shut gcc up */
level = 0;
conn = NULL;
enc.value = buf;
enc.length = len;
maj = gss_unseal(&min, *context, &enc, &dec, NULL, NULL);
if(maj != GSS_S_COMPLETE) {
if(len >= 4)
strcpy(buf, "599 ");
return -1;
}
memcpy(buf, dec.value, dec.length);
len = dec.length;
gss_release_buffer(&min, &dec);
return len;
}
static int
krb5_overhead(void *app_data, int level, int len)
{
/* no arguments are used, just init them to prevent compiler warnings */
app_data = NULL;
level = 0;
len = 0;
return 0;
}
static int
krb5_encode(void *app_data, void *from, int length, int level, void **to,
struct connectdata *conn)
{
gss_ctx_id_t *context = app_data;
gss_buffer_desc dec, enc;
OM_uint32 maj, min;
int state;
int len;
/* shut gcc up */
conn = NULL;
dec.value = from;
dec.length = length;
maj = gss_seal(&min, *context,
level == prot_private,
GSS_C_QOP_DEFAULT,
&dec, &state, &enc);
if(maj != GSS_S_COMPLETE)
return -1;
/* malloc a new buffer, in case gss_release_buffer doesn't work as expected */
*to = malloc(enc.length);
if(!*to)
return -1;
memcpy(*to, enc.value, enc.length);
len = enc.length;
gss_release_buffer(&min, &enc);
return len;
}
static int
krb5_auth(void *app_data, struct connectdata *conn)
{
int ret;
char *p;
const char *host = conn->dns_entry->addr->ai_canonname;
ssize_t nread;
unsigned int l = sizeof(conn->local_addr);
struct SessionHandle *data = conn->data;
CURLcode result;
const char *service = "ftp", *srv_host = "host";
gss_buffer_desc gssbuf, _gssresp, *gssresp;
OM_uint32 maj, min;
gss_name_t gssname;
gss_ctx_id_t *context = app_data;
struct gss_channel_bindings_struct chan;
if(getsockname(conn->sock[FIRSTSOCKET],
(struct sockaddr *)LOCAL_ADDR, &l) < 0)
perror("getsockname()");
chan.initiator_addrtype = GSS_C_AF_INET;
chan.initiator_address.length = l - 4;
chan.initiator_address.value = &((struct sockaddr_in *)LOCAL_ADDR)->sin_addr.s_addr;
chan.acceptor_addrtype = GSS_C_AF_INET;
chan.acceptor_address.length = l - 4;
chan.acceptor_address.value = &((struct sockaddr_in *)REMOTE_ADDR)->sin_addr.s_addr;
chan.application_data.length = 0;
chan.application_data.value = NULL;
/* this loop will execute twice (once for service, once for host) */
while(1) {
/* this really shouldn't be repeated here, but can't help it */
if(service == srv_host) {
result = Curl_ftpsendf(conn, "AUTH GSSAPI");
if(result)
return -2;
if(Curl_GetFTPResponse(&nread, conn, NULL))
return -1;
if(data->state.buffer[0] != '3')
return -1;
}
gssbuf.value = data->state.buffer;
gssbuf.length = snprintf(gssbuf.value, BUFSIZE, "%s@%s", service, host);
maj = gss_import_name(&min, &gssbuf, gss_nt_service_name, &gssname);
if(maj != GSS_S_COMPLETE) {
gss_release_name(&min, &gssname);
if(service == srv_host) {
Curl_failf(data, "Error importing service name %s", gssbuf.value);
return AUTH_ERROR;
}
service = srv_host;
continue;
}
{
gss_OID t;
gss_display_name(&min, gssname, &gssbuf, &t);
Curl_infof(data, "Trying against %s\n", gssbuf.value);
gss_release_buffer(&min, &gssbuf);
}
gssresp = GSS_C_NO_BUFFER;
*context = GSS_C_NO_CONTEXT;
do {
ret = AUTH_OK;
maj = gss_init_sec_context(&min,
GSS_C_NO_CREDENTIAL,
context,
gssname,
GSS_C_NO_OID,
GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG,
0,
&chan,
gssresp,
NULL,
&gssbuf,
NULL,
NULL);
if(gssresp) {
free(_gssresp.value);
gssresp = NULL;
}
if(maj != GSS_S_COMPLETE && maj != GSS_S_CONTINUE_NEEDED) {
Curl_infof(data, "Error creating security context");
ret = AUTH_ERROR;
break;
}
if(gssbuf.length != 0) {
if(Curl_base64_encode(data, (char *)gssbuf.value, gssbuf.length, &p) < 1) {
Curl_infof(data, "Out of memory base64-encoding");
ret = AUTH_CONTINUE;
break;
}
result = Curl_ftpsendf(conn, "ADAT %s", p);
free(p);
if(result) {
ret = -2;
break;
}
if(Curl_GetFTPResponse(&nread, conn, NULL)) {
ret = -1;
break;
}
if(data->state.buffer[0] != '2' && data->state.buffer[0] != '3'){
Curl_infof(data, "Server didn't accept auth data\n");
ret = AUTH_ERROR;
break;
}
p = data->state.buffer + 4;
p = strstr(p, "ADAT=");
if(p) {
_gssresp.length = Curl_base64_decode(p + 5, (unsigned char **)&_gssresp.value);
if(_gssresp.length < 1) {
Curl_failf(data, "Out of memory base64-encoding");
ret = AUTH_CONTINUE;
break;
}
}
gssresp = &_gssresp;
}
} while(maj == GSS_S_CONTINUE_NEEDED);
gss_release_name(&min, &gssname);
if(gssresp)
free(_gssresp.value);
if(ret == AUTH_OK || service == srv_host)
return ret;
service = srv_host;
}
}
struct Curl_sec_client_mech Curl_krb5_client_mech = {
"GSSAPI",
sizeof(gss_ctx_id_t),
NULL, /* init */
krb5_auth,
NULL, /* end */
krb5_check_prot,
krb5_overhead,
krb5_encode,
krb5_decode
};
#endif /* HAVE_GSSAPI */
#endif /* CURL_DISABLE_FTP */

View File

@@ -31,7 +31,7 @@ VS_VERSION_INFO VERSIONINFO
FILEVERSION RC_VERSION
PRODUCTVERSION RC_VERSION
FILEFLAGSMASK 0x3fL
#if CURLDEBUG
#if defined(CURLDEBUG) || defined(_DEBUG)
FILEFLAGS 1
#else
FILEFLAGS 0

View File

@@ -73,6 +73,10 @@ void curl_memdebug(const char *logname)
logfile = fopen(logname, "w");
else
logfile = stderr;
#ifdef MEMDEBUG_LOG_SYNC
/* Flush the log file after every line so the log isn't lost in a crash */
setvbuf(logfile, (char *)NULL, _IOLBF, 0);
#endif
}
}
@@ -276,6 +280,16 @@ FILE *curl_fopen(const char *file, const char *mode,
return res;
}
FILE *curl_fdopen(int filedes, const char *mode,
int line, const char *source)
{
FILE *res=(fdopen)(filedes, mode);
if(logfile)
fprintf(logfile, "FILE %s:%d fdopen(\"%d\",\"%s\") = %p\n",
source, line, filedes, mode, res);
return res;
}
int curl_fclose(FILE *file, int line, const char *source)
{
int res;

View File

@@ -67,6 +67,8 @@ CURL_EXTERN int curl_accept(int s, void *addr, void *addrlen,
/* FILE functions */
CURL_EXTERN FILE *curl_fopen(const char *file, const char *mode, int line,
const char *source);
CURL_EXTERN FILE *curl_fdopen(int filedes, const char *mode, int line,
const char *source);
CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
#ifndef MEMDEBUG_NODEFINES
@@ -117,6 +119,8 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
#undef fopen
#define fopen(file,mode) curl_fopen(file,mode,__LINE__,__FILE__)
#undef fdopen
#define fdopen(file,mode) curl_fdopen(file,mode,__LINE__,__FILE__)
#define fclose(file) curl_fclose(file,__LINE__,__FILE__)
#endif /* MEMDEBUG_NODEFINES */

View File

@@ -50,6 +50,15 @@
/* The last #include file should be: */
#include "memdebug.h"
/*
CURL_SOCKET_HASH_TABLE_SIZE should be a prime number. Increasing it from 97
to 911 takes on a 32-bit machine 4 x 804 = 3211 more bytes. Still, every
CURL handle takes 45-50 K memory, therefore this 3K are not significant.
*/
#ifndef CURL_SOCKET_HASH_TABLE_SIZE
#define CURL_SOCKET_HASH_TABLE_SIZE 911
#endif
struct Curl_message {
/* the 'CURLMsg' is the part that is visible to the external user */
struct CURLMsg extmsg;
@@ -121,9 +130,9 @@ struct Curl_one_easy {
#define CURL_MULTI_HANDLE 0x000bab1e
#define GOOD_MULTI_HANDLE(x) \
((x)&&(((struct Curl_multi *)x)->type == CURL_MULTI_HANDLE))
((x)&&(((struct Curl_multi *)(x))->type == CURL_MULTI_HANDLE))
#define GOOD_EASY_HANDLE(x) \
(((struct SessionHandle *)x)->magic == CURLEASY_MAGIC_NUMBER)
(((struct SessionHandle *)(x))->magic == CURLEASY_MAGIC_NUMBER)
/* This is the struct known as CURLM on the outside */
struct Curl_multi {
@@ -160,6 +169,8 @@ struct Curl_multi {
/* shared connection cache */
struct conncache *connc;
long maxconnects; /* if >0, a fixed limit of the maximum number of entries
we're allowed to grow the connection cache to */
/* list of easy handles kept around for doing nice connection closures */
struct closure *closure;
@@ -180,7 +191,7 @@ static void add_closure(struct Curl_multi *multi,
static int update_timer(struct Curl_multi *multi);
#ifdef CURLDEBUG
static const char *statename[]={
static const char * const statename[]={
"INIT",
"CONNECT",
"WAITRESOLVE",
@@ -303,6 +314,21 @@ static void sh_freeentry(void *freethis)
free(p);
}
static size_t fd_key_compare(void*k1, size_t k1_len, void*k2, size_t k2_len)
{
(void) k1_len; (void) k2_len;
return ((*((int* ) k1)) == (*((int* ) k2))) ? 1 : 0;
}
static size_t hash_fd(void* key, size_t key_length, size_t slots_num)
{
int fd = * ((int* ) key);
(void) key_length;
return (fd % (int)slots_num);
}
/*
* sh_init() creates a new socket hash and returns the handle for it.
*
@@ -323,7 +349,8 @@ static void sh_freeentry(void *freethis)
*/
static struct curl_hash *sh_init(void)
{
return Curl_hash_alloc(97, sh_freeentry);
return Curl_hash_alloc(CURL_SOCKET_HASH_TABLE_SIZE, hash_fd, fd_key_compare,
sh_freeentry);
}
CURLM *curl_multi_init(void)
@@ -469,6 +496,14 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
/* make the SessionHandle struct refer back to this struct */
easy->easy_handle->set.one_easy = easy;
/* Set the timeout for this handle to expire really soon so that it will
be taken care of even when this handle is added in the midst of operation
when only the curl_multi_socket() API is used. During that flow, only
sockets that time-out or have actions will be dealt with. Since this
handle has no action yet, we make sure it times out to get things to
happen. */
Curl_expire(easy->easy_handle, 10);
/* increase the node-counter */
multi->num_easy++;
@@ -476,11 +511,19 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
/* We want the connection cache to have plenty room. Before we supported
the shared cache every single easy handle had 5 entries in their cache
by default. */
CURLcode res = Curl_ch_connc(easy_handle, multi->connc,
multi->connc->num*4);
if(res != CURLE_OK)
/* TODO: we need to do some cleaning up here! */
return CURLM_OUT_OF_MEMORY;
int newmax = multi->num_easy * 4;
if(multi->maxconnects && (multi->maxconnects < newmax))
/* don't grow beyond the allowed size */
newmax = multi->maxconnects;
if(newmax > multi->connc->num) {
/* we only do this is we can in fact grow the cache */
CURLcode res = Curl_ch_connc(easy_handle, multi->connc, newmax);
if(res != CURLE_OK)
/* TODO: we need to do some cleaning up here! */
return CURLM_OUT_OF_MEMORY;
}
}
/* increase the alive-counter */
@@ -796,7 +839,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
struct Curl_message *msg = NULL;
bool connected;
bool async;
bool protocol_connect;
bool protocol_connect = FALSE;
bool dophase_done;
bool done;
CURLMcode result = CURLM_OK;
@@ -888,29 +931,30 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(CURLE_OK == easy->result) {
/* Add this handle to the send pipeline */
Curl_addHandleToPipeline(easy->easy_handle,
easy->easy_conn->send_pipe);
easy->result = Curl_addHandleToPipeline(easy->easy_handle,
easy->easy_conn->send_pipe);
if(CURLE_OK == easy->result) {
if(async)
/* We're now waiting for an asynchronous name lookup */
multistate(easy, CURLM_STATE_WAITRESOLVE);
else {
/* after the connect has been sent off, go WAITCONNECT unless the
protocol connect is already done and we can go directly to
WAITDO! */
result = CURLM_CALL_MULTI_PERFORM;
if(async)
/* We're now waiting for an asynchronous name lookup */
multistate(easy, CURLM_STATE_WAITRESOLVE);
else {
/* after the connect has been sent off, go WAITCONNECT unless the
protocol connect is already done and we can go directly to
WAITDO! */
result = CURLM_CALL_MULTI_PERFORM;
if(protocol_connect)
multistate(easy, CURLM_STATE_WAITDO);
else {
if(protocol_connect)
multistate(easy, CURLM_STATE_WAITDO);
else {
#ifndef CURL_DISABLE_HTTP
if (easy->easy_conn->bits.tunnel_connecting)
multistate(easy, CURLM_STATE_WAITPROXYCONNECT);
else
if (easy->easy_conn->bits.tunnel_connecting)
multistate(easy, CURLM_STATE_WAITPROXYCONNECT);
else
#endif
multistate(easy, CURLM_STATE_WAITCONNECT);
}
}
multistate(easy, CURLM_STATE_WAITCONNECT);
}
}
}
}
break;
@@ -988,8 +1032,15 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(!protocol_connect) {
/* We have a TCP connection, but 'protocol_connect' may be false
and then we continue to 'STATE_PROTOCONNECT'. If protocol
connect is TRUE, we move on to STATE_DO. */
multistate(easy, CURLM_STATE_PROTOCONNECT);
connect is TRUE, we move on to STATE_DO.
BUT if we are using a proxy we must change to WAITPROXYCONNECT
*/
#ifndef CURL_DISABLE_HTTP
if (easy->easy_conn->bits.tunnel_connecting)
multistate(easy, CURLM_STATE_WAITPROXYCONNECT);
else
#endif
multistate(easy, CURLM_STATE_PROTOCONNECT);
}
else {
/* after the connect has completed, go WAITDO */
@@ -1145,8 +1196,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
Curl_removeHandleFromPipeline(easy->easy_handle,
easy->easy_conn->send_pipe);
/* Add ourselves to the recv pipeline */
Curl_addHandleToPipeline(easy->easy_handle,
easy->easy_conn->recv_pipe);
easy->result = Curl_addHandleToPipeline(easy->easy_handle,
easy->easy_conn->recv_pipe);
multistate(easy, CURLM_STATE_WAITPERFORM);
result = CURLM_CALL_MULTI_PERFORM;
@@ -1385,6 +1436,17 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
multi->num_msgs++; /* increase message counter */
}
if(CURLM_CALL_MULTI_PERFORM == result)
/* Set the timeout for this handle to expire really soon so that it will
be taken care of even when this handle is added in the midst of
operation when only the curl_multi_socket() API is used. During that
flow, only sockets that time-out or have actions will be dealt
with. Since this handle has no action yet, we make sure it times out to
get things to happen. Also, this makes it less important for callers of
the curl_multi_* functions to bother about the CURLM_CALL_MULTI_PERFORM
return code, as long as they deal with the timeouts properly. */
Curl_expire(easy->easy_handle, 10);
return result;
}
@@ -1443,7 +1505,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
*running_handles = multi->num_alive;
if ( CURLM_OK == returncode )
if ( CURLM_OK >= returncode )
update_timer(multi);
return returncode;
}
@@ -1661,6 +1723,7 @@ static void singlesocket(struct Curl_multi *multi,
static CURLMcode multi_socket(struct Curl_multi *multi,
bool checkall,
curl_socket_t s,
int ev_bitmask,
int *running_handles)
{
CURLMcode result = CURLM_OK;
@@ -1698,9 +1761,15 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
/* bad bad bad bad bad bad bad */
return CURLM_INTERNAL_ERROR;
if (data->set.one_easy->easy_conn) /* set socket event bitmask */
data->set.one_easy->easy_conn->cselect_bits = ev_bitmask;
result = multi_runsingle(multi, data->set.one_easy);
if(result == CURLM_OK)
if (data->set.one_easy->easy_conn)
data->set.one_easy->easy_conn->cselect_bits = 0;
if(CURLM_OK >= result)
/* get the socket(s) and check if the state has been changed since
last */
singlesocket(multi, data->set.one_easy);
@@ -1726,7 +1795,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
if(data) {
result = multi_runsingle(multi, data->set.one_easy);
if(result == CURLM_OK)
if(CURLM_OK >= result)
/* get the socket(s) and check if the state has been changed since
last */
singlesocket(multi, data->set.one_easy);
@@ -1783,6 +1852,9 @@ CURLMcode curl_multi_setopt(CURLM *multi_handle,
case CURLMOPT_TIMERDATA:
multi->timer_userp = va_arg(param, void *);
break;
case CURLMOPT_MAXCONNECTS:
multi->maxconnects = va_arg(param, long);
break;
default:
res = CURLM_UNKNOWN_OPTION;
break;
@@ -1791,13 +1863,25 @@ CURLMcode curl_multi_setopt(CURLM *multi_handle,
return res;
}
/* we define curl_multi_socket() in the public multi.h header */
#undef curl_multi_socket
CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
int *running_handles)
{
CURLMcode result = multi_socket((struct Curl_multi *)multi_handle, FALSE, s,
running_handles);
if (CURLM_OK == result)
0, running_handles);
if (CURLM_OK >= result)
update_timer((struct Curl_multi *)multi_handle);
return result;
}
CURLMcode curl_multi_socket_action(CURLM *multi_handle, curl_socket_t s,
int ev_bitmask, int *running_handles)
{
CURLMcode result = multi_socket((struct Curl_multi *)multi_handle, FALSE, s,
ev_bitmask, running_handles);
if (CURLM_OK >= result)
update_timer((struct Curl_multi *)multi_handle);
return result;
}
@@ -1806,8 +1890,8 @@ CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles)
{
CURLMcode result = multi_socket((struct Curl_multi *)multi_handle,
TRUE, CURL_SOCKET_BAD, running_handles);
if (CURLM_OK == result)
TRUE, CURL_SOCKET_BAD, 0, running_handles);
if (CURLM_OK >= result)
update_timer((struct Curl_multi *)multi_handle);
return result;
}

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
@@ -227,7 +227,7 @@ int Curl_parsenetrc(char *host,
}
#ifdef _NETRC_DEBUG
int main(int argc, char **argv)
int main(int argc, argv_item_t argv[])
{
char login[64]="";
char password[64]="";

View File

@@ -74,6 +74,8 @@ PRFileDesc *PR_ImportTCPSocket(PRInt32 osfd);
static int initialized = 0;
static int noverify = 0;
#define HANDSHAKE_TIMEOUT 30
typedef struct {
PRInt32 retryCount;
struct SessionHandle *data;
@@ -513,6 +515,12 @@ CURLcode Curl_nss_connect(struct connectdata * conn, int sockindex)
SSL_SetURL(connssl->handle, conn->host.name);
/* Force the handshake now */
if (SSL_ForceHandshakeWithTimeout(connssl->handle,
PR_SecondsToInterval(HANDSHAKE_TIMEOUT))
!= SECSuccess)
goto error;
return CURLE_OK;
error:

View File

@@ -23,9 +23,12 @@
#ifdef NETWARE /* Novell NetWare */
#include <stdlib.h>
#ifdef __NOVELL_LIBC__
/* For native LibC-based NLM we need to register as a real lib. */
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <library.h>
#include <netware.h>
#include <screen.h>
@@ -148,7 +151,7 @@ void _NonAppStop( void )
** we return a non-zero value. Right now, there isn't any reason not to allow
** it.
*/
int _NonAppCheckUnload( void )
int _NonAppCheckUnload( void )
{
return 0;
}
@@ -275,10 +278,10 @@ int GetOrSetUpData(int id, libdata_t **appData,
return err;
}
int DisposeLibraryData( void *data)
int DisposeLibraryData( void *data )
{
if (data) {
void *tenbytes = ((libdata_t *) data)->tenbytes;
void *tenbytes = ((libdata_t *) data)->tenbytes;
if (tenbytes)
free(tenbytes);
@@ -289,10 +292,10 @@ int DisposeLibraryData( void *data)
return 0;
}
void DisposeThreadData(void *data)
void DisposeThreadData( void *data )
{
if (data) {
void *twentybytes = ((libthreaddata_t *) data)->twentybytes;
void *twentybytes = ((libthreaddata_t *) data)->twentybytes;
if (twentybytes)
free(twentybytes);
@@ -301,4 +304,28 @@ void DisposeThreadData(void *data)
}
}
#else /* __NOVELL_LIBC__ */
/* For native CLib-based NLM seems we can do a bit more simple. */
#include <nwthread.h>
/* Make the CLIB Ctx stuff link */
/*
#include <stdio.h>
#include <netdb.h>
NETDB_DEFINE_CONTEXT
*/
int main ( void )
{
/* initialize any globals here... */
/* do this if any global initializing was done
SynchronizeStart();
*/
ExitThread (TSR_THREAD, 0);
return 0;
}
#endif /* __NOVELL_LIBC__ */
#endif /* NETWARE */

View File

@@ -245,6 +245,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
long ulestimate=0;
long dlestimate=0;
long total_estimate;
bool shownow=FALSE;
now = Curl_tvnow(); /* what time is it */
@@ -266,6 +267,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* Calculations done at most once a second, unless end is reached */
if(data->progress.lastshow != (long)now.tv_sec) {
shownow = TRUE;
data->progress.lastshow = now.tv_sec;
@@ -346,7 +348,12 @@ int Curl_pgrsUpdate(struct connectdata *conn)
return result;
}
/* If there's no external callback set, use internal code to show progress */
if(!shownow)
/* only show the internal progress meter once per second */
return 0;
/* If there's no external callback set, use internal code to show
progress */
if(!(data->progress.flags & PGRS_HEADERS_OUT)) {
if(data->reqdata.resume_from) {
@@ -422,7 +429,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* we flush the output stream to make it appear as soon as possible */
fflush(data->set.err);
}
} /* !(data->progress.flags & PGRS_HIDE) */
return 0;
}

View File

@@ -41,7 +41,7 @@
#include "setup.h"
#ifndef CURL_DISABLE_FTP
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */
#include <curl/mprintf.h>
@@ -87,8 +87,8 @@ name_to_level(const char *name)
}
static const struct Curl_sec_client_mech * const mechs[] = {
#ifdef KRB5
/* not supported */
#ifdef HAVE_GSSAPI
&Curl_krb5_client_mech,
#endif
#ifdef HAVE_KRB4
&Curl_krb4_client_mech,
@@ -118,6 +118,8 @@ block_read(int fd, void *buf, size_t len)
b = read(fd, p, len);
if (b == 0)
return 0;
else if (b < 0 && (errno == EINTR || errno == EAGAIN))
continue;
else if (b < 0)
return -1;
len -= b;
@@ -127,13 +129,15 @@ block_read(int fd, void *buf, size_t len)
}
static int
block_write(int fd, void *buf, size_t len)
block_write(int fd, const void *buf, size_t len)
{
unsigned char *p = buf;
const unsigned char *p = buf;
int b;
while(len) {
b = write(fd, p, len);
if(b < 0)
if (b < 0 && (errno == EINTR || errno == EAGAIN))
continue;
else if(b < 0)
return -1;
len -= b;
p += b;
@@ -155,7 +159,7 @@ sec_get_data(struct connectdata *conn,
return -1;
len = ntohl(len);
buf->data = realloc(buf->data, len);
b = block_read(fd, buf->data, len);
b = buf->data ? block_read(fd, buf->data, len) : -1;
if (b == 0)
return 0;
else if (b < 0)
@@ -234,11 +238,36 @@ sec_send(struct connectdata *conn, int fd, char *from, int length)
{
int bytes;
void *buf;
bytes = (conn->mech->encode)(conn->app_data, from, length, conn->data_prot,
enum protection_level protlevel = conn->data_prot;
int iscmd = protlevel == prot_cmd;
if(iscmd) {
if(!strncmp(from, "PASS ", 5) || !strncmp(from, "ACCT ", 5))
protlevel = prot_private;
else
protlevel = conn->command_prot;
}
bytes = (conn->mech->encode)(conn->app_data, from, length, protlevel,
&buf, conn);
bytes = htonl(bytes);
block_write(fd, &bytes, sizeof(bytes));
block_write(fd, buf, ntohl(bytes));
if(iscmd) {
char *cmdbuf;
bytes = Curl_base64_encode(conn->data, (char *)buf, bytes, &cmdbuf);
if(bytes > 0) {
if(protlevel == prot_private)
block_write(fd, "ENC ", 4);
else
block_write(fd, "MIC ", 4);
block_write(fd, cmdbuf, bytes);
block_write(fd, "\r\n", 2);
Curl_infof(conn->data, "%s %s\n", protlevel == prot_private ? "ENC" : "MIC", cmdbuf);
free(cmdbuf);
}
} else {
bytes = htonl(bytes);
block_write(fd, &bytes, sizeof(bytes));
block_write(fd, buf, ntohl(bytes));
}
free(buf);
return length;
}
@@ -267,6 +296,8 @@ Curl_sec_write(struct connectdata *conn, int fd, char *buffer, int length)
return write(fd, buffer, length);
len -= (conn->mech->overhead)(conn->app_data, conn->data_prot, len);
if(len <= 0)
len = length;
while(length){
if(length < len)
len = length;
@@ -319,6 +350,11 @@ Curl_sec_read_msg(struct connectdata *conn, char *s, int level)
return -1;
}
if(conn->data->set.verbose) {
buf[len] = '\n';
Curl_debug(conn->data, CURLINFO_HEADER_IN, (char *)buf, len + 1, conn);
}
buf[len] = '\0';
if(buf[3] == '-')
@@ -360,7 +396,7 @@ sec_prot_internal(struct connectdata *conn, int level)
if(Curl_GetFTPResponse(&nread, conn, &code))
return -1;
if(code/100 != '2'){
if(code/100 != 2){
failf(conn->data, "Failed to set protection buffer size.");
return -1;
}
@@ -385,6 +421,8 @@ sec_prot_internal(struct connectdata *conn, int level)
}
conn->data_prot = (enum protection_level)level;
if(level == prot_private)
conn->command_prot = (enum protection_level)level;
return 0;
}
@@ -468,6 +506,9 @@ Curl_sec_login(struct connectdata *conn)
conn->mech = *m;
conn->sec_complete = 1;
conn->command_prot = prot_safe;
/* Set the requested protection level */
/* BLOCKING */
Curl_sec_set_protection_level(conn);
break;
}

View File

@@ -76,12 +76,12 @@
#define elapsed_ms (int)curlx_tvdiff(curlx_tvnow(), initial_tv)
#ifdef CURL_ACKNOWLEDGE_EINTR
#define error_not_EINTR (error != EINTR)
#define error_is_EINTR (error == EINTR)
#else
#define error_not_EINTR (1)
#define error_is_EINTR (0)
#endif
#define SMALL_POLLNFDS 0X20
#define SMALL_POLLNFDS 0x20
/*
* Internal function used for waiting a specific amount of ms
@@ -136,9 +136,15 @@ static int wait_ms(int timeout_ms)
pending_tv.tv_usec = (pending_ms % 1000) * 1000;
r = select(0, NULL, NULL, NULL, &pending_tv);
#endif /* HAVE_POLL_FINE */
} while ((r == -1) && (error = SOCKERRNO) &&
(error != EINVAL) && error_not_EINTR &&
((pending_ms = timeout_ms - elapsed_ms) > 0));
if (r != -1)
break;
error = SOCKERRNO;
if ((error == EINVAL) || error_is_EINTR)
break;
pending_ms = timeout_ms - elapsed_ms;
if (pending_ms <= 0)
break;
} while (r == -1);
#endif /* USE_WINSOCK */
if (r)
r = -1;
@@ -161,9 +167,10 @@ static int wait_ms(int timeout_ms)
* Return values:
* -1 = system call error or fd >= FD_SETSIZE
* 0 = timeout
* CSELECT_IN | CSELECT_OUT | CSELECT_ERR
* CURL_CSELECT_IN | CURL_CSELECT_OUT | CURL_CSELECT_ERR
*/
int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd,
int timeout_ms)
{
#ifdef HAVE_POLL_FINE
struct pollfd pfd[2];
@@ -177,7 +184,7 @@ int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_m
curl_socket_t maxfd;
#endif
struct timeval initial_tv;
int pending_ms;
int pending_ms = 0;
int error;
int r;
int ret;
@@ -187,8 +194,15 @@ int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_m
return r;
}
pending_ms = timeout_ms;
initial_tv = curlx_tvnow();
/* Avoid initial timestamp, avoid gettimeofday() call, when elapsed
time in this function does not need to be measured. This happens
when function is called with a zero timeout or a negative timeout
value indicating a blocking call should be performed. */
if (timeout_ms > 0) {
pending_ms = timeout_ms;
initial_tv = curlx_tvnow();
}
#ifdef HAVE_POLL_FINE
@@ -209,10 +223,20 @@ int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_m
do {
if (timeout_ms < 0)
pending_ms = -1;
else if (!timeout_ms)
pending_ms = 0;
r = poll(pfd, num, pending_ms);
} while ((r == -1) && (error = SOCKERRNO) &&
(error != EINVAL) && error_not_EINTR &&
((timeout_ms < 0) || ((pending_ms = timeout_ms - elapsed_ms) > 0)));
if (r != -1)
break;
error = SOCKERRNO;
if ((error == EINVAL) || error_is_EINTR)
break;
if (timeout_ms > 0) {
pending_ms = timeout_ms - elapsed_ms;
if (pending_ms <= 0)
break;
}
} while (r == -1);
if (r < 0)
return -1;
@@ -223,16 +247,16 @@ int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_m
num = 0;
if (readfd != CURL_SOCKET_BAD) {
if (pfd[num].revents & (POLLRDNORM|POLLIN|POLLERR|POLLHUP))
ret |= CSELECT_IN;
ret |= CURL_CSELECT_IN;
if (pfd[num].revents & (POLLRDBAND|POLLPRI|POLLNVAL))
ret |= CSELECT_ERR;
ret |= CURL_CSELECT_ERR;
num++;
}
if (writefd != CURL_SOCKET_BAD) {
if (pfd[num].revents & (POLLWRNORM|POLLOUT))
ret |= CSELECT_OUT;
ret |= CURL_CSELECT_OUT;
if (pfd[num].revents & (POLLERR|POLLHUP|POLLNVAL))
ret |= CSELECT_ERR;
ret |= CURL_CSELECT_ERR;
}
return ret;
@@ -262,14 +286,26 @@ int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_m
ptimeout = (timeout_ms < 0) ? NULL : &pending_tv;
do {
if (ptimeout) {
if (timeout_ms > 0) {
pending_tv.tv_sec = pending_ms / 1000;
pending_tv.tv_usec = (pending_ms % 1000) * 1000;
}
else if (!timeout_ms) {
pending_tv.tv_sec = 0;
pending_tv.tv_usec = 0;
}
r = select((int)maxfd + 1, &fds_read, &fds_write, &fds_err, ptimeout);
} while ((r == -1) && (error = SOCKERRNO) &&
(error != EINVAL) && (error != EBADF) && error_not_EINTR &&
((timeout_ms < 0) || ((pending_ms = timeout_ms - elapsed_ms) > 0)));
if (r != -1)
break;
error = SOCKERRNO;
if ((error == EINVAL) || (error == EBADF) || error_is_EINTR)
break;
if (timeout_ms > 0) {
pending_ms = timeout_ms - elapsed_ms;
if (pending_ms <= 0)
break;
}
} while (r == -1);
if (r < 0)
return -1;
@@ -279,15 +315,15 @@ int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_m
ret = 0;
if (readfd != CURL_SOCKET_BAD) {
if (FD_ISSET(readfd, &fds_read))
ret |= CSELECT_IN;
ret |= CURL_CSELECT_IN;
if (FD_ISSET(readfd, &fds_err))
ret |= CSELECT_ERR;
ret |= CURL_CSELECT_ERR;
}
if (writefd != CURL_SOCKET_BAD) {
if (FD_ISSET(writefd, &fds_write))
ret |= CSELECT_OUT;
ret |= CURL_CSELECT_OUT;
if (FD_ISSET(writefd, &fds_err))
ret |= CSELECT_ERR;
ret |= CURL_CSELECT_ERR;
}
return ret;
@@ -325,7 +361,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
struct timeval initial_tv;
bool fds_none = TRUE;
unsigned int i;
int pending_ms;
int pending_ms = 0;
int error;
int r;
@@ -342,18 +378,35 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
return r;
}
pending_ms = timeout_ms;
initial_tv = curlx_tvnow();
/* Avoid initial timestamp, avoid gettimeofday() call, when elapsed
time in this function does not need to be measured. This happens
when function is called with a zero timeout or a negative timeout
value indicating a blocking call should be performed. */
if (timeout_ms > 0) {
pending_ms = timeout_ms;
initial_tv = curlx_tvnow();
}
#ifdef HAVE_POLL_FINE
do {
if (timeout_ms < 0)
pending_ms = -1;
else if (!timeout_ms)
pending_ms = 0;
r = poll(ufds, nfds, pending_ms);
} while ((r == -1) && (error = SOCKERRNO) &&
(error != EINVAL) && error_not_EINTR &&
((timeout_ms < 0) || ((pending_ms = timeout_ms - elapsed_ms) > 0)));
if (r != -1)
break;
error = SOCKERRNO;
if ((error == EINVAL) || error_is_EINTR)
break;
if (timeout_ms > 0) {
pending_ms = timeout_ms - elapsed_ms;
if (pending_ms <= 0)
break;
}
} while (r == -1);
#else /* HAVE_POLL_FINE */
@@ -383,14 +436,26 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
ptimeout = (timeout_ms < 0) ? NULL : &pending_tv;
do {
if (ptimeout) {
if (timeout_ms > 0) {
pending_tv.tv_sec = pending_ms / 1000;
pending_tv.tv_usec = (pending_ms % 1000) * 1000;
}
else if (!timeout_ms) {
pending_tv.tv_sec = 0;
pending_tv.tv_usec = 0;
}
r = select((int)maxfd + 1, &fds_read, &fds_write, &fds_err, ptimeout);
} while ((r == -1) && (error = SOCKERRNO) &&
(error != EINVAL) && (error != EBADF) && error_not_EINTR &&
((timeout_ms < 0) || ((pending_ms = timeout_ms - elapsed_ms) > 0)));
if (r != -1)
break;
error = SOCKERRNO;
if ((error == EINVAL) || (error == EBADF) || error_is_EINTR)
break;
if (timeout_ms > 0) {
pending_ms = timeout_ms - elapsed_ms;
if (pending_ms <= 0)
break;
}
} while (r == -1);
if (r < 0)
return -1;
@@ -417,189 +482,6 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
return r;
}
/*
* This is a wrapper around select(). It uses poll() when a fine
* poll() is available, in order to avoid limits with FD_SETSIZE,
* otherwise select() is used. An error is returned if select() is
* being used and a the number of file descriptors is larger than
* FD_SETSIZE. A NULL timeout pointer makes this function wait
* indefinitely, unles no valid file descriptor is given, when this
* happens the NULL timeout is ignored and the function times out
* immediately. When compiled with CURL_ACKNOWLEDGE_EINTR defined,
* EINTR condition is honored and function might exit early without
* awaiting timeout, otherwise EINTR will be ignored.
*
* Return values:
* -1 = system call error or nfds > FD_SETSIZE
* 0 = timeout
* N = number of file descriptors kept in file descriptor sets.
*/
int Curl_select(int nfds,
fd_set *fds_read, fd_set *fds_write, fd_set *fds_excep,
struct timeval *timeout)
{
struct timeval initial_tv;
int timeout_ms;
int pending_ms;
int error;
int r;
#ifdef HAVE_POLL_FINE
struct pollfd small_fds[SMALL_POLLNFDS];
struct pollfd *poll_fds;
int ix;
int fd;
int poll_nfds = 0;
#else
struct timeval pending_tv;
struct timeval *ptimeout;
#endif
int ret = 0;
if ((nfds < 0) ||
((nfds > 0) && (!fds_read && !fds_write && !fds_excep))) {
SET_SOCKERRNO(EINVAL);
return -1;
}
if (timeout) {
if ((timeout->tv_sec < 0) ||
(timeout->tv_usec < 0) ||
(timeout->tv_usec >= 1000000)) {
SET_SOCKERRNO(EINVAL);
return -1;
}
timeout_ms = (int)(timeout->tv_sec * 1000) + (int)(timeout->tv_usec / 1000);
}
else {
timeout_ms = -1;
}
if ((!nfds) || (!fds_read && !fds_write && !fds_excep)) {
r = wait_ms(timeout_ms);
return r;
}
pending_ms = timeout_ms;
initial_tv = curlx_tvnow();
#ifdef HAVE_POLL_FINE
if (fds_read || fds_write || fds_excep) {
fd = nfds;
while (fd--) {
if ((fds_read && (0 != FD_ISSET(fd, fds_read))) ||
(fds_write && (0 != FD_ISSET(fd, fds_write))) ||
(fds_excep && (0 != FD_ISSET(fd, fds_excep))))
poll_nfds++;
}
}
if (!poll_nfds)
poll_fds = NULL;
else if (poll_nfds <= SMALL_POLLNFDS)
poll_fds = small_fds;
else {
poll_fds = calloc((size_t)poll_nfds, sizeof(struct pollfd));
if (!poll_fds) {
SET_SOCKERRNO(ENOBUFS);
return -1;
}
}
if (poll_fds) {
ix = 0;
fd = nfds;
while (fd--) {
poll_fds[ix].events = 0;
if (fds_read && (0 != FD_ISSET(fd, fds_read)))
poll_fds[ix].events |= (POLLRDNORM|POLLIN);
if (fds_write && (0 != FD_ISSET(fd, fds_write)))
poll_fds[ix].events |= (POLLWRNORM|POLLOUT);
if (fds_excep && (0 != FD_ISSET(fd, fds_excep)))
poll_fds[ix].events |= (POLLRDBAND|POLLPRI);
if (poll_fds[ix].events) {
poll_fds[ix].fd = fd;
poll_fds[ix].revents = 0;
ix++;
}
}
}
do {
if (timeout_ms < 0)
pending_ms = -1;
r = poll(poll_fds, poll_nfds, pending_ms);
} while ((r == -1) && (error = SOCKERRNO) &&
(error != EINVAL) && error_not_EINTR &&
((timeout_ms < 0) || ((pending_ms = timeout_ms - elapsed_ms) > 0)));
if (r < 0)
ret = -1;
if (r > 0) {
ix = poll_nfds;
while (ix--) {
if (poll_fds[ix].revents & POLLNVAL) {
SET_SOCKERRNO(EBADF);
ret = -1;
break;
}
}
}
if (!ret) {
ix = poll_nfds;
while (ix--) {
if (fds_read && (0 != FD_ISSET(poll_fds[ix].fd, fds_read))) {
if (0 == (poll_fds[ix].revents & (POLLRDNORM|POLLERR|POLLHUP|POLLIN)))
FD_CLR(poll_fds[ix].fd, fds_read);
else
ret++;
}
if (fds_write && (0 != FD_ISSET(poll_fds[ix].fd, fds_write))) {
if (0 == (poll_fds[ix].revents & (POLLWRNORM|POLLERR|POLLHUP|POLLOUT)))
FD_CLR(poll_fds[ix].fd, fds_write);
else
ret++;
}
if (fds_excep && (0 != FD_ISSET(poll_fds[ix].fd, fds_excep))) {
if (0 == (poll_fds[ix].revents & (POLLRDBAND|POLLERR|POLLHUP|POLLPRI)))
FD_CLR(poll_fds[ix].fd, fds_excep);
else
ret++;
}
}
}
if (poll_fds && (poll_nfds > SMALL_POLLNFDS))
free(poll_fds);
#else /* HAVE_POLL_FINE */
VERIFY_NFDS(nfds);
ptimeout = (timeout_ms < 0) ? NULL : &pending_tv;
do {
if (ptimeout) {
pending_tv.tv_sec = pending_ms / 1000;
pending_tv.tv_usec = (pending_ms % 1000) * 1000;
}
r = select(nfds, fds_read, fds_write, fds_excep, ptimeout);
} while ((r == -1) && (error = SOCKERRNO) &&
(error != EINVAL) && (error != EBADF) && error_not_EINTR &&
((timeout_ms < 0) || ((pending_ms = timeout_ms - elapsed_ms) > 0)));
if (r < 0)
ret = -1;
else
ret = r;
#endif /* HAVE_POLL_FINE */
return ret;
}
#ifdef TPF
/*
* This is a replacement for select() on the TPF platform.

View File

@@ -46,7 +46,7 @@
* Definition of pollfd struct and constants for platforms lacking them.
*/
#ifndef HAVE_POLL
#ifndef HAVE_SYS_POLL_H
#define POLLIN 0x01
#define POLLPRI 0x02
@@ -76,18 +76,11 @@ struct pollfd
#define POLLRDBAND POLLPRI
#endif
#define CSELECT_IN 0x01
#define CSELECT_OUT 0x02
#define CSELECT_ERR 0x04
int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms);
int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd,
int timeout_ms);
int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms);
int Curl_select(int nfds,
fd_set *fds_read, fd_set *fds_write, fd_set *fds_excep,
struct timeval *timeout);
#ifdef TPF
int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
fd_set* excepts, struct timeval* tv);

View File

@@ -47,7 +47,7 @@
#define _MPRINTF_REPLACE /* use the internal *printf() functions */
#include <curl/mprintf.h>
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
#include "krb4.h"
#else
#define Curl_sec_send(a,b,c,d) -1
@@ -79,11 +79,11 @@ static struct curl_slist *slist_get_last(struct curl_slist *list)
}
/*
* curl_slist_append() appends a string to the linked list. It always retunrs
* the address of the first record, so that you can sure this function as an
* curl_slist_append() appends a string to the linked list. It always returns
* the address of the first record, so that you can use this function as an
* initialization function as well as an append function. If you find this
* bothersome, then simply create a separate _init function and call it
* appropriately from within the proram.
* appropriately from within the program.
*/
struct curl_slist *curl_slist_append(struct curl_slist *list,
const char *data)
@@ -365,7 +365,7 @@ CURLcode Curl_write(struct connectdata *conn,
bytes_written = Curl_sftp_send(conn, num, mem, len);
#endif /* !USE_LIBSSH2 */
else if(conn->sec_complete)
/* only TRUE if krb4 enabled */
/* only TRUE if krb enabled */
bytes_written = Curl_sec_send(conn, num, mem, len);
else
bytes_written = Curl_plain_send(conn, num, mem, len);
@@ -495,7 +495,7 @@ int Curl_read(struct connectdata *conn, /* connection data */
}
/* If we come here, it means that there is no data to read from the buffer,
* so we read from the socket */
bytesfromsocket = MIN(sizerequested, sizeof(conn->master_buffer));
bytesfromsocket = MIN(sizerequested, BUFSIZE * sizeof (char));
buffertofill = conn->master_buffer;
}
else {

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