1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00
Commit Graph

812 Commits

Author SHA1 Message Date
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
Daniel Stenberg
1f4c8c4f09 Andreas Rieke added extra infof() for when a connection is not re-used due to
SSL conditions not being the same
2007-01-28 22:45:22 +00:00
Dan Fandrich
44ac2776ae Fixed a dangling pointer problem that prevented the http_proxy environment
variable from being properly used in many cases (and caused test case 63
to fail).
2007-01-25 01:35:43 +00:00
Daniel Stenberg
385e612fa5 - Armel Asselin improved libcurl to behave a lot better when an easy handle
doing an FTP transfer is removed from a multi handle before completion. The
  fix also fixed the "alive counter" to be correct on "premature removal" for
  all protocols.
2007-01-16 22:22:10 +00:00
Daniel Stenberg
0fb5a65a58 - David McCreedy provided libcurl changes for doing HTTP communication on
non-ASCII platforms. It does add some complexity, most notably with more
  #ifdefs, but I want to see this supported added and I can't see how we can
  add it without the extra stuff added.
2007-01-14 14:57:51 +00:00
Daniel Stenberg
4750e6f3c5 - Linus Nielsen Feltzing introduced the --ftp-ssl-ccc command line option to
curl that uses the new CURLOPT_FTP_SSL_CCC option in libcurl. If enabled, it
  will make libcurl shutdown SSL/TLS after the authentication is done on a
  FTP-SSL operation.
2007-01-05 23:11:14 +00:00
Daniel Stenberg
bedc61ac45 - Robert Foreman provided a prime example snippet showing how libcurl would
get confused and not acknowledge the 'no_proxy' variable properly once it
  had used the proxy and you re-used the same easy handle. I made sure the
  proxy name is properly stored in the connect struct rather than the
  sessionhandle/easy struct.
