Compare commits

..

202 Commits

Author SHA1 Message Date
Daniel Stenberg
da59692067 the smell of release 2005-04-05 07:37:08 +00:00
Daniel Stenberg
bae77c0a46 bug report #1156287, ftp upload from VMS 2005-04-05 07:33:30 +00:00
Daniel Stenberg
b42bc7329e win resolve crash, win makefile fix 2005-04-04 22:38:53 +00:00
Daniel Stenberg
9b3c2b6ae2 kill warnings 2005-04-04 21:23:04 +00:00
Daniel Stenberg
833b6df969 Marcelo Juchem's improvements 2005-04-04 13:21:03 +00:00
Gisle Vanem
0b45431139 hostthre.c: destroy_thread_data() made public. Called
from url.c: Curl_disconnect().
2005-04-04 12:30:03 +00:00
Daniel Stenberg
5d1349031c spell fixes, based on the Debian bug report #302820 submitted by "A Costa" 2005-04-04 08:07:04 +00:00
Daniel Stenberg
82388a5e4c fix of tonight 2005-04-03 23:01:33 +00:00
Daniel Stenberg
74816fed6c Hardeep Singh reported a problem doing HTTP POST with Digest. (It was actually
also affecting NTLM and Negotiate.) It turned out that if the server responded
with 100 Continue before the initial 401 response, libcurl didn't take care of
the response properly. Test case 245 and 246 added to verify this.
2005-04-03 22:46:25 +00:00
Daniel Stenberg
b4c9789d5f Test 245 was just added in an attempt to repeat Hardeep Singh's recent bug.
But this works just fine on my host. Plain HTTP POST using Digest.
2005-04-03 22:18:27 +00:00
Daniel Stenberg
f96fadc074 fixed bad comment, pointed out by Marcelo Juchem 2005-03-31 20:34:24 +00:00
Daniel Stenberg
f6b1173437 copyright this year 2005-03-31 14:42:28 +00:00
Daniel Stenberg
346992c366 Attempt to make this code more forgiving for systems that doesn't detect
the failed connect "immediately".
2005-03-31 14:10:54 +00:00
Daniel Stenberg
ab4086bc24 Updated the copyright year since changes have been this year. 2005-03-31 07:02:02 +00:00
Daniel Stenberg
d8e7f2b2c7 the cookie API is better and more likely to happen in a separate release 2005-03-31 06:55:17 +00:00
Daniel Stenberg
93fcb94b62 fix configure's SSL-detection for msys/mingw (from Andres Garcia) 2005-03-30 20:55:44 +00:00
Daniel Stenberg
32a446cf19 format mistake in --form-string, pointed out by Owen Watson 2005-03-30 06:31:32 +00:00
Daniel Stenberg
94459cab98 Better connection keep-alive when POSTing with HTTP Digest or Negotiate. 2005-03-29 21:08:57 +00:00
Daniel Stenberg
158588640a Don't close the connection if we're in a known negotiation mode and we won't
send any data anyway. Probably the bug Tom Moers noticed.
2005-03-29 12:28:25 +00:00
Daniel Stenberg
f00f050d1b proxy multi auth fix, --proxy-anyauth, ftp-ssl and ftp response reading fix 2005-03-29 11:54:07 +00:00
Daniel Stenberg
c4f34c60a5 postpone these 2005-03-29 11:53:22 +00:00
Daniel Stenberg
371ef80dc3 When doing FTP-SSL, advance to the next state properly when the response to
AUTH has been received successfully.
2005-03-29 11:43:02 +00:00
Daniel Stenberg
84b4e9ff7c Fixed the FTP response reader function to properly deal with responses split
up in several chunks when read.
2005-03-29 11:35:25 +00:00
Daniel Stenberg
677a74fa1b Made the server send data to the control/data connections using two dedicated
functions. This enabled me to add a function that automatically delays between
each byte, to proper test curl's ability to read FTP server responses sent in
many (small) chunks. See also upcoming libcurl fixes...
2005-03-29 09:09:58 +00:00
Daniel Stenberg
8a076d1dba Based on Augustus Saunders' comments and findings, the HTTP output auth
function was fixed to use the proper proxy authentication when multiple ones
were added as accepted. test 239 and test 243 were added to repeat the
problems and verify the fixes.
2005-03-28 22:19:31 +00:00
Daniel Stenberg
970722483c Added --proxy-anyauth 2005-03-28 22:17:49 +00:00
Daniel Stenberg
31443724c6 modified some log outputs, added comment about auth required as used in
test 154
2005-03-28 22:15:17 +00:00
Daniel Stenberg
0e7614919b can you spell copy and paste error for me loud and clear? ;-P 2005-03-22 19:58:00 +00:00
Daniel Stenberg
2bf72937d2 provide HTML and PDF versions of the man pages in the dist archive 2005-03-22 19:46:49 +00:00
Daniel Stenberg
4e555c7b32 When cross-compiling, we do some better checking for the NI_WITHSCOPEID option instead of just assuming it is present. 2005-03-22 18:02:06 +00:00
Gisle Vanem
bd7021d05b CURL_EXTERN is already in <curl/curl.h>. 2005-03-22 10:37:26 +00:00
Gisle Vanem
1a14555605 Prevent redefinition warning with CURLDEBUG. 2005-03-22 10:36:20 +00:00
Daniel Stenberg
cb3fb371ea moved out the changes from 2004 to CHANGES.2004 2005-03-22 09:23:56 +00:00
Dan Fandrich
6c6dda1b74 Fixed typo. 2005-03-22 01:24:27 +00:00
Daniel Stenberg
a712808006 the same fix here too, typecast to prevent win32 compiler warning 2005-03-21 22:38:45 +00:00
Daniel Stenberg
e19c203728 typecase to fix win32 compiler warning (and intended as other code is) 2005-03-21 22:37:18 +00:00
Daniel Stenberg
8817779f23 Modified the VALID_SOCK() macro to become VERIFY_SOCK() instead. It is slighly
more involved, but should hopefully not generate any compiler warnings on
win32 systems (that can't check the socket based on the numeric).
2005-03-21 22:34:07 +00:00
Daniel Stenberg
3e5a32671c Make NTLM tests depend on the NTLM feature at not SSL, since the NTLM support
is no longer only present when built with SSL support.
2005-03-21 08:14:32 +00:00
Daniel Stenberg
d34f32b39e format mistake 2005-03-21 07:45:18 +00:00
Daniel Stenberg
c85a77e0b1 removed a (fairly useless) debug output just to compile without warning 2005-03-20 12:46:11 +00:00
Daniel Stenberg
9406e517e6 silence win32 compiler warnings 2005-03-20 12:29:15 +00:00
Daniel Stenberg
4a56049225 attempt to fix the ares link breakage with --enable-debug in libcurl and here 2005-03-20 00:38:50 +00:00
Daniel Stenberg
04ea4b4d75 silence warnings on win32 about static functions that are never used 2005-03-19 01:03:46 +00:00
Daniel Stenberg
5b6b6283f3 some additional debug output 2005-03-19 01:00:00 +00:00
Daniel Stenberg
38f07ce0fb fix compiler warning 2005-03-19 00:44:55 +00:00
Dan Fandrich
987cdebefb Fixed spelling of --runtestopts 2005-03-18 18:41:50 +00:00
Dan Fandrich
6b978db369 Netware builds don't use configure. 2005-03-18 18:03:38 +00:00
Daniel Stenberg
5840c8cb70 fix by Kyrre Kristiansen 2005-03-18 10:16:49 +00:00
Daniel Stenberg
44f2024bab adjust to use plain 'make' even for cross-compiles if using configure-
style build
2005-03-18 09:21:25 +00:00
Daniel Stenberg
410942e9df a Common Lisp binding 2005-03-18 09:01:42 +00:00
Dan Fandrich
5b3730feae Change the bogus address used in test237 to be more reliable when run
on a host with a buggy resolver that strips all but the bottom 8 bits of
each octet.  The resolved address in this case (192.0.2.127) is guaranteed
never to belong to a real host (see RFC3330).
2005-03-17 20:50:17 +00:00
Dan Fandrich
38f797ccd6 Use the proper macro to do uClibc detection. 2005-03-17 20:32:59 +00:00
Daniel Stenberg
553c5a7501 include inet_pton.h 2005-03-17 19:12:15 +00:00
Daniel Stenberg
bbba9d568f added descriptions 2005-03-17 12:16:24 +00:00
Daniel Stenberg
11e43dd021 update year 2005-03-17 12:00:23 +00:00
Daniel Stenberg
e8ddf84871 don't set TEST_F to blank when --runtestopts isn't used, as that will override
the default options set in the Makefile
2005-03-17 09:44:09 +00:00
Daniel Stenberg
67f04d2d5f support multiple error codes for a test case since some things just vary
between platforms
2005-03-17 08:17:48 +00:00
Daniel Stenberg
8f646eef45 add 'FTP ASCII transfers' here, since they seem to be frequently attempted
these days...!
2005-03-17 08:09:10 +00:00
Daniel Stenberg
d26e932858 add new option 2005-03-17 08:04:08 +00:00
Daniel Stenberg
73b9d0840c add new file 2005-03-17 08:04:00 +00:00
Daniel Stenberg
2ea4326c40 its a start 2005-03-17 08:03:46 +00:00
Daniel Stenberg
8b80ac2877 use Curl_inet_pton(), not inet_pton(). 2005-03-17 07:40:15 +00:00
Dan Fandrich
233237740d Added the --runtestsopts option to testcurl.pl to override the default
options used by runtests.pl during testing (useful for disabling valgrind).
2005-03-17 00:57:17 +00:00
Dan Fandrich
f5cdac38bd Removed references to config-vms.h from the makefiles. 2005-03-16 23:09:39 +00:00
Dan Fandrich
760565dcad Removed old VMS config files (on behalf of Marty Kuhrt). The VMS build
scripts use the version in packages/vms/
2005-03-16 22:27:05 +00:00
Daniel Stenberg
b5d97b3d94 more 2005-03-16 22:03:55 +00:00
Daniel Stenberg
4a6cc54eb5 check for the HTTPS server in a manner similar to how we check for the HTTP
server
2005-03-16 22:02:09 +00:00
Daniel Stenberg
61133545f6 - Tru64 and some IRIX boxes seem to not like test 237 as it is. Their
inet_addr() functions seems to use &255 on all numericals in a ipv4 dotted
  address which makes a different failure... Now I've modified the ipv4
  resolve code to use inet_pton() instead in an attempt to make these systems
  better detect this as a bad IP address rather than creating a toally bogus
  address that is then passed on and used.
2005-03-16 22:01:39 +00:00
Dan Fandrich
bf87d13f5b Fixed some compiler warnings I should have noticed before. 2005-03-16 02:25:12 +00:00
Dan Fandrich
efaf688650 Fixed ftp support with uClibc due to differing inet_ntoa_r() behaviour. 2005-03-15 21:00:46 +00:00
Daniel Stenberg
9a5c21c16f test EPSV and PASV response handling when they get well-formated data back
but using illegal values
2005-03-15 12:33:08 +00:00
Daniel Stenberg
06ffb47ef2 initial man page attempt for testcurl.pl 2005-03-15 12:13:37 +00:00
Daniel Stenberg
1acbda97e0 new options to testcurl.pl, fixed curl-config and removed compiler warnings 2005-03-15 07:50:16 +00:00
Daniel Stenberg
d6460aff36 added missing features to curl-config 2005-03-15 07:49:47 +00:00
Daniel Stenberg
a357f77c4c nonsense change for(;;) => while(1) just to prevent gcc from warning on
never executed code when -Wunreachable-code is used
2005-03-15 07:48:45 +00:00
Daniel Stenberg
d5bdd2b2f9 prevent compiler warning 2005-03-15 07:47:59 +00:00
Daniel Stenberg
562d2de303 Added lots of new command line options, made confsuffix get set based on
targetos only and not build os. Commented away the line that enables perl
warnings.
2005-03-15 07:35:36 +00:00
Dan Fandrich
1f68fa19c7 Finally fixed the LDAP library searching bug on libtool ver. 1.5 2005-03-15 04:47:07 +00:00
Dan Fandrich
677ddd6160 Make nonexistent host names absolute so tests will pass on machines
with a wildcard DNS search domain.
2005-03-15 04:04:50 +00:00
Dan Fandrich
228e627475 Use the libtool variables better to make LDAP library search work on
more platforms.
2005-03-14 19:37:07 +00:00
Daniel Stenberg
ec4e653c6f hushing up more warnings 2005-03-14 15:51:10 +00:00
Daniel Stenberg
3916d1e6cb silence compiler warnings for mingw win32 builds --enable-debug 2005-03-14 15:43:23 +00:00
Daniel Stenberg
387aaba810 show LDFLAGS too 2005-03-14 12:26:29 +00:00
Daniel Stenberg
9f3d9da119 if ws2_32 is used, append the lib last in the LIBS list (too) to make it
build and link fine with c-ares
2005-03-14 09:39:11 +00:00
Gisle Vanem
76c24a0d82 Avoid "unused variable" warnings. 2005-03-14 09:37:08 +00:00
Daniel Stenberg
ffd65a1956 configure --enable-sspi 2005-03-14 08:15:06 +00:00
Daniel Stenberg
de8947f92f security.h is removed 2005-03-14 07:46:42 +00:00
Daniel Stenberg
d2b4dedbe4 two issues fixed 2005-03-14 00:52:14 +00:00
Daniel Stenberg
34865ffb4a include security.h with lowercase s to work on cross-compiled mingw 2005-03-14 00:01:30 +00:00
Daniel Stenberg
62970da675 Removed security.h since it shadows an include file mingw needs when building
for SSPI support. The contents of the file has been moved into the krb4.h file.
2005-03-14 00:00:45 +00:00
Daniel Stenberg
8ed31c48e0 Added --enable-sspi that now make libcurl build with SSPI support. This only
works when built for win32.
2005-03-13 23:59:28 +00:00
Gisle Vanem
13d40e33a4 Prevent gcc warning. 2005-03-13 09:21:54 +00:00
Daniel Stenberg
c765213aaa found a common lisp binding 2005-03-12 22:55:57 +00:00
Daniel Stenberg
983bf93a24 --form-string 2005-03-12 19:49:55 +00:00
Daniel Stenberg
2f8085af15 David Houlder added --form-string 2005-03-12 19:39:27 +00:00
Gisle Vanem
88a4dc2795 Swap <security.h> and <sspi.h> (needed for MingW). 2005-03-12 17:31:15 +00:00
Dan Fandrich
b5112096d7 Work around a bug in libtool ver. 1.5 during LDAP library detection. 2005-03-11 23:07:40 +00:00
Daniel Stenberg
fc80c714e8 added CURL_VERSION_SSPI 2005-03-11 15:18:46 +00:00
Daniel Stenberg
84bc23b92f curl_version_info() returns the feature bit CURL_VERSION_SSPI 2005-03-11 15:10:36 +00:00
Daniel Stenberg
d90472dd64 fixed two leftover from Christopher's patch 2005-03-11 15:10:08 +00:00
Daniel Stenberg
3b63ed8230 the ares_parse_aaaa_reply man page 2005-03-11 08:34:51 +00:00
Daniel Stenberg
e75441e027 Check for winsock.h to work with win32. Only include system headers we know
exist.
2005-03-11 08:14:36 +00:00
Daniel Stenberg
0ae8b51230 Replace AC_TRY_RUN() with AC_EGREP_CPP() when checking for constants to
work fine with cross-compiled builds.
2005-03-11 08:06:57 +00:00
Daniel Stenberg
547c136b4f oops, once is enough! ;-) 2005-03-11 08:03:20 +00:00
Daniel Stenberg
4ed13bde55 Define HAVE_AF_INET6_H for Netware too, as Guenter Knauf's builds indicate. 2005-03-11 07:53:42 +00:00
Dan Fandrich
80e01deba0 Added HAVE_AF_INET6 to Netware's config.h 2005-03-11 07:52:24 +00:00
Dan Fandrich
fb9ae9d0e2 Fixed some compiler warnings. 2005-03-11 05:49:04 +00:00
Dan Fandrich
dd54d8551b Added HAVE_STRUCT_IN6_ADDR to Netware's config.h 2005-03-11 05:39:37 +00:00
Dan Fandrich
205f8b266c Fixed LDAP library file name bug (KNOWN_BUGS #1). configure now auto-detects
the correct dynamic library names by default, and provides override switches
--with-ldap-lib, --with-lber-lib and --without-lber-lib.  Added
CURL_DISABLE_LDAP to platform-specific config files to disable LDAP
support on those platforms that probably don't have dynamic OpenLDAP
libraries available to avoid compile errors.
2005-03-11 05:28:07 +00:00
Daniel Stenberg
c4ce9ac4de Add an alert already here if 'make test' is attempted for a cross-compile
since there's no use building the whole test suite first and _then_ tell it
doesn't work anyway...
2005-03-11 00:44:32 +00:00
Daniel Stenberg
0e4e28fdda no more rewriting of the setup file 2005-03-11 00:20:30 +00:00
Daniel Stenberg
db2370a12f Dominick Meglio added ares_parse_aaaa_reply.c and did various adjustments. The
first little steps towards IPv6 support!
2005-03-10 23:30:34 +00:00
Daniel Stenberg
d1d35ba85f Christopher R. Palmer made it possible to build libcurl with the
USE_WINDOWS_SSPI on Windows, and then libcurl will be built to use the native
way to do NTLM. SSPI also allows libcurl to pass on the current user and its
password in the request.
2005-03-10 23:15:29 +00:00
Daniel Stenberg
2ab2e7675c configure, socks, debug, getdate 2005-03-09 23:35:14 +00:00
Daniel Stenberg
0472629222 As reported by 'nodak sodak' we should check for a NULL pointer before
referencing the proxy name pointer.
2005-03-09 22:13:52 +00:00
Dan Fandrich
c4f7570a23 Stopped linking to the SSL libs if a full installation isn't found.
Removed a redundant library check.
2005-03-09 18:40:41 +00:00
Daniel Stenberg
d26cfd5791 skip the test of "2094 Nov 6" for now, since the 64bit time_t systems return
different values for it...
2005-03-09 07:56:32 +00:00
Daniel Stenberg
b7ffc6bb45 remove old printf() debug leftover 2005-03-08 22:21:59 +00:00
Daniel Stenberg
8a96aec567 mktime() returns a time_t. time_t is often 32 bits, even on many architectures
that feature 64 bit 'long'.

Some systems have 64 bit time_t and deal with years beyond 2038. However, even
some of the systems with 64 bit time_t returns -1 for dates beyond 03:14:07
UTC, January 19, 2038. (Such as AIX 5100-06)
2005-03-08 16:31:56 +00:00
Daniel Stenberg
5cd9f57137 days are english 2005-03-08 11:15:29 +00:00
Daniel Stenberg
702664e959 Dominick Meglio reported that using CURLOPT_FILETIME when transferring a FTP
file got a Last-Modified: header written to the data stream, corrupting the
actual data. This was because some conditions from the previous FTP code was
not properly brought into the new FTP code. I fixed and I added test case 520
to verify. (This bug was introduced in 7.13.1)
2005-03-08 08:09:14 +00:00
Dan Fandrich
18d87edd6d Fixed the --with-zlib configure option so that it always adds the specified
path to the compiler flags.  Before, a zlib installation in the default
path was always used in preference to the one in the desired location.
2005-03-08 03:24:49 +00:00
Dan Fandrich
dc59795629 fseek() with SEEK_SET is broken on large file capable 32-bit systems, so
revert to the SEEK_END method of repositioning the stream after a ftruncate()
and only use SEEK_SET if ftruncate() isn't available.
2005-03-07 18:59:04 +00:00
Daniel Stenberg
cb9bb31f7d test 236: FTP resume upload but denied access to remote file 2005-03-07 08:29:28 +00:00
Daniel Stenberg
02706bec94 valgrind.pm fixed 2005-03-07 08:11:36 +00:00
Daniel Stenberg
7657186bf6 added valgrind.pm to the dist 2005-03-06 22:33:05 +00:00
Dan Fandrich
42ac24448c Better cope with a failed or unavailable ftruncate().
Added HAVE_FTRUNCATE to all the static config-*.h files on the assumption
that all those systems provide it.
2005-03-05 00:54:16 +00:00
Daniel Stenberg
31891b55a4 Samuel Daz Garca's correction 2005-03-05 00:04:52 +00:00
Daniel Stenberg
aa47ac4c06 Added test case 235 that makes a resumed upload of a file that isn't present
on the remote side. This then converts the operation to an ordinary STOR
upload. This was requested/pointed out by Ignacio Vazquez-Abrams.

It also proved (and I fixed) a bug in the newly rewritten ftp code (and
present in the 7.13.1 release) when trying to resume an upload and the servers
returns an error to the SIZE command. libcurl then loops and sends SIZE
commands infinitely.
2005-03-04 23:52:06 +00:00
Dan Fandrich
b01151e81c Reduced the length of data read from the random entropy file. 2005-03-04 22:36:56 +00:00
Dan Fandrich
67bd6f9ccd Don't try to read the whole of the random file because when /dev/urandom is
used, it slows initialization too much reading an infinitely long file!
2005-03-04 20:10:29 +00:00
Daniel Stenberg
4869fa285b 7.13.2-CVS 2005-03-04 15:42:33 +00:00
Daniel Stenberg
d221e01406 starting over 2005-03-04 14:09:04 +00:00
Daniel Stenberg
874fc8228a stand clear for release time 2005-03-04 13:41:46 +00:00
Daniel Stenberg
6f752c64bc Dave Dribin made it possible to set CURLOPT_COOKIEFILE to "" to activate
the cookie "engine" without having to provide an empty or non-existing file.
2005-03-04 00:26:50 +00:00
Daniel Stenberg
ccb7950c4c killed trailing whitespace 2005-03-04 00:24:52 +00:00
Daniel Stenberg
750e771376 killed trailing whitespace 2005-03-04 00:14:45 +00:00
Daniel Stenberg
7012a4a291 Rene Rebe fixed a -# crash when more data than expected was retrieved. 2005-03-04 00:12:02 +00:00
Daniel Stenberg
40ab20a252 new VB binding 2005-03-03 23:27:09 +00:00
Daniel Stenberg
6af315e50c VB binding, updated the .NET info 2005-03-03 23:25:13 +00:00
Daniel Stenberg
861b5e608b mention buffer overflows fixed 2005-03-03 13:13:21 +00:00
Daniel Stenberg
f61917594e fix the distribution files 2005-03-03 06:51:31 +00:00
Dan Fandrich
0ddab51ad8 Fix for a base64 decode heap buffer overflow vulnerability. 2005-02-28 23:54:17 +00:00
Dan Fandrich
9798432f56 Fixed some compiler warnings. Fixed a low incidence memory leak in the test server. 2005-02-24 18:54:23 +00:00
Daniel Stenberg
5faf52619d Updated as suggested by Samuel Daz Garca 2005-02-22 18:39:40 +00:00
Daniel Stenberg
f8b4ba80e0 krb4 fixed 2005-02-22 12:20:30 +00:00
Daniel Stenberg
527f70e540 Curl_base64_decode() now returns an allocated buffer 2005-02-22 12:10:30 +00:00
Daniel Stenberg
19f66c7575 Thanks for the notification iDEFENCE. We are the "initial vendor" and we sure
got no notification, no mail, no nothing.

You didn't even bother to mail us when you went public with this. Cool.

NTLM buffer overflow fix, as reported here:

http://www.securityfocus.com/archive/1/391042
2005-02-22 07:44:14 +00:00
Daniel Stenberg
b7721deb02 added test case 234 which is like 233 but uses --location-trusted instead so
thus the second request to the new host will use authentication fine
2005-02-19 22:33:06 +00:00
Daniel Stenberg
5ba188ab2d Ralph Mitchell reported a flaw when you used a proxy with auth, and you
requested data from a host and then followed a redirect to another
host. libcurl then didn't use the proxy-auth properly in the second request,
due to the host-only check for original host name wrongly being extended to
the proxy auth as well. Added test case 233 to verify the flaw and that the
fix removed the problem.
2005-02-18 23:53:07 +00:00
Daniel Stenberg
eadfd78c2e socket leak, mingw build 2005-02-18 11:54:52 +00:00
Daniel Stenberg
4d815c9990 Based on Mike Dobbs' report, BUILDING_LIBCURL is now defined in here if it
runs to build with mingw.
2005-02-18 08:24:53 +00:00
Daniel Stenberg
176981b529 close the socket properly when returning error due to failing localbind
Bug report #1124588 by David
2005-02-17 14:45:03 +00:00
Daniel Stenberg
85baebd0d4 mention filename= for the -F 2005-02-17 07:47:32 +00:00
Daniel Stenberg
ac022b2e30 Christopher R. Palmer reported a problem with HTTP-POSTing using "anyauth"
that picks NTLM. Thanks to David Byron letting me test NTLM against his
servers, I could quickly repeat and fix the problem. It turned out to be:

When libcurl POSTs without knowing/using an authentication and it gets back a
list of types from which it picks NTLM, it needs to either continue sending
its data if it keeps the connection alive, or not send the data but close the
connection. Then do the first step in the NTLM auth. libcurl didn't send the
data nor close the connection but simply read the response-body and then sent
the first negotiation step. Which then failed miserably of course. The fixed
version forces a connection if there is more than 2000 bytes left to send.
2005-02-16 14:31:23 +00:00
Daniel Stenberg
f169b750b8 check for ENGINE_load_builtin_engines() as well if engine is around 2005-02-14 23:50:29 +00:00
Marty Kuhrt
86295eef13 changed config-vms info 2005-02-14 22:37:59 +00:00
Marty Kuhrt
32d60b2714 changed curlmsg.* entries to see if CVS would ignore it now 2005-02-14 22:36:21 +00:00
Daniel Stenberg
0a3065a2f2 Rename Curl_pretransfersec() to *_second_connect() since it does not just
do pretransfer stuff like Curl_pretransfer().
2005-02-14 09:30:40 +00:00
Daniel Stenberg
b98faaa8c0 Fixed bad krb4 code. It always tried to use krb4 if built enabled. 2005-02-11 22:50:57 +00:00
Marty Kuhrt
73772323c9 rename amigaos.c and nwlib.c if they exist before building 2005-02-11 22:42:16 +00:00
Daniel Stenberg
98389066e2 Removed per Marty's request: The .h_* files aren't needed anymore, I
consolidated them into one file called config-vms.h.  The curlmsg.h and .sdl
files are generated from the curlmsg.msg file and, thus, shouldn't be in the
dist.
2005-02-11 22:05:04 +00:00
Marty Kuhrt
fb53ed4c1f re-sync'd with curlmsg.msg 2005-02-11 21:17:23 +00:00
Marty Kuhrt
e719eb5b81 ignore curlmsg.h and .sdl as they are generated by curlmsg.msg 2005-02-11 21:07:35 +00:00
Marty Kuhrt
3858063bcd sync'd error codes with include/curl.h 2005-02-11 21:01:52 +00:00
Marty Kuhrt
d4f5fea840 Added $Id$ and pre-exisiting logical check 2005-02-11 20:17:21 +00:00
Daniel Stenberg
22c1d48cb2 remove the check for strftime(), we don't need it 2005-02-11 19:34:05 +00:00
Daniel Stenberg
e7cefd684b Removed all uses of strftime() since it uses the localised version of the
week day names and month names and servers don't like that.
2005-02-11 00:03:49 +00:00
Daniel Stenberg
d2485e4f20 valgrind stuff for test suite, vms build and more 2005-02-10 08:57:23 +00:00
Daniel Stenberg
160d6b26b0 Moved out the valgrind report parser to valgrind.pm, to make it easier to
test it outside the test suite. Now we also disable valgrind usage if libcurl
was built shared, as then valgrind is only testing the wrapper-script running
shell which is pointless.
2005-02-10 08:50:33 +00:00
Daniel Stenberg
17d61e4f29 typecast assign to ftpport from int to prevent warnings 2005-02-10 07:45:26 +00:00
Daniel Stenberg
446b9467da init fix for non-SSL builds 2005-02-10 07:45:08 +00:00
Marty Kuhrt
3970a7056c Reduced the two config-vms.h_* files into this one. 2005-02-10 01:54:11 +00:00
Daniel Stenberg
74068a6d1b David Byron fixed his SSL problems, initially mentioned here:
http://curl.haxx.se/mail/lib-2005-01/0240.html. It turned out we didn't use
SSL_pending() as we should.

This was TODO-RELEASE issue #59.
2005-02-09 23:16:03 +00:00
Daniel Stenberg
8c83422fe2 David Byron identified the lack of SSL_pending() use, and this is my take
at fixing this issue.
2005-02-09 23:09:12 +00:00
Daniel Stenberg
61a1e3cd01 better error checking and SSL init by David Byron 2005-02-09 23:04:51 +00:00
Daniel Stenberg
89cac6f25c prevent a compiler warning 2005-02-09 22:47:57 +00:00
Gisle Vanem
62082293c5 Some functions are static here, but extern in libxml's
SAX.h. gcc doesn't like that. Rename.
2005-02-09 15:15:01 +00:00
Daniel Stenberg
153fd2752c the new ftp code and Gisle's DICT fix 2005-02-09 14:34:46 +00:00
Daniel Stenberg
e649a40f5d issue #54 done 2005-02-09 14:29:57 +00:00
Gisle Vanem
32d76a5b57 Set 'bits.close' in case of malloc fail.
Don't free 'lud_dn' twice in case curl_unescape()
fails.
2005-02-09 14:28:35 +00:00
Daniel Stenberg
14aa3fa258 add missing error codes 2005-02-09 14:13:21 +00:00
Gisle Vanem
f5394cccb1 Use CURL_SOCKET_BAD. 2005-02-09 14:01:15 +00:00
Gisle Vanem
64dd9c7656 Handle CURLE_LOGIN_DENIED in strerror.c.
For ftp only?
2005-02-09 13:59:40 +00:00
Daniel Stenberg
16ae0c6466 FD_SET can be big macro, use braces 2005-02-09 13:47:35 +00:00
Daniel Stenberg
6a2e21ec8c FTP code turned into state machine. Not completely yet, but a good start.
The tag 'before_ftp_statemachine' was set just before this commit in case
of future need.
2005-02-09 13:06:40 +00:00
Gisle Vanem
120f17ce04 Replace LF with CRLF. Ref RFC-2229, sec 2.3:
"Each command line must be terminated by a CRLF".
2005-02-09 11:50:41 +00:00
Daniel Stenberg
ab938bb9bd -O clarification 2005-02-08 23:39:47 +00:00
Daniel Stenberg
33820cd2ac inflate and out of memory fixes 2005-02-08 19:07:28 +00:00
Daniel Stenberg
41def21f91 ares_gethostbyname wants a 'ares_host_callback' in the 4th argument 2005-02-08 19:03:27 +00:00
Gisle Vanem
d118312922 Curl_addrinfo?_callback() and addrinfo_callback() now returns
CURLE_OK or CURLE_OUT_OF_MEMORY.
Add typecast in hostares.c.
2005-02-08 12:36:13 +00:00
Gisle Vanem
82b93e4945 Don't free too much in freedirs() if realloc() fails. 2005-02-08 12:32:28 +00:00
Daniel Stenberg
e36fb1ecda Curl_wait_for_resolv() no longer disconnects on failure, but leaves that
operation to the caller. Disconnecting has the disadvantage that the conn
pointer gets completely invalidated and this is not handled on lots of places
in the code.
2005-02-08 07:36:57 +00:00
Dan Fandrich
e4a1788614 Fix for a bug report that compressed files that are exactly 64 KiB long
produce a zlib error.
2005-02-07 19:12:37 +00:00
Gisle Vanem
7b23eff9cf Preserve previous status in Curl_http_done(). 2005-02-06 12:43:40 +00:00
Daniel Stenberg
67ff8e3ea3 valgrind errors occur too often when 'make test' is used. It is because too
many third-party libs and tools have problems. When curl is built without
--disable-shared, the testing is done with a front-end script which makes the
valgrind testing include (ba)sh as well and that often causes valgrind
errors. Either we improve the valgrind error scanner a lot to better identify
(lib)curl errors only, or we disable valgrind checking by default
2005-02-05 10:25:20 +00:00
Daniel Stenberg
2248599ae1 fix type 2005-02-04 23:53:12 +00:00
Daniel Stenberg
29350b363b Eric Vergnaud found a use of an uninitialized variable 2005-02-04 23:43:44 +00:00
Daniel Stenberg
83c470a443 David Byron pointed out that this -1 on the buffer size is pointless since
the buffer is already BUFSIZE +1 one big to fit the extra trailing zero. This
change is reported to fix David's weird SSL problem...
2005-02-04 13:42:41 +00:00
Daniel Stenberg
ab96e2d6e9 another example 2005-02-02 19:25:49 +00:00
Daniel Stenberg
6b81cf4bc9 HTML parsing example with libtidy, by Jeff Pohlmeyer 2005-02-02 19:25:37 +00:00
Daniel Stenberg
0d9301539e and we start over again 2005-02-01 08:46:06 +00:00
188 changed files with 8635 additions and 5484 deletions

2236
CHANGES

File diff suppressed because it is too large Load Diff

1994
CHANGES.2004 Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
COPYRIGHT AND PERMISSION NOTICE COPYRIGHT AND PERMISSION NOTICE
Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se>. Copyright (c) 1996 - 2005, Daniel Stenberg, <daniel@haxx.se>.
All rights reserved. All rights reserved.

View File

@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___ # | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____| # \___|\___/|_| \_\_____|
# #
# Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. # Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
# #
# This software is licensed as described in the file COPYING, which # This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms # you should have received as part of this distribution. The terms
@@ -48,6 +48,15 @@ pdf:
check: test check: test
if CROSSCOMPILING
test-full: test
test-torture: test
test:
@echo "NOTICE: we can't run the tests when cross-compiling!"
else
test: test:
@(cd tests; $(MAKE) all quiet-test) @(cd tests; $(MAKE) all quiet-test)
@@ -57,6 +66,8 @@ test-full:
test-torture: test-torture:
@(cd tests; $(MAKE) all torture-test) @(cd tests; $(MAKE) all torture-test)
endif
# #
# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros # Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
# must contain the following line: # must contain the following line:

View File

@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___ # | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____| # \___|\___/|_| \_\_____|
# #
# Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. # Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
# #
# This software is licensed as described in the file COPYING, which # This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms # you should have received as part of this distribution. The terms
@@ -174,6 +174,12 @@ vc-zlib-dll:
cd ..\src cd ..\src
nmake /f Makefile.vc6 cfg=release-zlib-dll nmake /f Makefile.vc6 cfg=release-zlib-dll
vc-sspi:
cd lib
nmake /f Makefile.vc6 cfg=release WINDOWS_SSPI=1
cd ..\src
nmake /f Makefile.vc6 cfg=release WINDOWS_SSPI=1
djgpp: djgpp:
$(MAKE) -C lib -f Makefile.dj $(MAKE) -C lib -f Makefile.dj
$(MAKE) -C src -f Makefile.dj $(MAKE) -C src -f Makefile.dj

View File

@@ -1,60 +1,57 @@
Curl and libcurl 7.13.0 Curl and libcurl 7.13.2
Public curl release number: 85 Public curl release number: 87
Releases counted from the very beginning: 112 Releases counted from the very beginning: 114
Available command line options: 104 Available command line options: 106
Available curl_easy_setopt() options: 122 Available curl_easy_setopt() options: 122
Number of public functions in libcurl: 46 Number of public functions in libcurl: 46
Amount of public web site mirrors: 15 Amount of public web site mirrors: 20
Number of known libcurl bindings: 29 Number of known libcurl bindings: 31
This release includes the following changes: This release includes the following changes:
o added --ftp-account and CURLOPT_FTP_ACCOUNT o Added --form-string
o added CURLOPT_SOURCE_URL and CURLOPT_SOURCE_QUOTE o libcurl can be built with SSPI support. curl_version_info() then returns
o obsoleted CURLOPT_SOURCE_HOST, CURLOPT_SOURCE_PATH, CURLOPT_SOURCE_PORT a new feature bit: CURL_VERSION_SSPI. configure --enable-sspi added
and CURLOPT_PASV_HOST o Added --proxy-anyauth
o added --3p-url, --3p-user and --3p-quote o Added runtests.1 and testcurl.1 man pages
o -Q "+[command]" was added
o src/getpass.c license issue sorted (code was rewritten)
o curl -w now supports 'http_connect' for the proxy's response to CONNECT
o introducing "curl-config --protocols"
This release includes the following bugfixes: This release includes the following bugfixes:
o re-sending a request when retrying on a fresh connection with multi o the MSVC libcurl Makefile was fixed
interface o libcurl on Windows crash if resolver was active when easy handle was killed
o improved valgrind report parser in the test suite o HTTP POST with auth and an initial 100 response before the 401/407
o several valgrind reports o configure's SSL-detection for msys/mingw
o CURLOPT_FTPPORT and -P work when built ipv6-enabled o better connection keep-alive when POSTing with HTTP Digest
o FTP third party transfers was much improved o FTP-SSL
o proxy environment variables are now ignored when built HTTP-disabled o reading FTP server response in multiple reads
o CURLOPT_PROXY can now disable HTTP proxy even when built HTTP-disabled o picking one out of multiple proxy auth methods
o "curl dictionary.com" no longer assumes DICT protocol o inet_ntoa_r() when built with uClibc
o re-invoke some system calls on EINTR o the so name issue for the LDAP library dynamic load
o duplicate Host: when failed connection re-use o crash when using SOCKS4 proxy
o SOCKS5 version check o a debug printf() was removed
o memory problem with cleaning up multi interface o CURLOPT_FILETIME when downloading FTP corrupted data
o SSL certificate name memory leak o FTP upload resume now works even if no file is present on the site
o -d with -G to multiple URLs crashed o SSL seeding no longer attempts to read the whole random file
o double va_list access crash fixed
o minor memory leak when "version" is set in a cookie header
o builds fine on BeOS and NetBSD
o builds and runs fine on FreeBSD
Other curl-related news since the previous public release: Other curl-related news since the previous public release:
o cURLpp 0.3.2 - https://rrette.com/curlpp.html o the cURL project is now over 7 years old
o pycURL 7.12.3 - http://pycurl.sourceforge.net/ o daily curl binary builds for Windows fresh from CVS:
o new web mirror: http://curl.mirrormonster.com/ (US, California) http://cool.haxx.se/curl-daily/
o curl-tracker is a new mailinglist for "tracker" activities:
http://cool.haxx.se/mailman/listinfo/curl-tracker
o libcurl binding for Common Lisp: http://common-lisp.net/project/cl-curl/
o pycurl 7.13.1 http://pycurl.sf.net
o http://curl.tolix.org is a new Californian mirror
o http://curl.seekmeup.com/ is a new mirror in US Texas
This release would not have looked like this without help, code, reports and This release would not have looked like this without help, code, reports and
advice from friends like these: advice from friends like these:
Dan Fandrich, Peter Pentchev, Marcin Konicki, Rune Kleveland, David Shaw, Dan Fandrich, Ignacio Vazquez-Abrams, Randy McMurchy, Dominick Meglio,
Werner Koch, Gisle Vanem, Alex Neblett, Kai Sommerfeld, Marty Kuhrt, Jean-Marc Ranger, Tor Arntsen, Nodak Sodak, David Houlder, Gisle Vanem,
Hzhijun, Pavel Orehov, Bruce Mitchener, Cyrill Osterwalder, Dan Torop, Christopher R. Palmer, Gwenole Beauchesne, Augustus Saunders, Jesper Jensen,
Martijn Koster, Alex aka WindEagle, Cody Jones, Samuel D<>az Garc<72>a, Tom Moers, Andres Garcia, Hardeep Singh, Marcelo Juchem
Stephan Bergmann, Philippe Hameau, Ian Ford, Stephen More, Lars Nilsson
Thanks! (and sorry if I forgot to mention someone) Thanks! (and sorry if I forgot to mention someone)

View File

@@ -1,21 +1,15 @@
Issues not sorted in any particular order. Issues not sorted in any particular order.
To get fixed in 7.13.1 (planned release: April 2005) To get fixed in 7.13.3 (planned release: June 2005)
====================== ======================
58 - Fix KNOWN_BUGS #19: "FTP 3rd party transfers with the multi interface 58 - Fix KNOWN_BUGS #19: "FTP 3rd party transfers with the multi interface
doesn't work" doesn't work"
59 - Figure out a fix for David Byron's SSL problems:
http://curl.haxx.se/mail/lib-2005-01/0240.html
47 - Peter Sylvester's patch for SRP on the TLS layer 47 - Peter Sylvester's patch for SRP on the TLS layer
Awaits OpenSSL support for this, no need to support this in libcurl before Awaits OpenSSL support for this, no need to support this in libcurl before
there's an OpenSSL release that does it. there's an OpenSSL release that does it.
54 - Turn the FTP code into a state machine to support the multi interface
100% non-blocking.
To get fixed in 7.14.0 To get fixed in 7.14.0
====================== ======================
@@ -30,7 +24,12 @@ To get fixed in 7.14.0
internally use and assume the multi interface. The select()-loop should internally use and assume the multi interface. The select()-loop should
use the new function from (55). use the new function from (55).
To get fixed in 7.15.0
======================
57 - Add an interface to libcurl for getting and setting cookies from an easy 57 - Add an interface to libcurl for getting and setting cookies from an easy
handle. One idea: http://curl.haxx.se/mail/lib-2004-12/0195.html the handle. One idea: http://curl.haxx.se/mail/lib-2004-12/0195.html the
older idea: http://curl.haxx.se/dev/COOKIES. We need to settle on some older idea: http://curl.haxx.se/dev/COOKIES. We need to settle on some
middle ground I guess. middle ground I guess.
60 -

View File

@@ -322,8 +322,24 @@ dnl program worked:
[ ac_cv_working_ni_withscopeid="yes" ], [ ac_cv_working_ni_withscopeid="yes" ],
dnl program failed: dnl program failed:
[ ac_cv_working_ni_withscopeid="no" ], [ ac_cv_working_ni_withscopeid="no" ],
dnl we cross-compile: dnl we cross-compile, check the headers using the preprocessor
[ ac_cv_working_ni_withscopeid="yes" ] [
AC_EGREP_CPP(WORKS,
[
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#ifdef NI_WITHSCOPEID
WORKS
#endif
],
ac_cv_working_ni_withscopeid="yes",
ac_cv_working_ni_withscopeid="no" )
]
) dnl end of AC_RUN_IFELSE ) dnl end of AC_RUN_IFELSE
]) dnl end of AC_CACHE_CHECK ]) dnl end of AC_CACHE_CHECK
@@ -766,3 +782,72 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
]) dnl end of AC_DEFUN() ]) dnl end of AC_DEFUN()
dnl Determine the name of the library to pass to dlopen() based on the name
dnl that would normally be given to AC_CHECK_LIB. The preprocessor symbol
dnl given is set to the quoted library file name.
dnl The standard dynamic library file name is first generated, based on the
dnl current system type, then a search is performed for that file on the
dnl standard dynamic library path. If it is a symbolic link, the destination
dnl of the link is used as the file name, after stripping off any minor
dnl version numbers. If a library file can't be found, a guess is made.
dnl This macro assumes AC_PROG_LIBTOOL has been called and requires perl
dnl to be available in the PATH, or $PERL to be set to its location.
dnl
dnl CURL_DLLIB_NAME(VARIABLE, library_name)
dnl e.g. CURL_DLLIB_NAME(LDAP_NAME, ldap) on a Linux system might result
dnl in LDAP_NAME holding the string "libldap.so.2".
AC_DEFUN([CURL_DLLIB_NAME],
[
AC_MSG_CHECKING([name of dynamic library $2])
dnl The shared library extension variable name changes from version to
dnl version of libtool. Try a few names then just set one statically.
test -z "$shared_ext" && shared_ext="$shrext_cmds"
test -z "$shared_ext" && shared_ext="$shrext"
test -z "$shared_ext" && shared_ext=".so"
dnl Create the library link name of the correct form for this platform
LIBNAME_LINK_SPEC=`echo "$library_names_spec" | $SED 's/^.* //'`
DLGUESSLIB=`name=$2 eval echo "$libname_spec"`
DLGUESSFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$LIBNAME_LINK_SPEC"`
dnl Synthesize a likely dynamic library name in case we can't find an actual one
SO_NAME_SPEC="$soname_spec"
dnl soname_spec undefined when identical to the 1st entry in library_names_spec
test -z "$SO_NAME_SPEC" && SO_NAME_SPEC=`echo "$library_names_spec" | $SED 's/ .*$//'`
DLGUESSSOFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$SO_NAME_SPEC"`
if test "$cross_compiling" = yes; then
dnl Can't look at filesystem when cross-compiling
AC_DEFINE_UNQUOTED($1, "$DLGUESSSOFILE", [$2 dynamic library file])
AC_MSG_RESULT([$DLGUESSSOFILE (guess while cross-compiling)])
else
DLFOUNDFILE=""
if test "$sys_lib_dlsearch_path_spec" ; then
dnl Search for the link library name and see what it points to.
for direc in $sys_lib_dlsearch_path_spec ; do
DLTRYFILE="$direc/$DLGUESSFILE"
dnl Find where the symbolic link for this name points
changequote(<<, >>)dnl
<<
DLFOUNDFILE=`${PERL:-perl} -e 'use File::Basename; (basename(readlink($ARGV[0])) =~ /^(.*[^\d]\.\d+)[\d\.]*$/ && print ${1}) || exit 1;' "$DLTRYFILE" 2>&5`
>>
changequote([, ])dnl
if test "$?" -eq "0"; then
dnl Found the file link
break
fi
done
fi
if test -z "$DLFOUNDFILE" ; then
dnl Couldn't find a link library, so guess at a name.
DLFOUNDFILE="$DLGUESSSOFILE"
fi
AC_DEFINE_UNQUOTED($1, "$DLFOUNDFILE", [$2 dynamic library file])
AC_MSG_RESULT($DLFOUNDFILE)
fi
])

