Compare commits

...

190 Commits

Author SHA1 Message Date
Gunter Knauf
b238e0b1b4 fixed warning with gcc 4.x (hopefully); dynamincally imported UseAccurateCaseForPaths() for CLIB port to be stonetime-compatible (NW 3.x). 2007-08-09 22:33:49 +00:00
Gunter Knauf
3f62bfb61d fixed a warning which MingW gcc 4.2.1. 2007-08-09 21:05:05 +00:00
Dan Fandrich
c7a66d5af4 There's no need to ignore the User-Agent for this test. 2007-08-09 03:28:16 +00:00
Gunter Knauf
1866b95b7f moved ugly CLIB define to nwos.c. 2007-08-08 20:09:08 +00:00
Dan Fandrich
668c204970 Song Ma noted a zlib memory leak in the illegal compressed header
countermeasures code path.
2007-08-08 17:51:40 +00:00
Gunter Knauf
af2d899d6b removed asm rules since we have no asm in the sources, and this produced 2 warnings. 2007-08-08 17:07:16 +00:00
Gunter Knauf
d5ed9f787f blocked ssize_t define for MingW32. 2007-08-08 16:59:43 +00:00
Patrick Monnerat
259f27b09f Fix getsockname argument type
Improve "universal" alignment type in struct memdebug
2007-08-08 10:37:07 +00:00
Daniel Stenberg
c1b9356081 Usage of the BCURLOPT_PROGRESSFUNCTION callback is not recommended when using
the multi interface, but having the comment in here caused more questions than
we fixed problems so I remove it now. It still works fine.
2007-08-07 21:14:31 +00:00
Dan Fandrich
c669e1ae45 Fixed torture test for test 509 2007-08-07 18:24:49 +00:00
Gunter Knauf
10203cada9 moved HAVE_LONGLONG from makefiles to config-win32.h. 2007-08-07 17:40:56 +00:00
Daniel Stenberg
58b0415d36 add URL to more "generated public config.h" details 2007-08-07 13:01:36 +00:00
Patrick Monnerat
ad9cb40b6f Some #if --> #ifdef
undef standard *printf before (re)defining them
2007-08-07 12:44:38 +00:00
Dan Fandrich
2e60ca382d Fixed some icc compiler warnings. 2007-08-07 00:10:27 +00:00
Gunter Knauf
25920f4a14 Peteris Krumins pointed out that MingW32 doesnt provide a batch file to set the path to the bin folder. 2007-08-06 22:21:38 +00:00
Daniel Stenberg
160c302933 ontributors from the 7.16.4 release notes and a removed duplicate 2007-08-06 15:58:05 +00:00
Daniel Stenberg
dddc8e3374 removed the rsaglue hint since it doesn't apply to modern OpenSSL, and added
some brief hints about gssapi and libssh2
2007-08-06 15:54:38 +00:00
Daniel Stenberg
bccb1ee7cd we now support GSS/Kerberos 5 for ftp file transfers! 2007-08-06 14:56:21 +00:00
Daniel Stenberg
26af759732 Patrick Monnerat updated the _FORM_DEBUG-enabled code, and I updated comments
based on his comments/suggestions.
2007-08-05 21:33:31 +00:00
Gunter Knauf
87fc4ad919 changed to use libssh2 0.16;
fixed link order in case libssh2 is build with zlib.
2007-08-04 23:35:23 +00:00
Daniel Stenberg
b214298960 another mirror 2007-08-04 20:58:53 +00:00
Daniel Stenberg
1926f4573d Patrick Monnerat fixed curl_easy_escape() and curlx_strtoll() to work on
non-ASCII systems.
2007-08-04 20:47:59 +00:00
Dan Fandrich
7fe65aaf5b Fixed a couple of compiler warnings. 2007-08-04 16:54:58 +00:00
Dan Fandrich
0d3d84e3ff Refactored CreateConnection() somewhat to reduce its length by splitting
it into a few new functions.
Fixed a few leaks in out of memory conditions, including for test case 231.
2007-08-03 22:46:59 +00:00
Gunter Knauf
e789a3802c fixed small fix issue I introduced with my previous commit. 2007-08-03 19:54:31 +00:00
Gunter Knauf
4aabbc5ac2 some more makefile fixes/changes. 2007-08-03 14:30:02 +00:00
James Housley
e7a50e37d6 Start adding some expanded error conversion of libssh2 errors. 2007-08-03 13:57:37 +00:00
James Housley
9fa05db83b The previous commit to force the use of libssh2-0.16 by removing
LIBSSH2_APINO
2007-08-03 13:46:59 +00:00
Gunter Knauf
7ed58c4636 changed 'rm -f' to 'del /f' so it works without GnuUtils as Peteris Krumins pointed out; changed to use latest external libs. 2007-08-03 12:53:00 +00:00
Gunter Knauf
f2f7c18245 Peteris Krumins pointed out some MingW32 related build issues. 2007-08-03 11:46:00 +00:00
Gunter Knauf
efaab37698 Peteris Krumins pointed out that the standard MingW32 build depends on zlib; removed that, and added another option for zlib build, and renamed all other targets to reflect zlib dependency. 2007-08-03 11:24:22 +00:00
Daniel Stenberg
869319ce4a SCP and SFTP support now requires libssh2 0.16 or later 2007-08-03 08:31:47 +00:00
Daniel Stenberg
252f16db02 remove left-over partly support for libssh2 0.14 2007-08-03 08:25:28 +00:00
Daniel Stenberg
72f5d6ba46 The SSH code now only works with libssh2 0.16 or later. Thus we must not
release the next curl until there is a libssh2 0.16 released.
2007-08-03 08:14:51 +00:00
Daniel Stenberg
5ec786b02e Scott Cantor filed bug report #1766320
(http://curl.haxx.se/bug/view.cgi?id=1766320) pointing out that the libcurl
code accessed two curl_easy_setopt() options (CURLOPT_DNS_CACHE_TIMEOUT and
CURLOPT_DNS_USE_GLOBAL_CACHE) as ints even though they're documented to be
passed in as longs, and that makes a difference on 64 bit architectures.
2007-08-02 20:10:28 +00:00
Dan Fandrich
035ee257c8 Fixed a compiler warning. 2007-08-02 19:23:35 +00:00
Daniel Stenberg
188b08ca55 Patrick Monnerat's cleanup fix after my alloc-strings commit 2007-08-02 14:42:16 +00:00
Daniel Stenberg
6f750f3b57 Dmitriy Sergeyev reported a regression: resumed file:// transfers broke
after 7.16.2. This is much due to the different treatment file:// gets
internally, but now I added test 231 to make it less likely to happen again
without us noticing!
2007-08-02 14:09:08 +00:00
Daniel Stenberg
5a6dcdc36c clarify that setting POSTFIELDS to NULL or "" is not enough to make a zero byte
POST
2007-08-02 13:26:06 +00:00
Daniel Stenberg
59c16a570f argh, Greg Morse pointed out that the NTLM POST fix only worked if VERBOSE
was set, this should make it work for all cases!
2007-08-02 11:34:50 +00:00
Daniel Stenberg
50c10aa5bf Patrick Monnerat and I modified libcurl so that now it *copies* all strings
passed to it with curl_easy_setopt()! Previously it has always just refered
to the data, forcing the user to keep the data around until libcurl is done
with it. That is now history and libcurl will instead clone the given
strings and keep private copies.
2007-08-01 21:20:01 +00:00
Daniel Stenberg
006878686c Greg Morse reported a problem with POSTing using ANYAUTH to a server requiring
NTLM, and he provided test code and a test server and we worked out a bug
fix. We failed to count sent body data at times, which then caused internal
confusions when libcurl tried to send the rest of the data in order to
maintain the same connection alive.

(and then I did some minor reformatting of code in lib/http.c)
2007-08-01 12:58:04 +00:00
Daniel Stenberg
bd100b2a51 AIX 4 and 5 get to use non-blocking sockets 2007-07-30 22:54:02 +00:00
Daniel Stenberg
5b1bbffdff Peter O'Gorman pointed out (and fixed) that the non-blocking check in
configure made libcurl use blocking sockets on AIX 4 and 5, while that
wasn't the intention.
2007-07-30 22:53:18 +00:00
Daniel Stenberg
16710a1c9b users should use the CURLMOPT_TIMERFUNCTION rather than curl_multi_timeout
when using the socket API
2007-07-30 22:01:04 +00:00
Daniel Stenberg
ba5c71b79b less blocking these days 2007-07-30 21:47:56 +00:00
Daniel Stenberg
f3799462c2 updated based on suggestion from Jeff Pohlmeyer 2007-07-30 21:47:44 +00:00
Daniel Stenberg
f01c6e51f4 Patrick Monnerat restored qssl successful compilation and loading 2007-07-30 21:41:12 +00:00
Daniel Stenberg
21d62118dc give credit to Greg Zavertnik 2007-07-30 20:07:43 +00:00
Dan Fandrich
de55038e33 Properly set USE_SSL on OS/400 2007-07-30 17:08:26 +00:00
Dan Fandrich
ea908c23ae Fixed compiler warning on non-SSL builds 2007-07-30 17:05:39 +00:00
Daniel Stenberg
844cbc701a Added "4.15 FTPS doesn't work" and updated a few other sections slightly 2007-07-29 22:17:39 +00:00
Daniel Stenberg
f1fa7b8ba4 Bug report #1759542 (http://curl.haxx.se/bug/view.cgi?id=1759542). A bad use
of a socket after it has been closed, when the FTP-SSL data connection is taken
down.
2007-07-29 12:54:05 +00:00
Daniel Stenberg
86ff3194fa added missing part for the qsossl support 2007-07-27 08:33:32 +00:00
Daniel Stenberg
d460b601f9 added initial pkg-config file (attempt) 2007-07-26 21:56:47 +00:00
Dan Fandrich
48a06d1a7b Removed unused variable. 2007-07-24 15:23:16 +00:00
Daniel Stenberg
813a1107f4 #if that should be #ifdef 2007-07-23 21:48:27 +00:00
Daniel Stenberg
b3461bab1d Implemented the parts of Patrick Monnerat's OS/400 patch that introduces
support for the OS/400 Secure Sockets Layer library
2007-07-23 21:46:26 +00:00
Dan Fandrich
5ecd56d964 Implemented only the parts of Patrick Monnerat's OS/400 patch that renamed
some few internal identifiers to avoid conflicts, which could be useful on
other platforms.
2007-07-23 18:51:22 +00:00
Dan Fandrich
cc44fb1dc8 Log the "<CMD> wasn't handled" error normally since it is now expected
to occur in a couple of tests.
2007-07-23 17:51:43 +00:00
Gunter Knauf
77b0efdbc2 added 2 system libs necessary for linking OpenSSL 0.9.8e statically. 2007-07-23 01:05:34 +00:00
Daniel Stenberg
68653bcbdd fix mess added in my previous commit 2007-07-22 10:19:53 +00:00
Daniel Stenberg
9af807a5ce HTTP Digest auth fix on a re-used connection 2007-07-22 10:17:52 +00:00
Daniel Stenberg
4bbcc47f3f Added test case 354 that makes a simple FTP retrieval without password, which
verifies the bug fix in #1757328.
2007-07-22 10:08:59 +00:00
Daniel Stenberg
8ab495a088 test and verify curl -I on a single FTP file somewhat more than before 2007-07-21 21:49:23 +00:00
Daniel Stenberg
84e7bb85b1 To allow more flexibility in FTP test cases, I've removed the enforced states
from the test server code as they served no real purpose. The test server is
here to serve for the test cases, not to attempt to function as a real server!
2007-07-21 21:48:58 +00:00
Daniel Stenberg
4fc7e13a98 news 2007-07-21 21:47:02 +00:00
Dan Fandrich
b465750041 Make the pointers of a few static const arrays const, too, for safety. 2007-07-21 02:08:17 +00:00
Gunter Knauf
37dc0fa519 added curl include for debug builds. 2007-07-20 21:50:53 +00:00
Dan Fandrich
000fdc6b99 Document pwd as an sftp quote command for curl(1), and show it as
lower case for consistency since sftp commands are case insensitive.
2007-07-20 17:29:43 +00:00
Gunter Knauf
594fc0411e added lf to Win32 getpass_r() so that next output appears in new line. 2007-07-20 16:01:05 +00:00
Daniel Stenberg
94fcb4b09d PWD for SFTP is fixed 2007-07-20 15:33:44 +00:00
Daniel Stenberg
1a0034ac34 the "libssh2 owns the memory don't free it" case 2007-07-20 09:38:41 +00:00
Daniel Stenberg
e3377e637a Ralf S. Engelschall filed bug report #1757328
(http://curl.haxx.se/bug/view.cgi?id=1757328) and submitted a patch. It turns
out we broke login to FTP servers that don't require (nor understand) PASS
after the USER command
2007-07-20 09:35:58 +00:00
James Housley
2ab854cafd Fix a loop with PWD 2007-07-20 01:03:49 +00:00
Dan Fandrich
4a2f0fb2be Made some const arrays static to avoid unnecessary stack usage. 2007-07-20 00:41:12 +00:00
Daniel Stenberg
dca3564cfb minor addition, re-count of the number of lines of code 2007-07-19 21:35:36 +00:00
Daniel Stenberg
9d183bb7b1 libssh2 fix 2007-07-19 15:08:47 +00:00
Dan Fandrich
c7db74fe73 Revert the 512 change since newer versions of OpenSSH don't support DSA
keys that small.
2007-07-19 01:42:22 +00:00
James Housley
5251c45187 SFTP also supports PWD 2007-07-18 23:21:32 +00:00
Dan Fandrich
d9b5f327bf Added the list of sftp quote commands. 2007-07-18 22:23:07 +00:00
James Housley
ca1356702a As has been pointed out, err_msg should not be freed here. The actual
issue is in libssh2 and not freeing a dynamic error message during cleanup.
2007-07-18 18:31:34 +00:00
Dan Fandrich
89d119646d Use 512 bit keys to reduce the time taken to generate them. This shouldn't
really reduce security since in the common case of a daily automated build
the keys are only used for a single test run lasting a few minutes before
being deleted.
2007-07-18 00:27:13 +00:00
Dan Fandrich
989dd9c34a Fixed test cases 613 and 614 by improving the log postprocessor to handle
a new directory listing format that newer libssh2's can provide.  This
is probably NOT sufficient to handle all directory listing formats that
server's can provide and should be revisited.
2007-07-17 21:53:38 +00:00
Daniel Stenberg
1d728aae2a Jofell Gallardo posted a libcurl log using FTP that exposed a bug which made
a control connection that was deemed "dead" to yet be re-used in a following
request. We must make sure the connection gets closed on this situation.
2007-07-17 20:59:53 +00:00
Daniel Stenberg
98b9349be7 make it do all three requests on the same connection 2007-07-16 21:44:46 +00:00
Dan Fandrich
4706a93341 Fixed some more simple compile warnings in the examples. 2007-07-16 21:22:12 +00:00
Daniel Stenberg
b85b56a73d 45. libcurl built to support ipv6 uses getaddrinfo() to resolve host names.
getaddrinfo() sorts the response list which effectively kills how libcurl
  deals with round-robin DNS entries. All details:
    http://curl.haxx.se/mail/lib-2007-07/0168.html
  initial suggested function to use for randomizing the response:
    http://curl.haxx.se/mail/lib-2007-07/0178.html
2007-07-16 21:08:08 +00:00
Daniel Stenberg
1da3d402f6 convert test case 540 to use a custom Host: header as well 2007-07-15 21:00:26 +00:00
Daniel Stenberg
1da3192d2d let's just export the whole argc + argv pair globally so that each test tool
can take advantage of it however they see fit!
2007-07-15 20:59:43 +00:00
Gunter Knauf
dab569d76c make users use the latest OpenSSL and Zlib libraries;
added hint to compile with SSPI with MSVC6 without PSDK.
2007-07-15 13:00:39 +00:00
Daniel Stenberg
598c589359 added another SEE ALSO 2007-07-14 23:01:49 +00:00
Daniel Stenberg
15c8219340 Added test case 540 and lib540.c, the 'proxyauth.c' test app posted by Shmulik
Regev on the libcurl mailing list on 10 Jul 2007, converted to a test case.
2007-07-14 22:39:22 +00:00
Daniel Stenberg
5ae21ebde9 add support for arg3 as the third argument... 2007-07-14 22:38:18 +00:00
Daniel Stenberg
c7e0d8c30b add some better logging when HTTP server start fails, and make the failure
really hard if the test server can't be resolved (like for ::1 ipv6)
2007-07-14 22:33:46 +00:00
Gunter Knauf
fee4f8c86d for now unless we do better fixed LIBSSH2_APINO compares to use long constants. 2007-07-14 15:59:01 +00:00
Daniel Stenberg
1261c3feba Brad House's fix to hish a win32 compiler warning 2007-07-14 13:14:58 +00:00
Daniel Stenberg
7fc300d5dc added Vlad's entire description of his valgrind fix 2007-07-14 13:11:36 +00:00
Daniel Stenberg
88ce03e945 Vlad Dinulescu fixed two outstanding valgrind reports 2007-07-14 13:08:50 +00:00
Dan Fandrich
5bed99c97d The examples don't need access to curl internal source files. 2007-07-13 21:31:44 +00:00
Daniel Stenberg
46c699c483 Colin Hogben filed bug report #1750274
(http://curl.haxx.se/bug/view.cgi?id=1750274) and submitted a patch for the
case where libcurl did a connect attempt to a non-listening port and didn't
provide a human readable error string back.
2007-07-13 20:17:35 +00:00
Daniel Stenberg
f7d6e147f1 Daniel Cater added the mentioning of CURL_DISABLE_TFTP 2007-07-13 20:09:38 +00:00
Daniel Stenberg
aad1d3ce14 Daniel Cater: libcurl-errors needs updating to reflect a couple of deprecated
error codes
2007-07-13 20:07:22 +00:00
Daniel Stenberg
cf5378b366 Daniel Cater made libcurl build with CURL_NO_OLDIES defined (which doesn't
define the symbols for backwards source compatibility)
2007-07-13 20:04:53 +00:00
Daniel Stenberg
fea938cbcb Daniel Cater made the vc8-generating line use double-quotes to run fine on
windows
2007-07-13 19:38:36 +00:00
Daniel Stenberg
a67c8b4698 Made the krb5 code build with Heimdal's GSSAPI lib 2007-07-12 21:34:42 +00:00
Dan Fandrich
49ce3e5160 Fixed some compile warnings and errors and improved portability in the
examples.
Removed ftp3rdparty.c since libcurl doesn't support 3rd party FTP transfers
any longer.
2007-07-12 21:11:10 +00:00
Daniel Stenberg
4a728747e6 make it compile fine 2007-07-12 20:55:17 +00:00
Daniel Stenberg
f5a6355172 fix include path 2007-07-12 20:54:54 +00:00
Dan Fandrich
ffff8ddbef Compile most of the example apps in docs/examples when doing a 'make check'. 2007-07-12 20:38:54 +00:00
Daniel Stenberg
cf86f8cb78 Shmulik Regev found an (albeit rare) case where the proxy CONNECT operation
could in fact get stuck in an endless loop.
2007-07-12 20:15:38 +00:00
Daniel Stenberg
a53ba060c8 start the retry delay at 10 ms, double it for every failed attempt which makes
it 10 seconds delay after 11 attempts
2007-07-12 17:03:45 +00:00
Gunter Knauf
72bb5854f7 the timeout was probably too short with max = 1 sec, so lets test with 5 sec. 2007-07-12 10:54:15 +00:00
Gunter Knauf
0de56e5535 added nwos.c so that it gets distributed with releases and tarballs. 2007-07-12 10:44:46 +00:00
Gunter Knauf
0878b14f79 added time loop to sockfilt.c in order to wait for SO_REUSEADDR;
added go_sleep() to util.c.
2007-07-12 01:07:49 +00:00
Marty Kuhrt
7d56f35388 Updated to match curl.h 2007-07-11 23:17:11 +00:00
Daniel Stenberg
d12759c73e Made CURLOPT_SSL_VERIFYHOST set to 1 acts as described in the documentation:
fail to connect if there is no Common Name field found in the remote cert.
We should deprecate the support for this set to 1 anyway soon, since the
feature is pointless and most likely never really used by anyone.
2007-07-11 22:20:46 +00:00
Gunter Knauf
c0095d6dd9 removed now obsolete NETDB_DEFINE_CONTEXT macro calls. 2007-07-11 21:47:31 +00:00
Gunter Knauf
6a88eab067 updated makefile to compile nwos.c. 2007-07-11 21:38:28 +00:00
Gunter Knauf
a4f36558fc added NetWare-own file to provide some init functions (for now only CLIB);
added call to netware_init() in curl_global_init() to make sure it gets called before any library functions get used.
2007-07-11 21:34:22 +00:00
Dan Fandrich
5e1cd407a3 Added the first libcurl version to which the SSH options were added. 2007-07-11 19:21:38 +00:00
Gunter Knauf
2a1345ae9f added netdb.h for NetWare CLIB since gethostname() is defined there. 2007-07-11 09:08:03 +00:00
Gunter Knauf
cf61c8d659 fixed endif comment. 2007-07-11 09:03:22 +00:00
Gunter Knauf
c39690486c fixed endif comment. 2007-07-11 08:55:28 +00:00
Dan Fandrich
814b471d55 Added a code coverage section using gcc and gcov. 2007-07-10 22:55:51 +00:00
Daniel Stenberg
5119fb16d6 Shmulik Regev:
The tiny patch below fixes a bug (that I introduced :) which happens
when negotiating authentication with a proxy (probably with web
servers as well) that uses chunked transfer encoding for the 407 error
pages. In this case the ''ignorebody'' flag was ignored (no pun
intended).
2007-07-10 22:45:01 +00:00
Daniel Stenberg
dc2c70be07 Giancarlo Formicuccia reported and fixed a problem with a closed connection
to a proxy during CONNECT auth negotiation.
2007-07-10 22:31:13 +00:00
Dan Fandrich
19631f5d5f Force the time zone to GMT in the cookie tests in case the user is
using one of the so-called 'right' time zones that take into account
leap seconds, which causes the tests to fail (as reported by
Daniel Black in bug report #1745964).
2007-07-10 22:27:16 +00:00
James Housley
a8d6b40736 The previous commits changed the error code 2007-07-10 22:26:59 +00:00
James Housley
8026d94c07 * Finish moving sftp:// into a state machine so it won't block in multi mode
* Move scp:// into a state machine so it won't block in multi mode
* When available use the full directory entry from the sftp:// server
2007-07-10 22:26:32 +00:00
Dan Fandrich
93bd512357 Fixed a curl memory leak reported by Song Ma with a modified version
of the patch he suggested.  Added his test case as test289 to verify.
2007-07-10 22:23:16 +00:00
Daniel Stenberg
04d3a8c714 start working on 7.16.5... 2007-07-10 22:07:33 +00:00
Daniel Stenberg
4b1782c371 7.16.4 preps 2007-07-10 21:36:30 +00:00
Gunter Knauf
f84642197f added better CodeWarrior detection (forgot to add with previos version). 2007-07-09 02:00:39 +00:00
Gunter Knauf
ec1b7a0eea added better CodeWarrior detection;
added defines for setlocale().
2007-07-08 23:19:24 +00:00
Gunter Knauf
4b0e48cb4e added better CodeWarrior detection;
moved autounload flag so that its used for both lib architectures.
2007-07-08 23:18:47 +00:00
Gunter Knauf
41df67fc2c added better CodeWarrior detection. 2007-07-08 23:17:56 +00:00
Gunter Knauf
932d38323f removed some obsolete include paths and defines. 2007-07-07 16:26:02 +00:00
Daniel Stenberg
74ad8516d7 Thomas J. Moore made it build with less warnings 2007-07-06 22:14:29 +00:00
Daniel Stenberg
ed4a16dbd1 Gavrie Philipson's change, updated numbers 2007-07-06 21:56:42 +00:00
Daniel Stenberg
e2bac4fe6f add note about windows and dlls with CURLOPT_WRITEDATA 2007-07-06 20:14:03 +00:00
Gunter Knauf
836ffbfc22 fixed NetWare CLIB implementation of getpass_r() 2007-07-06 14:58:59 +00:00
James Housley
7fd4f82a45 Gavrie Philipson provided a patch that will use a more specific error
message for an scp:// upload failure.  If libssh2 has his matching
patch, then the error message return by the server will be used instead
of a more generic error.
2007-07-05 12:48:34 +00:00
Dan Fandrich
598bc3968e Add -a when running torture tests now that it's supported. 2007-07-05 01:38:00 +00:00
James Housley
29357151af Fix spelling error in error message 2007-07-04 22:54:29 +00:00
Gunter Knauf
6606ae6fe0 add test for gettimeofday() so that HAVE_GETTIMEOFDAY gets defined. 2007-07-04 17:20:19 +00:00
Gunter Knauf
9f21f74fbd enabled ares build. 2007-07-04 13:45:46 +00:00
Gunter Knauf
3760180320 although the check for HAVE_STRUCT_TIMEVAL solved the redefine it is incorrect; lets see if a check for HAVE_GETTIMEOFDAY also works; if gettimeofday() is present then we can assume we have the timezone struct too. 2007-07-04 10:54:15 +00:00
Gunter Knauf
056af4c9ac added check for sys/param.h. 2007-07-04 09:01:40 +00:00
Gunter Knauf
07bf3c86b6 trial to catch problem with Daniels cross-mingw ares builds. 2007-07-03 18:18:40 +00:00
Gunter Knauf
4182803bc2 added NetWare CLIB-own header to solve gcc warnings. 2007-07-03 16:21:57 +00:00
Gunter Knauf
7509ef6b4e few minor changes to make ares compile for NetWare CLIB architecture. 2007-07-03 16:00:36 +00:00
Gunter Knauf
70f8068d4d fixed rule to build libcares when needed. 2007-07-03 00:50:40 +00:00
Gunter Knauf
a7513a8521 changed to build for CLIB / LIBC. 2007-07-03 00:42:11 +00:00
Gunter Knauf
3f7e541415 added libcares to static build if ares enabled. 2007-07-03 00:12:03 +00:00
Daniel Stenberg
f7e9a21c53 contributors from the 7.16.3 release notes 2007-07-02 22:04:36 +00:00
Gunter Knauf
f1537d45ca sync'd with lib makefile changes: use var for awk; fixed RECV* / SEND* defines; debug var can be overwritten; added better compiler path handling. 2007-07-02 18:50:18 +00:00
Gunter Knauf
5a051617f3 some more makefile tweaks and hacks to deal with both lib architectures. 2007-07-02 18:42:14 +00:00
James Housley
55cd28283c Fix problem with the indenting noticed by Pavel 2007-07-02 17:22:51 +00:00
Gunter Knauf
924665c84c ignore make error when trying to copy curl.pdf which isnt in CVS. 2007-07-01 22:17:07 +00:00
Daniel Stenberg
fcfffbe2f2 mention the old name 2007-07-01 22:03:47 +00:00
Daniel Stenberg
54967d2a3a Thomas J. Moore provided a patch that introduces Kerberos5 support in
libcurl. This also makes the options change name to --krb (from --krb4) and
CURLOPT_KRBLEVEL (from CURLOPT_KRB4LEVEL) but the old names are still
2007-07-01 22:01:18 +00:00
Daniel Stenberg
667fd9a60b Song Ma helped me verify and extend a fix for doing FTP over a SOCKS4/5 proxy 2007-07-01 21:28:14 +00:00
Gunter Knauf
892a24f4c4 changed RECV_* / SEND_* defines to correctly reflect NetWare APIs;
some more minor Makefile tidyups.
2007-07-01 21:06:41 +00:00
Gunter Knauf
f7676e9667 disabled 64bit type for CLIB build which removes compiler runtime dependency. 2007-07-01 16:55:37 +00:00
Gunter Knauf
8727803cf8 updated NetWare docu. 2007-07-01 12:09:25 +00:00
Gunter Knauf
73e13ef19d added lib architecture to NLM description. 2007-07-01 01:33:51 +00:00
Gunter Knauf
e983cd5cd3 added HAVE_SYS_IOCTL_H define; added gcc runtime. 2007-06-30 23:53:54 +00:00
Gunter Knauf
ca3e5a6322 moved includes to setup.h so that the project headers also pick them up (eleminate gcc warning). 2007-06-30 23:45:57 +00:00
Gunter Knauf
c4931601c6 fixed path to Metrowerks tools and runtime since they changed between compiler versions. 2007-06-30 21:20:24 +00:00
Gunter Knauf
857492ac9e minor patches to enable building for NetWare CLIB.
sent by Dmitry Mityugov.
2007-06-30 20:16:03 +00:00
Gunter Knauf
afdfa4bed2 minor patches to enable building for NetWare CLIB.
sent by Dmitry Mityugov.
2007-06-30 20:08:13 +00:00
Gunter Knauf
3fc6faf1ae enabled building for NetWare CLIB architecture. 2007-06-30 20:02:51 +00:00
Gunter Knauf
c8a47bf662 revert previous patch since it turned out that older cp dont know this switch, argh! 2007-06-28 22:31:18 +00:00
James Housley
aed0cc6f2a Using fdopen() is a more correct way to implement the CURLOPT_NEW_FILE_PREMS
file.c, but the debug interface was missing.  This adds the routines needed
to make the memory debuging work for fdopen().
2007-06-28 11:11:29 +00:00
Daniel Stenberg
d500c468fc reality sync 2007-06-28 10:47:05 +00:00
Gunter Knauf
5df5a2aa54 fixed nasty cp warnings about not beeing able to preserve ownership. 2007-06-28 01:20:30 +00:00
Daniel Stenberg
9ca688c8e7 James Bursa's improvement 2007-06-27 21:35:17 +00:00
Daniel Stenberg
8edbe262d9 fix little flaw that could make the transfer loop end prematurely 2007-06-27 21:29:29 +00:00
James Housley
4cd7f85410 Add two new options for the SFTP/SCP/FILE protocols: CURLOPT_NEW_FILE_PERMS
and CURLOPT_NEW_DIRECTORY_PERMS.  These control the premissions for files
and directories created on the remote server.  CURLOPT_NEW_FILE_PERMS
defaults to 0644 and CURLOPT_NEW_DIRECTORY_PERMS defaults to 0755
2007-06-27 20:15:48 +00:00
Gunter Knauf
edd35cab5c removed trailing spaces. 2007-06-27 10:14:00 +00:00
Gunter Knauf
a2060effed fixed wrong var name 2007-06-27 10:12:48 +00:00
Daniel Stenberg
33b9daaa4c add an FTP rename example to 3.7 2007-06-26 21:53:46 +00:00
Daniel Stenberg
62f0f5571d Robert Iakobashvili re-arranged the internal hash code to work with a custom
hash function for different hashes, and also expanded the default size for
the socket hash table used in multi handles to greatly enhance speed when
very many connections are added and the socket API is used.
2007-06-26 21:09:28 +00:00
James Housley
7a360de49d The results for a list only directory should be sent to the callback 2007-06-26 20:23:10 +00:00
James Housley
1be4557694 ftp_list_only mode should list all file types, not just directories. 2007-06-26 19:12:58 +00:00
Daniel Stenberg
6a21738704 gah, adding missing braces, removed silly debug output, added new debug output 2007-06-25 14:17:52 +00:00
Daniel Stenberg
974fa1242a Adjusted how libcurl treats HTTP 1.1 responses without content-lenth or
chunked encoding (that also lacks "Connection: close"). It now simply
assumes that the connection WILL be closed to signal the end, as that is how
RFC2616 section 4.4 point #5 says we should behave.
2007-06-25 13:58:14 +00:00
Daniel Stenberg
3dff58b3aa fix the version string as well 2007-06-25 13:52:16 +00:00
Daniel Stenberg
abf8589f0d start working towards 7.16.4 2007-06-25 09:34:44 +00:00
159 changed files with 5808 additions and 3219 deletions

227
CHANGES
View File

@@ -6,6 +6,233 @@
Changelog
Dan F (8 August 2007)
- Song Ma noted a zlib memory leak in the illegal compressed header
countermeasures code path.
Daniel S (4 August 2007)
- Patrick Monnerat fixed curl_easy_escape() and curlx_strtoll() to work on
non-ASCII systems.
Daniel S (3 August 2007)
- I cut out support for libssh2 versions older than 0.16 to make our code a
lot simpler, and to avoid getting trouble with the LIBSSH2_APINO define
that 1) didn't work properly since it was >32 bits and 2) is removed in
libssh2 0.16...
Daniel S (2 August 2007)
- Scott Cantor filed bug report #1766320
(http://curl.haxx.se/bug/view.cgi?id=1766320) pointing out that the libcurl
code accessed two curl_easy_setopt() options (CURLOPT_DNS_CACHE_TIMEOUT and
CURLOPT_DNS_USE_GLOBAL_CACHE) as ints even though they're documented to be
passed in as longs, and that makes a difference on 64 bit architectures.
- Dmitriy Sergeyev reported a regression: resumed file:// transfers broke
after 7.16.2. This is much due to the different treatment file:// gets
internally, but now I added test 231 to make it less likely to happen again
without us noticing!
Daniel S (1 August 2007)
- Patrick Monnerat and I modified libcurl so that now it *copies* all strings
passed to it with curl_easy_setopt()! Previously it has always just refered
to the data, forcing the user to keep the data around until libcurl is done
with it. That is now history and libcurl will instead clone the given
strings and keep private copies. This is also part of Patrick Monnerat's
OS/400 port.
Due to this being a somewhat interesting change API wise, I've decided to
bump the version of the upcoming release to 7.17.0. Older applications will
of course not notice this change nor do they have to care, but new
applications can be written to take advantage of this.
- Greg Morse reported a problem with POSTing using ANYAUTH to a server
requiring NTLM, and he provided test code and a test server and we worked
out a bug fix. We failed to count sent body data at times, which then caused
internal confusions when libcurl tried to send the rest of the data in order
to maintain the same connection alive.
Daniel S (31 July 2007)
- Peter O'Gorman pointed out (and fixed) that the non-blocking check in
configure made libcurl use blocking sockets on AIX 4 and 5, while that
wasn't the intention.
Daniel S (29 July 2007)
- Jayesh A Shah filed bug report #1759542
(http://curl.haxx.se/bug/view.cgi?id=1759542) identifying a rather serious
problem with FTPS: libcurl closed the data connection socket and then later
in the flow it would call the SSL layer to do SSL shutdown which then would
use a socket that had already been closed - so if the application had opened
a new one in the mean time, libcurl could send gibberish that way! I worked
with Greg Zavertnik to properly diagnose and fix this. The fix affects code
for all SSL libraries we support, but it has only been truly verified to
work fine for the OpenSSL version. The others have only been code reviewed.
Daniel S (23 July 2007)
- Implemented the parts of Patrick Monnerat's OS/400 patch that introduces
support for the OS/400 Secure Sockets Layer library.
Dan F (23 July 2007)
- Implemented only the parts of Patrick Monnerat's OS/400 patch that renamed
some few internal identifiers to avoid conflicts, which could be useful on
other platforms.
Daniel S (22 July 2007)
- HTTP Digest bug fix by Chris Flerackers:
Scenario
- Perfoming a POST request with body
- With authentication (only Digest)
- Re-using a connection
libcurl would send a HTTP POST with an Authorization header but without
body. Our server would return 400 Bad Request in that case (because
authentication passed, but the body was empty).
Cause
1) http_digest.c -> Curl_output_digest
- Updates allocptr.userpwd/allocptr.proxyuserpwd *only* if d->nonce is
filled in (and no errors)
- authp->done = TRUE if d->nonce is filled in
2) http.c -> Curl_http
- *Always* uses allocptr.userpwd/allocptr.proxyuserpwd if not NULL
3) http.c -> Curl_http, Curl_http_output_auth
So what happens is that Curl_output_digest cannot yet update the
Authorization header (allocptr.userpwd) which results in authhost->done=0 ->
authhost->multi=1 -> conn->bits.authneg = TRUE. The body is not
added. *However*, allocptr.userpwd is still used when building the request
- Added test case 354 that makes a simple FTP retrieval without password, which
verifies the bug fix in #1757328.
Daniel S (21 July 2007)
- To allow more flexibility in FTP test cases, I've removed the enforced states
from the test server code as they served no real purpose. The test server
is here to serve for the test cases, not to attempt to function as a real
server! While at it, I modified test case 141 to better test and verify
curl -I on a single FTP file.
Daniel S (20 July 2007)
- James Housley fixed the SFTP PWD command to work.
- Ralf S. Engelschall filed bug report #1757328
(http://curl.haxx.se/bug/view.cgi?id=1757328) and submitted a patch. It
turns out we broke login to FTP servers that don't require (nor understand)
PASS after the USER command. The breakage was done as part of the krb5
commit so a krb-using person needs to verify that the current version now
works or if we need to fix it (in a different way of course).
Dan F (17 July 2007)
- Fixed test cases 613 and 614 by improving the log postprocessor to handle
a new directory listing format that newer libssh2's can provide. This
is probably NOT sufficient to handle all directory listing formats that
server's can provide, and should be revisited.
Daniel S (17 July 2007)
- Daniel Johnson fixed a bug in how libssh2_session_last_error() was used, in
two places.
- Jofell Gallardo posted a libcurl log using FTP that exposed a bug which made
a control connection that was deemed "dead" to yet be re-used in a following
request.
Daniel S (13 July 2007)
- Colin Hogben filed bug report #1750274
(http://curl.haxx.se/bug/view.cgi?id=1750274) and submitted a patch for the
case where libcurl did a connect attempt to a non-listening port and didn't
provide a human readable error string back.
- Daniel Cater fixes:
1 - made 'make vc8' work on windows.
2 - made libcurl itself built with CURL_NO_OLDIES defined (which doesn't
define the symbols for backwards source compatibility)
3 - updated libcurl-errors.3
4 - added CURL_DISABLE_TFTP to docs/INSTALL
Daniel S (12 July 2007)
- Made the krb5 code build with Heimdal's GSSAPI lib.
Dan F (12 July 2007)
- Compile most of the example apps in docs/examples when doing a 'make check'.
Fixed some compile warnings and errors in those examples.
- Removed the example program ftp3rdparty.c since libcurl doesn't support
3rd party FTP transfers any longer.
Daniel S (12 July 2007)
- Shmulik Regev found an (albeit rare) case where the proxy CONNECT operation
could in fact get stuck in an endless loop.
- Made CURLOPT_SSL_VERIFYHOST set to 1 acts as described in the documentation:
fail to connect if there is no Common Name field found in the remote cert.
We should deprecate the support for this set to 1 anyway soon, since the
feature is pointless and most likely never really used by anyone.
Daniel S (11 July 2007)
- Shmulik Regev fixed a bug with transfer-encoding skipping during the 407
error pages for proxy authentication.
- Giancarlo Formicuccia reported and fixed a problem with a closed connection
to a proxy during CONNECT auth negotiation.
Dan F (10 July 2007)
- Fixed a curl memory leak reported by Song Ma with a modified version
of the patch he suggested. Added his test case as test289 to verify.
- Force the time zone to GMT in the cookie tests in case the user is
using one of the so-called 'right' time zones that take into account
leap seconds, which causes the tests to fail (as reported by
Daniel Black in bug report #1745964).
Version 7.16.4 (10 July 2007)
Daniel S (10 July 2007)
- Kees Cook notified us about a security flaw
(http://curl.haxx.se/docs/adv_20070710.html) in which libcurl failed to
properly reject some outdated or not yet valid server certificates when
built with GnuTLS. Kees also provided the patch.
James H (5 July 2007)
- Gavrie Philipson provided a patch that will use a more specific error
message for an scp:// upload failure. If libssh2 has his matching
patch, then the error message return by the server will be used instead
of a more generic error.
Daniel S (1 July 2007)
- Thomas J. Moore provided a patch that introduces Kerberos5 support in
libcurl. This also makes the options change name to --krb (from --krb4) and
CURLOPT_KRBLEVEL (from CURLOPT_KRB4LEVEL) but the old names are still
- Song Ma helped me verify and extend a fix for doing FTP over a SOCKS4/5
proxy.
Daniel S (27 June 2007)
- James Housley: Add two new options for the SFTP/SCP/FILE protocols:
CURLOPT_NEW_FILE_PERMS and CURLOPT_NEW_DIRECTORY_PERMS. These control the
premissions for files and directories created on the remote
server. CURLOPT_NEW_FILE_PERMS defaults to 0644 and
CURLOPT_NEW_DIRECTORY_PERMS defaults to 0755
- I corrected the 10-at-a-time.c example and applied a patch for it by James
Bursa.
Daniel S (26 June 2007)
- Robert Iakobashvili re-arranged the internal hash code to work with a custom
hash function for different hashes, and also expanded the default size for
the socket hash table used in multi handles to greatly enhance speed when
very many connections are added and the socket API is used.
- James Housley made the CURLOPT_FTPLISTONLY mode work for SFTP directory
listings as well
Daniel S (25 June 2007)
- Adjusted how libcurl treats HTTP 1.1 responses without content-lenth or
chunked encoding (that also lacks "Connection: close"). It now simply
assumes that the connection WILL be closed to signal the end, as that is how
RFC2616 section 4.4 point #5 says we should behave.
Version 7.16.3 (25 June 2007)
Daniel S (23 June 2007)

View File

@@ -49,7 +49,7 @@ html:
pdf:
cd docs; make pdf
check: test
check: test examples
if CROSSCOMPILING
test-full: test
@@ -71,6 +71,9 @@ test-torture:
endif
examples:
@(cd docs/examples; $(MAKE) all)
#
# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
# must contain the following line:

View File

@@ -68,18 +68,22 @@ watcom-clean:
wmake -f Makefile.Watcom clean
mingw32:
$(MAKE) -C lib -f Makefile.m32
$(MAKE) -C src -f Makefile.m32
mingw32-zlib:
$(MAKE) -C lib -f Makefile.m32 ZLIB=1
$(MAKE) -C src -f Makefile.m32 ZLIB=1
mingw32-ssl:
mingw32-ssl-zlib:
$(MAKE) -C lib -f Makefile.m32 SSL=1 ZLIB=1
$(MAKE) -C src -f Makefile.m32 SSL=1 ZLIB=1
mingw32-ssh2-ssl:
mingw32-ssh2-ssl-zlib:
$(MAKE) -C lib -f Makefile.m32 SSH2=1 SSL=1 ZLIB=1
$(MAKE) -C src -f Makefile.m32 SSH2=1 SSL=1 ZLIB=1
mingw32-ssh2-ssl-sspi:
mingw32-ssh2-ssl-sspi-zlib:
$(MAKE) -C lib -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1
$(MAKE) -C src -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1
@@ -248,5 +252,5 @@ linux-ssl: ssl
vc8:
echo "generate VC8 makefiles"
sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e 's#/GZ#/RTC1#' -e 's/wsock32.lib/wsock32.lib bufferoverflowu.lib/g' -e 's/VC6/VC8/g' lib/Makefile.vc6 > lib/Makefile.vc8
sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e 's#/GZ#/RTC1#' -e 's/wsock32.lib/wsock32.lib bufferoverflowu.lib/g' -e 's/VC6/VC8/g' src/Makefile.vc6 > src/Makefile.vc8
sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/wsock32.lib/wsock32.lib bufferoverflowu.lib/g" -e "s/VC6/VC8/g" lib/Makefile.vc6 > lib/Makefile.vc8
sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/wsock32.lib/wsock32.lib bufferoverflowu.lib/g" -e "s/VC6/VC8/g" src/Makefile.vc6 > src/Makefile.vc8

View File

@@ -1,67 +1,41 @@
Curl and libcurl 7.16.3
Curl and libcurl 7.17.0
Public curl release number: 99
Releases counted from the very beginning: 126
Public curl release number: 101
Releases counted from the very beginning: 127
Available command line options: 118
Available curl_easy_setopt() options: 141
Number of public functions in libcurl: 54
Amount of public web site mirrors: 38
Available curl_easy_setopt() options: 143
Number of public functions in libcurl: 55
Amount of public web site mirrors: 41
Number of known libcurl bindings: 35
Number of contributors: 554
Number of contributors: 572
This release includes the following changes:
o added curl_multi_socket_action()
o deprecated curl_multi_socket()
o uses less memory in non-pipelined use cases
o CURLOPT_HTTP200ALIASES matched transfers assume HTTP 1.0 compliance
o more than one test harness can run at the same time without conflict
o SFTP now supports quote commands before a transfer
o CURLMOPT_MAXCONNECTS added to curl_multi_setopt()
o upload resume works for file:// URLs
o asynchronous name resolves now require c-ares 1.4.0 or later
o added SOCKS test cases
o CURLOPT_FTP_CREATE_MISSING_DIRS and --ftp-create-dirs now work for SFTP
operations as well
o support for OS/400 Secure Sockets Layer library
o curl_easy_setopt() now allocates strings passed to it
o SCP and SFTP support now requires libssh2 0.16 or later
This release includes the following bugfixes:
o if2up too long interface name memory leak
o test case 534 started to fail 2007-04-13 due to the existance of a
new host on the net with the same silly domain the test was using
for a host which was supposed not to exist.
o test suite SSL certificate works better with newer stunnel
o internal progress meter update frequency back to once per second
o avoid some unnecessary calls to function gettimeofday
o a double-free in the SSL-layer
o GnuTLS free of NULL credentials
o NSS-fix for closing down SSL
o bad warning from configure when gnutls was selected
o compilation on VMS 64-bit mode
o SCP/SFTP downloads could hang on the last bytes of a transfer
o curl_easy_duphandle() crash
o curl -V / curl_version*() works even when GnuTLS is used on a system without
a good random source
o curl_multi_socket() not "noticing" newly added handles
o lack of Content-Length and chunked encoding now requires HTTP 1.1 as well
to be treated as without response body
o connection cache growth in multi handles
o better handling of out of memory conditions
o overwriting an uploaded file with sftp now truncates it first
o SFTP quote commands chmod, chown, chgrp can now set a value of 0
o TFTP connect timouts less than 5 seconds
o improved curl -w for TFTP transfers
o memory leak when failed OpenSSL certificate CN field checking
o memory leak when OpenSSL failed PKCS #12 parsing
o FPL-SSL when built with NSS
o out-of-boundary write in Curl_select()
o -s/--silent can now be used to toggle off the silence again
o builds fine on 64bit HP-UX
o multi interface HTTP CONNECT glitch
o list FTP root directories when login dir is not root
o no longer slows down when getting very many URLs on the same command line
o lock share before decreasing dirty counter
o no-body FTP requests on re-used connections
o test cases 31, 46, 61, 506, 517 now work in time zones that use leap seconds
o problem with closed proxy connection during HTTP CONNECT auth negotiation
o transfer-encoding skipping didn't ignore the 407 response bodies properly
o CURLOPT_SSL_VERIFYHOST set to 1
o CONNECT endless loop
o krb5 support builds with Heimdal
o added returned error string for connection refused case
o re-use of dead FTP control connections
o login to FTP servers that don't require (nor understand) PASS after the
USER command
o bad free of memory from libssh2
o the SFTP PWD command works
o HTTP Digest auth on a re-used connection
o FTPS data connection close
o AIX 4 and 5 get to use non-blocking sockets
o small POST with NTLM
o resumed file:// transfers
o CURLOPT_DNS_CACHE_TIMEOUT and CURLOPT_DNS_USE_GLOBAL_CACHE are 64 bit "clean"
o memory leak when handling compressed data streams from broken servers
This release includes the following known bugs:
@@ -69,26 +43,22 @@ This release includes the following known bugs:
Other curl-related news:
o PycURL 7.16.2.1 was released: http://pycurl.sf.net/
o TclCurl 7.16.2 was released:
o pycurl 7.16.4 was released http://pycurl.sf.net
o TclCurl 7.16.4 was released
http://personal1.iddeo.es/andresgarci/tclcurl/english/
New curl mirrors:
o http://curl.spegulo.be is a new mirror in Belgium
o http://curl.piotrkosoft.net is a new mirror in Poland
o http://curl.smudge-it.net is a new mirror in St Louis, MO, USA
o http://curl.askapache.com is a new mirror in Indiana, USA
o http://curl.freeby.pctools.cl is a new mirror in Santiago, Chile
o http://curl.site2nd.org is a new mirror in Dallas, Texas, USA
This release would not have looked like this without help, code, reports and
advice from friends like these:
Song Ma, Dan Fandrich, Yang Tse, Jay Austin, Robert Iakobashvil,
James Housley, Daniel Black, Steve Little, Sonia Subramanian, Peter O'Gorman,
Frank Hempel, Michael Wallner, Jeff Pohlmeyer, Tobias Rundstr<74>m,
Anders Gustafsson, James Bursa, Kristian Gunstone, Feng Tu,
Andre Guibert de Bruet, Rob Crittenden, Rich Rauenzahn, Tom Regner,
Dave Vasilevsky, Shmulik Regev, Robson Braga Araujo, Adam Piggott,
Gerrit Bruchh<68>user
Dan Fandrich, Song Ma, Daniel Black, Giancarlo Formicuccia, Shmulik Regev,
Daniel Cater, Colin Hogben, Jofell Gallardo, Daniel Johnson,
Ralf S. Engelschall, James Housley, Chris Flerackers, Patrick Monnerat,
Jayesh A Shah, Greg Zavertnik, Peter O'Gorman, Greg Morse, Dmitriy Sergeyev,
Scott Cantor
Thanks! (and sorry if I forgot to mention someone)

View File

@@ -1107,7 +1107,7 @@ AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET],
# define PLATFORM_SUNOS4
# endif
#endif
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX4)
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
# define PLATFORM_AIX_V3
#endif

View File

@@ -1,5 +1,38 @@
Changelog for the c-ares project
* July 14 2007 (Daniel Stenberg)
- Vlad Dinulescu fixed two outstanding valgrind reports:
1. In ares_query.c , in find_query_by_id we compare q->qid (which is a short
int variable) with qid, which is declared as an int variable. Moreover,
DNS_HEADER_SET_QID is used to set the value of qid, but DNS_HEADER_SET_QID
sets only the first two bytes of qid. I think that qid should be declared as
"unsigned short" in this function.
2. The same problem occurs in ares_process.c, process_answer() . query->qid
(an unsigned short integer variable) is compared with id, which is an
integer variable. Moreover, id is initialized from DNS_HEADER_QID which sets
only the first two bytes of id. I think that the id variable should be
declared as "unsigned short" in this function.
Even after declaring these variables as "unsigned short", the valgrind
errors are still there. Which brings us to the third problem.
3. The third problem is that Valgrind assumes that query->qid is not
initialised correctly. And it does that because query->qid is set from
DNS_HEADER_QID(qbuf); Valgrind says that qbuf has unitialised bytes. And
qbuf has uninitialised bytes because of channel->next_id . And next_id is
set by ares_init.c:ares__generate_new_id() . I found that putting short r=0
in this function (instead of short r) makes all Valgrind warnings go away.
I have studied ares__rc4() too, and this is the offending line:
buffer_ptr[counter] ^= state[xorIndex]; (ares_query.c:62)
This is what triggers Valgrind.. buffer_ptr is unitialised in this function,
and by applying ^= on it, it remains unitialised.
Version 1.4.0 (June 8, 2007)
* June 4 2007 (Daniel Stenberg)

View File

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

View File

@@ -35,10 +35,10 @@ ifndef LIBARCH
LIBARCH = LIBC
endif
# must be equal to DEBUG or NDEBUG
# must be equal to NDEBUG or DEBUG, CURLDEBUG
ifndef DB
DB = NDEBUG
# DB = DEBUG
# DB = CURLDEBUG
endif
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
OPT = -O2
@@ -51,12 +51,20 @@ endif
# Include the version info retrieved from curlver.h
-include $(OBJDIR)/version.inc
# The following line defines your compiler.
# The following lines defines your compiler.
ifdef CWFolder
METROWERKS = $(CWFolder)
endif
ifdef METROWERKS
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
CC = mwccnlm
else
CC = gcc
endif
# a native win32 awk can be downloaded from here:
# http://www.gknw.net/development/prgtools/awk-20050424.zip
AWK = awk
YACC = bison -y
CP = cp -afv
# RM = rm -f
@@ -82,8 +90,10 @@ ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
CFLAGS += -align 4
else
PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
# PRELUDE = $(SDK_CLIB)/imports/clibpre.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
CFLAGS += -align 1
endif
else
@@ -98,7 +108,10 @@ CFLAGS += -Wall -Wno-format -Wno-uninitialized # -pedantic
ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
else
PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
# PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
PRELUDE = $(NDK_ROOT)/pre/prelude.o
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
endif
endif
@@ -108,14 +121,17 @@ SDK_CLIB = $(NDK_ROOT)/nwsdk
SDK_LIBC = $(NDK_ROOT)/libc
ifeq ($(LIBARCH),LIBC)
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
INCLUDES += -I$(SDK_LIBC)/include
# INCLUDES += -I$(SDK_LIBC)/include/nks
# INCLUDES += -I$(SDK_LIBC)/include/winsock
CFLAGS += -D_POSIX_SOURCE
# CFLAGS += -D__ANSIC__
else
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
INCLUDES += -I$(SDK_CLIB)/include/nlm
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
CFLAGS += -DNETDB_USE_INTERNET
# INCLUDES += -I$(SDK_CLIB)/include
endif
ifeq ($(DB),CURLDEBUG)
INCLUDES += -I../include
endif
CFLAGS += -I. $(INCLUDES)
@@ -135,13 +151,13 @@ endif
include Makefile.inc
OBJLIB := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES)))
OBJEXE = $(OBJLIB) $(OBJDIR)/ares_getopt.o
OBJEXE = $(OBJLIB) $(OBJDIR)/ares_getopt.o
.PHONY: lib nlm prebuild dist install clean
lib: prebuild $(LTARGET)
nlm: prebuild $(TARGETS)
nlm: prebuild $(TARGETS)
prebuild: $(OBJDIR) $(OBJDIR)/version.inc config.h arpa/nameser.h
@@ -186,7 +202,7 @@ $(OBJDIR)/%.o: %.c
$(OBJDIR)/version.inc: ares_version.h $(OBJDIR)
@echo Creating $@
@awk -f ../packages/NetWare/get_ver.awk $< > $@
@$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@
$(OBJDIR)/%.xdc: Makefile.netware
@echo Creating $@
@@ -267,25 +283,77 @@ config.h: Makefile.netware
@echo $(DL)#ifndef NETWARE$(DL) >> $@
@echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
@echo $(DL)#endif$(DL) >> $@
@echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@
@echo $(DL)#define VERSION "$(LIBCARES_VERSION_STR)"$(DL) >> $@
@echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_NAMESER_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
ifeq ($(LIBARCH),CLIB)
@echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@
@echo $(DL)#define MAXHOSTNAMELEN 256$(DL) >> $@
@echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define DL_LDAP_FILE "ldapsdk.nlm"$(DL) >> $@
@echo $(DL)#define socklen_t int$(DL) >> $@
@echo $(DL)#define strncasecmp strnicmp$(DL) >> $@
@echo $(DL)#define strcasecmp stricmp$(DL) >> $@
else
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
@echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
@echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@
endif
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_NAMESER_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
@echo $(DL)#define HAVE_LL 1$(DL) >> $@
@echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_RECV 1$(DL) >> $@
@@ -296,46 +364,26 @@ config.h: Makefile.netware
@echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
ifdef NW_WINSOCK
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
else

View File

@@ -20,12 +20,15 @@
#include <sys/types.h>
#if defined(_AIX) || defined(NETWARE)
#if defined(_AIX) || (defined(NETWARE) && defined(__NOVELL_LIBC__))
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
libc5-based Linux systems. Only include it on system that are known to
require it! */
#include <sys/select.h>
#endif
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
#include <sys/bsdskt.h>
#endif
#if defined(WATT32)
#include <netinet/in.h>

View File

@@ -33,12 +33,13 @@ allocated by one of the functions \fIares_parse_a_reply(3)\fP,
.SH NOTES
It is not necessary (and is not correct) to free the host structure passed to
the callback functions for \fIares_gethostbyname(3)\fP or
\fIares_gethostbyaddr(3)\fP. The ares library will automatically free such
host structures when the callback returns.
\fIares_gethostbyaddr(3)\fP. c-ares will automatically free such host
structures when the callback returns.
.SH SEE ALSO
.BR ares_parse_a_reply (3),
.BR ares_parse_aaaa_reply (3),
.BR ares_parse_ptr_reply (3)
.BR ares_parse_ptr_reply (3),
.BR ares_parse_ns_reply (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br

View File

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

View File

@@ -23,7 +23,10 @@
#include <malloc.h>
#else
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -1319,7 +1322,8 @@ static void init_id_key(rc4_key* key,int key_data_len)
randomize_key(key->state,key_data_len);
state = &key->state[0];
for(counter = 0; counter < 256; counter++)
state[counter] = counter;
/* unnecessary AND but it keeps some compilers happier */
state[counter] = counter & 0xff;
key->x = 0;
key->y = 0;
index1 = 0;
@@ -1338,7 +1342,7 @@ static void init_id_key(rc4_key* key,int key_data_len)
short ares__generate_new_id(rc4_key* key)
{
short r;
short r=0;
ares__rc4(key, (unsigned char *)&r, sizeof(r));
return r;
}

View File

@@ -400,7 +400,8 @@ static void process_timeouts(ares_channel channel, time_t now)
static void process_answer(ares_channel channel, unsigned char *abuf,
int alen, int whichserver, int tcp, time_t now)
{
int id, tc, rcode;
int tc, rcode;
unsigned short id;
struct query *query;
/* If there's no room in the answer for a header, we can't do much

View File

@@ -67,7 +67,7 @@ void ares__rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
static struct query* find_query_by_id(ares_channel channel, int id)
{
int qid;
unsigned short qid;
struct query* q;
DNS_HEADER_SET_QID(((unsigned char*)&qid), id);

View File

@@ -337,6 +337,7 @@ AC_CHECK_HEADERS(
sys/select.h \
sys/socket.h \
sys/ioctl.h \
sys/param.h \
netdb.h \
netinet/in.h \
net/if.h \
@@ -600,6 +601,7 @@ AC_CHECK_MEMBER(struct addrinfo.ai_flags,
AC_CHECK_FUNCS( bitncmp \
gettimeofday \
if_indextoname,
dnl if found
[],
@@ -801,4 +803,4 @@ if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
[a suitable file/device to read random data from])
fi
AC_OUTPUT(Makefile)
AC_OUTPUT(Makefile libcares.pc)

20
ares/libcares.pc.in Normal file
View File

@@ -0,0 +1,20 @@
#***************************************************************************
# Project ___ __ _ _ __ ___ ___
# / __|____ / _` | '__/ _ \/ __|
# | (_|_____| (_| | | | __/\__ \
# \___| \__,_|_| \___||___/
# $id: $
#
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: c-ares
URL: http://daniel.haxx.se/projects/c-ares/
Description: asyncronous DNS lookup library
Version: @VERSION@
Requires:
Requires.private:
Cflags: -I${includedir}
Libs: -L${libdir} -lcares

View File

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

View File

@@ -8,7 +8,7 @@ $Id$
BUGS
Curl and libcurl have grown substantially since the beginning. At the time
of writing (August 2003), there are about 40000 lines of source code, and by
of writing (July 2007), there are about 47000 lines of source code, and by
the time you read this it has probably grown even more.
Of course there are lots of bugs left. And lots of misfeatures.
@@ -39,6 +39,7 @@ WHAT TO REPORT
- your operating system's name and version number (uname -a under a unix
is fine)
- what version of curl you're using (curl -V is fine)
- versions of the used libraries that libcurl is built to use
- what URL you were working with (if possible), at least which protocol
and anything and everything else you think matters. Tell us what you

View File

@@ -1,4 +1,4 @@
Updated: February 11, 2007 (http://curl.haxx.se/docs/faq.html)
Updated: July 30, 2007 (http://curl.haxx.se/docs/faq.html)
_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
@@ -68,6 +68,7 @@ FAQ
4.12 Why do I get "certificate verify failed" ?
4.13 Why is curl -R on Windows one hour off?
4.14 Redirects work in browser but not with curl!
4.15 FTPS doesn't work
5. libcurl Issues
5.1 Is libcurl thread-safe?
@@ -289,13 +290,13 @@ FAQ
Some facts to use as input to the math:
curl packages are downloaded from the curl.haxx.se and mirrors almost one
curl packages are downloaded from the curl.haxx.se and mirrors over a
million times per year. curl is installed by default with most Linux
distributions. curl is installed by default with Mac OS X. curl and libcurl
as used by numerous applications that include libcurl binaries in their
distribution packages (like Adobe Acrobat Reader and Google Earth).
More than 60 known named companies use curl in commercial environments and
More than 70 known named companies use curl in commercial environments and
products. More than 100 known named open source projects depend on
(lib)curl.
@@ -374,7 +375,7 @@ FAQ
2.4 Does curl support Socks (RFC 1928) ?
Yes, SOCKS5 is supported.
Yes, SOCKS 4 and 5 are supported.
3. Usage problems
@@ -446,6 +447,10 @@ FAQ
curl -O ftp://download.com/coolfile -Q '-DELE coolfile'
or rename a file after upload:
curl -T infile ftp://upload.com/dir/ -Q "-RNFR infile" -Q "-RNTO newname"
3.8 How do I tell curl to follow HTTP redirects?
Curl does not follow so-called redirects by default. The Location: header
@@ -824,6 +829,20 @@ FAQ
manually figure out what the page is set to do, or you write a script that
parses the results and fetches the new URL.
4.15 FTPS doesn't work
curl supports FTPS (sometimes known as FTP-SSL) both implicit and explicit
mode.
When a URL is used that starts with FTPS://, curl assumes implicit SSL on
the control connection and will therefore immediately connect and try to
speak SSL. FTPS:// connections default to port 990.
To use explicit FTPS, you use a FTP:// URL and the --ftp-ssl option (or one
of its related flavours). This is the most common method, and the one
mandated by RFC4217. This kind of connection then of course uses the
standard FTP port 21 by default.
5. libcurl Issues
@@ -1099,14 +1118,14 @@ FAQ
In the cURL project we call this module PHP/CURL to differentiate it from
curl the command line tool and libcurl the library. The PHP team however
does not refer to it like this (for unknown reasons). They call it plain
CURL (often using all caps) which causes much confusion to users which in
turn gives us a higher question load.
CURL (often using all caps) or sometimes ext/curl, but both cause much
confusion to users which in turn gives us a higher question load.
7.2 Who write PHP/CURL?
PHP/CURL is a module that comes with the regular PHP package. It depends and
uses libcurl, so you need to have libcurl installed properly first before
PHP/CURL can be used. PHP/CURL is written by Sterling Hughes.
PHP/CURL can be used. PHP/CURL was initially written by Sterling Hughes.
7.3 Can I perform multiple requests using the same handle?

View File

@@ -73,7 +73,7 @@ HTTPS (*1)
FTP
- download
- authentication
- kerberos4 (*5)
- kerberos4 (*5), kerberos5 (*3)
- active/passive using PORT, EPRT, PASV or EPSV
- single file size information (compare to HTTP HEAD)
- 'type=' URL support

View File

@@ -85,15 +85,6 @@ UNIX
LDFLAGS=-R/usr/local/ssl/lib ./configure --with-ssl
Another option to the previous trick, is to set LD_LIBRARY_PATH or edit the
/etc/ld.so.conf file.
If your SSL library was compiled with rsaref (this was common in the past
when used in the United States), you may also need to set:
LIBS=-lRSAglue -lrsaref
(as suggested by Doug Kaufman)
MORE OPTIONS
To force configure to use the standard cc compiler if both cc and gcc are
@@ -143,6 +134,12 @@ UNIX
To build with NSS support instead of OpenSSL for SSL/TLS, note that
you need to use both --without-ssl and --with-nss.
To get GSSAPI support, build with --with-gssapi and have the MIT or
Heimdal Kerberos 5 packages installed.
To get support for SCP and SFTP, build with --with-libssh2 and have
libssh2 0.16 or later installed.
Win32
=====
@@ -173,9 +170,15 @@ Win32
MingW32
-------
Run the 'mingw32.bat' file to get the proper environment variables set,
then run 'make mingw32' in the root dir. Use 'make mingw32-ssl' to build
curl SSL enabled.
MinGW32 does not provide a batch script to set environment variables
automatically. Make sure that MinGW32's bin dir is in PATH and then
run 'mingw32-make mingw32' in the root dir. There are other make
targets available to build libcurl with more features, use:
'mingw32-make mingw32-zlib' to build with Zlib support;
'mingw32-make mingw32-ssl-zlib' to build with SSL and Zlib enabled;
'mingw32-make mingw32-ssh2-ssl-zlib' to build with SSH2, SSL, Zlib;
'mingw32-make mingw32-ssh2-ssl-sspi-zlib' to build with SSH2, SSL, Zlib
and SSPI.
If you have any problems linking libraries or finding header files, be sure
to verify that the provided "Makefile.m32" files use the proper paths, and
@@ -183,12 +186,12 @@ Win32
environment variables, for example:
set ZLIB_PATH=c:\zlib-1.2.3
set OPENSSL_PATH=c:\openssl-0.9.8d
set LIBSSH2_PATH=c:\libssh2-0.15
set OPENSSL_PATH=c:\openssl-0.9.8e
set LIBSSH2_PATH=c:\libssh2-0.16
ATTENTION: if you want to build with libssh2 support you have to use latest
sources fetched from CVS - the current 0.14 release will NOT work!
Use 'make mingw32-ssh2-ssl' to build curl with SSH2 and SSL enabled.
sources fetched from CVS - the current 0.15 release will NOT work!
Use 'mingw32-make mingw32-ssh2-ssl-zlib' to build with SSH2 and SSL enabled.
Cygwin
------
@@ -307,6 +310,7 @@ Win32
CURL_DISABLE_TELNET disables TELNET
CURL_DISABLE_DICT disables DICT
CURL_DISABLE_FILE disables FILE
CURL_DISABLE_TFTP disables TFTP
If you want to set any of these defines you have the following
possibilities:
@@ -484,17 +488,26 @@ NetWare
http://www.gknw.net/development/prgtools/
- recent Novell LibC SDK available from:
http://developer.novell.com/ndk/libc.htm
- optional zlib sources (at the moment only dynamic linking with zlib.imp);
- or recent Novell CLib SDK available from:
http://developer.novell.com/ndk/clib.htm
- optional zlib sources (static or dynamic linking with zlib.imp);
sources with NetWare Makefile can be obtained from:
http://www.gknw.net/mirror/zlib/
- optional OpenSSL sources (version 0.9.8 or later which builds with BSD);
- optional OpenSSL sources (version 0.9.8 or later build with BSD sockets);
you can find precompiled packages at:
http://www.gknw.net/development/ossl/netware/
for CLIB-based builds OpenSSL needs to be extended to build with BSD
sockets (currently only a winsock-based CLIB build is supported);
- optional SSH2 sources (version 0.15 or later);
Set a search path to your compiler, linker and tools; on Linux make
sure that the var OSTYPE contains the string 'linux'; and then type
sure that the var OSTYPE contains the string 'linux'; set the var
NDKBASE to point to the base of your Novell NDK; and then type
'make netware' from the top source directory; other tagets available
are 'netware-ssl', 'netware-ssl-zlib', 'netware-zlib' and 'netware-ares';
if you need other combinations you can control the build with the
environment variables WITH_SSL, WITH_ZLIB, WITH_ARES and ENABLE_IPV6.
environment variables WITH_SSL, WITH_ZLIB, WITH_ARES, WITH_SSH2, and
ENABLE_IPV6; you can set LINK_STATIC=1 to link curl.nlm statically.
I found on some Linux systems (RH9) that OS detection didnt work although
a 'set | grep OSTYPE' shows the var present and set; I simply overwrote it
with 'OSTYPE=linux-rh9-gnu' and the detection in the Makefile worked...

View File

@@ -3,6 +3,13 @@ join in and help us correct one or more of these! Also be sure to check the
changelog of the current development status, as one or more of these problems
may have been fixed since this was written!
45. libcurl built to support ipv6 uses getaddrinfo() to resolve host names.
getaddrinfo() sorts the response list which effectively kills how libcurl
deals with round-robin DNS entries. All details:
http://curl.haxx.se/mail/lib-2007-07/0168.html
initial suggested function to use for randomizing the response:
http://curl.haxx.se/mail/lib-2007-07/0178.html
44. --ftp-method nocwd does not handle URLs ending with a slash properly (it
should list the contents of that directory). See test case 351.

View File

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

View File

@@ -20,3 +20,7 @@ README.win32
command line similar to this in order to extract a separate text file:
curl -M >manual.txt
Read the INSTALL file for instructions how to compile curl self.

View File

@@ -5,6 +5,7 @@
If you have contributed but are missing here, please let us know!
Adam D. Moss
Adam Piggott
Adrian Schuur
Alan Pinstein
Albert Chin-A-Young
@@ -21,7 +22,9 @@ Alexander Zhuravlev
Alexey Simak
Alexis Carvalho
Amol Pattekar
Anders Gustafsson
Andi Jahja
Andre Guibert de Bruet
Andreas Damm
Andreas Ntaflos
Andreas Olsson
@@ -93,6 +96,7 @@ Dan Fandrich
Dan Nelson
Dan Torop
Dan Zitter
Daniel Black
Daniel Johnson
Daniel Stenberg
Daniel at touchtunes
@@ -101,6 +105,7 @@ Dave Dribin
Dave Halbakken
Dave Hamilton
Dave May
Dave Vasilevsky
David Byron
David Cohen
David Eriksson
@@ -163,20 +168,24 @@ Eygene Ryabinkin
Fabrizio Ammollo
Fedor Karpelevitch
Felix von Leitner
Feng Tu
Florian Schoppmann
Forrest Cahoon
Frank Hempel
Frank Keeney
Frank Ticheler
Fred New
Fred Noz
Frederic Lepied
Gautam Mani
Gavrie Philipson
Gaz Iqbal
Georg Horn
Georg Huettenegger
Georg Wicherski
Gerd v. Egidy
Gerhard Herre
Gerrit Bruchh<68>user
Giaslas Georgios
Gilad
Gilbert Ramirez Jr.
@@ -230,6 +239,7 @@ Jan Kunder
Jared Lundell
Jari Sundell
Jason S. Priebe
Jay Austin
Jaz Fresh
Jean Jacques Drouin
Jean-Claude Chauve
@@ -278,6 +288,7 @@ Kang-Jin Lee
Karl Moerder
Karol Pietrzak
Katie Wang
Kees Cook
Keith MacDonald
Keith McGuigan
Ken Hirsch
@@ -292,6 +303,7 @@ Kjetil Jacobsen
Klevtsov Vadim
Kris Kennaway
Krishnendu Majumdar
Kristian Gunstone
Kristian K<>hntopp
Kyle Sallee
Lachlan O'Dea
@@ -405,6 +417,7 @@ Pete Su
Peter Bray
Peter Forret
Peter Heuchert
Peter O'Gorman
Peter Pentchev
Peter Silva
Peter Su
@@ -434,6 +447,7 @@ Rene Bernhardt
Rene Rebe
Ricardo Cadime
Rich Gray
Rich Rauenzahn
Richard Archer
Richard Atterer
Richard Bramante
@@ -484,6 +498,8 @@ Siddhartha Prakash Jain
Simon Dick
Simon Josefsson
Simon Liu
Song Ma
Sonia Subramanian
Spiridonoff A.V
Stadler Stephan
Stefan Esser
@@ -495,6 +511,7 @@ Stephen More
Sterling Hughes
Steve Green
Steve Lhomme
Steve Little
Steve Marx
Steve Oliphant
Steven Bazyl
@@ -505,6 +522,7 @@ S
T. Bharath
T. Yamada
Temprimus
Thomas J. Moore
Thomas Klausner
Thomas Schwinge
Thomas Tonino
@@ -512,6 +530,7 @@ Tim Baker
Tim Bartley
Tim Costello
Tim Sneddon
Tobias Rundstr<74>m
Toby Peterson
Todd Kulesza
Todd Vierling
@@ -519,6 +538,7 @@ Tom Benoist
Tom Lee
Tom Mattison
Tom Moers
Tom Regner
Tom Zerucha
Tomas Pospisek
Tomas Szepe

View File

@@ -52,6 +52,10 @@ TODO
that would risk collide with other apps that use libcurl and that runs
configure).
Work on this has been started but hasn't been finished, and the initial
patch and some details are found here:
http://curl.haxx.se/mail/lib-2006-12/0084.html
LIBCURL - multi interface
* Make sure we don't ever loop because of non-blocking sockets return
@@ -81,10 +85,6 @@ TODO
* Make the detection of (bad) %0d and %0a codes in FTP url parts earlier in
the process to avoid doing a resolve and connect in vain.
* Support GSS/Kerberos 5 for ftp file transfer. This will allow user
authentication and file encryption. Possible libraries and example clients
are available from MIT or Heimdal. Requested by Markus Moeller.
* REST fix for servers not behaving well on >2GB requests. This should fail
if the server doesn't set the pointer to the requested index. The tricky
(impossible?) part is to figure out if the server did the right thing or

View File

@@ -593,13 +593,14 @@ private key is. DER, PEM and ENG are supported. If not specified, PEM is
assumed.
If this option is used several times, the last one will be used.
.IP "--krb4 <level>"
(FTP) Enable Kerberos4 authentication and use. The level must be entered and
.IP "--krb <level>"
(FTP) Enable Kerberos authentication and use. The level must be entered and
should be one of 'clear', 'safe', 'confidential' or 'private'. Should you use
a level that is not one of these, 'private' will instead be used.
This option requires that the library was built with Kerberos4 support. This
is not very common. Use \fI-V/--version\fP to see if your curl supports it.
This option requires that the library was built with kerberos4 or GSSAPI
(GSS-Negotiate) support. This is not very common. Use \fI-V/--version\fP to
see if your curl supports it.
If this option is used several times, the last one will be used.
.IP "-K/--config <config file>"
@@ -908,7 +909,7 @@ the server returns failure for one of the commands, the entire operation
will be aborted. You must send syntactically correct FTP commands as
RFC959 defines to FTP servers, or one of the following commands (with
appropriate arguments) to SFTP servers: chgrp, chmod, chown, ln, mkdir,
rename, rm, rmdir, symlink.
pwd, rename, rm, rmdir, symlink.
This option can be used multiple times.
.IP "--random-file <file>"
@@ -1153,7 +1154,7 @@ Automatic decompression of compressed files over HTTP is supported.
.IP "NTLM"
NTLM authentication is supported.
.IP "GSS-Negotiate"
Negotiate authentication is supported.
Negotiate authentication and krb5 for ftp is supported.
.IP "Debug"
This curl uses a libcurl built with Debug. This enables more error-tracking
and memory debugging etc. For curl-developers only!

View File

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

View File

@@ -2,17 +2,29 @@
# $Id$
#
AUTOMAKE_OPTIONS = foreign no-dependencies
AUTOMAKE_OPTIONS = foreign nostdinc
EXTRA_DIST = README curlgtk.c sepheaders.c simple.c postit2.c \
persistant.c ftpget.c Makefile.example multithread.c getinmemory.c \
ftpupload.c httpput.c simplessl.c ftpgetresp.c http-post.c \
post-callback.c multi-app.c multi-double.c multi-single.c \
multi-post.c fopen.c simplepost.c makefile.dj curlx.c https.c \
multi-debugcallback.c fileupload.c getinfo.c ftp3rdparty.c debug.c \
anyauthput.c htmltitle.cc htmltidy.c opensslthreadlock.c \
cookie_interface.c cacertinmem.c synctime.c sampleconv.c ftpuploadresume.c \
10-at-a-time.c hiperfifo.c ghiper.c
EXTRA_DIST = README Makefile.example makefile.dj $(COMPLICATED_EXAMPLES)
INCLUDES = -I$(top_srcdir)/include
LIBDIR = $(top_builddir)/lib
# Dependencies
LDADD = $(LIBDIR)/libcurl.la
# These are all libcurl example programs to be test compiled
noinst_PROGRAMS = 10-at-a-time anyauthput cookie_interface \
debug fileupload fopen ftpget ftpgetresp ftpupload \
getinfo getinmemory http-post httpput \
https multi-app multi-debugcallback multi-double \
multi-post multi-single persistant post-callback \
postit2 sepheaders simple simplepost simplessl
# These examples require external dependencies that may not be commonly
# available on POSIX systems, so don't bother attempting to compile them here.
COMPLICATED_EXAMPLES = \
curlgtk.c curlx.c htmltitle.cc cacertinmem.c ftpuploadresume.c \
ghiper.c hiperfifo.c htmltidy.c multithread.c \
opensslthreadlock.c sampleconv.c synctime.c
all:
@echo "done"

View File

@@ -11,6 +11,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <curl/curl.h>
@@ -18,6 +19,10 @@
#error "upgrade your libcurl to no less than 7.12.3"
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*
* This example shows a HTTP PUT operation with authentiction using "any"
* type. It PUTs a file given as a command line argument to the URL also given
@@ -52,7 +57,7 @@ static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp)
}
/* read callback function, fread() look alike */
size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{
size_t retcode;

View File

@@ -135,4 +135,5 @@ int main(void)
curl_easy_cleanup(ch);
curl_global_cleanup();
return rv;
}

View File

@@ -10,6 +10,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <time.h>
@@ -74,7 +75,7 @@ main(void)
#define snprintf _snprintf
#endif
/* Netscape format cookie */
snprintf(nline, 256, "%s\t%s\t%s\t%s\t%u\t%s\t%s",
snprintf(nline, sizeof(nline), "%s\t%s\t%s\t%s\t%lu\t%s\t%s",
".google.com", "TRUE", "/", "FALSE", time(NULL) + 31337, "PREF", "hello google, i like you very much!");
res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline);
if (res != CURLE_OK) {
@@ -83,7 +84,7 @@ main(void)
}
/* HTTP-header style cookie */
snprintf(nline, 256,
snprintf(nline, sizeof(nline),
"Set-Cookie: OLD_PREF=3d141414bf4209321; "
"expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com");
res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline);

View File

@@ -81,6 +81,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#include <openssl/x509v3.h>
#include <openssl/x509_vfy.h>
@@ -94,13 +95,13 @@
#include <openssl/bio.h>
#include <openssl/ssl.h>
static char *curlx_usage[]={
static const char *curlx_usage[]={
"usage: curlx args\n",
" -p12 arg - tia file ",
" -envpass arg - environement variable which content the tia private key password",
" -out arg - output file (response)- default stdout",
" -in arg - input file (request)- default stdin",
" -connect arg - URL of the server for the connection ex: www.openevidenve.org",
" -connect arg - URL of the server for the connection ex: www.openevidence.org",
" -mimetype arg - MIME type for data in ex : application/timestamp-query or application/dvcs -default application/timestamp-query",
" -acceptmime arg - MIME type acceptable for the response ex : application/timestamp-response or application/dvcs -default none",
" -accesstype arg - an Object identifier in an AIA/SIA method, e.g. AD_DVCS or ad_timestamping",
@@ -268,19 +269,21 @@ int main(int argc, char **argv) {
char* mimetype;
char* mimetypeaccept=NULL;
char* contenttype;
char** pp;
const char** pp;
unsigned char* hostporturl = NULL;
binaryptr=(char*)malloc(tabLength);
BIO * p12bio ;
char **args = argv + 1;
unsigned char * serverurl;
sslctxparm p;
char *response;
p.verbose = 0;
CURLcode res;
struct curl_slist * headers=NULL;
int badarg=0;
binaryptr=(char*)malloc(tabLength);
p.verbose = 0;
p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
curl_global_init(CURL_GLOBAL_DEFAULT);
@@ -292,7 +295,6 @@ int main(int argc, char **argv) {
ERR_load_crypto_strings();
int badarg=0;
while (*args && *args[0] == '-') {
if (!strcmp (*args, "-in")) {
@@ -407,10 +409,9 @@ int main(int argc, char **argv) {
}
else if (p.accesstype != 0) { /* see whether we can find an AIA or SIA for a given access type */
if (!(serverurl = my_get_ext(p.usercert,p.accesstype,NID_info_access))) {
int j=0;
BIO_printf(p.errorbio,"no service URL in user cert "
"cherching in others certificats\n");
int j=0;
int find=0;
for (j=0;j<sk_X509_num(p.ca);j++) {
if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype,
NID_info_access)))

View File

@@ -17,7 +17,6 @@ int main(void)
{
CURL *curl;
CURLcode res;
curl_off_t size;
struct stat file_info;
double speed_upload, total_time;
FILE *fd;

View File

@@ -70,7 +70,7 @@ struct fcurl_data
typedef struct fcurl_data URL_FILE;
/* exported functions */
URL_FILE *url_fopen(char *url,const char *operation);
URL_FILE *url_fopen(const char *url,const char *operation);
int url_fclose(URL_FILE *file);
int url_feof(URL_FILE *file);
size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file);
@@ -93,11 +93,11 @@ write_callback(char *buffer,
URL_FILE *url = (URL_FILE *)userp;
size *= nitems;
rembuff=url->buffer_len - url->buffer_pos;//remaining space in buffer
rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */
if(size > rembuff)
{
//not enuf space in buffer
/* not enough space in buffer */
newbuff=realloc(url->buffer,url->buffer_len + (size - rembuff));
if(newbuff==NULL)
{
@@ -211,7 +211,7 @@ use_buffer(URL_FILE *file,int want)
URL_FILE *
url_fopen(char *url,const char *operation)
url_fopen(const char *url,const char *operation)
{
/* this code could check for URLs or types in the 'url' and
basicly use the real fopen() for standard files */
@@ -236,7 +236,7 @@ url_fopen(char *url,const char *operation)
curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file);
curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, FALSE);
curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0);
curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);
if(!multi_handle)
@@ -466,7 +466,7 @@ main(int argc, char *argv[])
int nread;
char buffer[256];
char *url;
const char *url;
if(argc < 2)
{
@@ -481,7 +481,7 @@ main(int argc, char *argv[])
outf=fopen("fgets.test","w+");
if(!outf)
{
perror("couldnt open fgets output file\n");
perror("couldn't open fgets output file\n");
return 1;
}
@@ -508,7 +508,7 @@ main(int argc, char *argv[])
outf=fopen("fread.test","w+");
if(!outf)
{
perror("couldnt open fread output file\n");
perror("couldn't open fread output file\n");
return 1;
}
@@ -533,7 +533,7 @@ main(int argc, char *argv[])
outf=fopen("rewind.test","w+");
if(!outf)
{
perror("couldnt open fread output file\n");
perror("couldn't open fread output file\n");
return 1;
}

View File

@@ -1,103 +0,0 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
*/
#include <stdio.h>
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
/*
* This is an example showing how to transfer a file between two remote hosts.
* 7.13.0 or later required.
*/
int main(void)
{
CURL *curl;
CURLcode res;
char source_url[] = "ftp://remotehost.com/path/to/source";
char target_url[] = "ftp://aotherserver.com/path/to/dest";
char sourceUserPass[] = "user:pass";
char targetUserPass[] = "user:pass";
char url[100];
struct curl_slist *source_pre_cmd = NULL;
struct curl_slist *target_pre_cmd = NULL;
struct curl_slist *source_post_cmd = NULL;
struct curl_slist *target_post_cmd = NULL;
char cmd[] = "PWD"; /* just to test */
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if (curl) {
/* The ordinary URL is the target when speaking 3rd party transfers */
curl_easy_setopt(curl, CURLOPT_URL, target_url);
/* Set a source URL */
curl_easy_setopt(curl, CURLOPT_SOURCE_URL, source_url);
/* Set target user and password */
curl_easy_setopt(curl, CURLOPT_USERPWD, targetUserPass);
/* Set source user and password */
curl_easy_setopt(curl, CURLOPT_SOURCE_USERPWD, sourceUserPass);
#if 0
/* FTPPORT enables PORT on the target side, instead of PASV. */
curl_easy_setopt(curl, CURLOPT_FTPPORT, ""); /* optional */
#endif
/* build a list of commands to pass to libcurl */
source_pre_cmd = curl_slist_append(source_pre_cmd, cmd);
/* Set a proxy pre-quote command */
curl_easy_setopt(curl, CURLOPT_SOURCE_PREQUOTE, source_pre_cmd);
/* build a list of commands to pass to libcurl */
target_pre_cmd = curl_slist_append(target_pre_cmd, cmd);
/* Set a pre-quote command */
curl_easy_setopt(curl, CURLOPT_PREQUOTE, target_pre_cmd);
/* build a list of commands to pass to libcurl */
source_post_cmd = curl_slist_append(source_post_cmd, cmd);
/* Set a proxy post-quote command */
curl_easy_setopt(curl, CURLOPT_SOURCE_POSTQUOTE, source_post_cmd);
/* build a list of commands to pass to libcurl */
target_post_cmd = curl_slist_append(target_post_cmd, cmd);
/* Set a post-quote command */
curl_easy_setopt(curl, CURLOPT_POSTQUOTE, target_post_cmd);
/* Switch on full protocol/debug output */
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
res = curl_easy_perform(curl);
/* clean up the FTP commands list */
curl_slist_free_all(source_pre_cmd);
curl_slist_free_all(target_pre_cmd);
curl_slist_free_all(source_post_cmd);
curl_slist_free_all(target_post_cmd);
/* always cleanup */
curl_easy_cleanup(curl);
if(CURLE_OK != res) {
/* we failed */
fprintf(stderr, "curl told us %d\n", res);
}
}
curl_global_cleanup();
return 0;
}

View File

@@ -22,11 +22,11 @@
*/
struct FtpFile {
char *filename;
const char *filename;
FILE *stream;
};
int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
static int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
{
struct FtpFile *out=(struct FtpFile *)stream;
if(out && !out->stream) {
@@ -65,7 +65,7 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile);
/* Switch on full protocol/debug output */
curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
res = curl_easy_perform(curl);

View File

@@ -1,8 +1,8 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
@@ -21,7 +21,7 @@
* This functionality was introduced in libcurl 7.9.3.
*/
size_t
static size_t
write_response(void *ptr, size_t size, size_t nmemb, void *data)
{
FILE *writehere = (FILE *)data;
@@ -34,7 +34,7 @@ int main(int argc, char **argv)
CURLcode res;
FILE *ftpfile;
FILE *respfile;
/* local file name to store the file as */
ftpfile = fopen("ftp-list", "wb"); /* b is binary, needed on win32 */
@@ -46,6 +46,8 @@ int main(int argc, char **argv)
/* Get a file listing from sunet */
curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.sunet.se/");
curl_easy_setopt(curl, CURLOPT_WRITEDATA, ftpfile);
/* If you intend to use this on windows with a libcurl DLL, you must use
CURLOPT_WRITEFUNCTION as well */
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_response);
curl_easy_setopt(curl, CURLOPT_WRITEHEADER, respfile);
res = curl_easy_perform(curl);

View File

@@ -14,6 +14,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
/*
* This example shows an FTP upload, with a rename of the file just after
@@ -31,14 +32,13 @@ int main(int argc, char **argv)
{
CURL *curl;
CURLcode res;
FILE *ftpfile;
FILE * hd_src ;
int hd ;
struct stat file_info;
struct curl_slist *headerlist=NULL;
char buf_1 [] = "RNFR " UPLOAD_FILE_AS;
char buf_2 [] = "RNTO " RENAME_FILE_TO;
static const char buf_1 [] = "RNFR " UPLOAD_FILE_AS;
static const char buf_2 [] = "RNTO " RENAME_FILE_TO;
/* get the file size of the local file */
hd = open(LOCAL_FILE, O_RDONLY) ;
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
headerlist = curl_slist_append(headerlist, buf_2);
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ;
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1) ;
/* specify target */
curl_easy_setopt(curl,CURLOPT_URL, REMOTE_URL);

View File

@@ -24,7 +24,9 @@
/* The MinGW headers are missing a few Win32 function definitions,
you shouldn't need this if you use VC++ */
#ifdef __MINGW32__
int __cdecl _snscanf(const char * input, size_t length, const char * format, ...);
#endif
/* parse headers for Content-Length */
@@ -75,7 +77,7 @@ int upload(CURL *curlhandle, const char * remotepath, const char * localpath,
return 0;
}
curl_easy_setopt(curlhandle, CURLOPT_UPLOAD, TRUE);
curl_easy_setopt(curlhandle, CURLOPT_UPLOAD, 1);
curl_easy_setopt(curlhandle, CURLOPT_URL, remotepath);
@@ -91,9 +93,9 @@ int upload(CURL *curlhandle, const char * remotepath, const char * localpath,
curl_easy_setopt(curlhandle, CURLOPT_READDATA, f);
curl_easy_setopt(curlhandle, CURLOPT_FTPPORT, "-"); /* disable passive mode */
curl_easy_setopt(curlhandle, CURLOPT_FTP_CREATE_MISSING_DIRS, TRUE);
curl_easy_setopt(curlhandle, CURLOPT_FTP_CREATE_MISSING_DIRS, 1);
curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 1);
for (c = 0; (r != CURLE_OK) && (c < tries); c++) {
/* are we resuming? */
@@ -108,22 +110,22 @@ int upload(CURL *curlhandle, const char * remotepath, const char * localpath,
* because HEADER will dump the headers to stdout
* without it.
*/
curl_easy_setopt(curlhandle, CURLOPT_NOBODY, TRUE);
curl_easy_setopt(curlhandle, CURLOPT_HEADER, TRUE);
curl_easy_setopt(curlhandle, CURLOPT_NOBODY, 1);
curl_easy_setopt(curlhandle, CURLOPT_HEADER, 1);
r = curl_easy_perform(curlhandle);
if (r != CURLE_OK)
continue;
curl_easy_setopt(curlhandle, CURLOPT_NOBODY, FALSE);
curl_easy_setopt(curlhandle, CURLOPT_HEADER, FALSE);
curl_easy_setopt(curlhandle, CURLOPT_NOBODY, 0);
curl_easy_setopt(curlhandle, CURLOPT_HEADER, 0);
fseek(f, uploaded_len, SEEK_SET);
curl_easy_setopt(curlhandle, CURLOPT_FTPAPPEND, TRUE);
curl_easy_setopt(curlhandle, CURLOPT_FTPAPPEND, 1);
}
else { /* no */
curl_easy_setopt(curlhandle, CURLOPT_FTPAPPEND, FALSE);
curl_easy_setopt(curlhandle, CURLOPT_FTPAPPEND, 0);
}
r = curl_easy_perform(curlhandle);

View File

@@ -26,7 +26,7 @@ struct MemoryStruct {
size_t size;
};
void *myrealloc(void *ptr, size_t size)
static void *myrealloc(void *ptr, size_t size)
{
/* There might be a realloc() out there that doesn't like reallocing
NULL pointers, so we take care of it here */
@@ -36,7 +36,7 @@ void *myrealloc(void *ptr, size_t size)
return malloc(size);
}
size_t
static size_t
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
size_t realsize = size * nmemb;

View File

@@ -91,9 +91,9 @@ typedef struct _SockInfo {
/* Die if we get a bad CURLMcode somewhere */
static void mcode_or_die(char *where, CURLMcode code) {
static void mcode_or_die(const char *where, CURLMcode code) {
if ( CURLM_OK != code ) {
char *s;
const char *s;
switch (code) {
case CURLM_CALL_MULTI_PERFORM: s="CURLM_CALL_MULTI_PERFORM"; break;
case CURLM_OK: s="CURLM_OK"; break;
@@ -259,7 +259,7 @@ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
GlobalInfo *g = (GlobalInfo*) cbp;
SockInfo *fdp = (SockInfo*) sockp;
char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" };
static const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" };
MSG_OUT("socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]);
if (what == CURL_POLL_REMOVE) {
@@ -402,7 +402,7 @@ static gboolean fifo_cb (GIOChannel *ch, GIOCondition condition, gpointer data)
int init_fifo(void)
{
struct stat st;
char *fifo = "hiper.fifo";
const char *fifo = "hiper.fifo";
int socket;
if (lstat (fifo, &st) == 0) {

View File

@@ -252,7 +252,7 @@ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
GlobalInfo *g = (GlobalInfo*) cbp;
SockInfo *fdp = (SockInfo*) sockp;
char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" };
const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" };
fprintf(MSG_OUT,
"socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]);
@@ -357,7 +357,7 @@ void fifo_cb(int fd, short event, void *arg) {
/* Create a named pipe and tell libevent to monitor it */
int init_fifo (GlobalInfo *g) {
struct stat st;
char *fifo = "hiper.fifo";
static const char *fifo = "hiper.fifo";
int socket;
fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo);

View File

@@ -11,6 +11,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <curl/curl.h>
@@ -24,7 +25,7 @@
* http://www.apacheweek.com/features/put
*/
size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{
size_t retcode;
@@ -75,10 +76,10 @@ int main(int argc, char **argv)
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ;
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1) ;
/* HTTP PUT please */
curl_easy_setopt(curl, CURLOPT_PUT, TRUE);
curl_easy_setopt(curl, CURLOPT_PUT, 1);
/* specify target URL, and note that this URL should include a file
name, not only a directory */

View File

@@ -31,7 +31,7 @@ int main(void)
* default bundle, then the CURLOPT_CAPATH option might come handy for
* you.
*/
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
#endif
#ifdef SKIP_HOSTNAME_VERFICATION

View File

@@ -47,7 +47,7 @@ int main(int argc, char **argv)
curl_easy_setopt(handles[HTTP_HANDLE], CURLOPT_URL, "http://website.com");
curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_URL, "ftp://ftpsite.com");
curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_UPLOAD, TRUE);
curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_UPLOAD, 1);
/* init a multi stack */
multi_handle = curl_multi_init();

View File

@@ -19,7 +19,6 @@
int main(int argc, char *argv[])
{
CURL *curl;
CURLcode res;
CURLM *multi_handle;
int still_running;
@@ -27,7 +26,7 @@ int main(int argc, char *argv[])
struct curl_httppost *formpost=NULL;
struct curl_httppost *lastptr=NULL;
struct curl_slist *headerlist=NULL;
char buf[] = "Expect:";
static const char buf[] = "Expect:";
/* Fill in the file upload field. This makes libcurl load data from
the given file name when curl_easy_perform() is called. */
@@ -58,7 +57,6 @@ int main(int argc, char *argv[])
wanted */
headerlist = curl_slist_append(headerlist, buf);
if(curl && multi_handle) {
int perform=0;
/* what URL that receives this POST */
curl_easy_setopt(curl, CURLOPT_URL,

View File

@@ -24,7 +24,7 @@
http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION
*/
char *urls[]= {
const char *urls[]= {
"http://curl.haxx.se/",
"ftp://cool.haxx.se/",
"http://www.contactor.se/",
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
error = pthread_create(&tid[i],
NULL, /* default attributes please */
pull_one_url,
urls[i]);
(void *)urls[i]);
if(0 != error)
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
else

View File

@@ -16,6 +16,11 @@
* Author: Jeremy Brown
*/
#include <stdio.h>
#include <pthread.h>
#include <openssl/err.h>
#define MUTEX_TYPE pthread_mutex_t
#define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL)
#define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x))
@@ -25,7 +30,7 @@
void handle_error(const char *file, int lineno, const char *msg){
fprintf(stderr, ** %s:%i %s\n, file, lineno, msg);
fprintf(stderr, "** %s:%d %s\n", file, lineno, msg);
ERR_print_errors_fp(stderr);
/* exit(-1); */
}

View File

@@ -15,14 +15,14 @@
#include <string.h>
#include <curl/curl.h>
char data[]="this is what we post to the silly web server";
const char data[]="this is what we post to the silly web server";
struct WriteThis {
char *readptr;
const char *readptr;
int sizeleft;
};
size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
{
struct WriteThis *pooh = (struct WriteThis *)userp;
@@ -55,7 +55,7 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_URL,
"http://receivingsite.com.pooh/index.cgi");
/* Now specify we want to POST data */
curl_easy_setopt(curl, CURLOPT_POST, TRUE);
curl_easy_setopt(curl, CURLOPT_POST, 1);
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);

View File

@@ -36,7 +36,7 @@ int main(int argc, char *argv[])
struct curl_httppost *formpost=NULL;
struct curl_httppost *lastptr=NULL;
struct curl_slist *headerlist=NULL;
char buf[] = "Expect:";
static const char buf[] = "Expect:";
curl_global_init(CURL_GLOBAL_ALL);

View File

@@ -16,7 +16,7 @@
#include <curl/types.h>
#include <curl/easy.h>
size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
{
int written = fwrite(ptr, size, nmemb, (FILE *)stream);
return written;
@@ -25,9 +25,9 @@ size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
int main(int argc, char **argv)
{
CURL *curl_handle;
char *headerfilename = "head.out";
static const char *headerfilename = "head.out";
FILE *headerfile;
char *bodyfilename = "body.out";
static const char *bodyfilename = "body.out";
FILE *bodyfile;
curl_global_init(CURL_GLOBAL_ALL);

View File

@@ -9,6 +9,7 @@
*/
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
int main(void)
@@ -16,7 +17,7 @@ int main(void)
CURL *curl;
CURLcode res;
char *postthis="moo mooo moo moo";
static const char *postthis="moo mooo moo moo";
curl = curl_easy_init();
if(curl) {

View File

@@ -38,9 +38,10 @@ int main(int argc, char **argv)
CURL *curl;
CURLcode res;
FILE *headerfile;
const char *pPassphrase = NULL;
const char *pCertFile = "testcert.pem";
const char *pCACertFile="cacert.pem";
static const char *pCertFile = "testcert.pem";
static const char *pCACertFile="cacert.pem";
const char *pKeyName;
const char *pKeyType;
@@ -57,8 +58,6 @@ int main(int argc, char **argv)
pEngine = NULL;
#endif
const char *pPassphrase = NULL;
headerfile = fopen("dumpit", "w");
curl_global_init(CURL_GLOBAL_DEFAULT);

View File

@@ -87,7 +87,7 @@ typedef struct
char timeserver[MAX_STRING1];
} conf_t;
char DefaultTimeServer[4][MAX_STRING1] =
const char DefaultTimeServer[4][MAX_STRING1] =
{
"http://nist.time.gov/timezone.cgi?UTC/s/0",
"http://www.google.com/",
@@ -95,9 +95,9 @@ char DefaultTimeServer[4][MAX_STRING1] =
"http://www.worldtime.com/cgi-bin/wt.cgi"
};
char *DayStr[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
char *MthStr[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
const char *DayStr[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
const char *MthStr[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
int ShowAllHeader;
int AutoSyncTime;

View File

@@ -133,7 +133,9 @@ protocol used doesn't support this.
.IP CURLINFO_PRIVATE
Pass a pointer to a 'char *' to receive the pointer to the private data
associated with the curl handle (set with the CURLOPT_PRIVATE option to
\fIcurl_easy_setopt(3)\fP). (Added in 7.10.3)
\fIcurl_easy_setopt(3)\fP). Please note that for internal reasons, the
value is returned as a 'char *', although effectively being a 'void *'.
(Added in 7.10.3)
.IP CURLINFO_HTTPAUTH_AVAIL
Pass a pointer to a long to receive a bitmask indicating the authentication
method(s) available. The meaning of the bits is explained in the

View File

@@ -21,7 +21,7 @@
.\" * $Id$
.\" **************************************************************************
.\"
.TH curl_easy_setopt 3 "22 Feb 2007" "libcurl 7.16.2" "libcurl Manual"
.TH curl_easy_setopt 3 "1 Aug 2007" "libcurl 7.17.0" "libcurl Manual"
.SH NAME
curl_easy_setopt \- set options for a curl easy handle
.SH SYNOPSIS
@@ -44,11 +44,13 @@ between transfers, so if you want subsequent transfers with different options,
you must change them between the transfers. You can optionally reset all
options back to internal default with \fIcurl_easy_reset(3)\fP.
Strings passed to libcurl as 'char *' arguments, will not be copied by the
library. Instead you should keep them available until libcurl no longer needs
them. Failing to do so will cause very odd behavior or even crashes. libcurl
will need them until you call \fIcurl_easy_cleanup(3)\fP or you set the same
option again to use a different pointer.
Strings passed to libcurl as 'char *' arguments, are copied by the library;
thus the string storage associated to the pointer argument may be overwritten
after curl_easy_setopt() returns. Exceptions to this rule are described in
the option details below.
NOTE: before 7.17.0 strings were not copied. Instead the user was forced keep
them available until libcurl no longer needed them.
The \fIhandle\fP is the return code from a \fIcurl_easy_init(3)\fP or
\fIcurl_easy_duphandle(3)\fP call.
@@ -194,8 +196,7 @@ this callback will cause libcurl to abort the transfer and return
If you transfer data with the multi interface, this function will not be
called during periods of idleness unless you call the appropriate libcurl
function that performs transfers. Usage of the \fBCURLOPT_PROGRESSFUNCTION\fP
callback is not recommended when using the multi interface.
function that performs transfers.
\fICURLOPT_NOPROGRESS\fP must be set to FALSE to make this function actually
get called.
@@ -330,6 +331,12 @@ system.
Pass a char * to a buffer that the libcurl may store human readable error
messages in. This may be more helpful than just the return code from
\fIcurl_easy_perform\fP. The buffer must be at least CURL_ERROR_SIZE big.
Although this argument is a 'char *', it does not describe an input string.
Therefore the (probably undefined) contents of the buffer is NOT copied
by the library. You should keep the associated storage available until
libcurl no longer needs it. Failing to do so will cause very odd behavior
or even crashes. libcurl will need it until you call \fIcurl_easy_cleanup(3)\fP
or you set the same option again to use a different pointer.
Use \fICURLOPT_VERBOSE\fP and \fICURLOPT_DEBUGFUNCTION\fP to better
debug/trace why errors happen.
@@ -662,6 +669,12 @@ set that Content-Type by default when this option is used), which is the most
commonly used one by HTML forms. See also the \fICURLOPT_POST\fP. Using
\fICURLOPT_POSTFIELDS\fP implies \fICURLOPT_POST\fP.
If you want to do a zero-byte POST, you need to set
\fICURLOPT_POSTFIELDSIZE\fP explicitly to zero, as simply setting
\fICURLOPT_POSTFIELDS\fP to NULL or "" just effectively disables the sending
of the specified string. libcurl will instead assume that you'll send the POST
data using the read callback!
Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual.
@@ -810,6 +823,7 @@ it thinks fit.
Enforce HTTP 1.0 requests.
.IP CURL_HTTP_VERSION_1_1
Enforce HTTP 1.1 requests.
.RE
.IP CURLOPT_IGNORE_CONTENT_LENGTH
Ignore the Content-Length header. This is useful for Apache 1.x (and similar
servers) which will report incorrect content length for files over 2
@@ -826,7 +840,6 @@ Pass a long to tell libcurl how to act on transfer decoding. If set to zero,
transfer decoding will be disabled, if set to 1 it is enabled
(default). libcurl does chunked transfer decoding by default unless this
option is set to zero. (added in 7.16.2)
.RE
.SH FTP OPTIONS
.IP CURLOPT_FTPPORT
Pass a pointer to a zero terminated string as parameter. It will be used to
@@ -847,6 +860,8 @@ properly filled in with text strings. Use \fIcurl_slist_append(3)\fP
to append strings (commands) to the list, and clear the entire list
afterwards with \fIcurl_slist_free_all(3)\fP. Disable this operation
again by setting a NULL to this option.
The valid SFTP commands are: chgrp, chmod, chown, ln, mkdir, pwd,
rename, rm, rmdir, symlink. (SFTP support added in 7.16.3)
.IP CURLOPT_POSTQUOTE
Pass a pointer to a linked list of FTP or SFTP commands to pass to the
server after your ftp transfer request. The linked list should be a
@@ -1370,27 +1385,32 @@ this to 1 to enable it. By default all transfers are done using the
cache. Note that while nothing ever should get hurt by attempting to reuse SSL
session-IDs, there seem to be broken SSL implementations in the wild that may
require you to disable this in order for you to succeed. (Added in 7.16.0)
.IP CURLOPT_KRB4LEVEL
Pass a char * as parameter. Set the krb4 security level, this also enables
krb4 awareness. This is a string, 'clear', 'safe', 'confidential' or
\&'private'. If the string is set but doesn't match one of these, 'private'
will be used. Set the string to NULL to disable Kerberos4. The Kerberos
support only works for FTP.
.IP CURLOPT_KRBLEVEL
Pass a char * as parameter. Set the kerberos security level for FTP; this
also enables kerberos awareness. This is a string, 'clear', 'safe',
'confidential' or \&'private'. If the string is set but doesn't match one
of these, 'private' will be used. Set the string to NULL to disable kerberos
support for FTP.
(This option was known as CURLOPT_KRB4LEVEL up to 7.16.3)
.SH SSH OPTIONS
.IP CURLOPT_SSH_AUTH_TYPES
Pass a long set to a bitmask consisting of one or more of
CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST,
CURLSSH_AUTH_KEYBOARD. Set CURLSSH_AUTH_ANY to let libcurl pick one.
(Added in 7.16.1)
.IP CURLOPT_SSH_PUBLIC_KEYFILE
Pass a char * pointing to a file name for your public key. If not used,
libcurl defaults to using \fB~/.ssh/id_dsa.pub\fP.
(Added in 7.16.1)
.IP CURLOPT_SSH_PRIVATE_KEYFILE
Pass a char * pointing to a file name for your private key. If not used,
libcurl defaults to using \fB~/.ssh/id_dsa\fP.
If the file is password-protected, set the password with \fICURLOPT_SSLKEYPASSWD\fP.
(Added in 7.16.1)
.SH OTHER OPTIONS
.IP CURLOPT_PRIVATE
Pass a char * as parameter, pointing to data that should be associated with
Pass a void * as parameter, pointing to data that should be associated with
this curl handle. The pointer can subsequently be retrieved using
\fIcurl_easy_getinfo(3)\fP with the CURLINFO_PRIVATE option. libcurl itself
does nothing with this data. (Added in 7.10.3)
@@ -1401,6 +1421,17 @@ this curl handle use the data from the shared handle instead of keeping the
data to itself. This enables several curl handles to share data. If the curl
handles are used simultaneously, you \fBMUST\fP use the locking methods in the
share handle. See \fIcurl_share_setopt(3)\fP for details.
.IP CURLOPT_NEW_FILE_PERMS
Pass a long as a parameter, containing the value of the permissions that will
be assigned to newly created files on the remote server. The default value is
\fI0644\fP, but any valid value can be used. The only protocols that can use
this are \fIsftp://\fP, \fIscp://\fP and \fIfile://\fP. (Added in 7.16.4)
.IP CURLOPT_NEW_DIRECTORY_PERMS
Pass a long as a parameter, containing the value of the permissions that will
be assigned to newly created directories on the remote server. The default
value is \fI0755\fP, but any valid value can be used. The only protocols that
can use this are \fIsftp://\fP, \fIscp://\fP and \fIfile://\fP.
(Added in 7.16.4)
.SH TELNET OPTIONS
.IP CURLOPT_TELNETOPTIONS
Provide a pointer to a curl_slist with variables to pass to the telnet

View File

@@ -106,7 +106,7 @@ The \fIuserp\fP argument is a private pointer you have previously set with
CURLMcode type, general libcurl multi interface error code.
If you receive \fICURLM_CALL_MULTI_PERFORM\fP, this basically means that you
should call \fIcurl_multi_perform\fP again, before you wait for more actions
should call \fIcurl_multi_socket(3)\fP again, before you wait for more actions
on libcurl's sockets. You don't have to do it immediately, but the return code
means that libcurl may have more data available to return or that there may be
more data to send off before it is "satisfied".
@@ -119,26 +119,32 @@ function returns OK.
2. Set the socket callback with CURLMOPT_SOCKETFUNCTION
3. Add easy handles
3. Set the timeout callback with CURLMOPT_TIMERFUNCTION, to get to know what
timeout value to use when waiting for socket activities.
4. Call curl_multi_socket_all() first once
4. Add easy handles
5. Setup a "collection" of sockets to supervise when your socket
callback is called.
5. Call curl_multi_socket_all() first once
6. Use curl_multi_timeout() to figure out how long to wait for action
6. Provide some means to manage the sockets libcurl is using, so you can check
them for activity. This can be done through your application code, or by way
of an external library such as libevent or glib.
7. Wait for action on any of libcurl's sockets
7. Wait for activity on any of libcurl's sockets, use the timeout value your
calback has been told
8, When action happens, call curl_multi_socket_action() for the socket(s) that got
action.
8, When activity is detected, call curl_multi_socket_action() for the
socket(s) that got action. If no activity is detected and the timeout expires,
call \fIcurl_multi_socket(3)\fP with \fICURL_SOCKET_TIMEOUT\fP
9. Go back to step 6.
9. Go back to step 7.
.SH AVAILABILITY
This function was added in libcurl 7.15.4, although deemed stablesince 7.16.0.
This function was added in libcurl 7.15.4, although deemed stable since
7.16.0.
\fIcurl_multi_socket(3)\fP is deprecated, use
\fIcurl_multi_socket_action(3)\fP instead!
.SH "SEE ALSO"
.BR curl_multi_cleanup "(3), " curl_multi_init "(3), "
.BR curl_multi_fdset "(3), " curl_multi_info_read "(3)"
.BR curl_multi_fdset "(3), " curl_multi_info_read "(3), "
.BR "the hiperfifo.c example"

View File

@@ -99,7 +99,8 @@ When sending custom "QUOTE" commands to the remote server, one of the commands
returned an error code that was 400 or higher.
.IP "CURLE_HTTP_RETURNED_ERROR (22)"
This is returned if CURLOPT_FAILONERROR is set TRUE and the HTTP server
returns an error code that is >= 400.
returns an error code that is >= 400. (This error code was formerly known as
CURLE_HTTP_NOT_FOUND.)
.IP "CURLE_WRITE_ERROR (23)"
An error occurred when writing received data to a local file, or an error was
returned to libcurl from a write callback.
@@ -157,10 +158,11 @@ Aborted by callback. A callback returned "abort" to libcurl.
Internal error. A function was called with a bad parameter.
.IP "CURLE_BAD_CALLING_ORDER (44)"
This is never returned by current libcurl.
.IP "CURLE_HTTP_PORT_FAILED (45)"
.IP "CURLE_INTERFACE_FAILED (45)"
Interface error. A specified outgoing interface could not be used. Set which
interface to use for outgoing connections' source IP address with
CURLOPT_INTERFACE.
CURLOPT_INTERFACE. (This error code was formerly known as
CURLE_HTTP_PORT_FAILED.)
.IP "CURLE_BAD_PASSWORD_ENTERED (46)"
This is never returned by current libcurl.
.IP "CURLE_TOO_MANY_REDIRECTS (47)"

View File

@@ -136,8 +136,6 @@ the future, you should be aware of the following current restrictions:
- GnuTLS SSL connections
- Active FTP connections
- HTTP proxy CONNECT operations
- SCP and SFTP connections
- SFTP transfers
- TFTP transfers
- file:// transfers
.fi

View File

@@ -151,7 +151,7 @@ extern "C" {
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
libc5-based Linux systems. Only include it on system that are known to
require it! */
#if defined(_AIX) || defined(NETWARE) || defined(__NetBSD__) || defined(__minix)
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || defined(__minix)
#include <sys/select.h>
#endif
@@ -736,10 +736,12 @@ typedef enum {
/* Set the interface string to use as outgoing network interface */
CINIT(INTERFACE, OBJECTPOINT, 62),
/* Set the krb4 security level, this also enables krb4 awareness. This is a
* string, 'clear', 'safe', 'confidential' or 'private'. If the string is
* set but doesn't match one of these, 'private' will be used. */
CINIT(KRB4LEVEL, OBJECTPOINT, 63),
/* Set the krb4/5 security level, this also enables krb4/5 awareness. This
* is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
* is set but doesn't match one of these, 'private' will be used. */
CINIT(KRBLEVEL, OBJECTPOINT, 63),
/* This is for compatibility with older curl releases */
#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
/* Set if we should verify the peer in ssl handshake, set 1 to verify. */
CINIT(SSL_VERIFYPEER, LONG, 64),
@@ -1076,6 +1078,11 @@ typedef enum {
CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
CINIT(HTTP_CONTENT_DECODING, LONG, 158),
/* Permission used when creating new files and directories on the remote
server for protocols that support it, SFTP/SCP/FILE */
CINIT(NEW_FILE_PERMS, LONG, 159),
CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;

View File

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

View File

@@ -44,6 +44,16 @@ CURL_EXTERN char *curl_maprintf(const char *format, ...);
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
#ifdef _MPRINTF_REPLACE
# undef printf
# undef fprintf
# undef sprintf
# undef vsprintf
# undef snprintf
# undef vprintf
# undef vfprintf
# undef vsnprintf
# undef aprintf
# undef vaprintf
# define printf curl_mprintf
# define fprintf curl_mfprintf
#ifdef CURLDEBUG

View File

@@ -9,7 +9,7 @@ TARGETS = libcurl_wc.lib libcurl_wc.dll libcurl_wc_imp.lib
CC = wcc386
CFLAGS = -3r -mf -d3 -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm -bt=nt -bd &
-d+ -dWIN32 -dHAVE_LONGLONG -dCURL_CA_BUNDLE=getenv("CURL_CA_BUNDLE") &
-d+ -dWIN32 -dCURL_CA_BUNDLE=getenv("CURL_CA_BUNDLE") &
-dBUILDING_LIBCURL -dWITHOUT_MM_LIB -dHAVE_SPNEGO=1 -dENABLE_IPV6 &
-dDEBUG_THREADING_GETADDRINFO -dDEBUG=1 -dCURLDEBUG -d_WIN32_WINNT=0x0501 &
-I. -I..\include

View File

@@ -32,7 +32,7 @@ EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos \
$(DSP) curllib.dsw config-win32.h config-win32ce.h config-riscos.h \
config-mac.h config.h.in ca-bundle.crt makefile.dj config.dos \
libcurl.framework.make libcurl.plist libcurl.rc config-amigaos.h \
amigaos.c amigaos.h makefile.amiga Makefile.netware nwlib.c \
amigaos.c amigaos.h makefile.amiga Makefile.netware nwlib.c nwos.c \
libcurl.imp msvcproj.head msvcproj.foot config-win32ce.h \
Makefile.Watcom config-tpf.h $(DOCS) $(VCPROJ)

View File

@@ -1,22 +1,23 @@
# ./lib/Makefile.inc
CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \
ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c \
netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c \
memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c multi.c \
content_encoding.c share.c http_digest.c md5.c http_negotiate.c \
http_ntlm.c inet_pton.c strtoofft.c strerror.c hostares.c hostasyn.c \
hostip4.c hostip6.c hostsyn.c hostthre.c inet_ntop.c parsedate.c \
select.c gtls.c sslgen.c tftp.c splay.c strdup.c socks.c ssh.c nss.c
krb5.c memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c \
multi.c content_encoding.c share.c http_digest.c md5.c \
http_negotiate.c http_ntlm.c inet_pton.c strtoofft.c strerror.c \
hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c \
inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c \
strdup.c socks.c ssh.c nss.c qssl.c
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 \
if2ip.h speedcheck.h urldata.h ldap.h ssluse.h escape.h telnet.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 \
share.h md5.h http_digest.h http_negotiate.h http_ntlm.h ca-bundle.h \
inet_pton.h strtoofft.h strerror.h inet_ntop.h curlx.h memory.h \
setup.h transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h \
gtls.h tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h \
nssg.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 share.h md5.h \
http_digest.h http_negotiate.h http_ntlm.h ca-bundle.h inet_pton.h \
strtoofft.h strerror.h inet_ntop.h curlx.h memory.h setup.h \
transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h \
tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h \
qssl.h

View File

@@ -4,32 +4,43 @@
## Makefile for building libcurl.a with MingW32 (GCC-3.2) and
## optionally OpenSSL (0.9.8)
##
## Use: make -f Makefile.m32 [SSL=1] [SSH2=1] [DYN=1]
## Use: mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [DYN=1]
##
## Comments to: Troy Engel <tengel@sonic.net> or
## Joern Hartroth <hartroth@acm.org>
ifndef OPENSSL_PATH
OPENSSL_PATH = ../../openssl-0.9.8d
OPENSSL_PATH = ../../openssl-0.9.8e
endif
ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-0.14
LIBSSH2_PATH = ../../libssh2-0.16
endif
ifndef ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.3
endif
ARES_LIB = ../ares
CC = gcc
AR = ar
RM = rm -f
# comment LDFLAGS below to keep debug info
LDFLAGS = -s
RANLIB = ranlib
RC = windres
RCFLAGS = --include-dir=../include -DCURLDEBUG=0 -O COFF -i
RM = del /q /f
STRIP = strip -g
########################################################
## Nothing more to do below this line!
INCLUDES = -I. -I../include
CFLAGS = -g -O2 -DBUILDING_LIBCURL -DHAVE_LONGLONG
CFLAGS = -g -O2 -DBUILDING_LIBCURL
ifdef ARES
INCLUDES += -I$(ARES_LIB)
CFLAGS += -DUSE_ARES
DLL_LIBS += -L$(ARES_LIB) -lcares
endif
ifdef SSH2
INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
@@ -53,6 +64,7 @@ endif
ifdef IPV6
CFLAGS += -DENABLE_IPV6
endif
DLL_LIBS += -lws2_32 -lwinmm
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
# Makefile.inc provides the CSOURCES and HHEADERS defines
@@ -63,6 +75,10 @@ libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
libcurl_a_LIBRARIES = libcurl.a
libcurl_a_DEPENDENCIES = $(strip $(CSOURCES) $(HHEADERS))
RESOURCE = libcurl.res
.SUFFIXES: .rc .res
all: libcurl.a libcurl.dll libcurldll.a
libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
@@ -71,22 +87,18 @@ libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
$(RANLIB) libcurl.a
$(STRIP) $@
RESOURCE = libcurl.res
# remove the last line above to keep debug info
libcurl.dll libcurldll.a: $(libcurl_a_OBJECTS) $(RESOURCE)
$(RM) $@
$(CC) -s -shared -Wl,--out-implib,libcurldll.a -o libcurl.dll \
$(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS) -lws2_32 -lwinmm
# remove the above '-s' to keep debug info
$(CC) $(LDFLAGS) -shared -Wl,--out-implib,libcurldll.a -o libcurl.dll \
$(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
.c.o:
$(COMPILE) -c $<
libcurl.res: libcurl.rc
windres -DCURLDEBUG=0 -O COFF -o $@ -i $^
.rc.res:
$(RC) $(RCFLAGS) $< -o $@
clean:
$(RM) $(libcurl_a_OBJECTS) $(RESOURCE)

View File

@@ -25,7 +25,7 @@ endif
# Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-0.15
LIBSSH2_PATH = ../../libssh2-0.16
endif
ifndef INSTDIR
@@ -36,7 +36,7 @@ endif
TARGET = libcurl
VERSION = $(LIBCURL_VERSION)
COPYR = Copyright (C) 1996 - 2007, Daniel Stenberg, <daniel@haxx.se>
DESCR = cURL libcurl $(LIBCURL_VERSION_STR) - http://curl.haxx.se
DESCR = cURL libcurl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - http://curl.haxx.se
MTSAFE = YES
STACK = 64000
SCREEN = none
@@ -60,15 +60,19 @@ else
OBJDIR = debug
endif
# Include the version info retrieved from curlver.h
-include $(OBJDIR)/version.inc
# The following line defines your compiler.
# The following lines defines your compiler.
ifdef CWFolder
METROWERKS = $(CWFolder)
endif
ifdef METROWERKS
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
CC = mwccnlm
else
CC = gcc
endif
# a native win32 awk can be downloaded from here:
# http://www.gknw.net/development/prgtools/awk-20050424.zip
AWK = awk
YACC = bison -y
CP = cp -afv
@@ -78,6 +82,12 @@ CP = cp -afv
# http://www.gknw.net/development/prgtools/mkxdc.zip
MPKXDC = mkxdc
# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH))
# Include the version info retrieved from curlver.h
-include $(OBJDIR)/version.inc
# Global flags for all compilers
CFLAGS = $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
@@ -95,8 +105,10 @@ ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
CFLAGS += -align 4
else
PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
# PRELUDE = $(SDK_CLIB)/imports/clibpre.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
CFLAGS += -align 1
endif
else
@@ -112,6 +124,9 @@ ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
else
PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
# PRELUDE = $(NDK_ROOT)/pre/prelude.o
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
endif
endif
@@ -128,16 +143,7 @@ INCLUDES = -I$(CURL_INC) -I$(CURL_LIB)
ifdef WITH_ARES
INCLUDES += -I$(ARES_LIB)
LDLIBS = $(ARES_LIB)/libcares.$(LIBEXT)
endif
ifdef WITH_ZLIB
INCLUDES += -I$(ZLIB_PATH)
ifdef LINK_STATIC
LDLIBS += $(ZLIB_PATH)/nw/libz.$(LIBEXT)
else
MODULES += libz.nlm
IMPORTS += @$(ZLIB_PATH)/nw/libz.imp
endif
LDLIBS += $(ARES_LIB)/libcares.$(LIBEXT)
endif
ifdef WITH_SSH2
INCLUDES += -I$(LIBSSH2_PATH)/include
@@ -149,23 +155,34 @@ else
endif
endif
ifdef WITH_SSL
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_libc -I$(OPENSSL_PATH)/outinc_nw_libc/openssl
LDLIBS += $(OPENSSL_PATH)/out_nw_libc/ssl.$(LIBEXT)
LDLIBS += $(OPENSSL_PATH)/out_nw_libc/crypto.$(LIBEXT)
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT)
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
IMPORTS += GetProcessSwitchCount RunningProcess
endif
ifdef WITH_ZLIB
INCLUDES += -I$(ZLIB_PATH)
ifdef LINK_STATIC
LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT)
else
MODULES += libz.nlm
IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp
endif
endif
ifeq ($(LIBARCH),LIBC)
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
INCLUDES += -I$(SDK_LIBC)/include
# INCLUDES += -I$(SDK_LIBC)/include/nks
# INCLUDES += -I$(SDK_LIBC)/include/winsock
# INCLUDES += -I$(SDK_LDAP)/libc/inc
CFLAGS += -D_POSIX_SOURCE
# CFLAGS += -D__ANSIC__
else
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
INCLUDES += -I$(SDK_CLIB)/include/nlm
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
# INCLUDES += -I$(SDK_CLIB)/include
# INCLUDES += -I$(SDK_LDAP)/clib/inc
CFLAGS += -DNETDB_USE_INTERNET
# for now disable LDAP unless we have coded a CLIB dynaloader.
DISABLE_LDAP = 1
endif
CFLAGS += $(INCLUDES)
@@ -190,7 +207,7 @@ endif
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES)))
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES))) $(OBJDIR)/nwos.o
OBJL = $(OBJS) $(OBJDIR)/nwlib.o $(LDLIBS)
@@ -281,6 +298,7 @@ endif
ifdef XDCDATA
@echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
endif
@echo $(DL)flag_on 64$(DL) >> $@
ifeq ($(LIBARCH),CLIB)
@echo $(DL)start _Prelude$(DL) >> $@
@echo $(DL)exit _Stop$(DL) >> $@
@@ -293,7 +311,6 @@ ifeq ($(LIBARCH),CLIB)
# @echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
@echo $(DL)module clib$(DL) >> $@
else
@echo $(DL)flag_on 64$(DL) >> $@
@echo $(DL)pseudopreemption$(DL) >> $@
@echo $(DL)start _LibCPrelude$(DL) >> $@
@echo $(DL)exit _LibCPostlude$(DL) >> $@
@@ -332,24 +349,78 @@ config.h: Makefile.netware
@echo $(DL)#ifndef NETWARE$(DL) >> $@
@echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
@echo $(DL)#endif$(DL) >> $@
@echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@
@echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@
@echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
ifeq ($(LIBARCH),CLIB)
@echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@
@echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@
@echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define socklen_t int$(DL) >> $@
@echo $(DL)#define DL_LDAP_FILE "ldapsdk.nlm"$(DL) >> $@
else
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
@echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
@echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@
ifdef ENABLE_IPV6
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
endif
endif
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
@echo $(DL)#define HAVE_LL 1$(DL) >> $@
@echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_RECV 1$(DL) >> $@
@echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
@@ -359,52 +430,28 @@ config.h: Makefile.netware
@echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
ifdef DISABLE_LDAP
@echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@
else
@echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@
endif
ifdef ENABLE_IPV6
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
endif
ifdef NW_WINSOCK
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
@@ -463,6 +510,7 @@ endif
info: $(OBJDIR)/version.inc
@echo Configured to build $(TARGET) with these options:
@echo libarchitecture: $(LIBARCH)
@echo curl version: $(LIBCURL_VERSION_STR)
@echo compiler/linker: $(CC) / $(LD)
ifdef CABUNDLE
@@ -494,7 +542,7 @@ else
@echo ipv6 support: no
endif
$(LIBCARES):
$(ARES_LIB)/libcares.$(LIBEXT):
$(MAKE) -C $(ARES_LIB) -f Makefile.netware lib

View File

@@ -1,4 +1,5 @@
#############################################################
# $Id: Makefile.vc6,v 1.19 2004/11/14 13:48:15 giva Exp $
#
# Makefile for building libcurl with MSVC6
#
@@ -34,11 +35,11 @@ IMPLIB_NAME = libcurl_imp
IMPLIB_NAME_DEBUG = libcurld_imp
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-0.9.7e
OPENSSL_PATH = ../../openssl-0.9.8e
!ENDIF
!IFNDEF ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.1
ZLIB_PATH = ../../zlib-1.2.3
!ENDIF
!IFNDEF MACHINE
@@ -47,8 +48,10 @@ MACHINE = X86
# 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.
# using the "current logged in user". Since at least with MSVC6 the sspi.h
# header is broken it is either required to install the Windows SDK,
# or to fix sspi.h with adding this define at the beginning of sspi.h:
# #define FreeCredentialHandle FreeCredentialsHandle
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.

View File

@@ -282,7 +282,8 @@
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
#if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || defined(__POCC__)
#if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || defined(__POCC__) || \
defined(__MINGW32__)
#elif defined(_WIN64)
#define ssize_t __int64
#else
@@ -346,6 +347,11 @@
#define HAVE_VARIADIC_MACROS_C99 1
#endif
/* Define if the compiler supports LONGLONG. */
#if defined(__MINGW32__) || defined(__WATCOMC__)
#define HAVE_LONGLONG 1
#endif
/* ---------------------------------------------------------------- */
/* LDAP LIBRARY FILES */
/* ---------------------------------------------------------------- */

View File

@@ -59,10 +59,10 @@
#include <stdlib.h> /* required for free() prototype, without it, this crashes */
#endif /* on macos 68K */
#if (defined(HAVE_FIONBIO) && defined(__NOVELL_LIBC__))
#if (defined(HAVE_FIONBIO) && defined(NETWARE))
#include <sys/filio.h>
#endif
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#ifdef NETWARE
#undef in_addr_t
#define in_addr_t unsigned long
#endif
@@ -228,11 +228,12 @@ static CURLcode bindlocal(struct connectdata *conn,
"random" */
/* how many port numbers to try to bind to, increasing one at a time */
int portnum = data->set.localportrange;
const char *dev = data->set.str[STRING_DEVICE];
/*************************************************************
* Select device to bind socket to
*************************************************************/
if (data->set.device && (strlen(data->set.device)<255) ) {
if (dev && (strlen(dev)<255) ) {
struct Curl_dns_entry *h=NULL;
char myhost[256] = "";
in_addr_t in;
@@ -241,10 +242,10 @@ static CURLcode bindlocal(struct connectdata *conn,
int in6 = -1;
/* First check if the given name is an IP address */
in=inet_addr(data->set.device);
in=inet_addr((char *) dev);
if((in == CURL_INADDR_NONE) &&
Curl_if2ip(data->set.device, myhost, sizeof(myhost))) {
Curl_if2ip(dev, myhost, sizeof(myhost))) {
/*
* We now have the numerical IPv4-style x.y.z.w in the 'myhost' buffer
*/
@@ -263,7 +264,7 @@ static CURLcode bindlocal(struct connectdata *conn,
* This was not an interface, resolve the name as a host name
* or IP number
*/
rc = Curl_resolv(conn, data->set.device, 0, &h);
rc = Curl_resolv(conn, dev, 0, &h);
if(rc == CURLRESOLV_PENDING)
(void)Curl_wait_for_resolv(conn, &h);
@@ -275,7 +276,7 @@ static CURLcode bindlocal(struct connectdata *conn,
myhost, sizeof myhost);
else
/* we know data->set.device is shorter than the myhost array */
strcpy(myhost, data->set.device);
strcpy(myhost, dev);
Curl_resolv_unlock(data, h);
}
}
@@ -287,8 +288,8 @@ static CURLcode bindlocal(struct connectdata *conn,
hostent_buf,
sizeof(hostent_buf));
*/
failf(data, "Couldn't bind to '%s'", data->set.device);
return CURLE_HTTP_PORT_FAILED;
failf(data, "Couldn't bind to '%s'", dev);
return CURLE_INTERFACE_FAILED;
}
infof(data, "Bind local address to %s\n", myhost);
@@ -307,11 +308,10 @@ static CURLcode bindlocal(struct connectdata *conn,
* hostname or ip address.
*/
if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
data->set.device, strlen(data->set.device)+1) != 0) {
dev, strlen(dev)+1) != 0) {
/* printf("Failed to BINDTODEVICE, socket: %d device: %s error: %s\n",
sockfd, data->set.device, Curl_strerror(SOCKERRNO)); */
infof(data, "SO_BINDTODEVICE %s failed\n",
data->set.device);
sockfd, dev, Curl_strerror(SOCKERRNO)); */
infof(data, "SO_BINDTODEVICE %s failed\n", dev);
/* This is typically "errno 1, error: Operation not permitted" if
you're not running as root or another suitable privileged user */
}
@@ -325,7 +325,7 @@ static CURLcode bindlocal(struct connectdata *conn,
#endif
if (CURL_INADDR_NONE == in && -1 == in6) {
failf(data,"couldn't find my own IP address (%s)", myhost);
return CURLE_HTTP_PORT_FAILED;
return CURLE_INTERFACE_FAILED;
} /* end of inet_addr */
if ( h ) {
@@ -334,7 +334,7 @@ static CURLcode bindlocal(struct connectdata *conn,
socksize = addr->ai_addrlen;
}
else
return CURLE_HTTP_PORT_FAILED;
return CURLE_INTERFACE_FAILED;
}
else if(port) {
@@ -370,7 +370,7 @@ static CURLcode bindlocal(struct connectdata *conn,
size = sizeof(add);
if(getsockname(sockfd, (struct sockaddr *) &add, &size) < 0) {
failf(data, "getsockname() failed");
return CURLE_HTTP_PORT_FAILED;
return CURLE_INTERFACE_FAILED;
}
/* We re-use/clobber the port variable here below */
if(((struct sockaddr *)&add)->sa_family == AF_INET)
@@ -393,7 +393,7 @@ static CURLcode bindlocal(struct connectdata *conn,
data->state.os_errno = SOCKERRNO;
failf(data, "bind failure: %s",
Curl_strerror(conn, data->state.os_errno));
return CURLE_HTTP_PORT_FAILED;
return CURLE_INTERFACE_FAILED;
}
@@ -577,6 +577,8 @@ CURLcode Curl_is_connected(struct connectdata *conn,
data->state.os_errno = error;
infof(data, "Connection failed\n");
if(trynextip(conn, sockindex, connected)) {
failf(data, "Failed connect to %s:%d; %s",
conn->host.name, conn->port, Curl_strerror(conn, error));
code = CURLE_COULDNT_CONNECT;
}
}
@@ -596,7 +598,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
error = SOCKERRNO;
data->state.os_errno = error;
failf(data, "Failed connect to %s:%d; %s",
conn->host.name, conn->port, Curl_strerror(conn,error));
conn->host.name, conn->port, Curl_strerror(conn, error));
code = CURLE_COULDNT_CONNECT;
}
}

View File

@@ -133,7 +133,7 @@ inflate_stream(struct connectdata *conn,
/* some servers seem to not generate zlib headers, so this is an attempt
to fix and continue anyway */
inflateReset(z);
(void) inflateEnd(z); /* don't care about the return code */
if (inflateInit2(z, -MAX_WBITS) != Z_OK) {
return process_zlib_error(conn, z);
}

View File

@@ -241,6 +241,12 @@ CURLcode curl_global_init(long flags)
}
#endif
#ifdef NETWARE
if(netware_init()) {
DEBUGF(fprintf(stderr, "Warning: LONG namespace not available\n"));
}
#endif
#ifdef USE_LIBIDN
idna_init();
#endif
@@ -573,7 +579,8 @@ CURL *curl_easy_duphandle(CURL *incurl)
outcurl->state.headersize=HEADERSIZE;
/* copy all userdefined values */
outcurl->set = data->set;
if (Curl_dupset(outcurl, data) != CURLE_OK)
break;
if(data->state.used_interface == Curl_if_multi)
outcurl->state.connc = data->state.connc;
@@ -652,6 +659,7 @@ CURL *curl_easy_duphandle(CURL *incurl)
free(outcurl->change.url);
if(outcurl->change.referer)
free(outcurl->change.referer);
Curl_freeset(outcurl);
free(outcurl); /* free the memory again */
outcurl = NULL;
}
@@ -675,6 +683,7 @@ void curl_easy_reset(CURL *curl)
data->reqdata.proto.generic=NULL;
/* zero out UserDefined data: */
Curl_freeset(data);
memset(&data->set, 0, sizeof(struct UserDefined));
/* zero out Progress data: */
@@ -690,10 +699,10 @@ void curl_easy_reset(CURL *curl)
data->set.err = stderr; /* default stderr to stderr */
/* use fwrite as default function to store output */
data->set.fwrite = (curl_write_callback)fwrite;
data->set.fwrite_func = (curl_write_callback)fwrite;
/* use fread as default function to read input */
data->set.fread = (curl_read_callback)fread;
data->set.fread_func = (curl_read_callback)fread;
data->set.infilesize = -1; /* we don't know any size */
data->set.postfieldsize = -1;
@@ -726,11 +735,13 @@ void curl_easy_reset(CURL *curl)
data->set.ssl.verifyhost = 2;
#ifdef CURL_CA_BUNDLE
/* This is our prefered CA cert bundle since install time */
data->set.ssl.CAfile = (char *)CURL_CA_BUNDLE;
(void) curl_easy_setopt(curl, CURLOPT_CAINFO, (char *) CURL_CA_BUNDLE);
#endif
data->set.ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth
type */
data->set.new_file_perms = 0644; /* Default permissions */
data->set.new_directory_perms = 0755; /* Default permissions */
}
#ifdef CURL_DOES_CONVERSIONS

View File

@@ -75,9 +75,27 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
length = alloc-1;
while(length--) {
in = *string;
if(!(in >= 'a' && in <= 'z') &&
!(in >= 'A' && in <= 'Z') &&
!(in >= '0' && in <= '9')) {
/* Portable character check (remember EBCDIC). Do not use isalnum() because
its behavior is altered by the current locale. */
switch (in) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
/* just copy this */
ns[strindex++]=in;
break;
default:
/* encode it */
newlen += 2; /* the size grows with two, since this'll become a %XX */
if(newlen > alloc) {
@@ -105,10 +123,7 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
snprintf(&ns[strindex], 4, "%%%02X", in);
strindex+=3;
}
else {
/* just copy this */
ns[strindex++]=in;
break;
}
string++;
}

View File

@@ -205,7 +205,7 @@ static CURLcode file_upload(struct connectdata *conn)
* Since FILE: doesn't do the full init, we need to provide some extra
* assignments here.
*/
conn->fread = data->set.fread;
conn->fread_func = data->set.fread_func;
conn->fread_in = data->set.in;
conn->data->reqdata.upload_fromhere = buf;
@@ -217,8 +217,22 @@ static CURLcode file_upload(struct connectdata *conn)
if(data->reqdata.resume_from)
fp = fopen( file->path, "ab" );
else
fp = fopen(file->path, "wb");
else {
int fd;
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,
conn->data->set.new_file_perms);
#else /* !(WIN32 || MSDOS || __EMX__) */
fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC,
conn->data->set.new_file_perms);
#endif /* !(WIN32 || MSDOS || __EMX__) */
if (fd < 0) {
failf(data, "Can't open %s for writing", file->path);
return CURLE_WRITE_ERROR;
}
fp = fdopen(fd, "wb");
}
if(!fp) {
failf(data, "Can't open %s for writing", file->path);

View File

@@ -24,7 +24,10 @@
/*
Debug the form generator stand-alone by compiling this source file with:
gcc -DHAVE_CONFIG_H -I../ -g -D_FORM_DEBUG -DCURLDEBUG -o formdata -I../include formdata.c strequal.c memdebug.c mprintf.c strerror.c
gcc -DHAVE_CONFIG_H -I../ -g -D_FORM_DEBUG -DCURLDEBUG -o formdata \
-I../include formdata.c strequal.c memdebug.c mprintf.c strerror.c
(depending on circumstances you may need further externals added)
run the 'formdata' executable the output should end with:
All Tests seem to have worked ...
@@ -49,8 +52,8 @@ vlue for PTRCONTENTS + CONTENTSLENGTH
(or you might see v^@lue at the start)
Content-Disposition: form-data; name="PTRCONTENTS_+_CONTENTSLENGTH_+_CONTENTTYPE"
Content-Type: text/plain
vlue for PTRCOTNENTS + CONTENTSLENGTH + CONTENTTYPE
Content-Type: application/octet-stream
vlue for PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE
(or you might see v^@lue at the start)
Content-Disposition: form-data; name="FILE1_+_CONTENTTYPE"; filename="inet_ntoa_r.h"
@@ -61,23 +64,23 @@ Content-Disposition: form-data; name="FILE1_+_FILE2"
Content-Type: multipart/mixed, boundary=curlz1s0dkticx49MV1KGcYP5cvfSsz
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
Content-Type: text/plain
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="Makefile.b32"
Content-Type: text/plain
Content-Type: application/octet-stream
...
Content-Disposition: form-data; name="FILE1_+_FILE2_+_FILE3"
Content-Type: multipart/mixed, boundary=curlirkYPmPwu6FrJ1vJ1u1BmtIufh1
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
Content-Type: text/plain
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="Makefile.b32"
Content-Type: text/plain
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
Content-Type: text/plain
Content-Type: application/octet-stream
...
@@ -85,13 +88,13 @@ Content-Disposition: form-data; name="ARRAY: FILE1_+_FILE2_+_FILE3"
Content-Type: multipart/mixed, boundary=curlirkYPmPwu6FrJ1vJ1u1BmtIufh1
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
Content-Type: text/plain
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="Makefile.b32"
Content-Type: text/plain
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
Content-Type: text/plain
Content-Type: application/octet-stream
...
Content-Disposition: form-data; name="FILECONTENT"
@@ -278,8 +281,6 @@ static const char * ContentTypeForFilename (const char *filename,
/* default to the previously set/used! */
contenttype = prevtype;
else
/* It seems RFC1867 defines no Content-Type to default to
text/plain so we don't actually need to set this: */
contenttype = HTTPPOST_CONTENTTYPE_DEFAULT;
if(filename) { /* in case a NULL was passed in */
@@ -1495,7 +1496,7 @@ int FormAddTest(const char * errormsg,
}
int main()
int main(int argc, argv_item_t argv[])
{
char name1[] = "simple_COPYCONTENTS";
char name2[] = "COPYCONTENTS_+_CONTENTTYPE";
@@ -1513,7 +1514,7 @@ int main()
char value3[] = "value for PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH";
char value4[] = "value for simple PTRCONTENTS";
char value5[] = "value for PTRCONTENTS + CONTENTSLENGTH";
char value6[] = "value for PTRCOTNENTS + CONTENTSLENGTH + CONTENTTYPE";
char value6[] = "value for PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE";
char value7[] = "inet_ntoa_r.h";
char value8[] = "Makefile.b32";
char type2[] = "image/gif";
@@ -1521,11 +1522,11 @@ int main()
char type7[] = "text/html";
int name3length = strlen(name3);
int value3length = strlen(value3);
int value5length = strlen(value4);
int value6length = strlen(value5);
int value5length = strlen(value5);
int value6length = strlen(value6);
int errors = 0;
CURLcode rc;
size_t size;
curl_off_t size;
size_t nread;
char buffer[4096];
struct curl_httppost *httppost=NULL;
@@ -1535,6 +1536,9 @@ int main()
struct FormData *form;
struct Form formread;
(void) argc;
(void) argv;
if (FormAddTest("simple COPYCONTENTS test", &httppost, &last_post,
CURLFORM_COPYNAME, name1, CURLFORM_COPYCONTENTS, value1,
CURLFORM_END))
@@ -1621,7 +1625,9 @@ int main()
fwrite(buffer, nread, 1, stdout);
} while(1);
fprintf(stdout, "size: %d\n", size);
fprintf(stdout, "size: ");
fprintf(stdout, CURL_FORMAT_OFF_T, size);
fprintf(stdout, "\n");
if (errors)
fprintf(stdout, "\n==> %d Test(s) failed!\n", errors);
else

163
lib/ftp.c
View File

@@ -75,7 +75,7 @@
#include "socks.h"
#include "ftp.h"
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
#include "krb4.h"
#endif
@@ -319,8 +319,17 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
ftpc->cache_size = 0; /* zero the size just in case */
}
else {
int res = Curl_read(conn, sockfd, ptr, BUFSIZE-ftpc->nread_resp,
&gotbytes);
int res;
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
enum protection_level prot = conn->data_prot;
conn->data_prot = 0;
#endif
res = Curl_read(conn, sockfd, ptr, BUFSIZE-ftpc->nread_resp,
&gotbytes);
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = prot;
#endif
if(res < 0)
/* EWOULDBLOCK */
return CURLE_OK; /* return */
@@ -360,6 +369,9 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
the line isn't really terminated until the LF comes */
/* output debug output if that is requested */
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
if(!conn->sec_complete)
#endif
if(data->set.verbose)
Curl_debug(data, CURLINFO_HEADER_IN,
ftpc->linestart_resp, (size_t)perline, conn);
@@ -414,18 +426,18 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
if(!result)
code = atoi(buf);
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
/* handle the security-oriented responses 6xx ***/
/* FIXME: some errorchecking perhaps... ***/
switch(code) {
case 631:
Curl_sec_read_msg(conn, buf, prot_safe);
code = Curl_sec_read_msg(conn, buf, prot_safe);
break;
case 632:
Curl_sec_read_msg(conn, buf, prot_private);
code = Curl_sec_read_msg(conn, buf, prot_private);
break;
case 633:
Curl_sec_read_msg(conn, buf, prot_confidential);
code = Curl_sec_read_msg(conn, buf, prot_confidential);
break;
default:
/* normal ftp stuff we pass through! */
@@ -553,7 +565,17 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
ftpc->cache_size = 0; /* zero the size just in case */
}
else {
int res = Curl_read(conn, sockfd, ptr, BUFSIZE-*nreadp, &gotbytes);
int res;
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
enum protection_level prot = conn->data_prot;
conn->data_prot = 0;
#endif
res = Curl_read(conn, sockfd, ptr, BUFSIZE-*nreadp,
&gotbytes);
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = prot;
#endif
if(res < 0)
/* EWOULDBLOCK */
continue; /* go looping again */
@@ -593,6 +615,9 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
the line isn't really terminated until the LF comes */
/* output debug output if that is requested */
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
if(!conn->sec_complete)
#endif
if(data->set.verbose)
Curl_debug(data, CURLINFO_HEADER_IN,
line_start, (size_t)perline, conn);
@@ -646,18 +671,18 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
if(!result)
code = atoi(buf);
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
/* handle the security-oriented responses 6xx ***/
/* FIXME: some errorchecking perhaps... ***/
switch(code) {
case 631:
Curl_sec_read_msg(conn, buf, prot_safe);
code = Curl_sec_read_msg(conn, buf, prot_safe);
break;
case 632:
Curl_sec_read_msg(conn, buf, prot_private);
code = Curl_sec_read_msg(conn, buf, prot_private);
break;
case 633:
Curl_sec_read_msg(conn, buf, prot_confidential);
code = Curl_sec_read_msg(conn, buf, prot_confidential);
break;
default:
/* normal ftp stuff we pass through! */
@@ -680,7 +705,7 @@ static void state(struct connectdata *conn,
{
#if defined(CURLDEBUG) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
/* for debug purposes */
const char *names[]={
static const char * const names[]={
"STOP",
"WAIT220",
"AUTH",
@@ -837,7 +862,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
char hbuf[NI_MAXHOST];
struct sockaddr *sa=(struct sockaddr *)&ss;
char tmp[1024];
const char *mode[] = { "EPRT", "PORT", NULL };
static const char * const mode[] = { "EPRT", "PORT", NULL };
int rc;
int error;
char *host=NULL;
@@ -846,11 +871,12 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
/* Step 1, figure out what address that is requested */
if(data->set.ftpport && (strlen(data->set.ftpport) > 1)) {
if(data->set.str[STRING_FTPPORT] &&
(strlen(data->set.str[STRING_FTPPORT]) > 1)) {
/* attempt to get the address of the given interface name */
if(!Curl_if2ip(data->set.ftpport, hbuf, sizeof(hbuf)))
if(!Curl_if2ip(data->set.str[STRING_FTPPORT], hbuf, sizeof(hbuf)))
/* not an interface, use the given string as host name instead */
host = data->set.ftpport;
host = data->set.str[STRING_FTPPORT];
else
host = hbuf; /* use the hbuf for host name */
} /* data->set.ftpport */
@@ -1055,27 +1081,28 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
unsigned short ip[4];
bool freeaddr = TRUE;
socklen_t sslen = sizeof(sa);
const char *ftpport = data->set.str[STRING_FTPPORT];
(void)fcmd; /* not used in the IPv4 code */
if(data->set.ftpport) {
if(ftpport) {
in_addr_t in;
/* First check if the given name is an IP address */
in=inet_addr(data->set.ftpport);
in=inet_addr(ftpport);
if(in != CURL_INADDR_NONE)
/* this is an IPv4 address */
addr = Curl_ip2addr(in, data->set.ftpport, 0);
addr = Curl_ip2addr(in, ftpport, 0);
else {
if(Curl_if2ip(data->set.ftpport, myhost, sizeof(myhost))) {
if(Curl_if2ip(ftpport, myhost, sizeof(myhost))) {
/* The interface to IP conversion provided a dotted address */
in=inet_addr(myhost);
addr = Curl_ip2addr(in, myhost, 0);
}
else if(strlen(data->set.ftpport)> 1) {
else if(strlen(ftpport)> 1) {
/* might be a host name! */
struct Curl_dns_entry *h=NULL;
int rc = Curl_resolv(conn, data->set.ftpport, 0, &h);
int rc = Curl_resolv(conn, ftpport, 0, &h);
if(rc == CURLRESOLV_PENDING)
/* BLOCKING */
rc = Curl_wait_for_resolv(conn, &h);
@@ -1089,11 +1116,11 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
since it points to a DNS cache entry! */
} /* (h) */
else {
infof(data, "Failed to resolve host name %s\n", data->set.ftpport);
infof(data, "Failed to resolve host name %s\n", ftpport);
}
} /* strlen */
} /* CURL_INADDR_NONE */
} /* data->set.ftpport */
} /* ftpport */
if(!addr) {
/* pick a suitable default here */
@@ -1221,7 +1248,7 @@ static CURLcode ftp_state_use_pasv(struct connectdata *conn)
*/
const char *mode[] = { "EPSV", "PASV", NULL };
static const char * const mode[] = { "EPSV", "PASV", NULL };
int modeoff;
#ifdef PF_INET6
@@ -1321,7 +1348,8 @@ static CURLcode ftp_state_post_listtype(struct connectdata *conn)
servers either... */
NBFTPSENDF(conn, "%s",
data->set.customrequest?data->set.customrequest:
data->set.str[STRING_CUSTOMREQUEST]?
data->set.str[STRING_CUSTOMREQUEST]:
(data->set.ftp_list_only?"NLST":"LIST"));
state(conn, FTP_LIST);
@@ -1452,7 +1480,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
readthisamountnow = BUFSIZE;
actuallyread = (curl_off_t)
conn->fread(data->state.buffer, 1, (size_t)readthisamountnow,
conn->fread_func(data->state.buffer, 1, (size_t)readthisamountnow,
conn->fread_in);
passed += actuallyread;
@@ -1610,7 +1638,9 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
if(ptr) {
newport = (unsigned short)(num & 0xffff);
if (conn->bits.tunnel_proxy)
if (conn->bits.tunnel_proxy ||
data->set.proxytype == CURLPROXY_SOCKS5 ||
data->set.proxytype == CURLPROXY_SOCKS4)
/* proxy tunnel -> use other host info because ip_addr_str is the
proxy address not the ftp host */
snprintf(newhost, sizeof(newhost), "%s", conn->host.name);
@@ -1662,7 +1692,9 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
infof(data, "Skips %d.%d.%d.%d for data connection, uses %s instead\n",
ip[0], ip[1], ip[2], ip[3],
conn->ip_addr_str);
if (conn->bits.tunnel_proxy)
if (conn->bits.tunnel_proxy ||
data->set.proxytype == CURLPROXY_SOCKS5 ||
data->set.proxytype == CURLPROXY_SOCKS4)
/* proxy tunnel -> use other host info because ip_addr_str is the
proxy address not the ftp host */
snprintf(newhost, sizeof(newhost), "%s", conn->host.name);
@@ -1691,7 +1723,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
return CURLE_FTP_WEIRD_PASV_REPLY;
}
if(data->set.proxy && *data->set.proxy) {
if(data->set.str[STRING_PROXY] && *data->set.str[STRING_PROXY]) {
/*
* This is a tunnel through a http proxy and we need to connect to the
* proxy again here.
@@ -2128,7 +2160,7 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
if(ftpcode>=400) {
failf(data, "Failed FTP upload: %0d", ftpcode);
/* oops, we never close the sockets! */
return CURLE_FTP_COULDNT_STOR_FILE;
return CURLE_UPLOAD_FAILED;
}
if(data->set.ftp_use_port) {
@@ -2295,14 +2327,7 @@ static CURLcode ftp_state_loggedin(struct connectdata *conn)
CURLcode result = CURLE_OK;
#ifdef HAVE_KRB4
if(conn->data->set.krb4) {
/* We are logged in, asked to use Kerberos. Set the requested
* protection level
*/
if(conn->sec_complete)
/* BLOCKING */
Curl_sec_set_protection_level(conn);
if(conn->data->set.krb) {
/* We may need to issue a KAUTH here to have access to the files
* do it if user supplied a password
*/
@@ -2349,6 +2374,7 @@ static CURLcode ftp_state_user_resp(struct connectdata *conn,
struct ftp_conn *ftpc = &conn->proto.ftpc;
(void)instate; /* no use for this yet */
/* some need password anyway, and others just return 2xx ignored */
if((ftpcode == 331) && (ftpc->state == FTP_USER)) {
/* 331 Password required for ...
(the server requires to send the user's password too) */
@@ -2361,8 +2387,8 @@ static CURLcode ftp_state_user_resp(struct connectdata *conn,
result = ftp_state_loggedin(conn);
}
else if(ftpcode == 332) {
if(data->set.ftp_account) {
NBFTPSENDF(conn, "ACCT %s", data->set.ftp_account);
if(data->set.str[STRING_FTP_ACCOUNT]) {
NBFTPSENDF(conn, "ACCT %s", data->set.str[STRING_FTP_ACCOUNT]);
state(conn, FTP_ACCT);
}
else {
@@ -2376,10 +2402,11 @@ static CURLcode ftp_state_user_resp(struct connectdata *conn,
530 User ... access denied
(the server denies to log the specified user) */
if (conn->data->set.ftp_alternative_to_user &&
if (conn->data->set.str[STRING_FTP_ALTERNATIVE_TO_USER] &&
!conn->data->state.ftp_trying_alternative) {
/* Ok, USER failed. Let's try the supplied command. */
NBFTPSENDF(conn, "%s", conn->data->set.ftp_alternative_to_user);
NBFTPSENDF(conn, "%s",
conn->data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]);
conn->data->state.ftp_trying_alternative = TRUE;
state(conn, FTP_USER);
result = CURLE_OK;
@@ -2457,15 +2484,15 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
}
/* We have received a 220 response fine, now we proceed. */
#ifdef HAVE_KRB4
if(data->set.krb4) {
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
if(data->set.krb) {
/* If not anonymous login, try a secure login. Note that this
procedure is still BLOCKING. */
Curl_sec_request_prot(conn, "private");
/* We set private first as default, in case the line below fails to
set a valid level */
Curl_sec_request_prot(conn, data->set.krb4_level);
Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]);
if(Curl_sec_login(conn) != 0)
infof(data, "Logging in with password in cleartext!\n");
@@ -3032,7 +3059,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature
case CURLE_FTP_PORT_FAILED:
case CURLE_FTP_COULDNT_SET_BINARY:
case CURLE_FTP_COULDNT_RETR_FILE:
case CURLE_FTP_COULDNT_STOR_FILE:
case CURLE_UPLOAD_FAILED:
case CURLE_FTP_ACCESS_DENIED:
case CURLE_FILESIZE_EXCEEDED:
/* the connection stays alive fine even though this happened */
@@ -3082,7 +3109,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature
/* free the dir tree and file parts */
freedirs(conn);
#ifdef HAVE_KRB4
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
Curl_sec_fflush_fd(conn, conn->sock[SECONDARYSOCKET]);
#endif
@@ -3092,6 +3119,14 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature
shutdown(conn->sock[SECONDARYSOCKET],2); /* SD_BOTH */
#endif
if(conn->ssl[SECONDARYSOCKET].use) {
/* The secondary socket is using SSL so we must close down that part first
before we close the socket for real */
Curl_ssl_close(conn, SECONDARYSOCKET);
/* Note that we keep "use" set to TRUE since that (next) connection is
still requested to use SSL */
}
sclose(conn->sock[SECONDARYSOCKET]);
conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD;
@@ -3114,7 +3149,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature
if(!nread && (CURLE_OPERATION_TIMEDOUT == result)) {
failf(data, "control connection looks dead");
ftpc->ctl_valid = FALSE; /* mark control connection as bad */
return result;
conn->bits.close = TRUE; /* mark for closure */
}
if(result)
@@ -3492,16 +3527,21 @@ CURLcode Curl_nbftpsendf(struct connectdata *conn,
const char *fmt, ...)
{
ssize_t bytes_written;
char s[256];
/* may still not be big enough for some krb5 tokens */
#define SBUF_SIZE 1024
char s[SBUF_SIZE];
size_t write_len;
char *sptr=s;
CURLcode res = CURLE_OK;
struct SessionHandle *data = conn->data;
struct ftp_conn *ftpc = &conn->proto.ftpc;
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
enum protection_level data_sec = conn->data_prot;
#endif
va_list ap;
va_start(ap, fmt);
vsnprintf(s, 250, fmt, ap);
vsnprintf(s, SBUF_SIZE-3, fmt, ap);
va_end(ap);
strcat(s, "\r\n"); /* append a trailing CRLF */
@@ -3519,8 +3559,14 @@ CURLcode Curl_nbftpsendf(struct connectdata *conn,
}
#endif /* CURL_DOES_CONVERSIONS */
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = prot_cmd;
#endif
res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len,
&bytes_written);
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = data_sec;
#endif
if(CURLE_OK != res)
return res;
@@ -3553,14 +3599,17 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
const char *fmt, ...)
{
ssize_t bytes_written;
char s[256];
char s[SBUF_SIZE];
size_t write_len;
char *sptr=s;
CURLcode res = CURLE_OK;
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
enum protection_level data_sec = conn->data_prot;
#endif
va_list ap;
va_start(ap, fmt);
vsnprintf(s, 250, fmt, ap);
vsnprintf(s, SBUF_SIZE-3, fmt, ap);
va_end(ap);
strcat(s, "\r\n"); /* append a trailing CRLF */
@@ -3577,8 +3626,14 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
#endif /* CURL_DOES_CONVERSIONS */
while(1) {
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = prot_cmd;
#endif
res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len,
&bytes_written);
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = data_sec;
#endif
if(CURLE_OK != res)
break;

View File

@@ -176,7 +176,7 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
*param_charp = data->info.contenttype;
break;
case CURLINFO_PRIVATE:
*param_charp = data->set.private_data;
*param_charp = (char *) data->set.private_data;
break;
case CURLINFO_HTTPAUTH_AVAIL:
*param_longp = data->info.httpauthavail;

View File

@@ -227,7 +227,7 @@ Curl_gtls_connect(struct connectdata *conn,
int sockindex)
{
const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 };
static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 };
struct SessionHandle *data = conn->data;
gnutls_session session;
int rc;
@@ -299,11 +299,13 @@ Curl_gtls_connect(struct connectdata *conn,
if(rc < 0)
return CURLE_SSL_CONNECT_ERROR;
if(data->set.cert) {
if(data->set.str[STRING_CERT]) {
if( gnutls_certificate_set_x509_key_file(
conn->ssl[sockindex].cred, data->set.cert,
data->set.key != 0 ? data->set.key : data->set.cert,
do_file_type(data->set.cert_type) ) ) {
conn->ssl[sockindex].cred,
data->set.str[STRING_CERT],
data->set.str[STRING_KEY] ?
data->set.str[STRING_KEY] : data->set.str[STRING_CERT],
do_file_type(data->set.str[STRING_CERT_TYPE]) ) ) {
failf(data, "error reading X.509 key or certificate file");
return CURLE_SSL_CONNECT_ERROR;
}
@@ -420,6 +422,43 @@ Curl_gtls_connect(struct connectdata *conn,
else
infof(data, "\t common name: %s (matched)\n", certbuf);
/* Check for time-based validity */
clock = gnutls_x509_crt_get_expiration_time(x509_cert);
if(clock == (time_t)-1) {
failf(data, "server cert expiration date verify failed");
return CURLE_SSL_CONNECT_ERROR;
}
if(clock < time(NULL)) {
if (data->set.ssl.verifypeer) {
failf(data, "server certificate expiration date has passed.");
return CURLE_SSL_PEER_CERTIFICATE;
}
else
infof(data, "\t server certificate expiration date FAILED\n");
}
else
infof(data, "\t server certificate expiration date OK\n");
clock = gnutls_x509_crt_get_activation_time(x509_cert);
if(clock == (time_t)-1) {
failf(data, "server cert activation date verify failed");
return CURLE_SSL_CONNECT_ERROR;
}
if(clock > time(NULL)) {
if (data->set.ssl.verifypeer) {
failf(data, "server certificate not activated yet.");
return CURLE_SSL_PEER_CERTIFICATE;
}
else
infof(data, "\t server certificate activation date FAILED\n");
}
else
infof(data, "\t server certificate activation date OK\n");
/* Show:
- ciphers used
@@ -519,17 +558,17 @@ static void close_one(struct connectdata *conn,
if(conn->ssl[index].session) {
gnutls_bye(conn->ssl[index].session, GNUTLS_SHUT_RDWR);
gnutls_deinit(conn->ssl[index].session);
conn->ssl[index].session = NULL;
}
if(conn->ssl[index].cred)
if(conn->ssl[index].cred) {
gnutls_certificate_free_credentials(conn->ssl[index].cred);
conn->ssl[index].cred = NULL;
}
}
void Curl_gtls_close(struct connectdata *conn)
void Curl_gtls_close(struct connectdata *conn, int sockindex)
{
if(conn->ssl[0].use)
close_one(conn, 0);
if(conn->ssl[1].use)
close_one(conn, 1);
close_one(conn, sockindex);
}
/*
@@ -594,8 +633,8 @@ int Curl_gtls_shutdown(struct connectdata *conn, int sockindex)
}
gnutls_certificate_free_credentials(conn->ssl[sockindex].cred);
conn->ssl[sockindex].cred = NULL;
conn->ssl[sockindex].session = NULL;
conn->ssl[sockindex].use = FALSE;
return retval;
}

View File

@@ -29,7 +29,9 @@ CURLcode Curl_gtls_connect(struct connectdata *conn, int sockindex);
/* tell GnuTLS to close down all open information regarding connections (and
thus session ID caching etc) */
void Curl_gtls_close_all(struct SessionHandle *data);
void Curl_gtls_close(struct connectdata *conn); /* close a SSL connection */
/* close a SSL connection */
void Curl_gtls_close(struct connectdata *conn, int index);
/* return number of sent (non-SSL) bytes */
ssize_t Curl_gtls_send(struct connectdata *conn, int sockindex,

View File

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

View File

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

View File

@@ -131,7 +131,8 @@ static void freednsentry(void *freethis);
void Curl_global_host_cache_init(void)
{
if (!host_cache_initialized) {
Curl_hash_init(&hostname_cache, 7, freednsentry);
Curl_hash_init(&hostname_cache, 7, Curl_hash_str, Curl_str_key_compare,
freednsentry);
host_cache_initialized = 1;
}
}
@@ -537,7 +538,7 @@ static void freednsentry(void *freethis)
*/
struct curl_hash *Curl_mk_dnscache(void)
{
return Curl_hash_alloc(7, freednsentry);
return Curl_hash_alloc(7, Curl_hash_str, Curl_str_key_compare, freednsentry);
}
#ifdef CURLRES_ADDRINFO_COPY
@@ -574,6 +575,8 @@ void Curl_freeaddrinfo(Curl_addrinfo *ai)
/* walk over the list and free all entries */
while(ai) {
next = ai->ai_next;
if(ai->ai_canonname)
free(ai->ai_canonname);
free(ai);
ai = next;
}

View File

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

View File

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

View File

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

View File

@@ -790,7 +790,7 @@ static size_t readmoredata(char *buffer,
/* move backup data into focus and continue on that */
http->postdata = http->backup.postdata;
http->postsize = http->backup.postsize;
conn->fread = http->backup.fread;
conn->fread_func = http->backup.fread_func;
conn->fread_in = http->backup.fread_in;
http->sending++; /* move one step up */
@@ -853,10 +853,10 @@ send_buffer *add_buffer_init(void)
static
CURLcode add_buffer_send(send_buffer *in,
struct connectdata *conn,
long *bytes_written, /* add the number of sent
bytes to this counter */
long *bytes_written, /* add the number of sent bytes
to this counter */
size_t included_body_bytes, /* how much of the buffer
contains body data (for log tracing) */
contains body data */
int socketindex)
{
@@ -926,6 +926,10 @@ CURLcode add_buffer_send(send_buffer *in,
ptr+amount-included_body_bytes,
(size_t)included_body_bytes, conn);
}
if (included_body_bytes)
/* since we sent a piece of the body here, up the byte counter for it
accordingly */
http->writebytecount = included_body_bytes;
*bytes_written += amount;
@@ -940,13 +944,13 @@ CURLcode add_buffer_send(send_buffer *in,
ptr = in->buffer + amount;
/* backup the currently set pointers */
http->backup.fread = conn->fread;
http->backup.fread_func = conn->fread_func;
http->backup.fread_in = conn->fread_in;
http->backup.postdata = http->postdata;
http->backup.postsize = http->postsize;
/* set the new pointers for the request-sending */
conn->fread = (curl_read_callback)readmoredata;
conn->fread_func = (curl_read_callback)readmoredata;
conn->fread_in = (void *)conn;
http->postdata = ptr;
http->postsize = (curl_off_t)size;
@@ -1183,7 +1187,8 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(!checkheaders(data, "Proxy-Connection:"))
proxyconn = "Proxy-Connection: Keep-Alive\r\n";
if(!checkheaders(data, "User-Agent:") && data->set.useragent)
if(!checkheaders(data, "User-Agent:") &&
data->set.str[STRING_USERAGENT])
useragent = conn->allocptr.uagent;
/* Send the connect request to the proxy */
@@ -1398,6 +1403,9 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
else if(Curl_compareheader(line_start,
"Connection:", "close"))
closeConnection = TRUE;
else if(Curl_compareheader(line_start,
"Proxy-Connection:", "close"))
closeConnection = TRUE;
else if(2 == sscanf(line_start, "HTTP/1.%d %d",
&subversion,
&k->httpcode)) {
@@ -1585,6 +1593,18 @@ int Curl_https_getsock(struct connectdata *conn,
(void)numsocks;
return GETSOCK_BLANK;
}
#else
#ifdef USE_QSOSSL
int Curl_https_getsock(struct connectdata *conn,
curl_socket_t *socks,
int numsocks)
{
(void)conn;
(void)socks;
(void)numsocks;
return GETSOCK_BLANK;
}
#endif
#endif
#endif
#endif
@@ -1603,7 +1623,7 @@ CURLcode Curl_http_done(struct connectdata *conn,
(void)premature; /* not used */
/* set the proper values (possibly modified on POST) */
conn->fread = data->set.fread; /* restore */
conn->fread_func = data->set.fread_func; /* restore */
conn->fread_in = data->set.in; /* restore */
if (http == NULL)
@@ -1751,8 +1771,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
/* Now set the 'request' pointer to the proper request string */
if(data->set.customrequest)
request = data->set.customrequest;
if(data->set.str[STRING_CUSTOMREQUEST])
request = data->set.str[STRING_CUSTOMREQUEST];
else {
if(conn->bits.no_body)
request = (char *)"HEAD";
@@ -1807,14 +1827,14 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
else
conn->allocptr.ref = NULL;
if(data->set.cookie && !checkheaders(data, "Cookie:"))
addcookies = data->set.cookie;
if(data->set.str[STRING_COOKIE] && !checkheaders(data, "Cookie:"))
addcookies = data->set.str[STRING_COOKIE];
if(!checkheaders(data, "Accept-Encoding:") &&
data->set.encoding) {
data->set.str[STRING_ENCODING]) {
Curl_safefree(conn->allocptr.accept_encoding);
conn->allocptr.accept_encoding =
aprintf("Accept-Encoding: %s\r\n", data->set.encoding);
aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]);
if(!conn->allocptr.accept_encoding)
return CURLE_OUT_OF_MEMORY;
}
@@ -1988,7 +2008,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
readthisamountnow = BUFSIZE;
actuallyread =
data->set.fread(data->state.buffer, 1, (size_t)readthisamountnow,
data->set.fread_func(data->state.buffer, 1, (size_t)readthisamountnow,
data->set.in);
passed += actuallyread;
@@ -2023,7 +2043,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
/* if a line like this was already allocated, free the previous one */
if(conn->allocptr.rangeline)
free(conn->allocptr.rangeline);
conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n", data->reqdata.range);
conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n",
data->reqdata.range);
}
else if((httpreq != HTTPREQ_GET) &&
!checkheaders(data, "Content-Range:")) {
@@ -2087,19 +2108,23 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
conn->allocptr.userpwd?conn->allocptr.userpwd:"",
(data->reqdata.use_range && conn->allocptr.rangeline)?
conn->allocptr.rangeline:"",
(data->set.useragent && *data->set.useragent && conn->allocptr.uagent)?
(data->set.str[STRING_USERAGENT] &&
*data->set.str[STRING_USERAGENT] && conn->allocptr.uagent)?
conn->allocptr.uagent:"",
(conn->allocptr.host?conn->allocptr.host:""), /* Host: host */
http->p_pragma?http->p_pragma:"",
http->p_accept?http->p_accept:"",
(data->set.encoding && *data->set.encoding && conn->allocptr.accept_encoding)?
conn->allocptr.accept_encoding:"",
(data->change.referer && conn->allocptr.ref)?conn->allocptr.ref:"" /* Referer: <data> */,
(conn->bits.httpproxy &&
!conn->bits.tunnel_proxy &&
!checkheaders(data, "Proxy-Connection:"))?
(data->set.str[STRING_ENCODING] &&
*data->set.str[STRING_ENCODING] &&
conn->allocptr.accept_encoding)?
conn->allocptr.accept_encoding:"",
(data->change.referer && conn->allocptr.ref)?
conn->allocptr.ref:"" /* Referer: <data> */,
(conn->bits.httpproxy &&
!conn->bits.tunnel_proxy &&
!checkheaders(data, "Proxy-Connection:"))?
"Proxy-Connection: Keep-Alive\r\n":"",
te
te
);
if(result)
@@ -2243,7 +2268,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
/* set the read function to read from the generated form data */
conn->fread = (curl_read_callback)Curl_FormReader;
conn->fread_func = (curl_read_callback)Curl_FormReader;
conn->fread_in = &http->form;
http->sending = HTTPSEND_BODY;
@@ -2364,7 +2389,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
/* figure out the size of the postfields */
postsize = (data->set.postfieldsize != -1)?
data->set.postfieldsize:
(data->set.postfields?(curl_off_t)strlen(data->set.postfields):0);
(data->set.str[STRING_POSTFIELDS]?
(curl_off_t)strlen(data->set.str[STRING_POSTFIELDS]):0);
if(!conn->bits.upload_chunky) {
/* We only set Content-Length and allow a custom Content-Length if
@@ -2389,7 +2415,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
return result;
}
if(data->set.postfields) {
if(data->set.str[STRING_POSTFIELDS]) {
/* for really small posts we don't use Expect: headers at all, and for
the somewhat bigger ones we allow the app to disable it */
@@ -2403,7 +2429,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(!data->state.expect100header &&
(postsize < MAX_INITIAL_POST_SIZE)) {
/* if we don't use expect:-100 AND
/* if we don't use expect: 100 AND
postsize is less than MAX_INITIAL_POST_SIZE
then append the post data to the HTTP request header. This limit
@@ -2417,7 +2443,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(!conn->bits.upload_chunky) {
/* We're not sending it 'chunked', append it to the request
already now to reduce the number if send() calls */
result = add_buffer(req_buffer, data->set.postfields,
result = add_buffer(req_buffer, data->set.str[STRING_POSTFIELDS],
(size_t)postsize);
included_body = postsize;
}
@@ -2425,7 +2451,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
/* Append the POST data chunky-style */
result = add_bufferf(req_buffer, "%x\r\n", (int)postsize);
if(CURLE_OK == result)
result = add_buffer(req_buffer, data->set.postfields,
result = add_buffer(req_buffer, data->set.str[STRING_POSTFIELDS],
(size_t)postsize);
if(CURLE_OK == result)
result = add_buffer(req_buffer,
@@ -2439,11 +2465,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
else {
/* A huge POST coming up, do data separate from the request */
http->postsize = postsize;
http->postdata = data->set.postfields;
http->postdata = data->set.str[STRING_POSTFIELDS];
http->sending = HTTPSEND_BODY;
conn->fread = (curl_read_callback)readmoredata;
conn->fread_func = (curl_read_callback)readmoredata;
conn->fread_in = (void *)conn;
/* set the upload size to the progress meter */
@@ -2477,9 +2503,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
else
result =
Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
&http->readbytecount,
http->postdata?FIRSTSOCKET:-1,
http->postdata?&http->writebytecount:NULL);
&http->readbytecount,
http->postdata?FIRSTSOCKET:-1,
http->postdata?&http->writebytecount:NULL);
break;
default:

View File

@@ -118,10 +118,9 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
/* the original data is written to the client, but we go on with the
chunk read process, to properly calculate the content length*/
if ( data->set.http_te_skip )
if (data->set.http_te_skip && !k->ignorebody)
Curl_client_write(conn, CLIENTWRITE_BODY, datap,datalen);
while(length) {
switch(ch->state) {
case CHUNK_HEX:

View File

@@ -266,6 +266,11 @@ CURLcode Curl_output_digest(struct connectdata *conn,
authp = &data->state.authhost;
}
if (*allocuserpwd) {
Curl_safefree(*allocuserpwd);
*allocuserpwd = NULL;
}
/* not set means empty */
if(!userp)
userp=(char *)"";
@@ -388,8 +393,6 @@ CURLcode Curl_output_digest(struct connectdata *conn,
nonce="1053604145", uri="/64", response="c55f7f30d83d774a3d2dcacf725abaca"
*/
Curl_safefree(*allocuserpwd);
if (d->qop) {
*allocuserpwd =
aprintf( "%sAuthorization: Digest "

View File

@@ -48,6 +48,10 @@
#include <unistd.h>
#endif
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
#include <netdb.h>
#endif
#include "urldata.h"
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "sendf.h"

View File

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

311
lib/krb5.c Normal file
View File

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

View File

@@ -47,7 +47,10 @@
struct memdebug {
size_t size;
double mem[1];
union {
double d;
void * p;
} mem[1];
/* I'm hoping this is the thing with the strictest alignment
* requirements. That also means we waste some space :-( */
};
@@ -280,6 +283,16 @@ FILE *curl_fopen(const char *file, const char *mode,
return res;
}
FILE *curl_fdopen(int filedes, const char *mode,
int line, const char *source)
{
FILE *res=(fdopen)(filedes, mode);
if(logfile)
fprintf(logfile, "FILE %s:%d fdopen(\"%d\",\"%s\") = %p\n",
source, line, filedes, mode, res);
return res;
}
int curl_fclose(FILE *file, int line, const char *source)
{
int res;

View File

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

View File

@@ -296,10 +296,10 @@ int dprintf_Pass1Report(va_stack_t *vto, int max)
*
******************************************************************/
static long dprintf_Pass1(char *format, va_stack_t *vto, char **endpos,
static long dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos,
va_list arglist)
{
char *fmt = format;
char *fmt = (char *)format;
int param_num = 0;
long this_param;
long width;
@@ -614,7 +614,7 @@ static int dprintf_formatf(
va_stack_t *p;
/* Do the actual %-code parsing */
dprintf_Pass1((char *)format, vto, endpos, ap_save);
dprintf_Pass1(format, vto, endpos, ap_save);
end = &endpos[0]; /* the initial end-position from the list dprintf_Pass1()
created for us */

View File

@@ -50,6 +50,15 @@
/* The last #include file should be: */
#include "memdebug.h"
/*
CURL_SOCKET_HASH_TABLE_SIZE should be a prime number. Increasing it from 97
to 911 takes on a 32-bit machine 4 x 804 = 3211 more bytes. Still, every
CURL handle takes 45-50 K memory, therefore this 3K are not significant.
*/
#ifndef CURL_SOCKET_HASH_TABLE_SIZE
#define CURL_SOCKET_HASH_TABLE_SIZE 911
#endif
struct Curl_message {
/* the 'CURLMsg' is the part that is visible to the external user */
struct CURLMsg extmsg;
@@ -305,6 +314,21 @@ static void sh_freeentry(void *freethis)
free(p);
}
static size_t fd_key_compare(void*k1, size_t k1_len, void*k2, size_t k2_len)
{
(void) k1_len; (void) k2_len;
return ((*((int* ) k1)) == (*((int* ) k2))) ? 1 : 0;
}
static size_t hash_fd(void* key, size_t key_length, size_t slots_num)
{
int fd = * ((int* ) key);
(void) key_length;
return (fd % (int)slots_num);
}
/*
* sh_init() creates a new socket hash and returns the handle for it.
*
@@ -325,7 +349,8 @@ static void sh_freeentry(void *freethis)
*/
static struct curl_hash *sh_init(void)
{
return Curl_hash_alloc(97, sh_freeentry);
return Curl_hash_alloc(CURL_SOCKET_HASH_TABLE_SIZE, hash_fd, fd_key_compare,
sh_freeentry);
}
CURLM *curl_multi_init(void)

View File

@@ -96,7 +96,7 @@ typedef struct {
enum sslversion { SSL2 = 1, SSL3 = 2, TLS = 4 };
cipher_s cipherlist[ciphernum] = {
static const cipher_s cipherlist[ciphernum] = {
/* SSL2 cipher suites */
{"rc4", SSL_EN_RC4_128_WITH_MD5, SSL2},
{"rc4export", SSL_EN_RC4_128_EXPORT40_WITH_MD5, SSL2},
@@ -225,8 +225,8 @@ static char * nss_get_password(PK11SlotInfo * slot, PRBool retry, void *arg)
pphrase_arg_t *parg = (pphrase_arg_t *) arg;
(void)slot; /* unused */
(void)retry; /* unused */
if(parg->data->set.key_passwd)
return (char *)PORT_Strdup((char *)parg->data->set.key_passwd);
if(parg->data->set.str[STRING_KEY_PASSWD])
return (char *)PORT_Strdup((char *)parg->data->set.str[STRING_KEY_PASSWD]);
else
return NULL;
}
@@ -384,18 +384,13 @@ Curl_nss_check_cxn(struct connectdata *conn)
/*
* This function is called when an SSL connection is closed.
*/
void Curl_nss_close(struct connectdata *conn)
void Curl_nss_close(struct connectdata *conn, int sockindex)
{
int i;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
for(i=0; i<2; i++) {
struct ssl_connect_data *connssl = &conn->ssl[i];
if(connssl->handle) {
PR_Close(connssl->handle);
connssl->handle = NULL;
}
connssl->use = FALSE; /* get back to ordinary socket usage */
if(connssl->handle) {
PR_Close(connssl->handle);
connssl->handle = NULL;
}
}
@@ -493,10 +488,11 @@ CURLcode Curl_nss_connect(struct connectdata * conn, int sockindex)
NULL) != SECSuccess)
goto error;
if(data->set.cert) {
if(data->set.str[STRING_CERT]) {
if(SSL_GetClientAuthDataHook(model,
(SSLGetClientAuthData) SelectClientCert,
(void *)data->set.cert) != SECSuccess) {
(void *)data->set.str[STRING_CERT]) !=
SECSuccess) {
curlerr = CURLE_SSL_CERTPROBLEM;
goto error;
}

View File

@@ -32,7 +32,9 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex);
CURLcode Curl_nss_connect_nonblocking(struct connectdata *conn,
int sockindex,
bool *done);
void Curl_nss_close(struct connectdata *conn); /* close a SSL connection */
/* close a SSL connection */
void Curl_nss_close(struct connectdata *conn, int index);
/* tell NSS to close down all open information regarding connections (and
thus session ID caching etc) */
int Curl_nss_close_all(struct SessionHandle *data);

View File

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

92
lib/nwos.c Normal file
View File

@@ -0,0 +1,92 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
#ifdef NETWARE /* Novell NetWare */
#include <stdlib.h>
#ifdef __NOVELL_LIBC__
/* For native LibC-based NLM we need to do nothing. */
int netware_init ( void )
{
return 0;
}
#else /* __NOVELL_LIBC__ */
/* For native CLib-based NLM we need to initialize the LONG namespace. */
#include <stdio.h>
#include <nwnspace.h>
#include <nwthread.h>
#include <nwadv.h>
/* Make the CLIB Ctx stuff link */
#include <netdb.h>
NETDB_DEFINE_CONTEXT
/* Make the CLIB Inet stuff link */
#include <netinet/in.h>
#include <arpa/inet.h>
NETINET_DEFINE_CONTEXT
int netware_init ( void )
{
int rc = 0;
unsigned int myHandle = GetNLMHandle();
/* import UnAugmentAsterisk dynamically for NW4.x compatibility */
void (*pUnAugmentAsterisk)(int) = (void(*)(int))
ImportSymbol(myHandle, "UnAugmentAsterisk");
/* import UseAccurateCaseForPaths dynamically for NW3.x compatibility */
void (*pUseAccurateCaseForPaths)(int) = (void(*)(int))
ImportSymbol(myHandle, "UseAccurateCaseForPaths");
if (pUnAugmentAsterisk)
pUnAugmentAsterisk(1);
if (pUseAccurateCaseForPaths)
pUseAccurateCaseForPaths(1);
UnimportSymbol(myHandle, "UnAugmentAsterisk");
UnimportSymbol(myHandle, "UseAccurateCaseForPaths");
/* set long name space */
if ((SetCurrentNameSpace(4) == 255)) {
rc = 1;
}
if ((SetTargetNameSpace(4) == 255)) {
rc = rc + 2;
}
return rc;
}
/* dummy function to satisfy newer prelude */
int __init_environment ( void )
{
return 0;
}
/* dummy function to satisfy newer prelude */
int __deinit_environment ( void )
{
return 0;
}
#endif /* __NOVELL_LIBC__ */
#endif /* NETWARE */

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