2006-12-22 15:04:59 +00:00
Daniel Stenberg
b2f8de571f When setting a proxy with environment variables and (for example) running
'curl [URL]' with a URL without a protocol prefix, curl would not send a
correct request as it failed to add the protocol prefix.
2006-12-22 07:30:21 +00:00
Daniel Stenberg
89ab5f4380 Robson Braga Araujo reported bug #1618359
(http://curl.haxx.se/bug/view.cgi?id=1618359) and subsequently provided a
patch for it: when downloading 2 zero byte files in a row, curl 7.16.0
enters an infinite loop, while curl 7.16.1-20061218 does one additional
unnecessary request.

Fix: During the "Major overhaul introducing http pipelining support and
shared connection cache within the multi handle." change, headerbytecount
was moved to live in the Curl_transfer_keeper structure. But that structure
is reset in the Transfer method, losing the information that we had about
the header size. This patch moves it back to the connectdata struct.
2006-12-21 10:15:38 +00:00
Daniel Stenberg
88c8d72a21 Alexey Simak found out that when doing FTP with the multi interface and
something went wrong like it got a bad response code back from the server,
libcurl would leak memory. Added test case 538 to verify the fix.

I also noted that the connection would get cached in that case, which
doesn't make sense since it cannot be re-use when the authentication has
failed. I fixed that issue too at the same time, and also that the path
would be "remembered" in vain for cases where the connection was about to
get closed.
2006-12-11 09:32:58 +00:00
Daniel Stenberg
eb29c5c285 removed the final traces of the closepolicy option 2006-12-05 21:39:24 +00:00
Daniel Stenberg
e4505aefd9 Jared Lundell filed bug report #1604956
(http://curl.haxx.se/bug/view.cgi?id=1604956) which identified setting
CURLOPT_MAXCONNECTS to zero caused libcurl to SIGSEGV. Starting now, libcurl
will always internally use no less than 1 entry in the connection cache.
2006-12-05 15:36:26 +00:00
Daniel Stenberg
4c65eb0af8 CURLOPT_FORBID_REUSE works again with a cleaned up order of doing things in
Curl_done()
2006-12-05 15:17:32 +00:00
Yang Tse
a46f55b9de Make sure RETSIGTYPE is properly defined 2006-11-25 01:02:52 +00:00
Daniel Stenberg
a634f64400 James Housley did lots of work and introduced SFTP downloads. 2006-11-24 22:14:39 +00:00
Daniel Stenberg
624745ab20 Dmitriy Sergeyev found a SIGSEGV with his test04.c example posted on 7 Nov
2006. It turned out we wrongly assumed that the connection cache was present
when tearing down a connection.
2006-11-09 21:54:33 +00:00
Daniel Stenberg
b5b3d9e5c7 Olaf fixed a leftover problem with the CONNECT fix of his that would leave a
wrong error message in the error message buffer.
2006-11-07 14:07:02 +00:00
Yang Tse
69f7d0a0ce compiler warning fix 2006-11-06 18:27:25 +00:00
Daniel Stenberg
a777eb3d81 Olaf Stueben provided a patch that I edited slightly. It fixes the notorious
KNOWN_BUGS #25, which happens when a proxy closes the connection when
libcurl has sent CONNECT, as part of an authentication negotiation. Starting
now, libcurl will re-connect accordingly and continue the authentication as
it should.
2006-11-03 12:43:55 +00:00
Daniel Stenberg
2147284cad James Housley brought support for SCP transfers 2006-11-02 21:56:40 +00:00
Yang Tse
ba481718a4 Make more human readable and maintainable previous
compiler warning fix since it was Ok and actually
avoids the targeted compiler warning.
2006-10-29 14:58:59 +00:00
Yang Tse
a93695a70e Compiler warning fix.
Assigning the const value zero to a pointer to function
results in a null pointer value assignment to the function
pointer.

Assignment of any nonzero value is what should result in a
implementation compiler dependent result.

Since what we want to do here is the first case, this should
not trigger compiler warnings related with conversions from
'pointer to data' to 'pointer to function'.

Our autobuild test suite will judge.
2006-10-27 15:32:18 +00:00
Yang Tse
8a8d5c784c Do an explicit typecast of data pointers to function pointers
to avoid picky compiler warnings, since this is what we want!
2006-10-27 01:04:41 +00:00
Yang Tse
012d7e2878 Fix Curl_open() not reporting failure when allocation of the
buffer used to store headers in the SessionHandle failed.
2006-10-26 11:15:25 +00:00
Daniel Stenberg
f44ef427a2 other pipelining fixes by Ravi Pratap, that now makes pipelines get used better 2006-10-24 21:14:40 +00:00
Daniel Stenberg
36a3514225 the check in ConnectionExists() for not re-using a non-resolved connection now
applies for asynch name resolves in general and not only ares
2006-10-23 20:41:50 +00:00
Daniel Stenberg
e1edd41e1b Ravi Pratap provided a major update with pipelining fixes. We also no longer
re-use connections (for pipelining) before the name resolving is done.
2006-10-23 20:34:56 +00:00
Daniel Stenberg
bd5d21aaf2 When a resolve is made on a pipelined connection we need to detect it properly
(when the resoling isn't completede yet) and not confuse it with a simple
connection re-use (non-pipelined).
2006-10-20 12:25:39 +00:00
Yang Tse
83884180ac Builds using synchronous name resolver dislike marking the connection as async. 2006-10-19 02:30:02 +00:00
Daniel Stenberg
18aae32015 When a connection is re-used, it can be flagged for re-use before the name
resolving is completed so we must make sure to survive it and mark the
connection as async (ie not yet connected completely).
2006-10-18 15:10:49 +00:00
Daniel Stenberg
5b8d5fdf2f cut out matching host names starting with telnet or ftps, since they hardly
ever actually are used
2006-10-18 11:13:39 +00:00
Dan Fandrich
8c38ea4ebc Fixed compile error in HAVE_SIGACTION case. 2006-10-17 21:45:37 +00:00
Daniel Stenberg
44d84ac164 Avoid typecasting a signed char to an int when using is*() functions, as that
could very well cause a negate number get passed in and thus cause reading
outside of the array usually used for this purpose.

We avoid this by using the uppercase macro versions introduced just now that
does some extra crazy typecasts to avoid byte codes > 127 to cause negative
int values.
2006-10-17 21:32:56 +00:00
Yang Tse
44ffe0dc79 Typo 2006-10-17 09:07:38 +00:00
Daniel Stenberg
0bb20cc611 fix the name resolve abort timeout calculation (when signals are used) 2006-10-17 08:05:41 +00:00
Gisle Vanem
2260c8aa11 Replace ";;" with ";". 2006-10-15 20:28:03 +00:00
Yang Tse
e150150d9f Remove redundant __CYGWIN__ symbol check 2006-10-11 16:01:16 +00:00
Daniel Stenberg
d390039873 minor indent fix 2006-10-09 21:24:50 +00:00
Daniel Stenberg
a1de9367ec Bogdan Nicula's second test case (posted Sun, 08 Oct 2006) converted to test
case 535 and it now runs fine. Again a problem with the pipelining code not
taking all possible (error) conditions into account.
2006-10-09 06:58:05 +00:00
Daniel Stenberg
5e0d9aea32 Support for FTP third party transfers is now dropped 2006-09-30 20:31:11 +00:00
Daniel Stenberg
ae13c93b7d Reported in #1561470 (http://curl.haxx.se/bug/view.cgi?id=1561470), libcurl
would crash if a bad function sequence was used when shutting down after
using the multi interface (i.e using easy_cleanup after multi_cleanup) so
precautions have been added to make sure it doesn't any more - test case 529
was added to verify.
2006-09-28 21:26:06 +00:00
Yang Tse
ba01198e6c Compiler warning fix 2006-09-25 00:05:39 +00:00
Daniel Stenberg
3ea8a4d220 Dmitriy Sergeyev provided a patch that made the SOCKS[45] code work better as
it now will read the full data sent from servers. The SOCKS-related code was
also moved to the new lib/socks.c source file.
2006-09-23 19:07:20 +00:00
Daniel Stenberg
ec4a16f2e0 Armel Asselin fixed problems when you gave a proxy URL with user name and
empty password or no password at all. Test case 278 and 279 were added to
verify.
2006-09-20 21:49:41 +00:00
Daniel Stenberg
71920d61e6 Michael Wallner's test program again help me track down a problem. This time
it basically was that we didn't remove the current connection from the pipe
list when following a redirect. Also in this commit: several cases of
additional debug code for debug builds helping to check and track down some
signs of run-time trouble.
2006-09-20 12:03:50 +00:00
Daniel Stenberg
2d5fc39d35 Resize the connection cache upwards when adding more handles than what
currently fits in the cache, to make the cache work better especially for
pipelining cases but also for "mere" (persistent) connection re-use.
2006-09-16 21:50:29 +00:00
Daniel Stenberg
39e01e9349 file-local function should be static and not use Curl_ prefix!
Curl_signalPipeClose is now signalPipeClose().
2006-09-15 08:47:55 +00:00
Yang Tse
7d3e719a2c Compiler warning fix 2006-09-13 12:42:12 +00:00
Yang Tse
733a184ce0 Compiler warning fix 2006-09-12 23:51:01 +00:00
Daniel Stenberg
7c5745720a If the current connection doesn't fit to get added to the connection cache,
we certainly MUST NOT kill an active connection... Problem tracked down thanks
to Michael Wallner's excellent test program.
2006-09-11 20:50:58 +00:00
Daniel Stenberg
29dc39fce1 - Fixed my breakage from earlier today so that doing curl_easy_cleanup() on a
handle that is part of a multi handle first removes the handle from the
  stack.

- Added CURLOPT_SSL_SESSIONID_CACHE and --no-sessionid to disable SSL
  session-ID re-use on demand since there obviously are broken servers out
  there that misbehave with session-IDs used.
2006-09-11 17:18:18 +00:00
Daniel Stenberg
5c184cfc0d stupid mistake rectified by Jeff Pohlmeyer 2006-09-11 11:25:47 +00:00
Yang Tse
055022a55f Compiler warning fix 2006-09-10 23:45:54 +00:00
Yang Tse
c30e908034 Compiler warning fix 2006-09-10 23:37:42 +00:00
Daniel Stenberg
8240cea628 Jeff Pohlmeyer presented a *multi_socket()-using program that exposed a
problem with it (SIGSEGV-style). It clearly showed that the existing
  socket-state and state-difference function wasn't good enough so I rewrote
  it and could then re-run Jeff's program without any crash. The previous
  version clearly could miss to tell the application when a handle changed
  from using one socket to using another.

  While I was at it (as I could use this as a means to track this problem
  down), I've now added a 'magic' number to the easy handle struct that is
  inited at curl_easy_init() time and cleared at curl_easy_cleanup() time that
  we can use internally to detect that an easy handle seems to be fine, or at
  least not closed or freed (freeing in debug builds fill the area with 0x13
  bytes but in normal builds we can of course not assume any particular data
  in the freed areas).
2006-09-10 22:15:32 +00:00
Gisle Vanem
690888cfc1 SIGALARM -> SIGALRM. 2006-09-09 19:13:13 +00:00
Gisle Vanem
fb8d9b6645 #ifdef around alarmfunc() to supress warning. 2006-09-09 19:11:54 +00:00
Gisle Vanem
1dec17562f signal() returns 'void (*)(int)'. 2006-09-08 13:06:41 +00:00
Daniel Stenberg
b7eeb6e67f Major overhaul introducing http pipelining support and shared connection
cache within the multi handle.
2006-09-07 21:49:20 +00:00
Yang Tse
7e4193b538 Fix compiler warning 2006-09-07 01:18:46 +00:00
Daniel Stenberg
466d093a92 - "Dortik" (http://curl.haxx.se/bug/view.cgi?id=1551412) provided a patch that
while not fixing things very nicely, it does make the SOCKS5 proxy
  connection slightly better as it now acknowledges the timeout for connection
  and it no longer segfaults in the case when SOCKS requires authentication
  and you did not specify username:password.
2006-09-03 22:52:42 +00:00
Gisle Vanem
4f4277d9c7 Simplified #ifdef on WIN32; the statement
" !defined(__GNUC__) || defined(__MINGW32__)" implies
CygWin.
2006-09-03 13:52:07 +00:00
Gisle Vanem
c7aae10300 Removed "#ifndef__WATCOMC__". Use "#ifdef HAVE_SYS_TIME_H" instead. 2006-08-30 16:17:06 +00:00
Gisle Vanem
59cf6fd4f0 Watcom lacks <sys/time.h>. 2006-08-29 18:45:55 +00:00
Daniel Stenberg
5acadc9cd7 David McCreedy added CURLOPT_SOCKOPTFUNCTION and CURLOPT_SOCKOPTDATA to
allow applications to set their own socket options.
2006-08-29 14:39:33 +00:00
Daniel Stenberg
cfdcae4bc7 Based on a patch by Armel Asselin, the FTP code no longer re-issues the TYPE
command on subsequent requests on a re-used connection unless it has to.
2006-08-19 21:18:36 +00:00
Yang Tse
9dde0b54a3 Silence warning: empty body in an if-statement 2006-07-31 17:46:28 +00:00
Daniel Stenberg
2527b53019 Dan Nelson added the CURLOPT_FTP_ALTERNATIVE_TO_USER libcurl option and curl
tool option named --ftp-alternative-to-user. It provides a mean to send a
particular command if the normal USER/PASS approach fails.
2006-07-25 22:45:21 +00:00
Gisle Vanem
385db0e97d Fix typo. 2006-07-24 15:56:40 +00:00
Gisle Vanem
e40641bf7c Use calloc() instead. 2006-07-21 04:19:44 +00:00
Yang Tse
d157c29269 Fix compiler warnings 2006-07-19 21:14:02 +00:00
Yang Tse
9c83a20a27 Fix compiler warning "enumerated type mixed with another type" 2006-07-17 14:52:31 +00:00
Daniel Stenberg
daef1cf34d David McCreedy fixed a flaw where the CRLF counter wasn't properly cleared
for FTP ASCII transfers.
2006-07-14 18:58:42 +00:00
Daniel Stenberg
ca319f63ad Ingmar Runge provided a source snippet that caused a crash. The reason for
the crash was that libcurl internally was a bit confused about who owned the
DNS cache at all times so if you created an easy handle that uses a shared
DNS cache and added that to a multi handle it would crash. Now we keep more
careful internal track of exactly what kind of DNS cache each easy handle
uses: None, Private (allocated for and used only by this single handle),
Shared (points to a cache held by a shared object), Global (points to the
global cache) or Multi (points to the cache within the multi handle that is
automatically shared between all easy handles that are added with private
caches).
2006-07-07 22:58:06 +00:00
Daniel Stenberg
dfe1884c25 Peter Silva introduced CURLOPT_MAX_SEND_SPEED_LARGE and
CURLOPT_MAX_RECV_SPEED_LARGE that limit tha maximum rate libcurl is allowed
to send or receive data. This kind of adds the the command line tool's
option --limit-rate to the library.

The rate limiting logic in the curl app is now removed and is instead
provided by libcurl itself. Transfer rate limiting will now also work for -d
and -F, which it didn't before.
2006-06-22 21:36:53 +00:00
Daniel Stenberg
990e56fb13 Brian Dessent's fixes for cygwin builds 2006-06-08 06:12:30 +00:00
Daniel Stenberg
482b3ba702 long/int cleanup to silence picky compiler warnings 2006-05-26 11:26:42 +00:00
Daniel Stenberg
606562aa7e Michael Wallner provided a patch that allows "SESS" to be set with
CURLOPT_COOKIELIST, which then makes all session cookies get cleared. (slightly
edited by me, and the re-indent in cookie.c was also done by me)
2006-05-24 22:46:38 +00:00
Daniel Stenberg
686d90745b First curl_multi_socket() commit. Should primarily be considered as an internal
code rearrange to fit the future better.
2006-04-10 15:00:53 +00:00
Daniel Stenberg
5a4b43848a First commit of David McCreedy's EBCDIC and TPF changes. 2006-04-07 21:50:47 +00:00
Daniel Stenberg
4d33cf739d added typedefed function pointers and typecast the NULL assignments in an
attempt to silence picky compilers when assigning data pointers to a function
pointer variable
2006-04-07 11:47:21 +00:00
Daniel Stenberg
83367f67de Xavier Bouchoux made the SSL connection non-blocking for the multi interface
(when using OpenSSL).
2006-03-21 21:54:44 +00:00
Daniel Stenberg
cffebd7fd6 Markus Koetter filed debian bug report #355715 which identified a problem
with the multi interface and multi-part formposts. The fix from February
22nd could make the Curl_done() function get called twice on the same
connection and it was not designed for that and thus tried to call free() on
an already freed memory area!
2006-03-07 23:11:41 +00:00
Dan Fandrich
a39ac3d94a Added user ID support to SOCKS4. 2006-02-24 21:35:48 +00:00
Dan Fandrich
45e4b811b0 Fixed a few more comment typos. 2006-02-23 18:39:22 +00:00
Daniel Stenberg
0e6a1a4420 Peter Su's SOCKS4 fix 2006-02-23 14:42:47 +00:00
Daniel Stenberg
6fdbb01194 Lots of work and analysis by "xbx___" in bug #1431750
(http://curl.haxx.se/bug/view.cgi?id=1431750) helped me identify and fix two
different but related bugs:

1) Removing an easy handle from a multi handle before the transfer is done
   could leave a connection in the connection cache for that handle that is
   in a state that isn't suitable for re-use. A subsequent re-use could then
   read from a NULL pointer and segfault.

2) When an easy handle was removed from the multi handle, there could be an
   outstanding c-ares DNS name resolve request. When the response arrived,
   it caused havoc since the connection struct it "belonged" to could've
   been freed already.

Now Curl_done() is called when an easy handle is removed from a multi handle
pre-maturely (that is, before the transfer was complteted). Curl_done() also
makes sure to cancel all (if any) outstanding c-ares requests.
2006-02-23 12:20:48 +00:00
Dan Fandrich
75c9430559 Fixed some spelling errors in comments, and extraneous \n in failf logs. 2006-02-22 19:09:33 +00:00
Daniel Stenberg
a15d107dde Peter Su added support for SOCKS4 proxies. Enable this by setting the proxy
type to the already provided type CURLPROXY_SOCKS4.
I added a --socks4 option that works like the current --socks5 option but
instead use the socks4 protocol.
2006-02-21 07:46:41 +00:00
Daniel Stenberg
ad6511c313 Added some clarifying comments 2006-02-16 10:02:11 +00:00
Daniel Stenberg
87bcb6f377 Karl M added the CURLOPT_CONNECT_ONLY and CURLINFO_LASTSOCKET options that
an app can use to let libcurl only connect to a remote host and then extract
the socket from libcurl. libcurl will then not attempt to do any transfer at
all after the connect is done.
2006-02-11 22:35:16 +00:00
Daniel Stenberg
2fbf94b0f3 Added CURLOPT_LOCALPORT and CURLOPT_LOCALPORTRANGE to libcurl. Set with the
curl tool with --local-port. Plain and simply set the range of ports to bind
the local end of connections to. Implemented on to popular demand.

Not extensively tested. Please let me know how it works.
2006-01-30 08:24:07 +00:00
Daniel Stenberg
fcfd6d9504 Duane Cathey was one of our friends who reported that curl -P [IP]
(CURLOPT_FTPPORT) didn't work for ipv6-enabed curls if the IP wasn't a
"native" IP while it works fine for ipv6-disabled builds!

In the process of fixing this, I removed the support for LPRT since I can't
think of many reasons to keep doing it and asking on the mailing list didn't
reveal anyone else that could either. The code that sends EPRT and PORT is
now also a lot simpler than before (IMHO).
2006-01-19 23:52:03 +00:00
Daniel Stenberg
67a83c1b34 David Shaw finally removed all traces of Gopher and we are now officially
not supporting it. It hasn't been functioning for years anyway, so this is
just finally stating what already was true. And a cleanup at the same time.
2006-01-16 22:14:37 +00:00
Daniel Stenberg
7d1e3ebeed explain tld_check_name() 2005-12-20 22:46:12 +00:00
Daniel Stenberg
6dbfce1031 Jean Jacques Drouin pointed out that you could only have a user name or
password of 127 bytes or less embedded in a URL, where actually the code
uses a 255 byte buffer for it! Modified now to use the full buffer size.
2005-12-16 14:52:16 +00:00
Daniel Stenberg
f49df54a36 7.15.1 with the now to be announced security flaw fixed 2005-12-06 23:05:51 +00:00
Daniel Stenberg
176d4e85e9 cast the va_arg() assignment to ftp_filemethod properly 2005-11-30 13:09:48 +00:00
Daniel Stenberg
0fd282b078 new experimental "ftp method" code 2005-11-28 23:06:00 +00:00
Daniel Stenberg
966fa848a0 Nis Jorgensen filed bug report #1338648
(http://curl.haxx.se/bug/view.cgi?id=1338648) which really is more of a
feature request, but anyway. It pointed out that --max-redirs did not allow
it to be set to 0, which then would return an error code on the first
Location: found. Based on Nis' patch, now libcurl supports CURLOPT_MAXREDIRS
set to 0, or -1 for infinity. Added test case 274 to verify.
2005-10-27 22:05:38 +00:00
Daniel Stenberg
1a1ab2e2e8 "Ofer" reported a problem when libcurl re-used a connection and failed to do
it, it could then accidentally actually crash. Presumably, this concerns FTP
connections.  http://curl.haxx.se/bug/view.cgi?id=1330310
2005-10-21 21:00:44 +00:00
Daniel Stenberg
e43217e664 Starting now, the verbose text that goes like "About to connect() to" will
now contain the word "proxy" is the hostname is in fact a proxy. This will
help users detect situations when they mistakenly use a proxy.
2005-09-29 11:37:52 +00:00
Daniel Stenberg
e7093b3ca8 keep 'socktype' in the connectdata struct and make sure we use that for all
protocol sockets even if the resolved address may say otherwise
2005-09-16 21:30:08 +00:00
Daniel Stenberg
7e845e7cfd Added FTP_SKIP_PASV_IP and --ftp-skip-pasv-ip 2005-09-04 05:16:06 +00:00
Daniel Stenberg
56d9624b56 John Kelly added TFTP support to libcurl. A bunch of new error codes was
added. TODO: add them to docs. add TFTP server to test suite. add TFTP to
list of protocols whereever those are mentioned.
2005-09-02 15:11:08 +00:00
Daniel Stenberg
a4773fcbbb Toby Peterson added CURLOPT_IGNORE_CONTENT_LENGTH to the library, accessible
from the command line tool with --ignore-content-length. This will make it
easier to download files from Apache 1.x (and similar) servers that are
still having problems serving files larger than 2 or 4 GB. When this option
is enabled, curl will simply have to wait for the server to close the
connection to signal end of transfer. I wrote test case 269 that runs a
simple test that this works.
2005-08-24 10:57:28 +00:00
Daniel Stenberg
a676c18502 - Jeff Pohlmeyer found out that if you ask libcurl to load a cookiefile (with
CURLOPT_COOKIEFILE), add a cookie (with CURLOPT_COOKIELIST), tell it to
  write the result to a given cookie jar and then never actually call
  curl_easy_perform() - the given file(s) to read was never read but the
  output file was written and thus it caused a "funny" result.

- While doing some tests for the bug above, I noticed that Firefox generates
  large numbers (for the expire time) in the cookies.txt file and libcurl
  didn't treat them properly. Now it does.
2005-08-17 08:55:43 +00:00
Daniel Stenberg
493d6033aa Jon Grubbs filed bug report #1249962 which identified a problem with NTLM on a
HTTP proxy if an FTP URL was given. libcurl now properly switches to pure HTTP
internally when an HTTP proxy is used, even for FTP URLs. The problem would
also occur with other multi-pass auth methods.
2005-08-07 22:59:06 +00:00
Daniel Stenberg
aeb04136f7 Don't prevent FTPS:// through a http proxy, as we cannot know if it works or
not!
2005-08-07 21:39:44 +00:00
Daniel Stenberg
e358a24a75 reset the numcookies counter too (I missed it in the previous commit) 2005-07-28 21:53:09 +00:00
Daniel Stenberg
ec3f269d1f now strdups the cookielist inpointer before passed on, as the cookie function
modifies it
2005-07-28 21:50:34 +00:00
Daniel Stenberg
726b9e2240 If any of the options CURLOPT_HTTPGET, CURLOPT_POST and CURLOPT_HTTPPOST is
set to 1, CURLOPT_NOBODY will now automatically be set to 0.
2005-07-27 22:29:50 +00:00
Daniel Stenberg
2236ba0d20 Peteris Krumins added CURLOPT_COOKIELIST and CURLINFO_COOKIELIST, which is a
simple interface to extracting and setting cookies in libcurl's internal
"cookie jar". See the new cookie_interface.c example code.
2005-07-27 22:17:14 +00:00
Daniel Stenberg
4922904991 Simplified the code within curl_easy_perform() that calls Curl_perform().
Pointed out by Bjorn Reese.
2005-07-17 12:44:11 +00:00
Daniel Stenberg
465e19dbe9 Adrian Schuur added trailer support in the chunked encoding stream. The
trailer is then sent to the normal header callback/stream.
2005-07-12 18:15:34 +00:00
Daniel Stenberg
3b60bb7259 David Shaw's fix that unifies proxy string treatment so that a proxy given
with CURLOPT_PROXY can use a http:// prefix and user + password. The user
and password fields are now also URL decoded properly.

Test case 264 added to verify.
2005-06-22 22:24:10 +00:00
Daniel Stenberg
300b4a9158 Todd Kulesza reported a flaw in the proxy option, since a numerical IPv6
address was not possible to use. It is now, but requires it written
RFC2732-style, within brackets - which incidently is how you enter numerical
IPv6 addresses in URLs. Test case 263 added to verify.
2005-05-31 13:03:26 +00:00
Daniel Stenberg
eff36caea8 additional fix for the malformed URL fix of yday 2005-05-19 07:21:18 +00:00