Commit Graph

381 Commits

Author SHA1 Message Date
Daniel Stenberg 621c2b9015 - Axel Tillequin and Arnaud Ebalard added support for CURLOPT_ISSUERCERT, for
OpenSSL, NSS and GnuTLS-built libcurls.
2008-06-06 20:52:32 +00:00
Daniel Stenberg 3fe8251dfb - Axel Tillequin and Arnaud Ebalard added support for CURLOPT_CRLFILE, for
OpenSSL, NSS and GnuTLS-built libcurls.
2008-06-06 18:40:21 +00:00
Daniel Stenberg 930a45e7a9 - Added CURLINFO_PRIMARY_IP as a new information retrievable with
curl_easy_getinfo. It returns a pointer to a string with the most recently
  used IP address. Modified test case 500 to also verify this feature. The
  implementing of this feature was sponsored by Lenny Rachitsky at NeuStar.
2008-06-06 17:33:35 +00:00
Daniel Stenberg 852989856d - To make it easier for applications that want lots of magic stuff done on
redirections and thus cannot use CURLOPT_FOLLOWLOCATION easily, we now
  introduce the new CURLINFO_REDIRECT_URL option that lets applications
  extract the URL libcurl would've redirected to if it had been told to. This
  then enables the application to continue to that URL as it thinks is
  suitable, without having to re-implement the magic of creating the new URL
  from the Location: header etc. Test 1029 verifies it.
2008-04-30 21:20:08 +00:00
Daniel Stenberg 553ed99e3b Change the confusing two variables for the expect 100 continue stuff into
a single state variable to make the code easier to follow and understand.
2008-03-13 20:56:13 +00:00
Daniel Stenberg 53a549000c - Based on initial work done by Gautam Kachroo to address a bug, we now keep
better control at the exact state of the connection's SSL status so that we
  know exactly when it has completed the SSL negotiation or not so that there
  won't be accidental re-uses of connections that are wrongly believed to be
  in SSL-completed-negotiate state.
2008-02-20 09:56:26 +00:00
Daniel Stenberg 55700cb01f - We no longer support setting the CURLOPT_URL option from inside a callback
such as the CURLOPT_SSL_CTX_FUNCTION one treat that as if it was a Location:
  following. The patch that introduced this feature was done for 7.11.0, but
  this code and functionality has been broken since about 7.15.4 (March 2006)
  with the introduction of non-blocking OpenSSL "connects".

  It was a hack to begin with and since it doesn't work and hasn't worked
  correctly for a long time and nobody has even noticed, I consider it a very
  suitable subject for plain removal. And so it was done.
2008-02-20 08:28:02 +00:00
Daniel Stenberg ffae4f6b48 - Dmitry Kurochkin cleaned up the pipelining code and removed the need for and
use of the "is_in_pipeline" struct field.
2008-02-03 12:31:35 +00:00
Daniel Stenberg b620e62f0f - Dmitry Kurochkin moved several struct fields from the connectdata struct to
the SingleRequest one to make pipelining better. It is a bit tricky to keep
  them in the right place, to keep things related to the actual request or to
  the actual connection in the right place.
2008-01-31 12:04:33 +00:00
Daniel Stenberg ef0ed9b720 Dmitry Kurochkin removed the cancelled state for pipelining, as we agreed
that it is bad anyway. Starting now, removing a handle that is in used in a
pipeline will break the pipeline - it'll be set back up again but still...
2008-01-21 23:48:58 +00:00
Daniel Stenberg b3de497d83 Dmitry Kurochkin worked a lot on improving the HTTP Pipelining support that
previously had a number of flaws, perhaps most notably when an application
fired up N transfers at once as then they wouldn't pipeline at all that
nicely as anyone would think... Test case 530 was also updated to take the
improved functionality into account.
2008-01-16 12:24:00 +00:00
Daniel Stenberg 991505e077 Woops, partly revert my previous commit and do it slightly differently instead.
The signalling of that a global DNS cache is wanted is done by setting the
option but the setting of the internal variable that it is in use must not be
done until it finally actually gets used!