View File

@@ -1,5 +1,10 @@
Changelog for the c-ares project Changelog for the c-ares project
* March 11, 2005
- Dominick Meglio added ares_parse_aaaa_reply.c and did various
adjustments. The first little steps towards IPv6 support!
* November 7 * November 7
- Fixed the VC project and makefile to use ares_cancel and ares_version - Fixed the VC project and makefile to use ares_cancel and ares_version

View File

@@ -3,7 +3,8 @@ ares__close_sockets.c ares_free_string.c ares_search.c ares__get_hostent.c \
ares_gethostbyaddr.c ares_send.c ares__read_line.c ares_gethostbyname.c \ ares_gethostbyaddr.c ares_send.c ares__read_line.c ares_gethostbyname.c \
ares_strerror.c ares_cancel.c ares_init.c ares_timeout.c ares_destroy.c \ ares_strerror.c ares_cancel.c ares_init.c ares_timeout.c ares_destroy.c \
ares_mkquery.c ares_version.c ares_expand_name.c ares_parse_a_reply.c \ ares_mkquery.c ares_version.c ares_expand_name.c ares_parse_a_reply.c \
windows_port.c ares_expand_string.c ares_parse_ptr_reply.c windows_port.c ares_expand_string.c ares_parse_ptr_reply.c \
ares_parse_aaaa_reply.c
HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h nameser.h HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h nameser.h
@@ -12,4 +13,4 @@ MANPAGES= ares_destroy.3 ares_expand_name.3 ares_expand_string.3 ares_fds.3 \
ares_gethostbyname.3 ares_init.3 ares_init_options.3 ares_mkquery.3 \ ares_gethostbyname.3 ares_init.3 ares_init_options.3 ares_mkquery.3 \
ares_parse_a_reply.3 ares_parse_ptr_reply.3 ares_process.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_query.3 ares_search.3 ares_send.3 ares_strerror.3 ares_timeout.3 \
ares_version.3 ares_cancel.3 ares_version.3 ares_cancel.3 ares_parse_aaaa_reply.3

View File

@@ -20,7 +20,7 @@ endif
TARGETS = adig.nlm ahost.nlm TARGETS = adig.nlm ahost.nlm
LTARGET = libcares.lib LTARGET = libcares.lib
VERSION = $(LIBCARES_VERSION) VERSION = $(LIBCARES_VERSION)
COPYR = Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se> COPYR = Copyright (C) 1996 - 2005, Daniel Stenberg, <daniel@haxx.se>
DESCR = cURL $(subst .def,,$(notdir $@)) $(LIBCARES_VERSION_STR) - http://curl.haxx.se DESCR = cURL $(subst .def,,$(notdir $@)) $(LIBCARES_VERSION_STR) - http://curl.haxx.se
MTSAFE = YES MTSAFE = YES
STACK = 64000 STACK = 64000
@@ -297,6 +297,8 @@ config.h: Makefile.netware
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@ @echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
ifdef NW_WINSOCK ifdef NW_WINSOCK
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@ @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
else else

View File

@@ -99,3 +99,50 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
]) dnl end of AC_DEFUN() ]) dnl end of AC_DEFUN()
dnl This macro determines if the specified struct exists in the specified file
dnl Syntax:
dnl CARES_CHECK_STRUCT(headers, struct name, if found, [if not found])
AC_DEFUN([CARES_CHECK_STRUCT], [
AC_MSG_CHECKING([for struct $2])
AC_TRY_COMPILE([$1],
[
struct $2 struct_instance;
], ac_struct="yes", ac_found="no")
if test "$ac_struct" = "yes" ; then
AC_MSG_RESULT(yes)
$3
else
AC_MSG_RESULT(no)
$4
fi
])
dnl This macro determines if the specified constant exists in the specified file
dnl Syntax:
dnl CARES_CHECK_CONSTANT(headers, constant name, if found, [if not found])
AC_DEFUN([CARES_CHECK_CONSTANT], [
AC_MSG_CHECKING([for $2])
AC_EGREP_CPP(VARIABLEWASDEFINED,
[
$1
#ifdef $2
VARIABLEWASDEFINED
#else
NJET
#endif
], ac_constant="yes", ac_constant="no"
)
if test "$ac_constant" = "yes" ; then
AC_MSG_RESULT(yes)
$3
else
AC_MSG_RESULT(no)
$4
fi
])

View File

@@ -137,12 +137,13 @@ int ares_expand_string(const unsigned char *encoded, const unsigned char *abuf,
int alen, unsigned char **s, long *enclen); int alen, unsigned char **s, long *enclen);
int ares_parse_a_reply(const unsigned char *abuf, int alen, int ares_parse_a_reply(const unsigned char *abuf, int alen,
struct hostent **host); struct hostent **host);
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
struct hostent **host);
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
int addrlen, int family, struct hostent **host); int addrlen, int family, struct hostent **host);
void ares_free_string(void *str); void ares_free_string(void *str);
void ares_free_hostent(struct hostent *host); void ares_free_hostent(struct hostent *host);
const char *ares_strerror(int code); const char *ares_strerror(int code);
void ares_free_errmem(char *mem);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -147,21 +147,20 @@ static int file_lookup(struct in_addr *addr, struct hostent **host)
int status; int status;
#ifdef WIN32 #ifdef WIN32
char PATH_HOSTS[MAX_PATH]; char PATH_HOSTS[MAX_PATH];
if (IS_NT()) { if (IS_NT()) {
char tmp[MAX_PATH]; char tmp[MAX_PATH];
HKEY hkeyHosts; HKEY hkeyHosts;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts) if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
== ERROR_SUCCESS) == ERROR_SUCCESS)
{ {
DWORD dwLength = MAX_PATH; DWORD dwLength = MAX_PATH;
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, tmp, RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
&dwLength); &dwLength);
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH); ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
RegCloseKey(hkeyHosts); RegCloseKey(hkeyHosts);
} }
} }
else else
GetWindowsDirectory(PATH_HOSTS, MAX_PATH); GetWindowsDirectory(PATH_HOSTS, MAX_PATH);

View File

@@ -222,18 +222,18 @@ static int file_lookup(const char *name, struct hostent **host)
#ifdef WIN32 #ifdef WIN32
char PATH_HOSTS[MAX_PATH]; char PATH_HOSTS[MAX_PATH];
if (IS_NT()) { if (IS_NT()) {
char tmp[MAX_PATH]; char tmp[MAX_PATH];
HKEY hkeyHosts; HKEY hkeyHosts;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts) if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
== ERROR_SUCCESS) == ERROR_SUCCESS)
{ {
DWORD dwLength = MAX_PATH; DWORD dwLength = MAX_PATH;
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, tmp, RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
&dwLength); &dwLength);
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH); ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
RegCloseKey(hkeyHosts); RegCloseKey(hkeyHosts);
} }
} }
else else
GetWindowsDirectory(PATH_HOSTS, MAX_PATH); GetWindowsDirectory(PATH_HOSTS, MAX_PATH);

View File

