Commit Graph

729 Commits

Author SHA1 Message Date
Daniel Stenberg cb04619de2 Make the do_complete() function not get called until the DO actually is
compelete, which bascially means when used with the multi interface
2007-11-21 22:37:55 +00:00
Daniel Stenberg ef6dfdc7fd remove the unconditional enabling of cookies if you set a share to use! 2007-11-20 22:59:10 +00:00
Daniel Stenberg 50feea3eef Rearranged code and changed Curl_readwrite_init() and Curl_pre_readwrite() into
do_init() and do_complete() which now are called first and last in the DO
function. It simplified the flow in multi.c and the functions got more
sensible names!
2007-11-15 21:45:45 +00:00
Daniel Stenberg f5971f54ff comment language 2007-11-12 21:42:20 +00:00
Daniel Stenberg c5b16d4468 Bug report #1830637 (http://curl.haxx.se/bug/view.cgi?id=1830637), which was
forwarded from the Gentoo bug tracker by Daniel Black and was originally
submitted by Robin Johnson, pointed out that libcurl would do bad memory
references when it failed and bailed out before the handler thing was
setup. My fix is not done like the provided patch does it, but instead I
make sure that there's never any chance for a NULL pointer in that struct
member.
2007-11-12 21:38:43 +00:00
Yang Tse e87c996fe0 Fix compiler warning: integral size mismatch in argument 2007-11-08 19:28:25 +00:00
Daniel Stenberg ad6e28073c removed space after if and while before the parenthesis for better source code
consistency
2007-11-05 09:45:09 +00:00
Dan Fandrich 59b05ac383 Fixed an OOM problem with file: URLs
Moved Curl_file_connect into the protocol handler struct.
2007-10-30 23:00:40 +00:00
Yang Tse 07dbfa25a0 typecast to prevent compiler warning 2007-10-26 01:12:33 +00:00
Daniel Stenberg ca67dcbc05 Don't assume there's a sessionhandle around when a connection is disconnected,
so do the data->reqdata.current_conn assignment when we know there is an easy
handle existing! Fixes the valgrind report on test 509.
2007-10-25 09:41:35 +00:00
Daniel Stenberg 949ff9715a Bug report #1812190 (http://curl.haxx.se/bug/view.cgi?id=1812190) points out
that libcurl tried to re-use connections a bit too much when using non-SSL
protocols tunneled over a HTTP proxy.
2007-10-23 21:00:51 +00:00
Daniel Stenberg 5b358603bd Michal Marek forwarded the bug report
https://bugzilla.novell.com/show_bug.cgi?id=332917 about a HTTP redirect to
FTP that caused memory havoc. His work together with my efforts created two
fixes:

#1 - FTP::file was moved to struct ftp_conn, because is has to be dealt with
     at connection cleanup, at which time the struct HandleData could be
     used by another connection.
     Also, the unused char *urlpath member is removed from struct FTP.

#2 - provide a Curl_reset_reqproto() function that frees
     data->reqdata.proto.* on connection setup if needed (that is if the
     SessionHandle was used by a different connection).