NOTE and WARNING: I noticed that you can't actually switch off the global dns
cache with CURLOPT_DNS_USE_GLOBAL_CACHE but you couldn't do that previously
either and the option is very clearly and loudly documented as DO NOTE USE so
I won't bother to fix this bug now.
2008-01-15 22:44:12 +00:00
Daniel Stenberg 56f17d2c9f I made the torture test on test 530 go through. This was actually due to
silly code left from when we switched to let the multi handle "hold" the dns
cache when using the multi interface... Of course this only triggered when a
certain function call returned error at the correct moment.
2008-01-15 22:15:55 +00:00
Gisle Vanem bcc3c9279a Trying GnuTLS and OpenSSL together fails to compile in not so
obvious ways. Give an explicit error.
2008-01-14 16:51:32 +00:00
Daniel Stenberg 18faa50940 Georg Lippitsch brought CURLOPT_SEEKFUNCTION and CURLOPT_SEEKDATA to allow
libcurl to seek in a given input stream. This is particularly important when
doing upload resumes when there's already a huge part of the file present
remotely. Before, and still if this callback isn't used, libcurl will read
and through away the entire file up to the point to where the resuming
begins (which of course can be a slow opereration depending on file size,
I/O bandwidth and more). This new function will also be preferred to get
used instead of the CURLOPT_IOCTLFUNCTION for seeking back in a stream when
doing multi-stage HTTP auth with POST/PUT.
2008-01-10 10:30:19 +00:00
Daniel Stenberg de23b98522 Introducing curl_easy_pause() and new magic return codes for both the read
and the write callbacks that now can make a connection's reading and/or
writing get paused.
2008-01-08 14:52:05 +00:00
Daniel Stenberg b430576436 Based on further discussion on curl-library, I reverted yesterday's SOCKS5
code to instead introduce support for a new proxy type called
CURLPROXY_SOCKS5_HOSTNAME that is used to send the host name to the proxy
instead of IP address and there's thus no longer any need for a new
curl_easy_setopt() option.

The default SOCKS5 proxy is again back to sending the IP address to the
proxy.  The new curl command line option for enabling sending host name to a
SOCKS5 proxy is now --socks5-hostname.
2008-01-05 22:04:18 +00:00
Daniel Stenberg 2e42b0a252 Based on Maxim Perenesenko's patch, we now do SOCKS5 operations and let the
proxy do the host name resolving and only if --socks5ip (or
CURLOPT_SOCKS5_RESOLVE_LOCAL) is used we resolve the host name locally and
pass on the IP address only to the proxy.
2008-01-04 23:01:00 +00:00
Daniel Stenberg 1c93e75375 Michal Marek introduced CURLOPT_PROXY_TRANSFER_MODE which is used to control
the appending of the "type=" thing on FTP URLs when they are passed to a
HTTP proxy. Some proxies just don't like that appending (which is done
unconditionally in 7.17.1), and some proxies treat binary/ascii transfers
better with the appending done!
2007-12-02 23:38:23 +00:00
Daniel Stenberg 13648f8ccd struct HandleData is now called struct SingleRequest, and is only for data that
is inited at the start of the DO action. I removed the Curl_transfer_keeper
struct completely, and I had to move out a few struct members (that had to
be set before DO or used after DONE) to the UrlState struct. The SingleRequest
struct is accessed with SessionHandle->req.