@@ -54,19 +54,22 @@ static int init_by_options(ares_channel channel, struct ares_options *options,
static int init_by_environment(ares_channel channel); static int init_by_environment(ares_channel channel);
static int init_by_resolv_conf(ares_channel channel); static int init_by_resolv_conf(ares_channel channel);
static int init_by_defaults(ares_channel channel); static int init_by_defaults(ares_channel channel);
static int config_nameserver(struct server_state **servers, int *nservers,
char *str);
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);
#ifndef WIN32
static int ip_addr(const char *s, int len, struct in_addr *addr);
static void natural_mask(struct apattern *pat);
static int config_domain(ares_channel channel, char *str); static int config_domain(ares_channel channel, char *str);
static int config_lookup(ares_channel channel, const char *str, static int config_lookup(ares_channel channel, const char *str,
const char *bindch, const char *filech); const char *bindch, const char *filech);
static int config_nameserver(struct server_state **servers, int *nservers,
char *str);
static int config_sortlist(struct apattern **sortlist, int *nsort, static int config_sortlist(struct apattern **sortlist, int *nsort,
const char *str); const char *str);
static int set_search(ares_channel channel, const char *str);
static int set_options(ares_channel channel, const char *str);
static char *try_config(char *s, const char *opt); static char *try_config(char *s, const char *opt);
static const char *try_option(const char *p, const char *q, const char *opt); #endif
static int ip_addr(const char *s, int len, struct in_addr *addr);
static void natural_mask(struct apattern *pat);
int ares_init(ares_channel *channelptr) int ares_init(ares_channel *channelptr)
{ {
@@ -264,7 +267,8 @@ static int get_res_nt(HKEY hKey, const char *subkey, char **obuf)
if (!*obuf) if (!*obuf)
return 0; return 0;
if (RegQueryValueEx(hKey, subkey, 0, NULL, *obuf, &size) != ERROR_SUCCESS) if (RegQueryValueEx(hKey, subkey, 0, NULL,
(LPBYTE)*obuf, &size) != ERROR_SUCCESS)
{ {
free(*obuf); free(*obuf);
return 0; return 0;
@@ -709,6 +713,7 @@ static int init_by_defaults(ares_channel channel)
return ARES_SUCCESS; return ARES_SUCCESS;
} }
#ifndef WIN32
static int config_domain(ares_channel channel, char *str) static int config_domain(ares_channel channel, char *str)
{ {
char *q; char *q;
@@ -749,6 +754,8 @@ static int config_lookup(ares_channel channel, const char *str,
return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM; return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM;
} }
#endif
static int config_nameserver(struct server_state **servers, int *nservers, static int config_nameserver(struct server_state **servers, int *nservers,
char *str) char *str)
{ {
@@ -810,6 +817,7 @@ static int config_nameserver(struct server_state **servers, int *nservers,
return ARES_SUCCESS; return ARES_SUCCESS;
} }
#ifndef WIN32
static int config_sortlist(struct apattern **sortlist, int *nsort, static int config_sortlist(struct apattern **sortlist, int *nsort,
const char *str) const char *str)
{ {
@@ -856,6 +864,7 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
return ARES_SUCCESS; return ARES_SUCCESS;
} }
#endif
static int set_search(ares_channel channel, const char *str) static int set_search(ares_channel channel, const char *str)
{ {
@@ -937,6 +946,7 @@ static int set_options(ares_channel channel, const char *str)
return ARES_SUCCESS; return ARES_SUCCESS;
} }
#ifndef WIN32
static char *try_config(char *s, const char *opt) static char *try_config(char *s, const char *opt)
{ {
size_t len; size_t len;
@@ -950,12 +960,15 @@ static char *try_config(char *s, const char *opt)
return s; return s;
} }
#endif
static const char *try_option(const char *p, const char *q, const char *opt) static const char *try_option(const char *p, const char *q, const char *opt)
{ {
size_t len = strlen(opt); size_t len = strlen(opt);
return ((size_t)(q - p) > len && !strncmp(p, opt, len)) ? &p[len] : NULL; return ((size_t)(q - p) > len && !strncmp(p, opt, len)) ? &p[len] : NULL;
} }
#ifndef WIN32
static int ip_addr(const char *s, int len, struct in_addr *addr) static int ip_addr(const char *s, int len, struct in_addr *addr)
{ {
char ipbuf[16]; char ipbuf[16];
@@ -991,3 +1004,4 @@ static void natural_mask(struct apattern *pat)
else else
pat->mask.s_addr = htonl(IN_CLASSC_NET); pat->mask.s_addr = htonl(IN_CLASSC_NET);
} }
#endif

View File

@@ -0,0 +1,64 @@
.\" $Id$
.\"
.\" Copyright 2005 by Dominick Meglio.
.\"
.\" 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_PARSE_AAAA_REPLY 3 "10 March 2005"
.SH NAME
ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA into a hostent
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_aaaa_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
.B struct hostent **\fIhost\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_aaaa_reply
function parses the response to a query of type AAAA into a
.BR "struct hostent" .
The parameters
.I abuf
and
.I alen
give the contents of the response. The result is stored in allocated
memory and a pointer to it stored into the variable pointed to by
.IR host .
It is the caller's responsibility to free the resulting host structure
using
.BR ares_free_hostent (3)
when it is no longer needed.
.SH RETURN VALUES
.B ares_parse_aaaa_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_gethostbyname (3),
.BR ares_free_hostent (3)
.SH AUTHOR
Dominick Meglio
.br
Copyright 2005 by Dominick Meglio.

View File

@@ -0,0 +1,173 @@
/* Copyright 2005 Dominick Meglio
*
* 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.
*/
#include "setup.h"
#include <sys/types.h>
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <arpa/nameser.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_dns.h"
#include "ares_private.h"
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
struct hostent **host)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len, naddrs;
int naliases;
long len;
const unsigned char *aptr;
char *hostname, *rr_name, *rr_data, **aliases;
struct in6_addr *addrs;
struct hostent *hostent;
/* Set *host to NULL for all failure cases. */
*host = NULL;
/* Give up if abuf doesn't have room for a header. */
if (alen < HFIXEDSZ)
return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT(abuf);
ancount = DNS_HEADER_ANCOUNT(abuf);
if (qdcount != 1)
return ARES_EBADRESP;
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
status = ares_expand_name(aptr, abuf, alen, &hostname, &len);
if (status != ARES_SUCCESS)
return status;
if (aptr + len + QFIXEDSZ > abuf + alen)
{
free(hostname);
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
/* Allocate addresses and aliases; ancount gives an upper bound for both. */
addrs = malloc(ancount * sizeof(struct in6_addr));
if (!addrs)
{
free(hostname);
return ARES_ENOMEM;
}
aliases = malloc((ancount + 1) * sizeof(char *));
if (!aliases)
{
free(hostname);
free(addrs);
return ARES_ENOMEM;
}
naddrs = 0;
naliases = 0;
/* Examine each answer resource record (RR) in turn. */
for (i = 0; i < (int)ancount; i++)
{
/* Decode the RR up to the data field. */
status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
break;
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr);
aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_AAAA
&& rr_len == sizeof(struct in6_addr)
&& strcasecmp(rr_name, hostname) == 0)
{
memcpy(&addrs[naddrs], aptr, sizeof(struct in6_addr));
naddrs++;
status = ARES_SUCCESS;
}
if (rr_class == C_IN && rr_type == T_CNAME)
{
/* Record the RR name as an alias. */
aliases[naliases] = rr_name;
naliases++;
/* Decode the RR data and replace the hostname with it. */
status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
if (status != ARES_SUCCESS)
break;
free(hostname);
hostname = rr_data;
}
else
free(rr_name);
aptr += rr_len;
if (aptr > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
}
if (status == ARES_SUCCESS && naddrs == 0)
status = ARES_ENODATA;
if (status == ARES_SUCCESS)
{
/* We got our answer. Allocate memory to build the host entry. */
aliases[naliases] = NULL;
hostent = malloc(sizeof(struct hostent));
if (hostent)
{
hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));
if (hostent->h_addr_list)
{
/* Fill in the hostent and return successfully. */
hostent->h_name = hostname;
hostent->h_aliases = aliases;
hostent->h_addrtype = AF_INET6;
hostent->h_length = sizeof(struct in6_addr);
for (i = 0; i < naddrs; i++)
hostent->h_addr_list[i] = (char *) &addrs[i];
hostent->h_addr_list[naddrs] = NULL;
*host = hostent;
return ARES_SUCCESS;
}
free(hostent);
}
status = ARES_ENOMEM;
}
for (i = 0; i < naliases; i++)
free(aliases[i]);
free(aliases);
free(addrs);
free(hostname);
return status;
}

View File

@@ -164,9 +164,5 @@ int ares__read_line(FILE *fp, char **buf, int *bufsize);
libcurl lowlevel code from within library is ugly and only works when libcurl lowlevel code from within library is ugly and only works when
c-ares is built and linked with a similarly debug-build libcurl, but we do c-ares is built and linked with a similarly debug-build libcurl, but we do
this anyway for convenience. */ this anyway for convenience. */
#ifndef CURL_EXTERN
/* ugly hack to make this compile */
#define CURL_EXTERN
#endif
#include "../lib/memdebug.h" #include "../lib/memdebug.h"
#endif #endif

View File

@@ -465,8 +465,12 @@ void ares__send_query(ares_channel channel, struct query *query, time_t now)
static int open_tcp_socket(ares_channel channel, struct server_state *server) static int open_tcp_socket(ares_channel channel, struct server_state *server)
{ {
ares_socket_t s; #if defined(WIN32)
u_long flags;
#else
int flags; int flags;
#endif
ares_socket_t s;
struct sockaddr_in sockin; struct sockaddr_in sockin;
/* Acquire a socket. */ /* Acquire a socket. */

View File

@@ -41,6 +41,10 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
dnl Checks for standard header files, to make memdebug.h inclusions bettter dnl Checks for standard header files, to make memdebug.h inclusions bettter
AC_HEADER_STDC AC_HEADER_STDC
dnl the entire --enable-debug is a hack that lives and runs on top of
dnl libcurl stuff so this BUILDING_LIBCURL is not THAT much uglier
AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I$srcdir/../include" CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I$srcdir/../include"
CFLAGS="$CFLAGS -g" CFLAGS="$CFLAGS -g"
@@ -61,6 +65,59 @@ AC_CHECK_HEADERS(
sys/time.h \ sys/time.h \
sys/select.h \ sys/select.h \
sys/socket.h \ sys/socket.h \
) winsock.h \
netinet/in.h \
)
dnl check for AF_INET6
CARES_CHECK_CONSTANT(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
], [PF_INET6],
AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
)
dnl check for PF_INET6
CARES_CHECK_CONSTANT(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
], [AF_INET6],
AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
)
dnl check for the in6_addr structure
CARES_CHECK_STRUCT(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
], [in6_addr],
AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
)
AC_OUTPUT(Makefile) AC_OUTPUT(Makefile)

View File

@@ -1,7 +1,7 @@
#ifndef ARES_SETUP_H #ifndef ARES_SETUP_H
#define ARES_SETUP_H #define ARES_SETUP_H
/* Copyright (C) 2004 by Daniel Stenberg et al /* Copyright (C) 2004 - 2005 by Daniel Stenberg et al
* *
* Permission to use, copy, modify, and distribute this software and its * Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided * documentation for any purpose and without fee is hereby granted, provided
@@ -49,7 +49,7 @@ typedef int ares_socket_t;
#endif #endif
#if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER) #if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
#define HAVE_UNISTD_H #define HAVE_UNISTD_H 1
#endif #endif
#if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS) #if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS)
@@ -69,4 +69,24 @@ int ares_strcasecmp(const char *s1, const char *s2);
#define strcasecmp(a,b) ares_strcasecmp(a,b) #define strcasecmp(a,b) ares_strcasecmp(a,b)
#endif #endif
/* IPv6 compatibility */
#if !defined(HAVE_AF_INET6)
#if defined(HAVE_PF_INET6)
#define AF_INET6 PF_INET6
#else
#define AF_INET6 AF_MAX+1
#endif
#endif
#ifndef HAVE_PF_INET6
#define PF_INET6 AF_INET6
#endif
#ifndef HAVE_STRUCT_IN6_ADDR
struct in6_addr
{
unsigned char s6_addr[16];
};
#endif
#endif /* ARES_SETUP_H */ #endif /* ARES_SETUP_H */

View File

@@ -185,24 +185,24 @@ SOURCE=..\..\getopt.c
!IF "$(CFG)" == "adig - Win32 Release" !IF "$(CFG)" == "adig - Win32 Release"
"areslib - Win32 Release" : "areslib - Win32 Release" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release"
cd "..\adig" cd "..\adig"
"areslib - Win32 ReleaseCLEAN" : "areslib - Win32 ReleaseCLEAN" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN
cd "..\adig" cd "..\adig"
!ELSEIF "$(CFG)" == "adig - Win32 Debug" !ELSEIF "$(CFG)" == "adig - Win32 Debug"
"areslib - Win32 Debug" : "areslib - Win32 Debug" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug"
cd "..\adig" cd "..\adig"
"areslib - Win32 DebugCLEAN" : "areslib - Win32 DebugCLEAN" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN
cd "..\adig" cd "..\adig"

View File

@@ -195,24 +195,24 @@ SOURCE=..\..\ahost.c
!IF "$(CFG)" == "ahost - Win32 Release" !IF "$(CFG)" == "ahost - Win32 Release"
"areslib - Win32 Release" : "areslib - Win32 Release" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release"
cd "..\ahost" cd "..\ahost"
"areslib - Win32 ReleaseCLEAN" : "areslib - Win32 ReleaseCLEAN" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN
cd "..\ahost" cd "..\ahost"
!ELSEIF "$(CFG)" == "ahost - Win32 Debug" !ELSEIF "$(CFG)" == "ahost - Win32 Debug"
"areslib - Win32 Debug" : "areslib - Win32 Debug" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug"
cd "..\ahost" cd "..\ahost"
"areslib - Win32 DebugCLEAN" : "areslib - Win32 DebugCLEAN" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN
cd "..\ahost" cd "..\ahost"

View File

@@ -66,6 +66,7 @@ dnl initialize all the info variables
curl_idn_msg="no (--with-libidn)" curl_idn_msg="no (--with-libidn)"
curl_manual_msg="no (--enable-manual)" curl_manual_msg="no (--enable-manual)"
curl_verbose_msg="enabled (--disable-verbose)" curl_verbose_msg="enabled (--disable-verbose)"
curl_sspi_msg="no (--enable-sspi)"
dnl dnl
dnl Detect the canonical host and target build environment dnl Detect the canonical host and target build environment
@@ -116,6 +117,17 @@ esac
AC_MSG_RESULT($mimpure) AC_MSG_RESULT($mimpure)
AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes) AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
case $host in
*-*-mingw*)
AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself])
AC_MSG_RESULT(yes)
;;
*)
AC_MSG_RESULT(no)
;;
esac
dnl The install stuff has already been taken care of by the automake stuff dnl The install stuff has already been taken care of by the automake stuff
dnl AC_PROG_INSTALL dnl AC_PROG_INSTALL
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
@@ -306,6 +318,7 @@ then
AC_TRY_LINK([#include <winsock2.h>], AC_TRY_LINK([#include <winsock2.h>],
[gethostbyname("www.dummysite.com");], [gethostbyname("www.dummysite.com");],
[ dnl worked! [ dnl worked!
ws2="yes"
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
HAVE_GETHOSTBYNAME="1"], HAVE_GETHOSTBYNAME="1"],
[ dnl failed, restore LIBS [ dnl failed, restore LIBS
@@ -360,6 +373,55 @@ AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
dnl **********************************************************************
dnl Check for the name of dynamic OpenLDAP libraries
dnl **********************************************************************
LDAPLIBNAME=""
AC_ARG_WITH(ldap-lib,
AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of dynamic ldap lib file]),
[LDAPLIBNAME="$withval"])
LBERLIBNAME=""
AC_ARG_WITH(lber-lib,
AC_HELP_STRING([--with-lber-lib=libname],[Specify name of dynamic lber lib file]),
[LBERLIBNAME="$withval"])
if test x$CURL_DISABLE_LDAP != x1 ; then
if test -z "$LDAPLIBNAME" ; then
case $host in
*-*-cygwin | *-*-mingw* | *-*-pw32*)
dnl Windows uses a single and unique OpenLDAP DLL name
LDAPLIBNAME="wldap32.dll"
LBERLIBNAME="no"
;;
esac
fi
if test "$LDAPLIBNAME" ; then
AC_DEFINE_UNQUOTED(DL_LDAP_FILE, "$LDAPLIBNAME")
AC_MSG_CHECKING([name of dynamic library ldap])
AC_MSG_RESULT($LDAPLIBNAME)
else
dnl Try to find the right ldap library name for this system
CURL_DLLIB_NAME(DL_LDAP_FILE, ldap)
fi
if test "$LBERLIBNAME" ; then
dnl If name is "no" then don't define this variable at all
dnl (it's only needed if libldap.so's dependencies are broken).
if test "$LBERLIBNAME" != "no" ; then
AC_DEFINE_UNQUOTED(DL_LBER_FILE, "$LBERLIBNAME")
fi
AC_MSG_CHECKING([name of dynamic library lber])
AC_MSG_RESULT($LBERLIBNAME)
else
dnl Try to find the right lber library name for this system
CURL_DLLIB_NAME(DL_LBER_FILE, lber)
fi
fi
dnl ********************************************************************** dnl **********************************************************************
dnl Check for the presence of the winmm library. dnl Check for the presence of the winmm library.
dnl ********************************************************************** dnl **********************************************************************
@@ -748,13 +810,29 @@ else
fi fi
fi fi
dnl This is for Msys/Mingw
AC_MSG_CHECKING([for gdi32])
my_ac_save_LIBS=$LIBS
LIBS="-lgdi32 $LIBS"
AC_TRY_LINK([#include <windef.h>
#include <wingdi.h>],
[GdiFlush();],
[ dnl worked!
AC_MSG_RESULT([yes])],
[ dnl failed, restore LIBS
LIBS=$my_ac_save_LIBS
AC_MSG_RESULT(no)]
)
AC_CHECK_LIB(crypto, CRYPTO_lock,[ AC_CHECK_LIB(crypto, CRYPTO_lock,[
HAVECRYPTO="yes" HAVECRYPTO="yes"
LIBS="-lcrypto $LIBS"
],[ ],[
LDFLAGS="$CLEANLDFLAGS -L$EXTRA_SSL/lib$libsuff" LDFLAGS="$CLEANLDFLAGS -L$EXTRA_SSL/lib$libsuff"
CPPFLAGS="$CLEANCPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include" CPPFLAGS="$CLEANCPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
AC_CHECK_LIB(crypto, CRYPTO_add_lock,[ AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
HAVECRYPTO="yes" ], [ HAVECRYPTO="yes"
LIBS="-lcrypto $LIBS"], [
LDFLAGS="$CLEANLDFLAGS" LDFLAGS="$CLEANLDFLAGS"
CPPFLAGS="$CLEANCPPFLAGS" CPPFLAGS="$CLEANCPPFLAGS"
LIBS="$CLEANLIBS" LIBS="$CLEANLIBS"
@@ -769,21 +847,6 @@ else
dnl This is only reasonable to do if crypto actually is there: check for dnl This is only reasonable to do if crypto actually is there: check for
dnl SSL libs NOTE: it is important to do this AFTER the crypto lib dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
dnl This is for Msys/Mingw
AC_MSG_CHECKING([for gdi32])
my_ac_save_LIBS=$LIBS
LIBS="-lgdi32 $LIBS"
AC_TRY_LINK([#include <windef.h>
#include <wingdi.h>],
[GdiFlush();],
[ dnl worked!
AC_MSG_RESULT([yes])],
[ dnl failed, restore LIBS
LIBS=$my_ac_save_LIBS
AC_MSG_RESULT(no)]
)
AC_CHECK_LIB(crypto, CRYPTO_add_lock)
AC_CHECK_LIB(ssl, SSL_connect) AC_CHECK_LIB(ssl, SSL_connect)
if test "$ac_cv_lib_ssl_SSL_connect" != yes; then if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
@@ -821,7 +884,11 @@ else
dnl is there a pkcs12.h header present? dnl is there a pkcs12.h header present?
AC_CHECK_HEADERS(openssl/pkcs12.h) AC_CHECK_HEADERS(openssl/pkcs12.h)
else
LIBS="$CLEANLIBS"
fi fi
dnl USE_SSLEAY is the historical name for what configure calls
dnl OPENSSL_ENABLED; the names should really be unified
USE_SSLEAY="$OPENSSL_ENABLED" USE_SSLEAY="$OPENSSL_ENABLED"
AC_SUBST(USE_SSLEAY) AC_SUBST(USE_SSLEAY)
@@ -838,8 +905,12 @@ dnl **********************************************************************
if test X"$OPENSSL_ENABLED" = X"1"; then if test X"$OPENSSL_ENABLED" = X"1"; then
dnl If the ENGINE library seems to be around, check for the OpenSSL engine dnl If the ENGINE library seems to be around, check for the OpenSSL engine
dnl header, it is kind of "separated" from the main SSL check dnl stuff, it is kind of "separated" from the main SSL check
AC_CHECK_FUNC(ENGINE_init, [ AC_CHECK_HEADERS(openssl/engine.h) ]) AC_CHECK_FUNC(ENGINE_init,
[
AC_CHECK_HEADERS(openssl/engine.h)
AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
])
AC_MSG_CHECKING([CA cert bundle install path]) AC_MSG_CHECKING([CA cert bundle install path])
@@ -926,71 +997,78 @@ dnl Check for & handle argument to --with-zlib.
_cppflags=$CPPFLAGS _cppflags=$CPPFLAGS
_ldflags=$LDFLAGS _ldflags=$LDFLAGS
OPT_ZLIB="/usr/local"
AC_ARG_WITH(zlib, AC_ARG_WITH(zlib,
AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH]) AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
AC_HELP_STRING([--without-zlib],[disable use of zlib]), AC_HELP_STRING([--without-zlib],[disable use of zlib]),
[OPT_ZLIB="$withval"]) [OPT_ZLIB="$withval"])
case "$OPT_ZLIB" in if test "$OPT_ZLIB" = "no" ; then
no) AC_MSG_WARN([zlib disabled])
AC_MSG_WARN([zlib disabled]) ;; else
*) if test "$OPT_ZLIB" = "yes" ; then
OPT_ZLIB=""
fi
if test -z "$OPT_ZLIB" ; then
dnl check for the lib first without setting any new path, since many dnl check for the lib first without setting any new path, since many
dnl people have it in the default path dnl people have it in the default path
AC_CHECK_LIB(z, inflateEnd, AC_CHECK_LIB(z, inflateEnd,
dnl libz found, set the variable dnl libz found, set the variable
[HAVE_LIBZ="1"], [HAVE_LIBZ="1"],
dnl if no lib found, try to add the given library dnl if no lib found, try /usr/local
[if test -d "$OPT_ZLIB"; then [OPT_ZLIB="/usr/local"])
CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
fi])
AC_CHECK_HEADER(zlib.h, fi
[
dnl zlib.h was found
HAVE_ZLIB_H="1"
dnl if the lib wasn't found already, try again with the new paths
if test "$HAVE_LIBZ" != "1"; then
AC_CHECK_LIB(z, gzread,
[
dnl the lib was found!
HAVE_LIBZ="1"
],
[ CPPFLAGS=$_cppflags
LDFLAGS=$_ldflags])
fi
],
[
dnl zlib.h was not found, restore the flags
CPPFLAGS=$_cppflags
LDFLAGS=$_ldflags]
)
if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1" dnl Add a nonempty path to the compiler flags
then if test -n "$OPT_ZLIB"; then
AC_MSG_WARN([configure found only the libz lib, not the header file!]) CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1" LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
then fi
AC_MSG_WARN([configure found only the libz header file, not the lib!])
elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
then
dnl both header and lib were found!
AC_SUBST(HAVE_LIBZ)
AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
LIBS="$LIBS -lz" AC_CHECK_HEADER(zlib.h,
[
dnl replace 'HAVE_LIBZ' in the automake makefile.ams dnl zlib.h was found
AMFIXLIB="1" HAVE_ZLIB_H="1"
AC_MSG_NOTICE([found both libz and libz.h header]) dnl if the lib wasn't found already, try again with the new paths
curl_zlib_msg="enabled" if test "$HAVE_LIBZ" != "1"; then
AC_CHECK_LIB(z, gzread,
[
dnl the lib was found!
HAVE_LIBZ="1"
],
[ CPPFLAGS=$_cppflags
LDFLAGS=$_ldflags])
fi fi
;; ],
esac [
dnl zlib.h was not found, restore the flags
CPPFLAGS=$_cppflags
LDFLAGS=$_ldflags]
)
if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
then
AC_MSG_WARN([configure found only the libz lib, not the header file!])
elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
then
AC_MSG_WARN([configure found only the libz header file, not the lib!])
elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
then
dnl both header and lib were found!
AC_SUBST(HAVE_LIBZ)
AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
LIBS="$LIBS -lz"
dnl replace 'HAVE_LIBZ' in the automake makefile.ams
AMFIXLIB="1"
AC_MSG_NOTICE([found both libz and libz.h header])
curl_zlib_msg="enabled"
fi
fi
dnl set variable for use in automakefile(s) dnl set variable for use in automakefile(s)
AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1) AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
@@ -1033,6 +1111,7 @@ case "$LIBIDN" in
if test "x$idn" = "xyes"; then if test "x$idn" = "xyes"; then
curl_idn_msg="enabled" curl_idn_msg="enabled"
AC_SUBST(IDN_ENABLED, [1])
dnl different versions of libidn have different setups of these: dnl different versions of libidn have different setups of these:
AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror) AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
AC_CHECK_HEADERS( idn-free.h tld.h ) AC_CHECK_HEADERS( idn-free.h tld.h )
@@ -1254,7 +1333,6 @@ AC_CHECK_FUNCS( strtoll \
strdup \ strdup \
strstr \ strstr \
strtok_r \ strtok_r \
strftime \
uname \ uname \
strcasecmp \ strcasecmp \
stricmp \ stricmp \
@@ -1504,6 +1582,28 @@ AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
) )
dnl ************************************************************
dnl enable SSPI support
dnl
AC_MSG_CHECKING([whether to enable SSPI support (win32 builds only)])
AC_ARG_ENABLE(sspi,
AC_HELP_STRING([--enable-sspi],[Enable SSPI])
AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
[ case "$enableval" in
yes)
AC_MSG_RESULT(yes)
AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
AC_SUBST(USE_WINDOWS_SSPI)
LIBS="$LIBS -lsecur32"
curl_sspi_msg="yes"
;;
*)
AC_MSG_RESULT(no)
;;
esac ],
AC_MSG_RESULT(no)
)
dnl ************************************************************ dnl ************************************************************
dnl lame option to switch on debug options dnl lame option to switch on debug options
dnl dnl
@@ -1567,6 +1667,17 @@ AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
) )
if test "x$ws2" = "xyes"; then
dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes
dnl things work when built with c-ares). But we can't just move it last
dnl since then other stuff (SSL) won't build. So we simply append it to the
dnl end.
LIBS="$LIBS -lws2_32"
fi
AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes) AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
AC_CONFIG_FILES([Makefile \ AC_CONFIG_FILES([Makefile \
@@ -1615,4 +1726,5 @@ AC_MSG_NOTICE([Configured to build curl/libcurl:
Build libcurl: Shared=${enable_shared}, Static=${enable_static} Build libcurl: Shared=${enable_shared}, Static=${enable_static}
Built-in manual: ${curl_manual_msg} Built-in manual: ${curl_manual_msg}
Verbose errors: ${curl_verbose_msg} Verbose errors: ${curl_verbose_msg}
SSPI support: ${curl_sspi_msg}
]) ])

View File

@@ -60,6 +60,7 @@ while test $# -gt 0; do
--feature|--features) --feature|--features)
if test "@USE_SSLEAY@" = "1"; then if test "@USE_SSLEAY@" = "1"; then
echo "SSL" echo "SSL"
NTLM=1
fi fi
if test "@KRB4_ENABLED@" = "1"; then if test "@KRB4_ENABLED@" = "1"; then
echo "KRB4" echo "KRB4"
@@ -73,6 +74,16 @@ while test $# -gt 0; do
if test "@HAVE_ARES@" = "1"; then if test "@HAVE_ARES@" = "1"; then
echo "AsynchDNS" echo "AsynchDNS"
fi fi
if test "@IDN_ENABLED@" = "1"; then
echo "IDN"
fi
if test "@USE_WINDOWS_SSPI@" = "1"; then
echo "SSPI"
NTLM=1
fi
if test "$NTLM" = "1"; then
echo "NTLM"
fi
;; ;;
--protocols) --protocols)