2007-10-22 15:05:35 +00:00
Daniel Stenberg 1056dc9a26 Bug report #1815530 (http://curl.haxx.se/bug/view.cgi?id=1815530) points out
that specifying a proxy with a trailing slash didn't work (unless it also
contained a port number).
2007-10-22 09:25:45 +00:00
Yang Tse 7fe89c5d29 We use this ZERO_NULL to avoid picky compiler warnings,
when assigning a NULL pointer to a function pointer var.
2007-10-20 15:47:16 +00:00
Yang Tse 5c8fc7dce9 Fix compiler warning: conversion from "int" to "unsigned short" may lose significant bits 2007-10-20 15:11:51 +00:00
Patrick Monnerat 8f5909b664 Allow CURLOPT_COPYPOSTFIELDS with explicit data size = 0 2007-10-18 10:54:49 +00:00
Dan Fandrich bef2e7f2ff Avoid a NULL pointer dereference in an OOM condition. 2007-10-18 01:04:57 +00:00
Yang Tse 0164f0cf81 Fix overflow detection, take four. Avoiding zero size malloc. 2007-10-17 19:29:06 +00:00
Yang Tse e7387f7557 Fix overflow detection, thanks to Patrick Monnerat detecting test
failure condition: http://curl.haxx.se/mail/lib-2007-10/0152.html
2007-10-17 18:06:32 +00:00
Yang Tse 92433e596b We use this ZERO_NULL to avoid picky compiler warnings,
when assigning a NULL pointer to a function pointer var.
2007-10-17 16:58:32 +00:00
Yang Tse c6ef31955a ANSI C compliant overflow check 2007-10-16 23:32:02 +00:00
Dan Fandrich 65ba6e3337 Fixed compiler warning re: unused variable `bigsize' 2007-10-16 18:09:57 +00:00
Patrick Monnerat a005243908 Fix dynamic CURLOPT_POSTFIELDS bug: back to static.
CURLOPT_COPYPOSTFIELDS option added for dynamic.
Fix some OS400 features.
2007-10-15 18:32:01 +00:00
Dan Fandrich 001a2d9b67 Fix LDAP compile error when LDAP is not available.
Fixed a typo in the LDAP configure code and made sure NULL is defined
in a test programs that need it.
2007-10-15 16:24:46 +00:00
Dan Fandrich 61ffcd7815 Made a few more functions static with the protocol handler table in place. 2007-10-13 00:47:53 +00:00
Daniel Stenberg a9f47b9364 another Curl_handler fix, the #ifdefs got a bit mixed up... 2007-10-12 20:53:43 +00:00
Dan Fandrich 7831c1ae44 Fixed a few compile errors and warnings. 2007-10-12 18:49:14 +00:00
Patrick Monnerat 07b6e7363d Added per-protocol callback static tables, replacing callback ptr storage
in the connectdata structure by a single handler table ptr.
2007-10-12 13:36:37 +00:00
Daniel Stenberg 4449bd9b4d Michael Wallner made the CULROPT_COOKIELIST option support a new magic
string: "FLUSH". Using that will cause libcurl to flush its cookies to the
CURLOPT_COOKIEJAR file.
2007-10-05 14:37:33 +00:00
Daniel Stenberg ce1cfcb7a6 Alexey Pesternikov introduced CURLOPT_OPENSOCKETFUNCTION and
CURLOPT_OPENSOCKETDATA to set a callback that allows an application to replace
the socket() call used by libcurl. It basically allows the app to change
address, protocol or whatever of the socket. (I also did some whitespace
indent/cleanups in lib/url.c which kind of hides some of these changes, sorry
for mixing those in.)
2007-10-03 08:45:00 +00:00
Daniel Stenberg 51c6a5d43b Based on a patch brought by Johnny Luong, libcurl now offers
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 and the curl tool --hostpubmd5. They both make
the SCP or SFTP connection verify the remote host's md5 checksum of the public
key before doing a connect, to reduce the risk of a man-in-the-middle attack.
2007-10-03 08:00:42 +00:00
Yang Tse 048bfeaaef Fix compiler warning 2007-10-02 15:26:30 +00:00
Dan Fandrich 16b95fc773 Enabled a few more gcc warnings with --enable-debug. Renamed a few
variables to avoid shadowing global declarations.
2007-09-27 01:45:22 +00:00
Daniel Stenberg fd4cf78f36 Philip Langdale provided the new CURLOPT_POST301 option for
curl_easy_setopt() that alters how libcurl functions when following
redirects. It makes libcurl obey the RFC2616 when a 301 response is received
after a non-GET request is made. Default libcurl behaviour is to change
method to GET in the subsequent request (like it does for response code 302
- because that's what many/most browsers do), but with this CURLOPT_POST301
option enabled it will do what the spec says and do the next request using
the same method again. I.e keep POST after 301.

The curl tool got this option as --post301

Test case 1011 and 1012 were added to verify.
2007-09-26 12:44:59 +00:00
Dan Fandrich 3fa60164af Renamed the CURLE_FTP_SSL_FAILED error code to CURLE_USE_SSL_FAILED.
Renamed the curl_ftpssl enum to curl_usessl and its enumerated constants,
creating macros for backward compatibility.
2007-08-31 19:36:32 +00:00
Dan Fandrich 9f44a95522 Renamed several libcurl error codes and options to make them more general
and allow reuse by multiple protocols. Several unused error codes were
removed.  In all cases, macros were added to preserve source (and binary)
compatibility with the old names.  These macros are subject to removal at
a future date, but probably not before 2009.  An application can be
tested to see if it is using any obsolete code by compiling it with the
CURL_NO_OLDIES macro defined.

Documented some newer error codes in libcurl-error(3)
2007-08-30 20:34:57 +00:00
Dan Fandrich 1b66c1da6c Added lots of consts 2007-08-29 05:36:53 +00:00
Dan Fandrich 523767660c Fixed some minor mismatched types found by splint. 2007-08-26 05:53:26 +00:00
Gunter Knauf ccba0d10b6 added basic ldaps support; for now its ifdef'd with HAVE_LDAP_SSL unless we know its fully working, and available with all LDAP SDKs.
Win32 requires to have the trusted CA in local keystore - I've not found yet a way to disable the cert check.
2007-08-16 14:08:47 +00:00
Daniel Stenberg d0edb47896 Patrick Monnerat modified the LDAP code and approach in curl. Starting now,
the configure script checks for openldap and friends and we link with those
libs just like we link all other third party libraries, and we no longer
dlopen() those libraries. Our private header file lib/ldap.h was renamed to
lib/curl_ldap.h due to this. I set a tag in CVS (curl-7_17_0-preldapfix)
just before this commit, just in case.
2007-08-11 20:57:54 +00:00
Dan Fandrich c669e1ae45 Fixed torture test for test 509 2007-08-07 18:24:49 +00:00
Dan Fandrich 2e60ca382d Fixed some icc compiler warnings. 2007-08-07 00:10:27 +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
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
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 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 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 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 813a1107f4 #if that should be #ifdef 2007-07-23 21:48:27 +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
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 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
Gunter Knauf cf61c8d659 fixed endif comment. 2007-07-11 09:03:22 +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
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
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
Daniel Stenberg a1b650ad7b Gerrit Bruchhuser pointed out a warning that the Intel(R) Thread Checker
tool reports and it was indeed a legitimate one and it is one fixed. It was
a use of a share without doing the proper locking first.
2007-06-21 14:23:38 +00:00
Daniel Stenberg e71378d3c8 mark connect failures as non-connected when ConnectPlease() fails, like when
a connection through a socks proxy doesn't work
2007-06-05 13:41:50 +00:00
Daniel Stenberg b6820b2674 remove really annoying debug output that makes life miserable when you do
hundreds of parallel transfers...
2007-05-30 09:24:06 +00:00
Dan Fandrich 9f72db13c4 Fixed an out of memory handling issue with HTTP pipelines. 2007-05-02 19:13:56 +00:00
Dan Fandrich 717adfeb96 Rearranged some allocs so they will be freed correctly in the error path. 2007-04-29 07:04:29 +00:00
Daniel Stenberg 7a0e0c36c5 Move the explictit free of the range string to Curl_close() from Curl_disconnect()
since it easy-handle related and not connection-related.
2007-04-27 08:30:48 +00:00
Daniel Stenberg 61edee979f oops, this was supposed to be properly removed 2007-04-27 08:19:48 +00:00
Daniel Stenberg 7a343a3f60 As a follow-up to the removal of the free of the range data in Curl_done() - this
moves and re-arranges how range/resume is setup and freed.
2007-04-27 08:18:47 +00:00
Daniel Stenberg ed8cb57151 Sonia Subramanian brought our attention to a problem that happens if you set
the CURLOPT_RESUME_FROM or CURLOPT_RANGE options and an existing connection
in the connection cache is closed to make room for the new one when you call
curl_easy_perform(). It would then wrongly free range-related data in the
connection close funtion.
2007-04-25 20:20:15 +00:00
Daniel Stenberg bc1ae973da Robert Iakobashvili made the 'master_buffer' get allocated first once it is
can/will be used as it then makes the common cases save 16KB of data for each
easy handle that isn't used for pipelining.
2007-04-24 10:18:06 +00:00
Daniel Stenberg 5daa6b9367 Ravi Pratap provided fixes for HTTP pipelining 2007-04-10 20:46:40 +00:00
Yang Tse 0e05a6329a fix out of memory handling issue 2007-04-08 22:49:38 +00:00
Dan Fandrich c321b9f704 Fixes some more out of memory handling bugs. 2007-04-04 23:41:35 +00:00
Daniel Stenberg 990b15e402 Rob Jones fixed better #ifdef'ing for a bunch of #include lines. 2007-04-03 20:54:37 +00:00
Yang Tse bcf0af9ddb recover code simplification lost with last commit 2007-04-03 13:26:05 +00:00
Yang Tse a1e5c621c0 fix compiler warning 2007-03-29 12:29:32 +00:00
Yang Tse bfa0f8c6c2 fix compiler warning 2007-03-28 19:05:43 +00:00
Gisle Vanem 8a0a7ce3a8 Fix compiler warning. 2007-03-28 04:44:14 +00:00
Gisle Vanem 25c064c888 Simplified code around 'tld_errmsg' a bit. 2007-03-28 04:23:33 +00:00
Yang Tse fba4cd0e62 Internal function Curl_select() renamed to Curl_socket_ready() 2007-03-26 23:23:46 +00:00
Yang Tse fa0780bb91 fix compiler warning 2007-03-25 03:20:17 +00:00
Yang Tse d6eca89229 fix compiler warning 2007-03-25 01:59:52 +00:00
Dan Fandrich 2bd1d7e996 Fixed a couple of compile problems. 2007-03-24 17:23:01 +00:00
Dan Fandrich 0dd1219668 Fixed a memory leak when specifying a proxy with a file: URL and added
test case 288 to verify it.
2007-03-24 02:15:20 +00:00
Daniel Stenberg f9a339a225 fix debug message 2007-03-23 22:24:33 +00:00
Daniel Stenberg 20b9ab49a7 can just as well NULLify the pointer in a single spot 2007-03-11 22:48:58 +00:00
Daniel Stenberg 09c70dec08 Eygene Ryabinkin fixed a use-after-free issue with HTTP transfers with the
multi interface
2007-03-10 22:51:20 +00:00
Dan Fandrich 85daec253c Honour --ftp-ssl-control on ftps:// URLs to allow encrypted control and
unencrypted data connections.
2007-03-07 22:42:05 +00:00
Daniel Stenberg 060f7ca2d2 - Hang Kin Lau found and fixed: When I use libcurl to connect to an https
server through a proxy and have the remote https server port set using the
  CURLOPT_PORT option, protocol gets reset to http from https after the first
  request.

  User defined URL was modified internally by libcurl and subsequent reuse of
  the easy handle may lead to connection using a different protocol (if not
  originally http).

  I found that libcurl hardcoded the protocol to "http" when it tries to
  regenerate the URL if CURLOPT_PORT is set. I tried to fix the problem as
  follows and it's working fine so far
2007-02-27 22:12:15 +00:00
Gisle Vanem c514a2a89a Removed inclusion of <sys/types.h> and <sys/stat.h> in .c-files
since they're already included through "setup.h".
2007-02-26 04:24:26 +00:00
Yang Tse 4937281ddc compiler warning fix 2007-02-22 07:39:45 +00:00
Daniel Stenberg f19d333ef6 - Ravi Pratap provided work on libcurl making pipelining more robust and
fixing some bugs:
  o Don't mix GET and POST requests in a pipeline
  o Fix the order in which requests are dispatched from the pipeline
  o Fixed several curl bugs with pipelining when the server is returning
    chunked encoding:
    * Added states to chunked parsing for final CRLF
    * Rewind buffer after parsing chunk with data remaining
    * Moved chunked header initializing to a spot just before receiving
      headers
2007-02-21 21:59:40 +00:00
Yang Tse 48029d7e74 fix compiler warning "enumerated type mixed with another type" 2007-02-21 05:48:07 +00:00
Linus Nielsen Feltzing 2f5e99ca02 New FTP CCC functionality - adds passive and active mode to accomodate for different server behaviour 2007-02-20 22:02:11 +00:00
Daniel Stenberg 1045b8d382 - Shmulik Regev found a memory leak in re-used HTTPS connections, at least
when the multi interface was used.
2007-02-19 12:20:32 +00:00
Daniel Stenberg 17e8d60c01 - Robson Braga Araujo made passive FTP transfers work with SOCKS (both 4 and
5).
2007-02-19 11:53:54 +00:00
Daniel Stenberg cbf58d88d0 - Jeff Pohlmeyer identified two problems: first a rather obscure problem with
the multi interface and connection re-use that could make a
  curl_multi_remove_handle() ruin a pointer in another handle.

  The second problem was less of an actual problem but more of minor quirk:
  the re-using of connections wasn't properly checking if the connection was
  marked for closure.
2007-02-18 23:02:42 +00:00
Daniel Stenberg 28b932fb4e - Shmulik Regev fixed so that the final CRLF of HTTP response headers are sent
to the debug callback.

- Shmulik Regev added CURLOPT_HTTP_CONTENT_DECODING and
  CURLOPT_HTTP_TRANSFER_DECODING that if set to zero will disable libcurl's
  internal decoding of content or transfer encoded content. This may be
  preferable in cases where you use libcurl for proxy purposes or similar. The
  command line tool got a --raw option to disable both at once.
2007-02-12 21:13:47 +00:00
Daniel Stenberg 91386937ff - Michael Wallner provided a patch that adds support for CURLOPT_TIMEOUT_MS
and CURLOPT_CONNECTTIMEOUT_MS that, as their names should hint, do the
  timeouts with millisecond resolution instead. The only restriction to that
  is the alarm() (sometimes) used to abort name resolves as that uses full
  seconds. I fixed the FTP response timeout part of the patch.

  Internally we now count and keep the timeouts in milliseconds but it also
  means we multiply set timeouts with 1000. The effect of this is that no
  timeout can be set to more than 2^31 milliseconds (on 32 bit systems), which
  equals 24.86 days.  We probably couldn't before either since the code did
  *1000 on the timeout values on several places already.
2007-02-05 22:51:32 +00:00
Daniel Stenberg 138b4f27b4 - Manfred Schwarb reported that socks5 support was broken and help us pinpoint
the problem. The code now tries harder to use httproxy and proxy where
  apppropriate, as not all proxies are HTTP...
2007-02-03 09:33:54 +00:00
Yang Tse 54db98c220 compiler warning fix 2007-02-01 01:42:13 +00:00
Yang Tse 49c4d9c9cd add debug messages for initialization failures 2007-01-31 19:47:49 +00:00