One of the biggest reasons for doing this was the bunch of duplicate struct
members in HandleData and Curl_transfer_keeper since it was really messy to
keep track of two variables with the same name and basically the same purpose!
2007-11-24 23:16:55 +00:00
Daniel Stenberg b6575ce0b0 While inspecting the Negotiate code, I noticed how the proxy auth was using
the same state struct as the host auth, so both could never be used at the
same time! I fixed it (without being able to check) to use two separate
structs to allow authentication using Negotiate on host and proxy
simultanouesly.
2007-11-20 23:17:08 +00:00
Daniel Stenberg f3b85ef79d a bunch of new comments 2007-11-20 22:57:24 +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 c508d70258 Fixed a remaining problem with doing SFTP directory listings on a re-used
persistent connection. Mentioned by Immanuel Gregoire on the mailing list.
2007-11-12 23:04:44 +00:00
Daniel Stenberg a29471d0f7 spell! 2007-11-08 10:25:23 +00:00
Daniel Stenberg ba6f20a244 Bug report #1823487 (http://curl.haxx.se/bug/view.cgi?id=1823487) pointed
out that SFTP requests didn't use persistent connections. Neither did SCP
ones.  I gave the SSH code a good beating and now both SCP and SFTP should
use persistent connections fine. I also did a bunch for indent changes as
well as a bug fix for the "keyboard interactive" auth.
2007-11-08 10:22:49 +00:00
Daniel Stenberg b9a7f4e502 Move connection-oriented variables from the SessionHandle struct to the
connectdata struct. This will in theory enable us to do persistent connections
with SCP+SFTP, but currently the state machine always (and wrongly) cleanup
everything in the 'done' action instead of in 'disconnect'. Also did a bunch
of indent fixes, if () => if() and a few other source cleanups like added
comments etc.
2007-11-05 09:30:45 +00:00
Daniel Stenberg a3f958aaaa added clarifying comment 2007-10-24 21:09:59 +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
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
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 67d94514b0 Kim Rinnewitz reported that --local-port didn't work with TFTP transfers.
This happened because the tftp code always uncondionally did a bind()
without caring if one already had been done and then it failed. I wrote a
test case (1009) to verify this, but it is a bit error-prone since it will
have to pick a fixed local port number and since the tests are run on so
many different hosts in different situations I add it in disabled state.
2007-10-04 10:01:41 +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
Daniel Stenberg 119364741e known bug #46: chunked-encoded CONNECT responses from a http proxy now works.
Added test case 1008 to verify. Note that #47 is still there.
2007-10-02 10:21:36 +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
Daniel Stenberg a6315359d7 Max Katsev reported that when doing a libcurl FTP request with
CURLOPT_NOBODY enabled but not CURLOPT_HEADER, libcurl wouldn't do TYPE
before it does SIZE which makes it less useful. I walked over the code and
made it do this properly, and added test case 542 to verify it.
2007-09-26 12:00:01 +00:00
Daniel Stenberg 8c3f40ee32 Rob Crittenden provided an NSS update with the following highlights:
o It looks for the NSS database first in the environment variable SSL_DIR,
  then in /etc/pki/nssdb, then it initializes with no database if neither of
  those exist.

o If the NSS PKCS#11 libnspsem.so driver is available then PEM files may be
  loaded, including the ca-bundle. If it is not available then only
  certificates already in the NSS database are used.

o Tries to detect whether a file or nickname is being passed in so the right
  thing is done

o Added a bit of code to make the output more like the OpenSSL module,
  including displaying the certificate information when connecting in
  verbose mode

o Improved handling of certificate errors (expired, untrusted, etc)

The libnsspem.so PKCS#11 module is currently only available in Fedora
8/rawhide. Work will be done soon to upstream it. The NSS module will work
with or without it, all that changes is the source of the certificates and
keys.
2007-09-18 22:21:54 +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 523767660c Fixed some minor mismatched types found by splint. 2007-08-26 05:53:26 +00:00
Gunter Knauf 7f7e42732d added define PORT_LDAPS. 2007-08-15 16:17:32 +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 86ff3194fa added missing part for the qsossl support 2007-07-27 08:33:32 +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
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
James Housley f0b361ecc1 Change rsa and rsa_pub from static arrays in ssh_conn to be dynamically
allocated when needed
2007-06-19 11:31:33 +00:00
James Housley ab7e7144ef * Updates for the latest version of libssh2, specifically
libssh2_sftp_shutdown() and libssh2_session_free() can now return
  LIBSSH2_ERROR_EAGAIN.

* Fix the _send() and _recv() return values so non-blocking works
2007-06-12 21:32:45 +00:00