View File

@@ -75,6 +75,11 @@ Java
Maintained by Vic Hanson Maintained by Vic Hanson
http://curl.haxx.se/libcurl/java/ http://curl.haxx.se/libcurl/java/
Lisp
Written by Liam Healy
http://common-lisp.net/project/cl-curl/
Lua Lua
Written by Steve Dekorte Written by Steve Dekorte
@@ -87,8 +92,8 @@ Mono
.NET .NET
Written by Jeffrey Phillips libcurl-net Written by Jeffrey Phillips
http://www.seasideresearch.com/downloads.html http://sourceforge.net/projects/libcurl-net/
Object-Pascal Object-Pascal
@@ -150,6 +155,11 @@ Tcl
Tclcurl is written by Andr<64>s Garc<72>a Tclcurl is written by Andr<64>s Garc<72>a
http://personal1.iddeo.es/andresgarci/tclcurl/english/docs.html http://personal1.iddeo.es/andresgarci/tclcurl/english/docs.html
Visual Basic
libcurl-vb is written by Jeffrey Phillips
http://sourceforge.net/projects/libcurl-vb/
Q Q
http://q-lang.sourceforge.net/ http://q-lang.sourceforge.net/

View File

@@ -3,6 +3,29 @@ 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 changelog of the current development status, as one or more of these problems
may have been fixed since this was written! may have been fixed since this was written!
22. Sending files to a FTP server using curl on VMS, might lead to curl
complaining on "unaligned file size" on completion. The problem is related
to VMS file structures and the perceived file sizes stat() returns. A
possible fix would involve sending a "STRU VMS" command.
http://sourceforge.net/support/tracker.php?aid=1156287
21. FTP ASCII transfers do not follow RFC959. They don't convert the data
accordingly (not for sending nor for receiving). RFC 959 section 3.1.1.1
clearly describes how this should be done:
The sender converts the data from an internal character representation to
the standard 8-bit NVT-ASCII representation (see the Telnet
specification). The receiver will convert the data from the standard
form to his own internal form.
20. valgrind errors occur too often when 'make test' is used. It is because
too many third-party libs and tools have problems. When curl is built
without --disable-shared, the testing is done with a front-end script which
makes the valgrind testing include (ba)sh as well and that often causes
valgrind errors. Either we improve the valgrind error scanner a lot to
better identify (lib)curl errors only, or we disable valgrind checking by
default.
19. FTP 3rd party transfers with the multi interface doesn't work. Test: 19. FTP 3rd party transfers with the multi interface doesn't work. Test:
define CURL_MULTIEASY, rebuild curl, run test case 230 - 232. define CURL_MULTIEASY, rebuild curl, run test case 230 - 232.
@@ -83,7 +106,3 @@ may have been fixed since this was written!
and havoc is what happens. and havoc is what happens.
More details on this is found in this libcurl mailing list thread: More details on this is found in this libcurl mailing list thread:
http://curl.haxx.se/mail/lib-2002-08/0000.html http://curl.haxx.se/mail/lib-2002-08/0000.html
1. LDAP support requires that not only the OpenLDAP shared libraries be
present at run time, but the development libraries (liblber.so and
libldap.so) as well (not applicable to Windows).

View File

@@ -299,6 +299,13 @@ POST (HTTP)
curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif" curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif"
To send a field value literally without interpreting a leading '@'
or '<', or an embedded ';type=', use --form-string instead of
-F. This is recommended when the value is obtained from a user or
some other unpredictable source. Under these circumstances, using
-F instead of --form-string would allow a user to trick curl into
uploading a file.
REFERRER REFERRER
A HTTP request has the option to include information about which address A HTTP request has the option to include information about which address

View File

@@ -21,7 +21,7 @@
.\" * $Id$ .\" * $Id$
.\" ************************************************************************** .\" **************************************************************************
.\" .\"
.TH curl 1 "25 Jan 2005" "Curl 7.13.0" "Curl Manual" .TH curl 1 "29 Mar 2005" "Curl 7.13.2" "Curl Manual"
.SH NAME .SH NAME
curl \- transfer a URL curl \- transfer a URL
.SH SYNOPSIS .SH SYNOPSIS
@@ -267,7 +267,7 @@ If this option is used several times, the last one will be used.
be set with the \fI-H/--header\fP flag of course. When used with be set with the \fI-H/--header\fP flag of course. When used with
\fI-L/--location\fP you can append ";auto" to the referer URL to make curl \fI-L/--location\fP you can append ";auto" to the referer URL to make curl
automatically set the previous URL when it follows a Location: header. The automatically set the previous URL when it follows a Location: header. The
";auto" string can be used alone, even if you don't set an initial referer. \&";auto" string can be used alone, even if you don't set an initial referer.
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
.IP "--engine <name>" .IP "--engine <name>"
@@ -343,7 +343,7 @@ will instead attempt to create missing directories. (Added in 7.10.7)
If this option is used twice, the second will again disable silent failure. If this option is used twice, the second will again disable silent failure.
.IP "--ftp-pasv" .IP "--ftp-pasv"
(FTP) Use PASV when transfering. PASV is the internal default behavior, but (FTP) Use PASV when transferring. PASV is the internal default behavior, but
using this option can be used to override a previous --ftp-port option. (Added using this option can be used to override a previous --ftp-port option. (Added
in 7.11.0) in 7.11.0)
@@ -380,9 +380,20 @@ or
\fBcurl\fP -F "name=daniel;type=text/foo" url.com \fBcurl\fP -F "name=daniel;type=text/foo" url.com
You can also explicitly change the name field of an file upload part by
setting filename=, like this:
\fBcurl\fP -F "file=@localfile;filename=nameinpost" url.com
See further examples and details in the MANUAL. See further examples and details in the MANUAL.
This option can be used multiple times. This option can be used multiple times.
.IP "--form-string <name=string>"
(HTTP) Similar to \fI--form\fP except that the value string for the named
parameter is used literally. Leading \&'@' and \&'<' characters, and the
\&';type=' string in the value have no special meaning. Use this in preference
to \fI--form\fP if there's any possibility that the string value may
accidentally trigger the \&'@' or \&'<' features of \fI--form\fP.
.IP "-g/--globoff" .IP "-g/--globoff"
This option switches off the "URL globbing parser". When you set this option, This option switches off the "URL globbing parser". When you set this option,
you can specify URLs that contain the letters {}[] without having them being you can specify URLs that contain the letters {}[] without having them being
@@ -628,11 +639,21 @@ dynamically.
Write output to a local file named like the remote file we get. (Only the file Write output to a local file named like the remote file we get. (Only the file
part of the remote file is used, the path is cut off.) part of the remote file is used, the path is cut off.)
The remote file name to use for saving is extracted from the given URL.
Nothing else
You may use this option as many times as you have number of URLs. You may use this option as many times as you have number of URLs.
.IP "--pass <phrase>" .IP "--pass <phrase>"
(SSL) Pass phrase for the private key (SSL) Pass phrase for the private key
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
.IP "--proxy-anyauth"
Tells curl to pick a suitable authentication method when communicating with
the given proxy. This will cause an extra request/response round-trip. Added
in curl 7.13.2.
If this option is used twice, the second will again disable the proxy use-any
authentication.
.IP "--proxy-basic" .IP "--proxy-basic"
Tells curl to use HTTP Basic authentication when communicating with the given Tells curl to use HTTP Basic authentication when communicating with the given
proxy. Use \fI--basic\fP for enabling HTTP Basic with a remote host. Basic is proxy. Use \fI--basic\fP for enabling HTTP Basic with a remote host. Basic is
@@ -681,7 +702,7 @@ instead of PORT by using \fI--disable-eprt\fP. EPRT is really PORT++.
.IP "-q" .IP "-q"
If used as the first parameter on the command line, the \fI$HOME/.curlrc\fP If used as the first parameter on the command line, the \fI$HOME/.curlrc\fP
file will not be read and used as a config file. file will not be read and used as a config file.
.IP "-Q/--quote <comand>" .IP "-Q/--quote <command>"
(FTP) Send an arbitrary command to the remote FTP server. Quote commands are (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 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 to be exact). To make commands take place after a successful transfer, prefix

View File

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

View File

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

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

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

View File

@@ -131,7 +131,7 @@ static bool init(CURL *&conn, char *url)
// libxml start element callback function // libxml start element callback function
// //
static void startElement(void *voidContext, static void StartElement(void *voidContext,
const xmlChar *name, const xmlChar *name,
const xmlChar **attributes) const xmlChar **attributes)
{ {
@@ -148,7 +148,7 @@ static void startElement(void *voidContext,
// libxml end element callback function // libxml end element callback function
// //
static void endElement(void *voidContext, static void EndElement(void *voidContext,
const xmlChar *name) const xmlChar *name)
{ {
Context *context = (Context *)voidContext; Context *context = (Context *)voidContext;
@@ -173,7 +173,7 @@ static void handleCharacters(Context *context,
// libxml PCDATA callback function // libxml PCDATA callback function
// //
static void characters(void *voidContext, static void Characters(void *voidContext,
const xmlChar *chars, const xmlChar *chars,
int length) int length)
{ {
@@ -215,10 +215,10 @@ static htmlSAXHandler saxHandler =
NULL, NULL,
NULL, NULL,
NULL, NULL,
startElement, StartElement,
endElement, EndElement,
NULL, NULL,
characters, Characters,
NULL, NULL,
NULL, NULL,
NULL, NULL,

View File

@@ -617,9 +617,9 @@ name of your file holding cookie data to read. The cookie data may be in
Netscape / Mozilla cookie data format or just regular HTTP-style headers Netscape / Mozilla cookie data format or just regular HTTP-style headers
dumped to a file. dumped to a file.
Given an empty or non-existing file, this option will enable cookies for this Given an empty or non-existing file or by passing the empty string (""), this
curl handle, making it understand and parse received cookies and then use option will enable cookies for this curl handle, making it understand and
matching cookies in future request. parse received cookies and then use matching cookies in future request.
.IP CURLOPT_COOKIEJAR .IP CURLOPT_COOKIEJAR
Pass a file name as char *, zero terminated. This will make libcurl write all Pass a file name as char *, zero terminated. This will make libcurl write all
internally known cookies to the specified file when \fIcurl_easy_cleanup(3)\fP internally known cookies to the specified file when \fIcurl_easy_cleanup(3)\fP

View File

@@ -41,9 +41,9 @@ general you should instead use the specific relative time compared to
UTC. Supported formats include: -1200, MST, +0100. UTC. Supported formats include: -1200, MST, +0100.
.TP .TP
.B day of the week items .B day of the week items
Specifies a day of the week. Days of the week may be spelled out in full: Specifies a day of the week. Days of the week may be spelled out in full
`Sunday', `Monday', etc or they may be abbreviated to their first three (using english): `Sunday', `Monday', etc or they may be abbreviated to their
letters. This is usually not info that adds anything. first three letters. This is usually not info that adds anything.
.TP .TP
.B pure numbers .B pure numbers
If a decimal number of the form YYYYMMDD appears, then YYYY is read as the If a decimal number of the form YYYYMMDD appears, then YYYY is read as the
@@ -85,7 +85,12 @@ This function returns -1 when it fails to parse the date string. Otherwise it
returns the number of seconds as described. returns the number of seconds as described.
If the year is larger than 2037 on systems with 32 bit time_t, this function If the year is larger than 2037 on systems with 32 bit time_t, this function
will return 0x7fffffff (since that is the largest possible 31 bit number). will return 0x7fffffff (since that is the largest possible signed 32 bit
number).
Having a 64 bit time_t is not a guarantee that dates beyond 03:14:07 UTC,
January 19, 2038 will work fine. On systems with a 64 bit time_t but with a
crippled mktime(), \fIcurl_getdate\fP will return -1 in this case.
.SH REWRITE .SH REWRITE
The former version of this function was built with yacc and was not only very The former version of this function was built with yacc and was not only very
large, it was also never quite understood and it wasn't possible to build with large, it was also never quite understood and it wasn't possible to build with

View File

@@ -1,8 +1,6 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" $Id$ .\" $Id$
.\" .\"
.TH curl_version_info 3 "11 May 2004" "libcurl 7.12" "libcurl Manual" .TH curl_version_info 3 "11 Mar 2005" "libcurl 7.13.2" "libcurl Manual"
.SH NAME .SH NAME
curl_version_info - returns run-time libcurl version info curl_version_info - returns run-time libcurl version info
.SH SYNOPSIS .SH SYNOPSIS
@@ -73,9 +71,9 @@ supports IPv6
.IP CURL_VERSION_KERBEROS4 .IP CURL_VERSION_KERBEROS4
supports kerberos4 (when using FTP) supports kerberos4 (when using FTP)
.IP CURL_VERSION_SSL .IP CURL_VERSION_SSL
supports SSL (HTTPS/FTPS) supports SSL (HTTPS/FTPS) (Added in 7.10)
.IP CURL_VERSION_LIBZ .IP CURL_VERSION_LIBZ
supports HTTP deflate using libz supports HTTP deflate using libz (Added in 7.10)
.IP CURL_VERSION_NTLM .IP CURL_VERSION_NTLM
supports HTTP NTLM (added in 7.10.6) supports HTTP NTLM (added in 7.10.6)
.IP CURL_VERSION_GSSNEGOTIATE .IP CURL_VERSION_GSSNEGOTIATE
@@ -91,10 +89,15 @@ interface. (added in 7.10.7)
libcurl was built with support for SPNEGO authentication (Simple and Protected libcurl was built with support for SPNEGO authentication (Simple and Protected
GSS-API Negotiation Mechanism, defined in RFC 2478.) (added in 7.10.8) GSS-API Negotiation Mechanism, defined in RFC 2478.) (added in 7.10.8)
.IP CURL_VERSION_LARGEFILE .IP CURL_VERSION_LARGEFILE
libcurl was built with support for large files. libcurl was built with support for large files. (Added in 7.11.1)
.IP CURL_VERSION_IDN .IP CURL_VERSION_IDN
libcurl was built with support for IDNA, domain names with international libcurl was built with support for IDNA, domain names with international
letters. letters. (Added in 7.12.0)
.IP CURL_VERSION_SSPI
libcurl was built with support for SSPI. This is only available on Windows and
makes libcurl use Windows-provided functions for NTLM authentication. It also
allows libcurl to use the current user and the current user's password without
the app having to pass them on. (Added in 7.13.2)
.RE .RE
\fIssl_version\fP is an ascii string for the OpenSSL version used. If libcurl \fIssl_version\fP is an ascii string for the OpenSSL version used. If libcurl
has no SSL support, this is NULL. has no SSL support, this is NULL.

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file] .\" nroff -man [file]
.\" $Id$ .\" $Id$
.\" .\"
.TH libcurl-errors 3 "27 Apr 2004" "libcurl 7.12" "libcurl errors" .TH libcurl-errors 3 "9 Feb 2005" "libcurl 7.13.1" "libcurl errors"
.SH NAME .SH NAME
libcurl-errors \- error codes in libcurl libcurl-errors \- error codes in libcurl
.SH DESCRIPTION .SH DESCRIPTION
@@ -187,6 +187,13 @@ Invalid LDAP URL
Maximum file size exceeded Maximum file size exceeded
.IP "CURLE_FTP_SSL_FAILED (64)" .IP "CURLE_FTP_SSL_FAILED (64)"
Requested FTP SSL level failed Requested FTP SSL level failed
.IP "CURLE_SEND_FAIL_REWIND (65)"
When doing a send operation curl had to rewind the data to retransmit, but the
rewinding operation failed
.IP "CURLE_SSL_ENGINE_INITFAILED (66)"
Initiating the SSL Engine failed
.IP "CURLE_LOGIN_DENIED (67)"
The remote server denied curl to login (Added in 7.13.1)
.SH "CURLMcode" .SH "CURLMcode"
This is the generic return code used by functions in the libcurl multi This is the generic return code used by functions in the libcurl multi
interface. Also consider \fIcurl_multi_strerror(3)\fI. interface. Also consider \fIcurl_multi_strerror(3)\fI.

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -245,7 +245,9 @@ typedef enum {
CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */
CURLE_COULDNT_CONNECT, /* 7 */ CURLE_COULDNT_CONNECT, /* 7 */
CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */ CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
CURLE_FTP_ACCESS_DENIED, /* 9 */ CURLE_FTP_ACCESS_DENIED, /* 9 a service was denied by the FTP server
due to lack of access - when login fails
this is not returned. */
CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 */ CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 */
CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
CURLE_FTP_WEIRD_USER_REPLY, /* 12 */ CURLE_FTP_WEIRD_USER_REPLY, /* 12 */
@@ -305,6 +307,8 @@ typedef enum {
CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
that failed */ that failed */
CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
accepted and we failed to login */
CURL_LAST /* never use! */ CURL_LAST /* never use! */
} CURLcode; } CURLcode;
@@ -1378,6 +1382,7 @@ typedef struct {
#define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */ #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */
#define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */ #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */
#define CURL_VERSION_IDN (1<<10) /* International Domain Names support */ #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */
#define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */
/* /*
* NAME curl_version_info() * NAME curl_version_info()

View File

@@ -28,7 +28,7 @@
/* This is the version number of the libcurl package from which this header /* This is the version number of the libcurl package from which this header
file origins: */ file origins: */
#define LIBCURL_VERSION "7.13.0-CVS" #define LIBCURL_VERSION "7.13.2-CVS"
/* This is the numeric version of the libcurl version number, meant for easier /* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
@@ -44,12 +44,12 @@
always a greater number in a more recent release. It makes comparisons with always a greater number in a more recent release. It makes comparisons with
greater than and less than work. greater than and less than work.
*/ */
#define LIBCURL_VERSION_NUM 0x070d00 #define LIBCURL_VERSION_NUM 0x070d02
/* The numeric version number is also available "in parts" by using these /* The numeric version number is also available "in parts" by using these
defines: */ defines: */
#define LIBCURL_VERSION_MAJOR 7 #define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 13 #define LIBCURL_VERSION_MINOR 13
#define LIBCURL_VERSION_PATCH 0 #define LIBCURL_VERSION_PATCH 2
#endif /* __CURL_CURLVER_H */ #endif /* __CURL_CURLVER_H */

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___ # | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____| # \___|\___/|_| \_\_____|
# #
# Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. # Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
# #
# This software is licensed as described in the file COPYING, which # This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms # you should have received as part of this distribution. The terms
@@ -25,7 +25,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
DSP = curllib.dsp DSP = curllib.dsp
EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos $(DSP) \ EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos $(DSP) \
curllib.dsw config-vms.h config-win32.h config-win32ce.h config-riscos.h \ curllib.dsw config-win32.h config-win32ce.h config-riscos.h \
config-mac.h config.h.in ca-bundle.crt README.encoding README.memoryleak \ config-mac.h config.h.in ca-bundle.crt README.encoding README.memoryleak \
README.ares README.curlx makefile.dj config.dj libcurl.framework.make \ README.ares README.curlx makefile.dj config.dj libcurl.framework.make \
libcurl.plist libcurl.rc config-amigaos.h amigaos.c amigaos.h makefile.amiga \ libcurl.plist libcurl.rc config-amigaos.h amigaos.c amigaos.h makefile.amiga \

View File

@@ -13,8 +13,8 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
HHEADERS = arpa_telnet.h netrc.h file.h timeval.h base64.h hostip.h \ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h base64.h hostip.h \
progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \ progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \
if2ip.h speedcheck.h urldata.h ldap.h ssluse.h escape.h telnet.h \ if2ip.h speedcheck.h urldata.h ldap.h ssluse.h escape.h telnet.h \
getinfo.h strequal.h security.h krb4.h memdebug.h inet_ntoa_r.h \ getinfo.h strequal.h krb4.h memdebug.h inet_ntoa_r.h \
http_chunks.h strtok.h connect.h llist.h hash.h content_encoding.h \ http_chunks.h strtok.h connect.h llist.h hash.h content_encoding.h \
share.h md5.h http_digest.h http_negotiate.h http_ntlm.h ca-bundle.h \ share.h md5.h http_digest.h http_negotiate.h http_ntlm.h ca-bundle.h \
inet_pton.h strtoofft.h strerror.h inet_ntop.h curlx.h memory.h \ inet_pton.h strtoofft.h strerror.h inet_ntop.h curlx.h memory.h \
setup.h transfer.h select.h easyif.h multiif.h setup.h transfer.h select.h easyif.h multiif.h parsedate.h

View File

@@ -27,7 +27,7 @@ endif
# Edit the vars below to change NLM target settings. # Edit the vars below to change NLM target settings.
TARGET = libcurl TARGET = libcurl
VERSION = $(LIBCURL_VERSION) VERSION = $(LIBCURL_VERSION)
COPYR = Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se> COPYR = Copyright (C) 1996 - 2005, Daniel Stenberg, <daniel@haxx.se>
DESCR = cURL libcurl $(LIBCURL_VERSION_STR) - http://curl.haxx.se DESCR = cURL libcurl $(LIBCURL_VERSION_STR) - http://curl.haxx.se
MTSAFE = YES MTSAFE = YES
STACK = 64000 STACK = 64000
@@ -336,6 +336,7 @@ config.h: Makefile.netware
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@ @echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
@echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@
ifdef NW_WINSOCK ifdef NW_WINSOCK
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@ @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
else else

View File

@@ -42,6 +42,24 @@ OPENSSL_PATH = ../../openssl-0.9.7e
ZLIB_PATH = ../../zlib-1.2.1 ZLIB_PATH = ../../zlib-1.2.1
!ENDIF !ENDIF
# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
# without an openssl installation and offers the ability to authenticate
# using the "current logged in user". It does however require that the
# Windows SDK be installed.
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.
# It can be downloaded from:
# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
# USE_WINDOWS_SSPI = 1
!IFDEF WINDOWS_SSPI
!IFNDEF WINDOWS_SDK_PATH
WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK"
!ENDIF
!ENDIF
# Use the high resolution time by default. Comment this out to use low # Use the high resolution time by default. Comment this out to use low
# resolution time and not require winmm.lib # resolution time and not require winmm.lib
USEMM_LIBS = YES USEMM_LIBS = YES
@@ -69,6 +87,11 @@ CFLAGS = $(CFLAGS) /DWITHOUT_MM_LIB
# RSAglue.lib was formerly needed in the SSLLIBS # RSAglue.lib was formerly needed in the SSLLIBS
CFGSET = FALSE CFGSET = FALSE
!IFDEF WINDOWS_SSPI
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
LFLAGS = $(LFLAGS) $(WINDOWS_SDK_PATH)\lib\secur32.lib
!ENDIF
###################### ######################
# release # release
@@ -120,10 +143,10 @@ CFGSET = TRUE
# release-ssl-dll # release-ssl-dll
!IF "$(CFG)" == "release-ssl-dll" !IF "$(CFG)" == "release-ssl-dll"
TARGET = $(LIB_NAME).lib TARGET = $(LIB_NAME).dll
DIROBJ = $(CFG) DIROBJ = $(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) $(SSLLIBS) $(LFLAGSSSL) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
CC = $(CCNODBG) $(CFLAGSSSL) CC = $(CCNODBG) $(CFLAGSSSL)
CFGSET = TRUE CFGSET = TRUE
!ENDIF !ENDIF
@@ -297,7 +320,7 @@ CFGSET = TRUE
!IF "$(CFG)" == "debug-dll" !IF "$(CFG)" == "debug-dll"
TARGET = $(LIB_NAME_DEBUG).dll TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = $(CFG) DIROBJ = $(CFG)
LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
CC = $(CCDEBUG) CC = $(CCDEBUG)
CFGSET = TRUE CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res RESOURCE = $(DIROBJ)\libcurl.res
@@ -310,7 +333,7 @@ RESOURCE = $(DIROBJ)\libcurl.res
TARGET = $(LIB_NAME_DEBUG).dll TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = $(CFG) DIROBJ = $(CFG)
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
CC = $(CCDEBUG) $(CFLAGSSSL) CC = $(CCDEBUG) $(CFLAGSSSL)
CFGSET = TRUE CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res RESOURCE = $(DIROBJ)\libcurl.res
@@ -323,7 +346,7 @@ RESOURCE = $(DIROBJ)\libcurl.res
TARGET = $(LIB_NAME_DEBUG).dll TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = $(CFG) DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
CC = $(CCDEBUG) $(CFLAGSZLIB) CC = $(CCDEBUG) $(CFLAGSZLIB)
CFGSET = TRUE CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res RESOURCE = $(DIROBJ)\libcurl.res
@@ -337,7 +360,7 @@ TARGET = $(LIB_NAME_DEBUG).dll
DIROBJ = $(CFG) DIROBJ = $(CFG)
LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
CC = $(CCDEBUG) $(CFLAGSSSL) $(CFLAGSZLIB) CC = $(CCDEBUG) $(CFLAGSSSL) $(CFLAGSZLIB)
CFGSET = TRUE CFGSET = TRUE
RESOURCE = $(DIROBJ)\libcurl.res RESOURCE = $(DIROBJ)\libcurl.res
@@ -454,7 +477,7 @@ $(TARGET): $(X_OBJS)
-xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y
-xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y
-xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y
-xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y
-xcopy $(DIROBJ)\*.exp . /y -xcopy $(DIROBJ)\*.exp . /y
-xcopy $(DIROBJ)\*.pdb . /y -xcopy $(DIROBJ)\*.pdb . /y

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -76,10 +76,10 @@ static void decodeQuantum(unsigned char *dest, const char *src)
/* /*
* Curl_base64_decode() * Curl_base64_decode()
* *
* Given a base64 string at src, decode it into the memory pointed to by * Given a base64 string at src, decode it and return an allocated memory in
* dest. Returns the length of the decoded data. * the *outptr. Returns the length of the decoded data.
*/ */
size_t Curl_base64_decode(const char *src, char *dest) size_t Curl_base64_decode(const char *src, unsigned char **outptr)
{ {
int length = 0; int length = 0;
int equalsTerm = 0; int equalsTerm = 0;
@@ -87,25 +87,49 @@ size_t Curl_base64_decode(const char *src, char *dest)
int numQuantums; int numQuantums;
unsigned char lastQuantum[3]; unsigned char lastQuantum[3];
size_t rawlen=0; size_t rawlen=0;
unsigned char *newstr;
*outptr = NULL;
while((src[length] != '=') && src[length]) while((src[length] != '=') && src[length])
length++; length++;
while(src[length+equalsTerm] == '=') /* A maximum of two = padding characters is allowed */
if(src[length] == '=') {
equalsTerm++; equalsTerm++;
if(src[length+equalsTerm] == '=')
equalsTerm++;
}
numQuantums = (length + equalsTerm) / 4; numQuantums = (length + equalsTerm) / 4;
/* Don't allocate a buffer if the decoded length is 0 */
if (numQuantums <= 0)
return 0;
rawlen = (numQuantums * 3) - equalsTerm; rawlen = (numQuantums * 3) - equalsTerm;
/* The buffer must be large enough to make room for the last quantum
(which may be partially thrown out) and the zero terminator. */
newstr = malloc(rawlen+4);
if(!newstr)
return 0;
*outptr = newstr;
/* Decode all but the last quantum (which may not decode to a
multiple of 3 bytes) */
for(i = 0; i < numQuantums - 1; i++) { for(i = 0; i < numQuantums - 1; i++) {
decodeQuantum((unsigned char *)dest, src); decodeQuantum((unsigned char *)newstr, src);
dest += 3; src += 4; newstr += 3; src += 4;
} }
/* This final decode may actually read slightly past the end of the buffer
if the input string is missing pad bytes. This will almost always be
harmless. */
decodeQuantum(lastQuantum, src); decodeQuantum(lastQuantum, src);
for(i = 0; i < 3 - equalsTerm; i++) for(i = 0; i < 3 - equalsTerm; i++)
dest[i] = lastQuantum[i]; newstr[i] = lastQuantum[i];
newstr[i] = 0; /* zero terminate */
return rawlen; return rawlen;
} }

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -23,5 +23,5 @@
* $Id$ * $Id$
***************************************************************************/ ***************************************************************************/
size_t Curl_base64_encode(const char *input, size_t size, char **str); size_t Curl_base64_encode(const char *input, size_t size, char **str);
size_t Curl_base64_decode(const char *source, char *dest); size_t Curl_base64_decode(const char *source, unsigned char **outptr);
#endif #endif

View File

@@ -57,6 +57,8 @@
#define USE_OPENSSL 1 #define USE_OPENSSL 1
#define USE_SSLEAY 1 #define USE_SSLEAY 1
#define CURL_DISABLE_LDAP 1
#define OS "AmigaOS" #define OS "AmigaOS"

View File

@@ -36,6 +36,8 @@
# define USE_OPENSSL 1 # define USE_OPENSSL 1
#endif #endif
#define CURL_DISABLE_LDAP 1
#define HAVE_RAND_STATUS 1 #define HAVE_RAND_STATUS 1
#define HAVE_RAND_EGD 1 #define HAVE_RAND_EGD 1

View File

@@ -388,3 +388,6 @@
#define HAVE_FIONBIO #define HAVE_FIONBIO
/* to disable LDAP */
#define CURL_DISABLE_LDAP

View File

@@ -1,385 +0,0 @@
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define to empty if the keyword does not work. */
#undef const
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define cpu-machine-OS */
#define OS "ALPHA-COMPAQ-VMS"
/* Define if you have the gethostbyaddr_r() function with 5 arguments */
#undef HAVE_GETHOSTBYADDR_R_5
/* Define if you have the gethostbyaddr_r() function with 7 arguments */
#undef HAVE_GETHOSTBYADDR_R_7
/* Define if you have the gethostbyaddr_r() function with 8 arguments */
#undef HAVE_GETHOSTBYADDR_R_8
/* Define if you have the gethostbyname_r() function with 3 arguments */
#undef HAVE_GETHOSTBYNAME_R_3
/* Define if you have the gethostbyname_r() function with 5 arguments */
#undef HAVE_GETHOSTBYNAME_R_5
/* Define if you have the gethostbyname_r() function with 6 arguments */
#undef HAVE_GETHOSTBYNAME_R_6
/* Define if you have the inet_ntoa_r function declared. */
#undef HAVE_INET_NTOA_R_DECL
/* Define if you need the _REENTRANT define for some functions */
#undef NEED_REENTRANT
/* Define if you have the Kerberos4 libraries (including -ldes) */
#undef HAVE_KRB4
/* Define this to 'int' if ssize_t is not an available typedefed type */
#undef ssize_t
/* Define this to 'int' if socklen_t is not an available typedefed type */
#define socklen_t size_t
/* Define this as a suitable file to read random data from */
#undef RANDOM_FILE
/* Define this to your Entropy Gathering Daemon socket pathname */
#undef EGD_SOCKET
/* The number of bytes in a long double. */
#define SIZEOF_LONG_DOUBLE 8
/* The number of bytes in a long long. */
#define SIZEOF_LONG_LONG 8
/* Define if you have the RAND_egd function. */
#undef HAVE_RAND_EGD
/* Define if you have the RAND_screen function. */
#undef HAVE_RAND_SCREEN
/* Define if you have the RAND_status function. */
#undef HAVE_RAND_STATUS
/* Define if you have the closesocket function. */
#undef HAVE_CLOSESOCKET
/* Define if you have the geteuid function. */
#define HAVE_GETEUID 1
/* Define if you have the gethostbyaddr function. */
#define HAVE_GETHOSTBYADDR 1
/* Define if you have the gethostbyaddr_r function. */
#undef HAVE_GETHOSTBYADDR_R
/* Define if you have the gethostbyname_r function. */
#undef HAVE_GETHOSTBYNAME_R
/* Define if you have the gethostname function. */
#define HAVE_GETHOSTNAME 1
/* Define if you have the getpass_r function. */
#undef HAVE_GETPASS_R
/* Define if you have the getpwuid function. */
#define HAVE_GETPWUID 1
/* Define if you have the getservbyname function. */
#define HAVE_GETSERVBYNAME 1
/* Define if you have the gettimeofday function. */
#define HAVE_GETTIMEOFDAY 1
/* Define if you have the inet_addr function. */
#define HAVE_INET_ADDR 1
/* Define if you have the inet_ntoa function. */
#define HAVE_INET_NTOA 1
/* Define if you have the inet_ntoa_r function. */
#undef HAVE_INET_NTOA_R
/* Define if you have the krb_get_our_ip_for_realm function. */
#undef HAVE_KRB_GET_OUR_IP_FOR_REALM
/* Define if you have the localtime_r function. */
#undef HAVE_LOCALTIME_R
/* Define if you have the perror function. */
#define HAVE_PERROR 1
/* Define if you have the select function. */
#define HAVE_SELECT 1
/* Define if you have the setvbuf function. */
#undef HAVE_SETVBUF
/* Define if you have the sigaction function. */
#define HAVE_SIGACTION 1
/* Define if you have the signal function. */
#define HAVE_SIGNAL 1
/* Define if you have the socket function. */
#define HAVE_SOCKET 1
/* Define if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1
/* Define if you have the strcmpi function. */
#define HAVE_STRCMPI 1
/* Define if you have the strdup function. */
#define HAVE_STRDUP 1
/* Define if you have the strftime function. */
#define HAVE_STRFTIME 1
/* Define if you have the stricmp function. */
#define HAVE_STRICMP 1
/* Define if you have the strlcat function. */
#undef HAVE_STRLCAT
/* Define if you have the strlcpy function. */
#undef HAVE_STRLCPY
/* Define if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
/* Define if you have the tcsetattr function. */
#undef HAVE_TCSETATTR
/* Define if you have the uname function. */
#define HAVE_UNAME 1
/* Define if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define if you have the <crypto.h> header file. */
#undef HAVE_CRYPTO_H
/* Define if you have the <des.h> header file. */
#undef HAVE_DES_H
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the <err.h> header file. */
#define HAVE_ERR_H 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1
/* Define if you have the <io.h> header file. */
#undef HAVE_IO_H
/* Define if you have the <krb.h> header file. */
#undef HAVE_KRB_H
/* Define if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define if you have the <netinet/if_ether.h> header file. */
#define HAVE_NETINET_IF_ETHER_H 1
/* Define if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define if you have the <openssl/crypto.h> header file. */
#define HAVE_OPENSSL_CRYPTO_H 1
/* Define if you have the <openssl/err.h> header file. */
#define HAVE_OPENSSL_ERR_H 1
/* Define if you have the <openssl/pem.h> header file. */
#define HAVE_OPENSSL_PEM_H 1
/* Define if you have the <openssl/rsa.h> header file. */
#define HAVE_OPENSSL_RSA_H 1
/* Define if you have the <openssl/ssl.h> header file. */
#define HAVE_OPENSSL_SSL_H 1
/* Define if you have the <openssl/x509.h> header file. */
#define HAVE_OPENSSL_X509_H 1
/* Define if you have the <pem.h> header file. */
#undef HAVE_PEM_H
/* Define if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
/* Define if you have the <rsa.h> header file. */
#undef HAVE_RSA_H
/* Define if you have the <sgtty.h> header file. */
#define HAVE_SGTTY_H 1
/* Define if you have the <ssl.h> header file. */
#undef HAVE_SSL_H
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
/* Define if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the <winsock.h> header file. */
#undef HAVE_WINSOCK_H
/* Define if you have the <x509.h> header file. */
#undef HAVE_X509_H
/* Define if you have the crypto library (-lcrypto). */
#define HAVE_LIBCRYPTO 1
/* Define if you have the dl library (-ldl). */
#undef HAVE_LIBDL
/* Define if you have the nsl library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if you have the resolv library (-lresolv). */
#define HAVE_LIBRESOLV 1
/* Define if you have the resolve library (-lresolve). */
#undef HAVE_LIBRESOLVE
/* Define if you have the socket library (-lsocket). */
#define HAVE_LIBSOCKET 1
/* Define if you have the ssl library (-lssl). */
#define HAVE_LIBSSL 1
/* Define if you have the ucb library (-lucb). */
#undef HAVE_LIBUCB
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define if getaddrinfo exists and works */
#define HAVE_GETADDRINFO 1
/* Define if you want to enable IPv6 support */
#undef ENABLE_IPV6
/* Set to explicitly specify we don't want to use thread-safe functions */
#undef DISABLED_THREADSAFE
#define HAVE_TIMEVAL_H 1
/* Name of this package! */
#define PACKAGE "not-used"
/* Version number of this archive. */
#define VERSION "not-used"
/* Define if you have the getpass function. */
#undef HAVE_GETPASS
/* if OpenSSL is in use */
#define USE_OPENSSL 1
/* if SSL is enabled */
#define USE_SSLEAY 1
/* Define if you have the `dlopen' function. */
#undef HAVE_DLOPEN
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define if you have the `strtok_r' function. */
#undef HAVE_STRTOK_R
/* Define if you have the `strtoll' function. */
#undef HAVE_STRTOLL
#define HAVE_MEMORY_H 1
#define HAVE_FIONBIO 1
/* Define if you have the `sigsetjmp' function. */
#define HAVE_SIGSETJMP 1
/* Define to 1 if you have the <setjmp.h> header file. */
#define HAVE_SETJMP_H 1
/*
* This needs to be defined for OpenSSL 0.9.7 and other versions that have the
* ENGINE stuff supported. If an include of "openssl/engine.h" fails, then
* undefine the define below.
*/
#define HAVE_OPENSSL_ENGINE_H 1

View File

@@ -232,6 +232,12 @@
/* use ioctlsocket() for non-blocking sockets */ /* use ioctlsocket() for non-blocking sockets */
#define HAVE_IOCTLSOCKET #define HAVE_IOCTLSOCKET
/* lber dynamic library file */
/* #undef DL_LBER_FILE */
/* ldap dynamic library file */
#define DL_LDAP_FILE "wldap32.dll"
/************************************************* /*************************************************
* This section is for compiler specific defines.* * This section is for compiler specific defines.*
*************************************************/ *************************************************/

View File

@@ -93,6 +93,9 @@
#define USE_OPENSSL 1 #define USE_OPENSSL 1
#endif #endif
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
/* Because djgpp <= 2.03 doesn't have snprintf() etc. /* Because djgpp <= 2.03 doesn't have snprintf() etc.
*/ */
#if (DJGPP_MINOR < 4) #if (DJGPP_MINOR < 4)

View File

@@ -364,6 +364,9 @@ static CURLcode bindlocal(struct connectdata *conn,
return CURLE_OK; return CURLE_OK;
} /* end of device selection support */ } /* end of device selection support */
#else
(void)conn;
(void)sockfd;
#endif /* end of HAVE_INET_NTOA */ #endif /* end of HAVE_INET_NTOA */
return CURLE_HTTP_PORT_FAILED; return CURLE_HTTP_PORT_FAILED;
@@ -640,8 +643,10 @@ singleipconnect(struct connectdata *conn,
/* user selected to bind the outgoing socket to a specified "device" /* user selected to bind the outgoing socket to a specified "device"
before doing connect */ before doing connect */
CURLcode res = bindlocal(conn, sockfd); CURLcode res = bindlocal(conn, sockfd);
if(res) if(res) {
sclose(sockfd); /* close socket and bail out */
return res; return res;
}
} }
/* set socket non-blocking */ /* set socket non-blocking */

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -128,7 +128,7 @@ inflate_stream(struct SessionHandle *data,
} }
/* Done with these bytes, exit */ /* Done with these bytes, exit */
if (status == Z_OK && z->avail_in == 0 && z->avail_out > 0) { if (status == Z_OK && z->avail_in == 0) {
free(decomp); free(decomp);
return result; return result;
} }

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -651,6 +651,10 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
fp = stdin; fp = stdin;
fromfile=FALSE; fromfile=FALSE;
} }
else if(file && !*file) {
/* points to a "" string */
fp = NULL;
}
else else
fp = file?fopen(file, "r"):NULL; fp = file?fopen(file, "r"):NULL;

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -85,7 +85,7 @@
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
CURLcode Curl_dict(struct connectdata *conn) CURLcode Curl_dict(struct connectdata *conn, bool *done)
{ {
char *word; char *word;
char *ppath; char *ppath;
@@ -100,6 +100,8 @@ CURLcode Curl_dict(struct connectdata *conn)
char *path = conn->path; char *path = conn->path;
curl_off_t *bytecount = &conn->bytecount; curl_off_t *bytecount = &conn->bytecount;
*done = TRUE; /* unconditionally */
if(conn->bits.user_passwd) { if(conn->bits.user_passwd) {
/* AUTH is missing */ /* AUTH is missing */
} }
@@ -136,12 +138,12 @@ CURLcode Curl_dict(struct connectdata *conn)
} }
result = Curl_sendf(sockfd, conn, result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"MATCH " "MATCH "
"%s " /* database */ "%s " /* database */
"%s " /* strategy */ "%s " /* strategy */
"%s\n" /* word */ "%s\r\n" /* word */
"QUIT\n", "QUIT\r\n",
database, database,
strategy, strategy,
@@ -180,11 +182,11 @@ CURLcode Curl_dict(struct connectdata *conn)
} }
result = Curl_sendf(sockfd, conn, result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"DEFINE " "DEFINE "
"%s " /* database */ "%s " /* database */
"%s\n" /* word */ "%s\r\n" /* word */
"QUIT\n", "QUIT\r\n",
database, database,
word); word);
if(result) if(result)
@@ -209,9 +211,9 @@ CURLcode Curl_dict(struct connectdata *conn)
ppath[i] = ' '; ppath[i] = ' ';
} }
result = Curl_sendf(sockfd, conn, result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"%s\n" "%s\r\n"
"QUIT\n", ppath); "QUIT\r\n", ppath);
if(result) if(result)
failf(data, "Failed sending DICT request"); failf(data, "Failed sending DICT request");
else else

View File

@@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -24,7 +24,7 @@
* $Id$ * $Id$
***************************************************************************/ ***************************************************************************/
#ifndef CURL_DISABLE_DICT #ifndef CURL_DISABLE_DICT
CURLcode Curl_dict(struct connectdata *conn); CURLcode Curl_dict(struct connectdata *conn, bool *done);
CURLcode Curl_dict_done(struct connectdata *conn); CURLcode Curl_dict_done(struct connectdata *conn);
#endif #endif
#endif #endif

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -201,7 +201,8 @@ CURLcode curl_global_init(long flags)
Curl_ccalloc = (curl_calloc_callback)calloc; Curl_ccalloc = (curl_calloc_callback)calloc;
if (flags & CURL_GLOBAL_SSL) if (flags & CURL_GLOBAL_SSL)
Curl_SSL_init(); if (!Curl_SSL_init())
return CURLE_FAILED_INIT;
if (flags & CURL_GLOBAL_WIN32) if (flags & CURL_GLOBAL_WIN32)
if (win32_init() != CURLE_OK) if (win32_init() != CURLE_OK)

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -87,6 +87,7 @@
#include "transfer.h" #include "transfer.h"
#include "url.h" #include "url.h"
#include "memory.h" #include "memory.h"
#include "parsedate.h" /* for the week day and month names */
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -266,7 +267,7 @@ static CURLcode file_upload(struct connectdata *conn)
* opposed to sockets) we instead perform the whole do-operation in this * opposed to sockets) we instead perform the whole do-operation in this
* function. * function.
*/ */
CURLcode Curl_file(struct connectdata *conn) CURLcode Curl_file(struct connectdata *conn, bool *done)
{ {
/* This implementation ignores the host name in conformance with /* This implementation ignores the host name in conformance with
RFC 1738. Only local files (reachable via the standard file system) RFC 1738. Only local files (reachable via the standard file system)
@@ -286,6 +287,8 @@ CURLcode Curl_file(struct connectdata *conn)
int fd; int fd;
struct timeval now = Curl_tvnow(); struct timeval now = Curl_tvnow();
*done = TRUE; /* unconditionally */
Curl_readwrite_init(conn); Curl_readwrite_init(conn);
Curl_initinfo(data); Curl_initinfo(data);
Curl_pgrsStartNow(data); Curl_pgrsStartNow(data);
@@ -319,7 +322,6 @@ CURLcode Curl_file(struct connectdata *conn)
if(result) if(result)
return result; return result;
#ifdef HAVE_STRFTIME
if(fstated) { if(fstated) {
struct tm *tm; struct tm *tm;
time_t clock = (time_t)statbuf.st_mtime; time_t clock = (time_t)statbuf.st_mtime;
@@ -330,11 +332,17 @@ CURLcode Curl_file(struct connectdata *conn)
tm = gmtime(&clock); tm = gmtime(&clock);
#endif #endif
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */ /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S GMT\r\n", snprintf(buf, BUFSIZE-1,
tm); "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
tm->tm_mday,
Curl_month[tm->tm_mon],
tm->tm_year + 1900,
tm->tm_hour,
tm->tm_min,
tm->tm_sec);
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0); result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
} }
#endif
return result; return result;
} }

View File

@@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -24,7 +24,7 @@
* $Id$ * $Id$
***************************************************************************/ ***************************************************************************/
#ifndef CURL_DISABLE_FILE #ifndef CURL_DISABLE_FILE
CURLcode Curl_file(struct connectdata *); CURLcode Curl_file(struct connectdata *, bool *done);
CURLcode Curl_file_done(struct connectdata *, CURLcode); CURLcode Curl_file_done(struct connectdata *, CURLcode);
CURLcode Curl_file_connect(struct connectdata *); CURLcode Curl_file_connect(struct connectdata *);
#endif #endif

4071
lib/ftp.c

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -24,14 +24,21 @@
***************************************************************************/ ***************************************************************************/
#ifndef CURL_DISABLE_FTP #ifndef CURL_DISABLE_FTP
CURLcode Curl_ftp(struct connectdata *conn); CURLcode Curl_ftp(struct connectdata *conn, bool *done);
CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode); CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode);
CURLcode Curl_ftp_connect(struct connectdata *conn); CURLcode Curl_ftp_connect(struct connectdata *conn, bool *done);
CURLcode Curl_ftp_disconnect(struct connectdata *conn); CURLcode Curl_ftp_disconnect(struct connectdata *conn);
CURLcode Curl_ftpsendf(struct connectdata *, const char *fmt, ...); CURLcode Curl_ftpsendf(struct connectdata *, const char *fmt, ...);
CURLcode Curl_nbftpsendf(struct connectdata *, const char *fmt, ...);
CURLcode Curl_GetFTPResponse(ssize_t *nread, struct connectdata *conn, CURLcode Curl_GetFTPResponse(ssize_t *nread, struct connectdata *conn,
int *ftpcode); int *ftpcode);
CURLcode Curl_ftp_nextconnect(struct connectdata *conn); CURLcode Curl_ftp_nextconnect(struct connectdata *conn);
#endif CURLcode Curl_ftp_multi_statemach(struct connectdata *conn, bool *done);
CURLcode Curl_ftp_fdset(struct connectdata *conn,
#endif fd_set *read_fd_set,
fd_set *write_fd_set,
int *max_fdp);
CURLcode Curl_ftp_doing(struct connectdata *conn,
bool *dophase_done);
#endif /* CURL_DISABLE_FTP */
#endif /* __FTP_H */

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -99,7 +99,7 @@
#ifdef CURLRES_ARES #ifdef CURLRES_ARES
/* /*
* Curl_fdset() is called when someone from the outside world (using * Curl_resolv_fdset() is called when someone from the outside world (using
* curl_multi_fdset()) wants to get our fd_set setup and we're talking with * curl_multi_fdset()) wants to get our fd_set setup and we're talking with
* ares. The caller must make sure that this function is only called when we * ares. The caller must make sure that this function is only called when we
* have a working ares channel. * have a working ares channel.
@@ -107,10 +107,10 @@
* Returns: CURLE_OK always! * Returns: CURLE_OK always!
*/ */
CURLcode Curl_fdset(struct connectdata *conn, CURLcode Curl_resolv_fdset(struct connectdata *conn,
fd_set *read_fd_set, fd_set *read_fd_set,
fd_set *write_fd_set, fd_set *write_fd_set,
int *max_fdp) int *max_fdp)
{ {
int max = ares_fds(conn->data->state.areschannel, int max = ares_fds(conn->data->state.areschannel,
@@ -249,7 +249,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
/* close the connection, since we can't return failure here without /* close the connection, since we can't return failure here without
cleaning up this connection properly */ cleaning up this connection properly */
Curl_disconnect(conn); conn->bits.close = TRUE;
} }
return rc; return rc;
@@ -291,7 +291,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
/* areschannel is already setup in the Curl_open() function */ /* areschannel is already setup in the Curl_open() function */
ares_gethostbyname(data->state.areschannel, hostname, PF_INET, ares_gethostbyname(data->state.areschannel, hostname, PF_INET,
Curl_addrinfo4_callback, conn); (ares_host_callback)Curl_addrinfo4_callback, conn);
*waitp = TRUE; /* please wait for the response */ *waitp = TRUE; /* please wait for the response */
} }

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -67,11 +67,6 @@
#include <process.h> #include <process.h>
#endif #endif
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#undef in_addr_t
#define in_addr_t unsigned long
#endif
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "hostip.h" #include "hostip.h"
@@ -108,12 +103,13 @@
* *
* The storage operation locks and unlocks the DNS cache. * The storage operation locks and unlocks the DNS cache.
*/ */
static void addrinfo_callback(void *arg, /* "struct connectdata *" */ static CURLcode addrinfo_callback(void *arg, /* "struct connectdata *" */
int status, int status,
void *addr) void *addr)
{ {
struct connectdata *conn = (struct connectdata *)arg; struct connectdata *conn = (struct connectdata *)arg;
struct Curl_dns_entry *dns = NULL; struct Curl_dns_entry *dns = NULL;
CURLcode rc = CURLE_OK;
conn->async.status = status; conn->async.status = status;
@@ -135,13 +131,17 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */
dns = Curl_cache_addr(data, ai, dns = Curl_cache_addr(data, ai,
conn->async.hostname, conn->async.hostname,
conn->async.port); conn->async.port);
if(!dns) if(!dns) {
/* failed to store, cleanup and return error */ /* failed to store, cleanup and return error */
Curl_freeaddrinfo(ai); Curl_freeaddrinfo(ai);
rc = CURLE_OUT_OF_MEMORY;
}
if(data->share) if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS); Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
} }
else
rc = CURLE_OUT_OF_MEMORY;
} }
conn->async.dns = dns; conn->async.dns = dns;
@@ -153,21 +153,22 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */
/* ipv4: The input hostent struct will be freed by ares when we return from /* ipv4: The input hostent struct will be freed by ares when we return from
this function */ this function */
return rc;
} }
void Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */ CURLcode Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */
int status, int status,
struct hostent *hostent) struct hostent *hostent)
{ {
addrinfo_callback(arg, status, hostent); return addrinfo_callback(arg, status, hostent);
} }
#ifdef CURLRES_IPV6 #ifdef CURLRES_IPV6
void Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */ CURLcode Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */
int status, int status,
struct addrinfo *ai) struct addrinfo *ai)
{ {
addrinfo_callback(arg, status, ai); return addrinfo_callback(arg, status, ai);
} }
#endif #endif

View File

@@ -67,11 +67,6 @@
#include <process.h> #include <process.h>
#endif #endif
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#undef in_addr_t
#define in_addr_t unsigned long
#endif
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "hostip.h" #include "hostip.h"

View File

@@ -159,13 +159,13 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
CURLcode Curl_wait_for_resolv(struct connectdata *conn, CURLcode Curl_wait_for_resolv(struct connectdata *conn,
struct Curl_dns_entry **dnsentry); struct Curl_dns_entry **dnsentry);
/* Curl_fdset() is a generic function that exists in multiple versions /* Curl_resolv_fdset() is a generic function that exists in multiple versions
depending on what name resolve technology we've built to use. The function depending on what name resolve technology we've built to use. The function
is called from the curl_multi_fdset() function */ is called from the curl_multi_fdset() function */
CURLcode Curl_fdset(struct connectdata *conn, CURLcode Curl_resolv_fdset(struct connectdata *conn,
fd_set *read_fd_set, fd_set *read_fd_set,
fd_set *write_fd_set, fd_set *write_fd_set,
int *max_fdp); int *max_fdp);
/* unlock a previously resolved dns entry */ /* unlock a previously resolved dns entry */
void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns); void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns);
@@ -199,14 +199,14 @@ int curl_dogetnameinfo(const struct sockaddr *sa, socklen_t salen,
/* This is the callback function that is used when we build with asynch /* This is the callback function that is used when we build with asynch
resolve, ipv4 */ resolve, ipv4 */
void Curl_addrinfo4_callback(void *arg, CURLcode Curl_addrinfo4_callback(void *arg,
int status, int status,
struct hostent *hostent); struct hostent *hostent);
/* This is the callback function that is used when we build with asynch /* This is the callback function that is used when we build with asynch
resolve, ipv6 */ resolve, ipv6 */
void Curl_addrinfo6_callback(void *arg, CURLcode Curl_addrinfo6_callback(void *arg,
int status, int status,
struct addrinfo *ai); struct addrinfo *ai);
/* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP /* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP
@@ -240,6 +240,13 @@ struct Curl_dns_entry *
Curl_cache_addr(struct SessionHandle *data, Curl_addrinfo *addr, Curl_cache_addr(struct SessionHandle *data, Curl_addrinfo *addr,
char *hostname, int port); char *hostname, int port);
/*
* Curl_destroy_thread_data() cleans up async resolver data.
* Complementary of ares_destroy.
*/
struct Curl_async; /* forward-declaration */
void Curl_destroy_thread_data(struct Curl_async *async);
#ifndef INADDR_NONE #ifndef INADDR_NONE
#define CURL_INADDR_NONE (in_addr_t) ~0 #define CURL_INADDR_NONE (in_addr_t) ~0
#else #else

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -79,6 +79,7 @@
#include "share.h" #include "share.h"
#include "strerror.h" #include "strerror.h"
#include "url.h" #include "url.h"
#include "inet_pton.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -202,11 +203,9 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
*waitp = 0; /* don't wait, we act synchronously */ *waitp = 0; /* don't wait, we act synchronously */
in=inet_addr(hostname); if(1 == Curl_inet_pton(AF_INET, hostname, &in))
if (in != CURL_INADDR_NONE) {
/* This is a dotted IP address 123.123.123.123-style */ /* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(in, hostname, port); return Curl_ip2addr(in, hostname, port);
}
#if defined(HAVE_GETHOSTBYNAME_R) #if defined(HAVE_GETHOSTBYNAME_R)
/* /*

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -67,11 +67,6 @@
#include <process.h> #include <process.h>
#endif #endif
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#undef in_addr_t
#define in_addr_t unsigned long
#endif
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "hostip.h" #include "hostip.h"
@@ -79,6 +74,7 @@
#include "share.h" #include "share.h"
#include "strerror.h" #include "strerror.h"
#include "url.h" #include "url.h"
#include "inet_pton.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -247,8 +243,8 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
} }
} }
if((1 == inet_pton(AF_INET, hostname, addrbuf)) || if((1 == Curl_inet_pton(AF_INET, hostname, addrbuf)) ||
(1 == inet_pton(AF_INET6, hostname, addrbuf))) { (1 == Curl_inet_pton(AF_INET6, hostname, addrbuf))) {
/* the given address is numerical only, prevent a reverse lookup */ /* the given address is numerical only, prevent a reverse lookup */
ai_flags = AI_NUMERICHOST; ai_flags = AI_NUMERICHOST;
} }

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -67,11 +67,6 @@
#include <process.h> #include <process.h>
#endif #endif
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#undef in_addr_t
#define in_addr_t unsigned long
#endif
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "hostip.h" #include "hostip.h"
@@ -133,10 +128,10 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
* It is present here to keep #ifdefs out from multi.c * It is present here to keep #ifdefs out from multi.c
*/ */
CURLcode Curl_fdset(struct connectdata *conn, CURLcode Curl_resolv_fdset(struct connectdata *conn,
fd_set *read_fd_set, fd_set *read_fd_set,
fd_set *write_fd_set, fd_set *write_fd_set,
int *max_fdp) int *max_fdp)
{ {
(void)conn; (void)conn;
(void)read_fd_set; (void)read_fd_set;

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -155,7 +155,7 @@ struct thread_data {
HANDLE thread_hnd; HANDLE thread_hnd;
unsigned thread_id; unsigned thread_id;
DWORD thread_status; DWORD thread_status;
curl_socket_t dummy_sock; /* dummy for Curl_fdset() */ curl_socket_t dummy_sock; /* dummy for Curl_resolv_fdset() */
FILE *stderr_file; FILE *stderr_file;
HANDLE mutex_waiting; /* marks that we are still waiting for a resolve */ HANDLE mutex_waiting; /* marks that we are still waiting for a resolve */
HANDLE event_resolved; /* marks that the thread obtained the information */ HANDLE event_resolved; /* marks that the thread obtained the information */
@@ -190,7 +190,7 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
curr_proc, &mutex_waiting, 0, FALSE, curr_proc, &mutex_waiting, 0, FALSE,
DUPLICATE_SAME_ACCESS)) { DUPLICATE_SAME_ACCESS)) {
/* failed to duplicate the mutex, no point in continuing */ /* failed to duplicate the mutex, no point in continuing */
return 0; return -1;
} }
/* Sharing the same _iob[] element with our parent thread should /* Sharing the same _iob[] element with our parent thread should
@@ -214,12 +214,10 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
SetEvent(td->event_resolved); SetEvent(td->event_resolved);
if (he) { if (he) {
Curl_addrinfo4_callback(conn, CURL_ASYNC_SUCCESS, he); rc = Curl_addrinfo4_callback(conn, CURL_ASYNC_SUCCESS, he);
rc = 1;
} }
else { else {
Curl_addrinfo4_callback(conn, (int)WSAGetLastError(), NULL); rc = Curl_addrinfo4_callback(conn, (int)WSAGetLastError(), NULL);
rc = 0;
} }
TRACE(("Winsock-error %d, addr %s\n", conn->async.status, TRACE(("Winsock-error %d, addr %s\n", conn->async.status,
he ? inet_ntoa(*(struct in_addr*)he->h_addr) : "unknown")); he ? inet_ntoa(*(struct in_addr*)he->h_addr) : "unknown"));
@@ -260,7 +258,7 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
curr_proc, &mutex_waiting, 0, FALSE, curr_proc, &mutex_waiting, 0, FALSE,
DUPLICATE_SAME_ACCESS)) { DUPLICATE_SAME_ACCESS)) {
/* failed to duplicate the mutex, no point in continuing */ /* failed to duplicate the mutex, no point in continuing */
return 0; return -1;
} }
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
@@ -286,10 +284,10 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
#ifdef DEBUG_THREADING_GETADDRINFO #ifdef DEBUG_THREADING_GETADDRINFO
dump_addrinfo (conn, res); dump_addrinfo (conn, res);
#endif #endif
Curl_addrinfo6_callback(conn, CURL_ASYNC_SUCCESS, res); rc = Curl_addrinfo6_callback(conn, CURL_ASYNC_SUCCESS, res);
} }
else { else {
Curl_addrinfo6_callback(conn, (int)WSAGetLastError(), NULL); rc = Curl_addrinfo6_callback(conn, (int)WSAGetLastError(), NULL);
TRACE(("Winsock-error %d, no address\n", conn->async.status)); TRACE(("Winsock-error %d, no address\n", conn->async.status));
} }
} }
@@ -303,10 +301,10 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
#endif #endif
/* /*
* destroy_thread_data() cleans up async resolver data. * Curl_destroy_thread_data() cleans up async resolver data.
* Complementary of ares_destroy. * Complementary of ares_destroy.
*/ */
static void destroy_thread_data (struct Curl_async *async) void Curl_destroy_thread_data (struct Curl_async *async)
{ {
if (async->hostname) if (async->hostname)
free(async->hostname); free(async->hostname);
@@ -321,6 +319,7 @@ static void destroy_thread_data (struct Curl_async *async)
/* destroy the synchronization objects */ /* destroy the synchronization objects */
if (td->mutex_waiting) if (td->mutex_waiting)
CloseHandle(td->mutex_waiting); CloseHandle(td->mutex_waiting);
td->mutex_waiting = NULL;
if (td->event_resolved) if (td->event_resolved)
CloseHandle(td->event_resolved); CloseHandle(td->event_resolved);
@@ -367,7 +366,7 @@ static bool init_resolve_thread (struct connectdata *conn,
*/ */
td->mutex_waiting = CreateMutex(NULL, TRUE, NULL); td->mutex_waiting = CreateMutex(NULL, TRUE, NULL);
if (td->mutex_waiting == NULL) { if (td->mutex_waiting == NULL) {
destroy_thread_data(&conn->async); Curl_destroy_thread_data(&conn->async);
SetLastError(EAGAIN); SetLastError(EAGAIN);
return FALSE; return FALSE;
} }
@@ -377,7 +376,7 @@ static bool init_resolve_thread (struct connectdata *conn,
*/ */
td->event_resolved = CreateEvent(NULL, TRUE, FALSE, NULL); td->event_resolved = CreateEvent(NULL, TRUE, FALSE, NULL);
if (td->event_resolved == NULL) { if (td->event_resolved == NULL) {
destroy_thread_data(&conn->async); Curl_destroy_thread_data(&conn->async);
SetLastError(EAGAIN); SetLastError(EAGAIN);
return FALSE; return FALSE;
} }
@@ -403,12 +402,12 @@ static bool init_resolve_thread (struct connectdata *conn,
if (!td->thread_hnd) { if (!td->thread_hnd) {
SetLastError(errno); SetLastError(errno);
TRACE(("_beginthreadex() failed; %s\n", Curl_strerror(conn,errno))); TRACE(("_beginthreadex() failed; %s\n", Curl_strerror(conn,errno)));
destroy_thread_data(&conn->async); Curl_destroy_thread_data(&conn->async);
return FALSE; return FALSE;
} }
/* This socket is only to keep Curl_fdset() and select() happy; should never /* This socket is only to keep Curl_resolv_fdset() and select() happy;
* become signalled for read/write since it's unbound but Windows needs * should never become signalled for read/write since it's unbound but
* atleast 1 socket in select(). * Windows needs atleast 1 socket in select().
*/ */
td->dummy_sock = socket(AF_INET, SOCK_DGRAM, 0); td->dummy_sock = socket(AF_INET, SOCK_DGRAM, 0);
return TRUE; return TRUE;
@@ -493,7 +492,11 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
if (!conn->async.dns) { if (!conn->async.dns) {
/* a name was not resolved */ /* a name was not resolved */
if (td->thread_status == (DWORD)-1 || conn->async.status == NO_DATA) { if (td->thread_status == CURLE_OUT_OF_MEMORY) {
rc = CURLE_OUT_OF_MEMORY;
failf(data, "Could not resolve host: %s", curl_easy_strerror(rc));
}
else if (td->thread_status == (DWORD)-1 || conn->async.status == NO_DATA) {
failf(data, "Resolving host timed out: %s", conn->host.name); failf(data, "Resolving host timed out: %s", conn->host.name);
rc = CURLE_OPERATION_TIMEDOUT; rc = CURLE_OPERATION_TIMEDOUT;
} }
@@ -506,12 +509,10 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
rc = CURLE_OPERATION_TIMEDOUT; rc = CURLE_OPERATION_TIMEDOUT;
} }
destroy_thread_data(&conn->async); Curl_destroy_thread_data(&conn->async);
if(CURLE_OK != rc) if(!conn->async.dns)
/* close the connection, since we must not return failure from here conn->bits.close = TRUE;
without cleaning up this connection properly */
Curl_disconnect(conn);
return (rc); return (rc);
} }
@@ -528,7 +529,7 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
if (conn->async.done) { if (conn->async.done) {
/* we're done */ /* we're done */
destroy_thread_data(&conn->async); Curl_destroy_thread_data(&conn->async);
if (!conn->async.dns) { if (!conn->async.dns) {
TRACE(("Curl_is_resolved(): CURLE_COULDNT_RESOLVE_HOST\n")); TRACE(("Curl_is_resolved(): CURLE_COULDNT_RESOLVE_HOST\n"));
return CURLE_COULDNT_RESOLVE_HOST; return CURLE_COULDNT_RESOLVE_HOST;
@@ -536,15 +537,13 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
*entry = conn->async.dns; *entry = conn->async.dns;
TRACE(("resolved okay, dns %p\n", *entry)); TRACE(("resolved okay, dns %p\n", *entry));
} }
else
TRACE(("not yet\n"));
return CURLE_OK; return CURLE_OK;
} }
CURLcode Curl_fdset(struct connectdata *conn, CURLcode Curl_resolv_fdset(struct connectdata *conn,
fd_set *read_fd_set, fd_set *read_fd_set,
fd_set *write_fd_set, fd_set *write_fd_set,
int *max_fdp) int *max_fdp)
{ {
const struct thread_data *td = const struct thread_data *td =
(const struct thread_data *) conn->async.os_specific; (const struct thread_data *) conn->async.os_specific;

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -95,6 +95,7 @@
#include "http.h" #include "http.h"
#include "memory.h" #include "memory.h"
#include "select.h" #include "select.h"
#include "parsedate.h" /* for the week day and month names */
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -229,42 +230,58 @@ static CURLcode perhapsrewind(struct connectdata *conn)
bytessent = http->writebytecount; bytessent = http->writebytecount;
/* figure out how much data we are expected to send */ if(conn->bits.authneg)
switch(data->set.httpreq) { /* This is a state where we are known to be negotiating and we don't send
case HTTPREQ_POST: any data then. */
if(data->set.postfieldsize != -1) expectsend = 0;
expectsend = data->set.postfieldsize; else {
break; /* figure out how much data we are expected to send */
case HTTPREQ_PUT: switch(data->set.httpreq) {
if(data->set.infilesize != -1) case HTTPREQ_POST:
expectsend = data->set.infilesize; if(data->set.postfieldsize != -1)
break; expectsend = data->set.postfieldsize;
case HTTPREQ_POST_FORM: break;
expectsend = http->postsize; case HTTPREQ_PUT:
break; if(data->set.infilesize != -1)
default: expectsend = data->set.infilesize;
break; break;
case HTTPREQ_POST_FORM:
expectsend = http->postsize;
break;
default:
break;
}
} }
conn->bits.rewindaftersend = FALSE; /* default */ conn->bits.rewindaftersend = FALSE; /* default */
if((expectsend == -1) || (expectsend > bytessent)) { if((expectsend == -1) || (expectsend > bytessent)) {
/* There is still data left to send */ /* There is still data left to send */
if((data->state.authproxy.picked == CURLAUTH_NTLM) ||/* using NTLM */ if((data->state.authproxy.picked == CURLAUTH_NTLM) ||
(data->state.authhost.picked == CURLAUTH_NTLM) ) { (data->state.authhost.picked == CURLAUTH_NTLM)) {
conn->bits.close = FALSE; /* don't close, keep on sending */ if(((expectsend - bytessent) < 2000) ||
(conn->ntlm.state != NTLMSTATE_NONE)) {
/* The NTLM-negotiation has started *OR* there is just a little (<2K)
data left to send, keep on sending. */
/* rewind data when completely done sending! */ /* rewind data when completely done sending! */
conn->bits.rewindaftersend = TRUE; if(!conn->bits.authneg)
return CURLE_OK; conn->bits.rewindaftersend = TRUE;
}
else { return CURLE_OK;
/* If there is more than just a little data left to send, close the }
* current connection by force. if(conn->bits.close)
*/ /* this is already marked to get closed */
conn->bits.close = TRUE; return CURLE_OK;
conn->size = 0; /* don't download any more than 0 bytes */
infof(data, "NTLM send, close instead of sending %ld bytes\n",
expectsend - bytessent);
} }
/* This is not NTLM or NTLM with many bytes left to send: close
*/
conn->bits.close = TRUE;
conn->size = 0; /* don't download any more than 0 bytes */
} }
if(bytessent) if(bytessent)
@@ -287,6 +304,10 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
bool pickproxy = FALSE; bool pickproxy = FALSE;
CURLcode code = CURLE_OK; CURLcode code = CURLE_OK;
if(100 == conn->keep.httpcode)
/* this is a transient response code, ignore */
return CURLE_OK;
if(data->state.authproblem) if(data->state.authproblem)
return data->set.http_fail_on_error?CURLE_HTTP_RETURNED_ERROR:CURLE_OK; return data->set.http_fail_on_error?CURLE_HTTP_RETURNED_ERROR:CURLE_OK;
@@ -309,7 +330,8 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
conn->newurl = strdup(data->change.url); /* clone URL */ conn->newurl = strdup(data->change.url); /* clone URL */
if((data->set.httpreq != HTTPREQ_GET) && if((data->set.httpreq != HTTPREQ_GET) &&
(data->set.httpreq != HTTPREQ_HEAD)) { (data->set.httpreq != HTTPREQ_HEAD) &&
!conn->bits.rewindaftersend) {
code = perhapsrewind(conn); code = perhapsrewind(conn);
if(code) if(code)
return code; return code;
@@ -391,26 +413,19 @@ Curl_http_output_auth(struct connectdata *conn,
and if this is one single bit it'll be used instantly. */ and if this is one single bit it'll be used instantly. */
authproxy->picked = authproxy->want; authproxy->picked = authproxy->want;
/* To prevent the user+password to get sent to other than the original /* Send proxy authentication header if needed */
host due to a location-follow, we do some weirdo checks here */ if (conn->bits.httpproxy &&
if(!data->state.this_is_a_follow || (conn->bits.tunnel_proxy == proxytunnel)) {
!data->state.first_host || #if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI)
curl_strequal(data->state.first_host, conn->host.name) || if(authproxy->picked == CURLAUTH_NTLM) {
data->set.http_disable_hostname_check_before_authentication) { auth=(char *)"NTLM";
result = Curl_output_ntlm(conn, TRUE);
/* Send proxy authentication header if needed */ if(result)
if (conn->bits.httpproxy && return result;
(conn->bits.tunnel_proxy == proxytunnel)) { }
#ifdef USE_SSLEAY else
if(authproxy->want == CURLAUTH_NTLM) {
auth=(char *)"NTLM";
result = Curl_output_ntlm(conn, TRUE);
if(result)
return result;
}
else
#endif #endif
if(authproxy->want == CURLAUTH_BASIC) { if(authproxy->picked == CURLAUTH_BASIC) {
/* Basic */ /* Basic */
if(conn->bits.proxy_user_passwd && if(conn->bits.proxy_user_passwd &&
!checkheaders(data, "Proxy-authorization:")) { !checkheaders(data, "Proxy-authorization:")) {
@@ -424,7 +439,7 @@ Curl_http_output_auth(struct connectdata *conn,
authproxy->done = TRUE; authproxy->done = TRUE;
} }
#ifndef CURL_DISABLE_CRYPTO_AUTH #ifndef CURL_DISABLE_CRYPTO_AUTH
else if(authproxy->want == CURLAUTH_DIGEST) { else if(authproxy->picked == CURLAUTH_DIGEST) {
auth=(char *)"Digest"; auth=(char *)"Digest";
result = Curl_output_digest(conn, result = Curl_output_digest(conn,
TRUE, /* proxy */ TRUE, /* proxy */
@@ -442,16 +457,23 @@ Curl_http_output_auth(struct connectdata *conn,
else else
authproxy->multi = FALSE; authproxy->multi = FALSE;
} }
else else
/* we have no proxy so let's pretend we're done authenticating /* we have no proxy so let's pretend we're done authenticating
with it */ with it */
authproxy->done = TRUE; authproxy->done = TRUE;
/* To prevent the user+password to get sent to other than the original
host due to a location-follow, we do some weirdo checks here */
if(!data->state.this_is_a_follow ||
!data->state.first_host ||
curl_strequal(data->state.first_host, conn->host.name) ||
data->set.http_disable_hostname_check_before_authentication) {
/* Send web authentication header if needed */ /* Send web authentication header if needed */
{ {
auth = NULL; auth = NULL;
#ifdef HAVE_GSSAPI #ifdef HAVE_GSSAPI
if((authhost->want == CURLAUTH_GSSNEGOTIATE) && if((authhost->picked == CURLAUTH_GSSNEGOTIATE) &&
data->state.negotiate.context && data->state.negotiate.context &&
!GSS_ERROR(data->state.negotiate.status)) { !GSS_ERROR(data->state.negotiate.status)) {
auth=(char *)"GSS-Negotiate"; auth=(char *)"GSS-Negotiate";
@@ -462,7 +484,7 @@ Curl_http_output_auth(struct connectdata *conn,
} }
else else
#endif #endif
#ifdef USE_SSLEAY #if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI)
if(authhost->picked == CURLAUTH_NTLM) { if(authhost->picked == CURLAUTH_NTLM) {
auth=(char *)"NTLM"; auth=(char *)"NTLM";
result = Curl_output_ntlm(conn, FALSE); result = Curl_output_ntlm(conn, FALSE);
@@ -575,7 +597,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
} }
else else
#endif #endif
#ifdef USE_SSLEAY #if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI)
/* NTLM support requires the SSL crypto libs */ /* NTLM support requires the SSL crypto libs */
if(checkprefix("NTLM", start)) { if(checkprefix("NTLM", start)) {
*availp |= CURLAUTH_NTLM; *availp |= CURLAUTH_NTLM;
@@ -1222,7 +1244,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
* Curl_http_connect() performs HTTP stuff to do at connect-time, called from * Curl_http_connect() performs HTTP stuff to do at connect-time, called from
* the generic Curl_connect(). * the generic Curl_connect().
*/ */
CURLcode Curl_http_connect(struct connectdata *conn) CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
{ {
struct SessionHandle *data; struct SessionHandle *data;
CURLcode result; CURLcode result;
@@ -1261,6 +1283,8 @@ CURLcode Curl_http_connect(struct connectdata *conn)
data->state.first_host = strdup(conn->host.name); data->state.first_host = strdup(conn->host.name);
} }
*done = TRUE;
return CURLE_OK; return CURLE_OK;
} }
@@ -1274,7 +1298,6 @@ CURLcode Curl_http_done(struct connectdata *conn,
{ {
struct SessionHandle *data; struct SessionHandle *data;
struct HTTP *http; struct HTTP *http;
(void)status; /* no use for us */
data=conn->data; data=conn->data;
http=conn->proto.http; http=conn->proto.http;
@@ -1291,7 +1314,7 @@ CURLcode Curl_http_done(struct connectdata *conn,
free(buff->buffer); free(buff->buffer);
free(buff); free(buff);
http->send_buffer = NULL; /* cleaer the pointer */ http->send_buffer = NULL; /* clear the pointer */
} }
if(HTTPREQ_POST_FORM == data->set.httpreq) { if(HTTPREQ_POST_FORM == data->set.httpreq) {
@@ -1307,6 +1330,9 @@ CURLcode Curl_http_done(struct connectdata *conn,
else if(HTTPREQ_PUT == data->set.httpreq) else if(HTTPREQ_PUT == data->set.httpreq)
conn->bytecount = http->readbytecount + http->writebytecount; conn->bytecount = http->readbytecount + http->writebytecount;
if (status != CURLE_OK)
return (status);
if(!conn->bits.retry && if(!conn->bits.retry &&
((http->readbytecount + ((http->readbytecount +
conn->headerbytecount - conn->headerbytecount -
@@ -1326,7 +1352,7 @@ CURLcode Curl_http_done(struct connectdata *conn,
* request is to be performed. This creates and sends a properly constructed * request is to be performed. This creates and sends a properly constructed
* HTTP request. * HTTP request.
*/ */
CURLcode Curl_http(struct connectdata *conn) CURLcode Curl_http(struct connectdata *conn, bool *done)
{ {
struct SessionHandle *data=conn->data; struct SessionHandle *data=conn->data;
char *buf = data->state.buffer; /* this is a short cut to the buffer */ char *buf = data->state.buffer; /* this is a short cut to the buffer */
@@ -1340,6 +1366,11 @@ CURLcode Curl_http(struct connectdata *conn)
Curl_HttpReq httpreq = data->set.httpreq; Curl_HttpReq httpreq = data->set.httpreq;
char *addcookies = NULL; char *addcookies = NULL;
/* Always consider the DO phase done after this function call, even if there
may be parts of the request that is not yet sent, since we can deal with
the rest of the request in the PERFORM phase. */
*done = TRUE;
if(!conn->proto.http) { if(!conn->proto.http) {
/* Only allocate this struct if we don't already have it! */ /* Only allocate this struct if we don't already have it! */
@@ -1774,7 +1805,7 @@ CURLcode Curl_http(struct connectdata *conn)
#endif #endif
if(data->set.timecondition) { if(data->set.timecondition) {
struct tm *thistime; struct tm *tm;
/* Phil Karn (Fri, 13 Apr 2001) pointed out that the If-Modified-Since /* Phil Karn (Fri, 13 Apr 2001) pointed out that the If-Modified-Since
* header family should have their times set in GMT as RFC2616 defines: * header family should have their times set in GMT as RFC2616 defines:
@@ -1786,18 +1817,22 @@ CURLcode Curl_http(struct connectdata *conn)
#ifdef HAVE_GMTIME_R #ifdef HAVE_GMTIME_R
/* thread-safe version */ /* thread-safe version */
struct tm keeptime; struct tm keeptime;
thistime = (struct tm *)gmtime_r(&data->set.timevalue, &keeptime); tm = (struct tm *)gmtime_r(&data->set.timevalue, &keeptime);
#else #else
thistime = gmtime(&data->set.timevalue); tm = gmtime(&data->set.timevalue);
#endif #endif
#ifdef HAVE_STRFTIME
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */ /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
strftime(buf, BUFSIZE-1, "%a, %d %b %Y %H:%M:%S GMT", thistime); snprintf(buf, BUFSIZE-1,
#else "%s, %02d %s %4d %02d:%02d:%02d GMT",
/* TODO: Right, we *could* write a replacement here */ Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
strcpy(buf, "no strftime() support"); tm->tm_mday,
#endif Curl_month[tm->tm_mon],
tm->tm_year + 1900,
tm->tm_hour,
tm->tm_min,
tm->tm_sec);
switch(data->set.timecondition) { switch(data->set.timecondition) {
case CURL_TIMECOND_IFMODSINCE: case CURL_TIMECOND_IFMODSINCE:
default: default:

View File

@@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -34,9 +34,9 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
char *hostname, int remote_port); char *hostname, int remote_port);
/* protocol-specific functions set up to be called by the main engine */ /* protocol-specific functions set up to be called by the main engine */
CURLcode Curl_http(struct connectdata *conn); CURLcode Curl_http(struct connectdata *conn, bool *done);
CURLcode Curl_http_done(struct connectdata *, CURLcode); CURLcode Curl_http_done(struct connectdata *, CURLcode);
CURLcode Curl_http_connect(struct connectdata *conn); CURLcode Curl_http_connect(struct connectdata *conn, bool *done);
/* The following functions are defined in http_chunks.c */ /* The following functions are defined in http_chunks.c */
void Curl_httpchunk_init(struct connectdata *conn); void Curl_httpchunk_init(struct connectdata *conn);

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -166,12 +166,7 @@ int Curl_input_negotiate(struct connectdata *conn, char *header)
len = strlen(header); len = strlen(header);
if (len > 0) { if (len > 0) {
int rawlen; int rawlen = Curl_base64_decode(header, (unsigned char **)&input_token.value);
input_token.length = (len+3)/4 * 3;
input_token.value = malloc(input_token.length);
if (input_token.value == NULL)
return ENOMEM;
rawlen = Curl_base64_decode(header, input_token.value);
if (rawlen < 0) if (rawlen < 0)
return -1; return -1;
input_token.length = rawlen; input_token.length = rawlen;
@@ -211,7 +206,7 @@ int Curl_input_negotiate(struct connectdata *conn, char *header)
input_token.length = mechTokenLength; input_token.length = mechTokenLength;
free(mechToken); free(mechToken);
mechToken = NULL; mechToken = NULL;
infof(conn->data, "Parse SPNEGO Target Token succeded\n"); infof(conn->data, "Parse SPNEGO Target Token succeeded\n");
} }
} }
#endif #endif
@@ -292,7 +287,7 @@ CURLcode Curl_output_negotiate(struct connectdata *conn)
neg_ctx->output_token.length = spnegoTokenLength; neg_ctx->output_token.length = spnegoTokenLength;
free(spnegoToken); free(spnegoToken);
spnegoToken = NULL; spnegoToken = NULL;
infof(conn->data, "Make SPNEGO Initial Token succeded\n"); infof(conn->data, "Make SPNEGO Initial Token succeeded\n");
} }
} }
#endif #endif

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -30,7 +30,7 @@
*/ */
#ifndef CURL_DISABLE_HTTP #ifndef CURL_DISABLE_HTTP
#ifdef USE_SSLEAY #if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI)
/* We need OpenSSL for the crypto lib to provide us with MD4 and DES */ /* We need OpenSSL for the crypto lib to provide us with MD4 and DES */
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
@@ -51,6 +51,8 @@
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
#ifndef USE_WINDOWS_SSPI
#include <openssl/des.h> #include <openssl/des.h>
#include <openssl/md4.h> #include <openssl/md4.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
@@ -71,6 +73,12 @@
#define DESKEY(x) &x #define DESKEY(x) &x
#endif #endif
#else
#include <rpc.h>
#endif
/* The last #include file should be: */ /* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"
@@ -103,7 +111,6 @@ CURLntlm Curl_input_ntlm(struct connectdata *conn,
header++; header++;
if(checkprefix("NTLM", header)) { if(checkprefix("NTLM", header)) {
unsigned char buffer[256];
header += strlen("NTLM"); header += strlen("NTLM");
while(*header && isspace((int)*header)) while(*header && isspace((int)*header))
@@ -123,17 +130,31 @@ CURLntlm Curl_input_ntlm(struct connectdata *conn,
(40) Target Information (optional) security buffer(*) (40) Target Information (optional) security buffer(*)
32 (48) start of data block 32 (48) start of data block
*/ */
size_t size;
size_t size = Curl_base64_decode(header, (char *)buffer); unsigned char *buffer;
size = Curl_base64_decode(header, &buffer);
if(!buffer)
return CURLNTLM_BAD;
ntlm->state = NTLMSTATE_TYPE2; /* we got a type-2 */ ntlm->state = NTLMSTATE_TYPE2; /* we got a type-2 */
#ifdef USE_WINDOWS_SSPI
if ((ntlm->type_2 = malloc(size+1)) == NULL) {
free(buffer);
return CURLE_OUT_OF_MEMORY;
}
ntlm->n_type_2 = size;
memcpy(ntlm->type_2, buffer, size);
#else
if(size >= 48) if(size >= 48)
/* the nonce of interest is index [24 .. 31], 8 bytes */ /* the nonce of interest is index [24 .. 31], 8 bytes */
memcpy(ntlm->nonce, &buffer[24], 8); memcpy(ntlm->nonce, &buffer[24], 8);
/* FIX: add an else here! */
/* at index decimal 20, there's a 32bit NTLM flag field */ /* at index decimal 20, there's a 32bit NTLM flag field */
free(buffer);
#endif
} }
else { else {
if(ntlm->state >= NTLMSTATE_TYPE1) if(ntlm->state >= NTLMSTATE_TYPE1)
@@ -145,6 +166,8 @@ CURLntlm Curl_input_ntlm(struct connectdata *conn,
return CURLNTLM_FINE; return CURLNTLM_FINE;
} }
#ifndef USE_WINDOWS_SSPI
/* /*
* Turns a 56 bit key into the 64 bit, odd parity key and sets the key. The * Turns a 56 bit key into the 64 bit, odd parity key and sets the key. The
* key schedule ks is also set. * key schedule ks is also set.
@@ -271,6 +294,32 @@ static void mkhash(char *password,
free(pw); free(pw);
} }
#endif
#ifdef USE_WINDOWS_SSPI
static void
ntlm_sspi_cleanup(struct ntlmdata *ntlm)
{
if (ntlm->type_2) {
free(ntlm->type_2);
ntlm->type_2 = NULL;
}
if (ntlm->has_handles) {
DeleteSecurityContext(&ntlm->c_handle);
FreeCredentialsHandle(&ntlm->handle);
ntlm->has_handles = 0;
}
if (ntlm->p_identity) {
if (ntlm->identity.User) free(ntlm->identity.User);
if (ntlm->identity.Password) free(ntlm->identity.Password);
if (ntlm->identity.Domain) free(ntlm->identity.Domain);
ntlm->p_identity = NULL;
}
}
#endif
#define SHORTPAIR(x) ((x) & 0xff), ((x) >> 8) #define SHORTPAIR(x) ((x) & 0xff), ((x) >> 8)
#define LONGQUARTET(x) ((x) & 0xff), (((x) >> 8)&0xff), \ #define LONGQUARTET(x) ((x) & 0xff), (((x) >> 8)&0xff), \
(((x) >>16)&0xff), ((x)>>24) (((x) >>16)&0xff), ((x)>>24)
@@ -281,10 +330,12 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
{ {
const char *domain=""; /* empty */ const char *domain=""; /* empty */
const char *host=""; /* empty */ const char *host=""; /* empty */
#ifndef USE_WINDOWS_SSPI
int domlen=(int)strlen(domain); int domlen=(int)strlen(domain);
int hostlen = (int)strlen(host); int hostlen = (int)strlen(host);
int hostoff; /* host name offset */ int hostoff; /* host name offset */
int domoff; /* domain name offset */ int domoff; /* domain name offset */
#endif
size_t size; size_t size;
char *base64=NULL; char *base64=NULL;
unsigned char ntlmbuf[256]; /* enough, unless the host/domain is very long */ unsigned char ntlmbuf[256]; /* enough, unless the host/domain is very long */
@@ -329,6 +380,90 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
switch(ntlm->state) { switch(ntlm->state) {
case NTLMSTATE_TYPE1: case NTLMSTATE_TYPE1:
default: /* for the weird cases we (re)start here */ default: /* for the weird cases we (re)start here */
#ifdef USE_WINDOWS_SSPI
{
SecBuffer buf;
SecBufferDesc desc;
SECURITY_STATUS status;
ULONG attrs;
const char *user;
int domlen;
ntlm_sspi_cleanup(ntlm);
user = strchr(userp, '\\');
if (!user)
user = strchr(userp, '/');
if (user) {
domain = userp;
domlen = user - userp;
user++;
}
else {
user = userp;
domain = "";
domlen = 0;
}
if (user && *user) {
/* note: initialize all of this before doing the mallocs so that
* it can be cleaned up later without leaking memory.
*/
ntlm->p_identity = &ntlm->identity;
memset(ntlm->p_identity, 0, sizeof(*ntlm->p_identity));
if ((ntlm->identity.User = (unsigned char *)strdup(user)) == NULL)
return CURLE_OUT_OF_MEMORY;
ntlm->identity.UserLength = strlen(user);
if ((ntlm->identity.Password = (unsigned char *)strdup(passwdp)) == NULL)
return CURLE_OUT_OF_MEMORY;
ntlm->identity.PasswordLength = strlen(passwdp);
if ((ntlm->identity.Domain = malloc(domlen+1)) == NULL)
return CURLE_OUT_OF_MEMORY;
strncpy((char *)ntlm->identity.Domain, domain, domlen);
ntlm->identity.Domain[domlen] = '\0';
ntlm->identity.DomainLength = domlen;
ntlm->identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
}
else {
ntlm->p_identity = NULL;
}
if (AcquireCredentialsHandle(
NULL, (char *)"NTLM", SECPKG_CRED_OUTBOUND, NULL, ntlm->p_identity,
NULL, NULL, &ntlm->handle, NULL
) != SEC_E_OK) {
return CURLE_OUT_OF_MEMORY;
}
desc.ulVersion = SECBUFFER_VERSION;
desc.cBuffers = 1;
desc.pBuffers = &buf;
buf.cbBuffer = sizeof(ntlmbuf);
buf.BufferType = SECBUFFER_TOKEN;
buf.pvBuffer = ntlmbuf;
status = InitializeSecurityContext(&ntlm->handle, NULL, (char *) host,
ISC_REQ_CONFIDENTIALITY |
ISC_REQ_REPLAY_DETECT |
ISC_REQ_CONNECTION,
0, SECURITY_NETWORK_DREP, NULL, 0,
&ntlm->c_handle, &desc, &attrs, NULL
);
if (status == SEC_I_COMPLETE_AND_CONTINUE ||
status == SEC_I_CONTINUE_NEEDED) {
CompleteAuthToken(&ntlm->c_handle, &desc);
}
else if (status != SEC_E_OK) {
FreeCredentialsHandle(&ntlm->handle);
return CURLE_RECV_ERROR;
}
ntlm->has_handles = 1;
size = buf.cbBuffer;
}
#else
hostoff = 32; hostoff = 32;
domoff = hostoff + hostlen; domoff = hostoff + hostlen;
@@ -378,6 +513,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
/* initial packet length */ /* initial packet length */
size = 32 + hostlen + domlen; size = 32 + hostlen + domlen;
#endif
/* now keeper of the base64 encoded package size */ /* now keeper of the base64 encoded package size */
size = Curl_base64_encode((char *)ntlmbuf, size, &base64); size = Curl_base64_encode((char *)ntlmbuf, size, &base64);
@@ -413,6 +549,41 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
*/ */
{ {
#ifdef USE_WINDOWS_SSPI
SecBuffer type_2, type_3;
SecBufferDesc type_2_desc, type_3_desc;
SECURITY_STATUS status;
ULONG attrs;
type_2_desc.ulVersion = type_3_desc.ulVersion = SECBUFFER_VERSION;
type_2_desc.cBuffers = type_3_desc.cBuffers = 1;
type_2_desc.pBuffers = &type_2;
type_3_desc.pBuffers = &type_3;
type_2.BufferType = SECBUFFER_TOKEN;
type_2.pvBuffer = ntlm->type_2;
type_2.cbBuffer = ntlm->n_type_2;
type_3.BufferType = SECBUFFER_TOKEN;
type_3.pvBuffer = ntlmbuf;
type_3.cbBuffer = sizeof(ntlmbuf);
status = InitializeSecurityContext(&ntlm->handle, &ntlm->c_handle,
(char *) host,
ISC_REQ_CONFIDENTIALITY |
ISC_REQ_REPLAY_DETECT |
ISC_REQ_CONNECTION,
0, SECURITY_NETWORK_DREP, &type_2_desc,
0, &ntlm->c_handle, &type_3_desc,
&attrs, NULL);
if (status != SEC_E_OK)
return CURLE_RECV_ERROR;
size = type_3.cbBuffer;
ntlm_sspi_cleanup(ntlm);
#else
int lmrespoff; int lmrespoff;
int ntrespoff; int ntrespoff;
int useroff; int useroff;
@@ -552,6 +723,8 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
ntlmbuf[56] = (unsigned char)(size & 0xff); ntlmbuf[56] = (unsigned char)(size & 0xff);
ntlmbuf[57] = (unsigned char)(size >> 8); ntlmbuf[57] = (unsigned char)(size >> 8);
#endif
/* convert the binary blob into base64 */ /* convert the binary blob into base64 */
size = Curl_base64_encode((char *)ntlmbuf, size, &base64); size = Curl_base64_encode((char *)ntlmbuf, size, &base64);
@@ -583,5 +756,18 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
return CURLE_OK; return CURLE_OK;
} }
void
Curl_ntlm_cleanup(struct connectdata *conn)
{
#ifdef USE_WINDOWS_SSPI
ntlm_sspi_cleanup(&conn->ntlm);
ntlm_sspi_cleanup(&conn->proxyntlm);
#else
(void)conn;
#endif
}
#endif /* USE_SSLEAY */ #endif /* USE_SSLEAY */
#endif /* !CURL_DISABLE_HTTP */ #endif /* !CURL_DISABLE_HTTP */

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -38,7 +38,7 @@ CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy, char *header);
/* this is for creating ntlm header output */ /* this is for creating ntlm header output */
CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy); CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);
void Curl_ntlm_cleanup(struct SessionHandle *data); void Curl_ntlm_cleanup(struct connectdata *conn);
/* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */ /* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -31,6 +31,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "if2ip.h"
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__CYGWIN32__) && \ #if !defined(WIN32) && !defined(__BEOS__) && !defined(__CYGWIN32__) && \
!defined(__riscos__) && !defined(__INTERIX) && !defined(NETWARE) !defined(__riscos__) && !defined(__INTERIX) && !defined(NETWARE)
@@ -55,7 +57,6 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
/* -- if2ip() -- */
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif #endif
@@ -64,15 +65,11 @@
#include <sys/sockio.h> #include <sys/sockio.h>
#endif #endif
#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
#include "inet_ntoa_r.h"
#endif
#ifdef VMS #ifdef VMS
#include <inet.h> #include <inet.h>
#endif #endif
#include "if2ip.h" #include "inet_ntop.h"
#include "memory.h" #include "memory.h"
/* The last #include file should be: */ /* The last #include file should be: */
@@ -113,12 +110,7 @@ char *Curl_if2ip(const char *interface, char *buf, int buf_size)
struct sockaddr_in *s = (struct sockaddr_in *)&req.ifr_dstaddr; struct sockaddr_in *s = (struct sockaddr_in *)&req.ifr_dstaddr;
memcpy(&in, &(s->sin_addr.s_addr), sizeof(in)); memcpy(&in, &(s->sin_addr.s_addr), sizeof(in));
#if defined(HAVE_INET_NTOA_R) ip = Curl_inet_ntop(s->sin_family, &in, buf, buf_size);
ip = inet_ntoa_r(in,buf,buf_size);
#else
ip = strncpy(buf,inet_ntoa(in),buf_size);
ip[buf_size - 1] = 0;
#endif
} }
sclose(dummy); sclose(dummy);
} }

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -24,12 +24,8 @@
***************************************************************************/ ***************************************************************************/
#include "setup.h" #include "setup.h"
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__CYGWIN32__) && \ extern char *Curl_if2ip(const char *interf, char *buf, int buf_size);
!defined(__riscos__) && !defined(__INTERIX)
extern char *Curl_if2ip(const char *interface, char *buf, int buf_size);
#else
#define Curl_if2ip(a,b,c) NULL
#endif
#ifdef __INTERIX #ifdef __INTERIX
/* Nedelcho Stanev's work-around for SFU 3.0 */ /* Nedelcho Stanev's work-around for SFU 3.0 */
struct ifreq { struct ifreq {

View File

@@ -1,5 +1,16 @@
#ifndef __INET_NTOA_R_H #ifndef __INET_NTOA_R_H
#define __INET_NTOA_R_H #define __INET_NTOA_R_H
#include "setup.h"
#ifdef HAVE_INET_NTOA_R_2_ARGS
/*
* uClibc 0.9.26 (at least) doesn't define this prototype. The buffer
* must be at least 16 characters long.
*/
char *inet_ntoa_r(const struct in_addr in, char buffer[]);
#else
/* /*
* My solaris 5.6 system running gcc 2.8.1 does *not* have this prototype * My solaris 5.6 system running gcc 2.8.1 does *not* have this prototype
* in any system include file! Isn't that weird? * in any system include file! Isn't that weird?
@@ -7,3 +18,5 @@
char *inet_ntoa_r(const struct in_addr in, char *buffer, int buflen); char *inet_ntoa_r(const struct in_addr in, char *buffer, int buflen);
#endif #endif
#endif

View File

@@ -54,10 +54,17 @@
* - uses no statics * - uses no statics
* - takes a u_char* not an in_addr as input * - takes a u_char* not an in_addr as input
*/ */
static const char *inet_ntop4 (const u_char *src, char *dst, size_t size) static char *inet_ntop4 (const u_char *src, char *dst, size_t size)
{ {
#ifdef HAVE_INET_NTOA_R #if defined(HAVE_INET_NTOA_R_2_ARGS)
const char *ptr;
curlassert(size >= 16);
ptr = inet_ntoa_r(*(struct in_addr*)src, dst);
return (char *)memmove(dst, ptr, strlen(ptr)+1);
#elif defined(HAVE_INET_NTOA_R)
return inet_ntoa_r(*(struct in_addr*)src, dst, size); return inet_ntoa_r(*(struct in_addr*)src, dst, size);
#else #else
const char *addr = inet_ntoa(*(struct in_addr*)src); const char *addr = inet_ntoa(*(struct in_addr*)src);
@@ -74,7 +81,7 @@ static const char *inet_ntop4 (const u_char *src, char *dst, size_t size)
/* /*
* Convert IPv6 binary address into presentation (printable) format. * Convert IPv6 binary address into presentation (printable) format.
*/ */
static const char *inet_ntop6 (const u_char *src, char *dst, size_t size) static char *inet_ntop6 (const u_char *src, char *dst, size_t size)
{ {
/* /*
* Note that int32_t and int16_t need only be "at least" large enough * Note that int32_t and int16_t need only be "at least" large enough
@@ -178,10 +185,10 @@ static const char *inet_ntop6 (const u_char *src, char *dst, size_t size)
/* /*
* Convert a network format address to presentation format. * Convert a network format address to presentation format.
* *
* Returns pointer to presentation format address (`dst'), * Returns pointer to presentation format address (`buf'),
* Returns NULL on error (see errno). * Returns NULL on error (see errno).
*/ */
const char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size) char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size)
{ {
switch (af) { switch (af) {
case AF_INET: case AF_INET:

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -31,7 +31,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#else #else
const char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size); char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size);
#endif #endif
#endif /* __INET_NTOP_H */ #endif /* __INET_NTOP_H */

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@@ -43,8 +43,6 @@
#ifndef CURL_DISABLE_FTP #ifndef CURL_DISABLE_FTP
#ifdef HAVE_KRB4 #ifdef HAVE_KRB4
#include "security.h"
#include "base64.h"
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
@@ -57,6 +55,8 @@
#include <unistd.h> /* for getpid() */ #include <unistd.h> /* for getpid() */
#endif #endif
#include "urldata.h"
#include "base64.h"
#include "ftp.h" #include "ftp.h"
#include "sendf.h" #include "sendf.h"
#include "krb4.h" #include "krb4.h"
@@ -199,7 +199,8 @@ krb4_auth(void *app_data, struct connectdata *conn)
{ {
int ret; int ret;
char *p; char *p;
int len; unsigned char *ptr;
size_t len;
KTEXT_ST adat; KTEXT_ST adat;
MSG_DAT msg_data; MSG_DAT msg_data;
int checksum; int checksum;
@@ -275,11 +276,17 @@ krb4_auth(void *app_data, struct connectdata *conn)
return AUTH_ERROR; return AUTH_ERROR;
} }
p += 5; p += 5;
len = Curl_base64_decode(p, (char *)adat.dat); len = Curl_base64_decode(p, &ptr);
if(len < 0) { if(len > sizeof(adat.dat)-1) {
free(ptr);
len=0;
}
if(!len || !ptr) {
Curl_failf(data, "Failed to decode base64 from server"); Curl_failf(data, "Failed to decode base64 from server");
return AUTH_ERROR; return AUTH_ERROR;
} }
memcpy((char *)adat.dat, ptr, len);
free(ptr);
adat.length = len; adat.length = len;
ret = krb_rd_safe(adat.dat, adat.length, &d->key, ret = krb_rd_safe(adat.dat, adat.length, &d->key,
(struct sockaddr_in *)hisctladdr, (struct sockaddr_in *)hisctladdr,
@@ -317,10 +324,11 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
char *name; char *name;
char *p; char *p;
char passwd[100]; char passwd[100];
int tmp; size_t tmp;
ssize_t nread; ssize_t nread;
int save; int save;
CURLcode result; CURLcode result;
unsigned char *ptr;
save = Curl_set_command_prot(conn, prot_private); save = Curl_set_command_prot(conn, prot_private);
@@ -346,12 +354,18 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
} }
p += 2; p += 2;
tmp = Curl_base64_decode(p, (char *)tkt.dat); tmp = Curl_base64_decode(p, &ptr);
if(tmp < 0) { if(tmp >= sizeof(tkt.dat)) {
free(ptr);
tmp=0;
}
if(!tmp || !ptr) {
Curl_failf(conn->data, "Failed to decode base64 in reply.\n"); Curl_failf(conn->data, "Failed to decode base64 in reply.\n");
Curl_set_command_prot(conn, save); Curl_set_command_prot(conn, save);
return CURLE_FTP_WEIRD_SERVER_REPLY; return CURLE_FTP_WEIRD_SERVER_REPLY;
} }
memcpy((char *)tkt.dat, ptr, tmp);
free(ptr);
tkt.length = tmp; tkt.length = tmp;
tktcopy.length = tkt.length; tktcopy.length = tkt.length;

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -22,6 +22,48 @@
* *
* $Id$ * $Id$
***************************************************************************/ ***************************************************************************/
struct Curl_sec_client_mech {
const char *name;
size_t size;
int (*init)(void *);
int (*auth)(void *, struct connectdata *);
void (*end)(void *);
int (*check_prot)(void *, int);
int (*overhead)(void *, int, int);
int (*encode)(void *, void*, int, int, void**, struct connectdata *);
int (*decode)(void *, void*, int, int, struct connectdata *);
};
#define AUTH_OK 0
#define AUTH_CONTINUE 1
#define AUTH_ERROR 2
extern struct Curl_sec_client_mech Curl_krb4_client_mech;
CURLcode Curl_krb_kauth(struct connectdata *conn); CURLcode Curl_krb_kauth(struct connectdata *conn);
int Curl_sec_fflush_fd(struct connectdata *conn, int fd);
int Curl_sec_fprintf (struct connectdata *, FILE *, const char *, ...);
int Curl_sec_getc (struct connectdata *conn, FILE *);
int Curl_sec_putc (struct connectdata *conn, int, FILE *);
int Curl_sec_read (struct connectdata *conn, int, void *, int);
int Curl_sec_read_msg (struct connectdata *conn, char *, int);
int Curl_sec_vfprintf(struct connectdata *, FILE *, const char *, va_list);
int Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...);
int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list);
int Curl_sec_write (struct connectdata *conn, int, char *, int);
void Curl_sec_end (struct connectdata *);
int Curl_sec_login (struct connectdata *);
void Curl_sec_prot (int, char **);
int Curl_sec_request_prot (struct connectdata *conn, const char *level);
void Curl_sec_set_protection_level(struct connectdata *conn);
void Curl_sec_status (void);
enum protection_level Curl_set_command_prot(struct connectdata *,
enum protection_level);
#endif #endif

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -110,7 +110,7 @@ typedef void * (*dynafunc)(void *input);
*/ */
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL) || defined(WIN32) #if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL) || defined(WIN32)
static void *libldap = NULL; static void *libldap = NULL;
#ifndef WIN32 #if defined(DL_LBER_FILE)
static void *liblber = NULL; static void *liblber = NULL;
#endif #endif
#endif #endif
@@ -120,24 +120,26 @@ static int DynaOpen(const char **mod_name)
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL) #if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
if (libldap == NULL) { if (libldap == NULL) {
/* /*
* libldap.so should be able to resolve its dependency on * libldap.so can normally resolve its dependency on liblber.so
* liblber.so automatically, but since it does not we will * automatically, but in broken installation it does not so
* handle it here by opening liblber.so as global. * handle it here by opening liblber.so as global.
*/ */
*mod_name = "liblber.so"; #ifdef DL_LBER_FILE
*mod_name = DL_LBER_FILE;
liblber = dlopen(*mod_name, DLOPEN_MODE); liblber = dlopen(*mod_name, DLOPEN_MODE);
if (!liblber)
return 0;
#endif
/* Assume loading libldap.so will fail if loading of liblber.so failed /* Assume loading libldap.so will fail if loading of liblber.so failed
*/ */
if (liblber) { *mod_name = DL_LDAP_FILE;
*mod_name = "libldap.so"; libldap = dlopen(*mod_name, RTLD_LAZY);
libldap = dlopen(*mod_name, RTLD_LAZY);
}
} }
return (libldap != NULL && liblber != NULL); return (libldap != NULL);
#elif defined(WIN32) #elif defined(WIN32)
*mod_name = "wldap32.dll"; *mod_name = DL_LDAP_FILE;
if (!libldap) if (!libldap)
libldap = (void*)LoadLibrary(*mod_name); libldap = (void*)LoadLibrary(*mod_name);
return (libldap != NULL); return (libldap != NULL);
@@ -155,10 +157,12 @@ static void DynaClose(void)
dlclose(libldap); dlclose(libldap);
libldap=NULL; libldap=NULL;
} }
#ifdef DL_LBER_FILE
if (liblber) { if (liblber) {
dlclose(liblber); dlclose(liblber);
liblber=NULL; liblber=NULL;
} }
#endif
#elif defined(WIN32) #elif defined(WIN32)
if (libldap) { if (libldap) {
FreeLibrary ((HMODULE)libldap); FreeLibrary ((HMODULE)libldap);
@@ -224,7 +228,7 @@ static void (*ldap_free_urldesc)(LDAPURLDesc *) = _ldap_free_urldesc;
#endif #endif
CURLcode Curl_ldap(struct connectdata *conn) CURLcode Curl_ldap(struct connectdata *conn, bool *done)
{ {
CURLcode status = CURLE_OK; CURLcode status = CURLE_OK;
int rc = 0; int rc = 0;
@@ -256,6 +260,7 @@ CURLcode Curl_ldap(struct connectdata *conn)
int num = 0; int num = 0;
struct SessionHandle *data=conn->data; struct SessionHandle *data=conn->data;
*done = TRUE; /* unconditionally */
infof(data, "LDAP local: %s\n", data->change.url); infof(data, "LDAP local: %s\n", data->change.url);
if (!DynaOpen(&mod_name)) { if (!DynaOpen(&mod_name)) {
@@ -379,6 +384,7 @@ quit:
/* no data to transfer */ /* no data to transfer */
Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL); Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
conn->bits.close = TRUE;
return status; return status;
} }
@@ -473,9 +479,9 @@ static bool unescape_elements (LDAPURLDesc *ludp)
char *new_dn = curl_unescape(dn, 0); char *new_dn = curl_unescape(dn, 0);
free(dn); free(dn);
ludp->lud_dn = new_dn;
if (!new_dn) if (!new_dn)
return (FALSE); return (FALSE);
ludp->lud_dn = new_dn;
} }
return (TRUE); return (TRUE);
} }

View File

@@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -24,6 +24,6 @@
* $Id$ * $Id$
***************************************************************************/ ***************************************************************************/
#ifndef CURL_DISABLE_LDAP #ifndef CURL_DISABLE_LDAP
CURLcode Curl_ldap(struct connectdata *conn); CURLcode Curl_ldap(struct connectdata *conn, bool *done);
#endif #endif
#endif /* __LDAP_H */ #endif /* __LDAP_H */

View File

@@ -6,7 +6,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@@ -45,6 +45,7 @@
#include "memory.h" #include "memory.h"
#include "easyif.h" #include "easyif.h"
#include "multiif.h" #include "multiif.h"
#include "sendf.h"
/* The last #include file should be: */ /* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"
@@ -56,11 +57,14 @@ struct Curl_message {
}; };
typedef enum { typedef enum {
CURLM_STATE_INIT, CURLM_STATE_INIT, /* start in this state */
CURLM_STATE_CONNECT, /* resolve/connect has been sent off */ CURLM_STATE_CONNECT, /* resolve/connect has been sent off */
CURLM_STATE_WAITRESOLVE, /* we're awaiting the resolve to finalize */ CURLM_STATE_WAITRESOLVE, /* awaiting the resolve to finalize */
CURLM_STATE_WAITCONNECT, /* we're awaiting the connect to finalize */ CURLM_STATE_WAITCONNECT, /* awaiting the connect to finalize */
CURLM_STATE_DO, /* send off the request (part 1) */ CURLM_STATE_PROTOCONNECT, /* completing the protocol-specific connect
phase */
CURLM_STATE_DO, /* start send off the request (part 1) */
CURLM_STATE_DOING, /* sending off the request (part 1) */
CURLM_STATE_DO_MORE, /* send off the request (part 2) */ CURLM_STATE_DO_MORE, /* send off the request (part 2) */
CURLM_STATE_PERFORM, /* transfer data */ CURLM_STATE_PERFORM, /* transfer data */
CURLM_STATE_DONE, /* post data transfer operation */ CURLM_STATE_DONE, /* post data transfer operation */
@@ -111,6 +115,33 @@ struct Curl_multi {
struct curl_hash *hostcache; struct curl_hash *hostcache;
}; };
/* always use this function to change state, to make debugging easier */
static void multistate(struct Curl_one_easy *easy, CURLMstate state)
{
#ifdef CURLDEBUG
const char *statename[]={
"INIT",
"CONNECT",
"WAITRESOLVE",
"WAITCONNECT",
"PROTOCONNECT",
"DO",
"DOING",
"DO_MORE",
"PERFORM",
"DONE",
"COMPLETED",
};
CURLMstate oldstate = easy->state;
#endif
easy->state = state;
#ifdef CURLDEBUG
infof(easy->easy_handle,
"STATE: %s => %s handle %p: \n",
statename[oldstate], statename[easy->state], (char *)easy);
#endif
}
CURLM *curl_multi_init(void) CURLM *curl_multi_init(void)
{ {
@@ -158,7 +189,7 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
/* set the easy handle */ /* set the easy handle */
easy->easy_handle = easy_handle; easy->easy_handle = easy_handle;
easy->state = CURLM_STATE_INIT; multistate(easy, CURLM_STATE_INIT);
/* for multi interface connections, we share DNS cache automaticly */ /* for multi interface connections, we share DNS cache automaticly */
easy->easy_handle->hostcache = multi->hostcache; easy->easy_handle->hostcache = multi->hostcache;
@@ -258,7 +289,22 @@ CURLMcode curl_multi_fdset(CURLM *multi_handle,
break; break;
case CURLM_STATE_WAITRESOLVE: case CURLM_STATE_WAITRESOLVE:
/* waiting for a resolve to complete */ /* waiting for a resolve to complete */
Curl_fdset(easy->easy_conn, read_fd_set, write_fd_set, &this_max_fd); Curl_resolv_fdset(easy->easy_conn, read_fd_set, write_fd_set,
&this_max_fd);
if(this_max_fd > *max_fd)
*max_fd = this_max_fd;
break;
case CURLM_STATE_PROTOCONNECT:
Curl_protocol_fdset(easy->easy_conn, read_fd_set, write_fd_set,
&this_max_fd);
if(this_max_fd > *max_fd)
*max_fd = this_max_fd;
break;
case CURLM_STATE_DOING:
Curl_doing_fdset(easy->easy_conn, read_fd_set, write_fd_set,
&this_max_fd);
if(this_max_fd > *max_fd) if(this_max_fd > *max_fd)
*max_fd = this_max_fd; *max_fd = this_max_fd;
break; break;
@@ -318,6 +364,8 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
struct Curl_message *msg = NULL; struct Curl_message *msg = NULL;
bool connected; bool connected;
bool async; bool async;
bool protocol_connect;
bool dophase_done;
*running_handles = 0; /* bump this once for every living handle */ *running_handles = 0; /* bump this once for every living handle */
@@ -326,10 +374,6 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
easy=multi->easy.next; easy=multi->easy.next;
while(easy) { while(easy) {
#if 0
fprintf(stderr, "HANDLE %p: State: %x\n",
(char *)easy, easy->state);
#endif
do { do {
if (CURLM_STATE_WAITCONNECT <= easy->state && if (CURLM_STATE_WAITCONNECT <= easy->state &&
easy->state <= CURLM_STATE_DO && easy->state <= CURLM_STATE_DO &&
@@ -344,13 +388,13 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
easy->easy_handle->change.url_changed = FALSE; easy->easy_handle->change.url_changed = FALSE;
easy->result = Curl_follow(easy->easy_handle, gotourl, FALSE); easy->result = Curl_follow(easy->easy_handle, gotourl, FALSE);
if(CURLE_OK == easy->result) if(CURLE_OK == easy->result)
easy->state = CURLM_STATE_CONNECT; multistate(easy, CURLM_STATE_CONNECT);
else else
free(gotourl); free(gotourl);
} }
else { else {
easy->result = CURLE_OUT_OF_MEMORY; easy->result = CURLE_OUT_OF_MEMORY;
easy->state = CURLM_STATE_COMPLETED; multistate(easy, CURLM_STATE_COMPLETED);
break; break;
} }
} }
@@ -365,7 +409,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
if(CURLE_OK == easy->result) { if(CURLE_OK == easy->result) {
/* after init, go CONNECT */ /* after init, go CONNECT */
easy->state = CURLM_STATE_CONNECT; multistate(easy, CURLM_STATE_CONNECT);
result = CURLM_CALL_MULTI_PERFORM; result = CURLM_CALL_MULTI_PERFORM;
easy->easy_handle->state.used_interface = Curl_if_multi; easy->easy_handle->state.used_interface = Curl_if_multi;
@@ -376,16 +420,22 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
/* Connect. We get a connection identifier filled in. */ /* Connect. We get a connection identifier filled in. */
Curl_pgrsTime(easy->easy_handle, TIMER_STARTSINGLE); Curl_pgrsTime(easy->easy_handle, TIMER_STARTSINGLE);
easy->result = Curl_connect(easy->easy_handle, &easy->easy_conn, easy->result = Curl_connect(easy->easy_handle, &easy->easy_conn,
&async); &async, &protocol_connect);
if(CURLE_OK == easy->result) { if(CURLE_OK == easy->result) {
if(async) if(async)
/* We're now waiting for an asynchronous name lookup */ /* We're now waiting for an asynchronous name lookup */
easy->state = CURLM_STATE_WAITRESOLVE; multistate(easy, CURLM_STATE_WAITRESOLVE);
else { else {
/* after the connect has been sent off, go WAITCONNECT */ /* after the connect has been sent off, go WAITCONNECT unless the
easy->state = CURLM_STATE_WAITCONNECT; protocol connect is already done and we can go directly to
DO! */
result = CURLM_CALL_MULTI_PERFORM; result = CURLM_CALL_MULTI_PERFORM;
if(protocol_connect)
multistate(easy, CURLM_STATE_DO);
else
multistate(easy, CURLM_STATE_WAITCONNECT);
} }
} }
break; break;
@@ -401,14 +451,17 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
if(dns) { if(dns) {
/* Perform the next step in the connection phase, and then move on /* Perform the next step in the connection phase, and then move on
to the WAITCONNECT state */ to the WAITCONNECT state */
easy->result = Curl_async_resolved(easy->easy_conn); easy->result = Curl_async_resolved(easy->easy_conn,
&protocol_connect);
if(CURLE_OK != easy->result) if(CURLE_OK != easy->result)
/* if Curl_async_resolved() returns failure, the connection struct /* if Curl_async_resolved() returns failure, the connection struct
is already freed and gone */ is already freed and gone */
easy->easy_conn = NULL; /* no more connection */ easy->easy_conn = NULL; /* no more connection */
else {
easy->state = CURLM_STATE_WAITCONNECT; /* FIX: what if protocol_connect is TRUE here?! */
multistate(easy, CURLM_STATE_WAITCONNECT);
}
} }
if(CURLE_OK != easy->result) { if(CURLE_OK != easy->result) {
@@ -425,7 +478,8 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
easy->result = Curl_is_connected(easy->easy_conn, FIRSTSOCKET, easy->result = Curl_is_connected(easy->easy_conn, FIRSTSOCKET,
&connected); &connected);
if(connected) if(connected)
easy->result = Curl_protocol_connect(easy->easy_conn); easy->result = Curl_protocol_connect(easy->easy_conn,
&protocol_connect);
if(CURLE_OK != easy->result) { if(CURLE_OK != easy->result) {
/* failure detected */ /* failure detected */
@@ -435,29 +489,63 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
} }
if(connected) { if(connected) {
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);
}
else {
/* after the connect has completed, go DO */
multistate(easy, CURLM_STATE_DO);
result = CURLM_CALL_MULTI_PERFORM;
}
}
break;
case CURLM_STATE_PROTOCONNECT:
/* protocol-specific connect phase */
easy->result = Curl_protocol_connecting(easy->easy_conn,
&protocol_connect);
if(protocol_connect) {
/* after the connect has completed, go DO */ /* after the connect has completed, go DO */
easy->state = CURLM_STATE_DO; multistate(easy, CURLM_STATE_DO);
result = CURLM_CALL_MULTI_PERFORM; result = CURLM_CALL_MULTI_PERFORM;
} }
else if(easy->result) {
/* failure detected */
Curl_posttransfer(easy->easy_handle);
Curl_done(&easy->easy_conn, easy->result);
Curl_disconnect(easy->easy_conn); /* close the connection */
easy->easy_conn = NULL; /* no more connection */
}
break; break;
case CURLM_STATE_DO: case CURLM_STATE_DO:
/* Do the fetch or put request */ /* Perform the protocol's DO action */
easy->result = Curl_do(&easy->easy_conn); easy->result = Curl_do(&easy->easy_conn, &dophase_done);
if(CURLE_OK == easy->result) { if(CURLE_OK == easy->result) {
/* after do, go PERFORM... or DO_MORE */ if(!dophase_done) {
if(easy->easy_conn->bits.do_more) { /* DO was not completed in one function call, we must continue
DOING... */
multistate(easy, CURLM_STATE_DOING);
result = CURLM_OK;
}
/* after DO, go PERFORM... or DO_MORE */
else if(easy->easy_conn->bits.do_more) {
/* we're supposed to do more, but we need to sit down, relax /* we're supposed to do more, but we need to sit down, relax
and wait a little while first */ and wait a little while first */
easy->state = CURLM_STATE_DO_MORE; multistate(easy, CURLM_STATE_DO_MORE);
result = CURLM_OK; result = CURLM_OK;
} }
else { else {
/* we're done with the DO, now PERFORM */ /* we're done with the DO, now PERFORM */
easy->result = Curl_readwrite_init(easy->easy_conn); easy->result = Curl_readwrite_init(easy->easy_conn);
if(CURLE_OK == easy->result) { if(CURLE_OK == easy->result) {
easy->state = CURLM_STATE_PERFORM; multistate(easy, CURLM_STATE_PERFORM);
result = CURLM_CALL_MULTI_PERFORM; result = CURLM_CALL_MULTI_PERFORM;
} }
} }
@@ -471,10 +559,39 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
} }
break; break;
case CURLM_STATE_DOING:
/* we continue DOING until the DO phase is complete */
easy->result = Curl_protocol_doing(easy->easy_conn, &dophase_done);
if(CURLE_OK == easy->result) {
if(dophase_done) {
/* after DO, go PERFORM... or DO_MORE */
if(easy->easy_conn->bits.do_more) {
/* we're supposed to do more, but we need to sit down, relax
and wait a little while first */
multistate(easy, CURLM_STATE_DO_MORE);
result = CURLM_OK;
}
else {
/* we're done with the DO, now PERFORM */
easy->result = Curl_readwrite_init(easy->easy_conn);
if(CURLE_OK == easy->result) {
multistate(easy, CURLM_STATE_PERFORM);
result = CURLM_CALL_MULTI_PERFORM;
}
}
} /* dophase_done */
}
else {
/* failure detected */
Curl_posttransfer(easy->easy_handle);
Curl_done(&easy->easy_conn, easy->result);
Curl_disconnect(easy->easy_conn); /* close the connection */
easy->easy_conn = NULL; /* no more connection */
}
break;
case CURLM_STATE_DO_MORE: case CURLM_STATE_DO_MORE:
/* /* Ready to do more? */
* First, check if we really are ready to do more.
*/
easy->result = Curl_is_connected(easy->easy_conn, SECONDARYSOCKET, easy->result = Curl_is_connected(easy->easy_conn, SECONDARYSOCKET,
&connected); &connected);
if(connected) { if(connected) {
@@ -487,7 +604,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
easy->result = Curl_readwrite_init(easy->easy_conn); easy->result = Curl_readwrite_init(easy->easy_conn);
if(CURLE_OK == easy->result) { if(CURLE_OK == easy->result) {
easy->state = CURLM_STATE_PERFORM; multistate(easy, CURLM_STATE_PERFORM);
result = CURLM_CALL_MULTI_PERFORM; result = CURLM_CALL_MULTI_PERFORM;
} }
} }
@@ -532,7 +649,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
if(easy->result == CURLE_OK) if(easy->result == CURLE_OK)
easy->result = Curl_follow(easy->easy_handle, newurl, retry); easy->result = Curl_follow(easy->easy_handle, newurl, retry);
if(CURLE_OK == easy->result) { if(CURLE_OK == easy->result) {
easy->state = CURLM_STATE_CONNECT; multistate(easy, CURLM_STATE_CONNECT);
result = CURLM_CALL_MULTI_PERFORM; result = CURLM_CALL_MULTI_PERFORM;
} }
else else
@@ -542,7 +659,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
} }
else { else {
/* after the transfer is done, go DONE */ /* after the transfer is done, go DONE */
easy->state = CURLM_STATE_DONE; multistate(easy, CURLM_STATE_DONE);
result = CURLM_CALL_MULTI_PERFORM; result = CURLM_CALL_MULTI_PERFORM;
} }
} }
@@ -553,7 +670,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
/* after we have DONE what we're supposed to do, go COMPLETED, and /* after we have DONE what we're supposed to do, go COMPLETED, and
it doesn't matter what the Curl_done() returned! */ it doesn't matter what the Curl_done() returned! */
easy->state = CURLM_STATE_COMPLETED; multistate(easy, CURLM_STATE_COMPLETED);
break; break;
case CURLM_STATE_COMPLETED: case CURLM_STATE_COMPLETED:
@@ -571,7 +688,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
/* /*
* If an error was returned, and we aren't in completed state now, * If an error was returned, and we aren't in completed state now,
* then we go to completed and consider this transfer aborted. */ * then we go to completed and consider this transfer aborted. */
easy->state = CURLM_STATE_COMPLETED; multistate(easy, CURLM_STATE_COMPLETED);
} }
else else
/* this one still lives! */ /* this one still lives! */
@@ -600,7 +717,6 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
multi->num_msgs++; /* increase message counter */ multi->num_msgs++; /* increase message counter */
} }
easy = easy->next; /* operate on next handle */ easy = easy->next; /* operate on next handle */
} }

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -27,5 +27,4 @@
* Prototypes for library-wide functions provided by multi.c * Prototypes for library-wide functions provided by multi.c
*/ */
void Curl_multi_rmeasy(void *multi, CURL *data); void Curl_multi_rmeasy(void *multi, CURL *data);
#endif /* __MULTIIF_H */ #endif /* __MULTIIF_H */

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -86,14 +86,14 @@
static time_t Curl_parsedate(const char *date); static time_t Curl_parsedate(const char *date);
static const char * const wkday[] = const char * const Curl_wkday[] =
{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
static const char * const weekday[] = static const char * const weekday[] =
{ "Monday", "Tuesday", "Wednesday", "Thursday", { "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday" }; "Friday", "Saturday", "Sunday" };
static const char * const month[]= const char * const Curl_month[]=
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
struct tzinfo { struct tzinfo {
const char *name; const char *name;
@@ -161,7 +161,7 @@ static int checkday(char *check, size_t len)
if(len > 3) if(len > 3)
what = &weekday[0]; what = &weekday[0];
else else
what = &wkday[0]; what = &Curl_wkday[0];
for(i=0; i<7; i++) { for(i=0; i<7; i++) {
if(curl_strequal(check, what[0])) { if(curl_strequal(check, what[0])) {
found=TRUE; found=TRUE;
@@ -178,7 +178,7 @@ static int checkmonth(char *check)
const char * const *what; const char * const *what;
bool found= FALSE; bool found= FALSE;
what = &month[0]; what = &Curl_month[0];
for(i=0; i<12; i++) { for(i=0; i<12; i++) {
if(curl_strequal(check, what[0])) { if(curl_strequal(check, what[0])) {
found=TRUE; found=TRUE;
@@ -369,10 +369,17 @@ static time_t Curl_parsedate(const char *date)
tm.tm_yday = 0; tm.tm_yday = 0;
tm.tm_isdst = 0; tm.tm_isdst = 0;
/* mktime() returns a time_t. time_t is often 32 bits, even on many
architectures that feature 64 bit 'long'.
Some systems have 64 bit time_t and deal with years beyond 2038. However,
even some of the systems with 64 bit time_t returns -1 for dates beyond
03:14:07 UTC, January 19, 2038. (Such as AIX 5100-06)
*/
t = mktime(&tm); t = mktime(&tm);
/* time zone adjust */ /* time zone adjust */
{ if(-1 != t) {
struct tm *gmt; struct tm *gmt;
long delta; long delta;
time_t t2; time_t t2;

28
lib/parsedate.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef __PARSEDATE_H
#define __PARSEDATEL_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
extern const char * const Curl_wkday[7];
extern const char * const Curl_month[12];
#endif

View File

@@ -46,7 +46,6 @@
#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */ #define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */
#include <curl/mprintf.h> #include <curl/mprintf.h>
#include "security.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <netdb.h> #include <netdb.h>
@@ -55,6 +54,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "urldata.h"
#include "krb4.h"
#include "base64.h" #include "base64.h"
#include "sendf.h" #include "sendf.h"
#include "ftp.h" #include "ftp.h"
@@ -297,13 +298,15 @@ int
Curl_sec_read_msg(struct connectdata *conn, char *s, int level) Curl_sec_read_msg(struct connectdata *conn, char *s, int level)
{ {
int len; int len;
char *buf; unsigned char *buf;
int code; int code;
buf = malloc(strlen(s)); len = Curl_base64_decode(s + 4, &buf); /* XXX */
len = Curl_base64_decode(s + 4, buf); /* XXX */ if(len > 0)
len = (conn->mech->decode)(conn->app_data, buf, len, level, conn);
else
return -1;
len = (conn->mech->decode)(conn->app_data, buf, len, level, conn);
if(len < 0) { if(len < 0) {
free(buf); free(buf);
return -1; return -1;
@@ -314,10 +317,10 @@ Curl_sec_read_msg(struct connectdata *conn, char *s, int level)
if(buf[3] == '-') if(buf[3] == '-')
code = 0; code = 0;
else else
sscanf(buf, "%d", &code); sscanf((char *)buf, "%d", &code);
if(buf[len-1] == '\n') if(buf[len-1] == '\n')
buf[len-1] = '\0'; buf[len-1] = '\0';
strcpy(s, buf); strcpy(s, (char *)buf);
free(buf); free(buf);
return code; return code;
} }

View File

@@ -1,72 +0,0 @@
#ifndef __SECURITY_H
#define __SECURITY_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
/* this is a re-write */
#include <stdarg.h>
#include "urldata.h" /* for struct connectdata * */
struct Curl_sec_client_mech {
const char *name;
size_t size;
int (*init)(void *);
int (*auth)(void *, struct connectdata *);
void (*end)(void *);
int (*check_prot)(void *, int);
int (*overhead)(void *, int, int);
int (*encode)(void *, void*, int, int, void**, struct connectdata *);
int (*decode)(void *, void*, int, int, struct connectdata *);
};
#define AUTH_OK 0
#define AUTH_CONTINUE 1
#define AUTH_ERROR 2
extern struct Curl_sec_client_mech Curl_krb4_client_mech;
int Curl_sec_fflush_fd(struct connectdata *conn, int fd);
int Curl_sec_fprintf (struct connectdata *, FILE *, const char *, ...);
int Curl_sec_getc (struct connectdata *conn, FILE *);
int Curl_sec_putc (struct connectdata *conn, int, FILE *);
int Curl_sec_read (struct connectdata *conn, int, void *, int);
int Curl_sec_read_msg (struct connectdata *conn, char *, int);
int Curl_sec_vfprintf(struct connectdata *, FILE *, const char *, va_list);
int Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...);
int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list);
int Curl_sec_write (struct connectdata *conn, int, char *, int);
void Curl_sec_end (struct connectdata *);
int Curl_sec_login (struct connectdata *);
void Curl_sec_prot (int, char **);
int Curl_sec_request_prot (struct connectdata *conn, const char *level);
void Curl_sec_set_protection_level(struct connectdata *conn);
void Curl_sec_status (void);
enum protection_level Curl_set_command_prot(struct connectdata *,
enum protection_level);
#endif

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -51,9 +51,15 @@
#include "select.h" #include "select.h"
#ifdef WIN32 #ifdef WIN32
#define VALID_SOCK(s) (1) /* Win-sockets are not in range [0..FD_SETSIZE> */ #define VERIFY_SOCK(x) /* Win-sockets are not in range [0..FD_SETSIZE> */
#else #else
#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE)) #define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE))
#define VERIFY_SOCK(x) do { \
if(!VALID_SOCK(x)) { \
errno = EINVAL; \
return -1; \
} \
} while(0)
#endif #endif
/* /*
@@ -129,10 +135,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
FD_ZERO(&fds_read); FD_ZERO(&fds_read);
if (readfd != CURL_SOCKET_BAD) { if (readfd != CURL_SOCKET_BAD) {
if (!VALID_SOCK(readfd)) { VERIFY_SOCK(readfd);
errno = EINVAL;
return -1;
}
FD_SET(readfd, &fds_read); FD_SET(readfd, &fds_read);
FD_SET(readfd, &fds_err); FD_SET(readfd, &fds_err);
maxfd = readfd; maxfd = readfd;
@@ -140,10 +143,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
FD_ZERO(&fds_write); FD_ZERO(&fds_write);
if (writefd != CURL_SOCKET_BAD) { if (writefd != CURL_SOCKET_BAD) {
if (!VALID_SOCK(writefd)) { VERIFY_SOCK(writefd);
errno = EINVAL;
return -1;
}
FD_SET(writefd, &fds_write); FD_SET(writefd, &fds_write);
FD_SET(writefd, &fds_err); FD_SET(writefd, &fds_err);
if (writefd > maxfd) if (writefd > maxfd)

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -49,7 +49,7 @@
#include <curl/mprintf.h> #include <curl/mprintf.h>
#ifdef HAVE_KRB4 #ifdef HAVE_KRB4
#include "security.h" #include "krb4.h"
#endif #endif
#include <string.h> #include <string.h>
#include "memory.h" #include "memory.h"

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

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