Kamil Dudka [Tue, 15 Mar 2011 13:52:26 +0000 (14:52 +0100)]
nss: do not ignore value of CURLOPT_SSL_VERIFYPEER
When NSS-powered libcurl connected to a SSL server with
CURLOPT_SSL_VERIFYPEER equal to zero, NSS remembered that the peer
certificate was accepted by libcurl and did not ask the second time when
connecting to the same server with CURLOPT_SSL_VERIFYPEER equal to one.
This patch turns off the SSL session cache for the particular SSL socket
if peer verification is disabled. In order to avoid any performance
impact, the peer verification is completely skipped in that case, which
makes it even faster than before.
Daniel Stenberg [Mon, 14 Mar 2011 21:52:14 +0000 (22:52 +0100)]
protocols: use CURLPROTO_ internally
The PROT_* set of internal defines for the protocols is no longer
used. We now use the same bits internally as we have defined in the
public header using the CURLPROTO_ prefix. This is for simplicity and
because the PROT_* prefix was already used duplicated internally for a
set of KRB4 values.
The PROTOPT_* defines were moved up to just below the struct definition
within which they are used.
Daniel Stenberg [Mon, 14 Mar 2011 21:22:22 +0000 (22:22 +0100)]
protocol handler: added flags field
The protocol handler struct got a 'flags' field for special information
and characteristics of the given protocol.
This now enables us to move away central protocol information such as
CLOSEACTION and DUALCHANNEL from single defines in a central place, out
to each protocol's definition. It also made us stop abusing the protocol
field for other info than the protocol, and we could start cleaning up
other protocol-specific things by adding flags bits to set in the
handler struct.
The "protocol" field connectdata struct was removed as well and the code
now refers directly to the conn->handler->protocol field instead. To
make things work properly, the code now always store a conn->given
pointer that points out the original handler struct so that the code can
learn details from the original protocol even if conn->handler is
modified along the way - for example when switching to go over a HTTP
proxy.
Only download and convert the certdata to the ca-bundle.crt if Mozilla
changed the data
The Perl LWP module (which in a bit of a circular reference is used by
mk-ca-bundle.pl) is now indirectly using this script. I made this small
tweak to make it easier to automatically maintain the generated
ca-bundle.crt file in version control.
Daniel Stenberg [Sun, 13 Mar 2011 22:21:03 +0000 (23:21 +0100)]
SSH: add protocol lock direction
Some protocols have to call the underlying functions without regard to
what exact state the socket signals. For example even if the socket says
"readable", the send function might need to be called while uploading,
or vice versa. This is the case for libssh2 based protocols: SCP and
SFTP and we now introduce a define to set those protocols and we make
the multi interface code aware of this concept.
This is another fix to make test 582 run properly.
Daniel Stenberg [Sun, 13 Mar 2011 13:19:16 +0000 (14:19 +0100)]
state: add missing state to debug table
As a new state recently was added to the IMAP state machine it has to be
in the array of names as well as otherwise libcurl crashes when a debug
version runs...
Daniel Stenberg [Sun, 13 Mar 2011 13:10:27 +0000 (14:10 +0100)]
ssh_statemach_act: set cselect for sftp upload
For uploads we want to use the _sending_ function even when the socket
turns out readable as the underlying libssh2 sftp send function will
deal with both accordingly. This is what the cselect_bits magic is for.
Daniel Stenberg [Sat, 12 Mar 2011 23:28:31 +0000 (00:28 +0100)]
TODO-RELEASE: fixed four isues
These issues are now addressed:
276 - Karl M's vc makefile patch
277 - The "Stall when uploading to sftp using multi interface" bug
279 - curl_multi_remove_handle() crashes
280 - Marcus Sundberg's gss patch
Marcus Sundberg [Sat, 12 Mar 2011 23:21:07 +0000 (00:21 +0100)]
GSS: handle reuse fix
Make GSS authentication work when a curl handle is reused for multiple
authenticated requests, by always setting negdata->state in
output_auth_headers().
Signed-off-by: Marcus Sundberg <marcus.sundberg@aptilo.com>
Daniel Stenberg [Sat, 12 Mar 2011 23:18:04 +0000 (00:18 +0100)]
test583: verify early SSH multi remove handle
This test case is meant to verify that the logic in commit 60172a0446bbe3f8b actually works. This test failed for me before that
change and it works after it.
Daniel Stenberg [Sat, 12 Mar 2011 23:15:59 +0000 (00:15 +0100)]
SFTP: gracefully handle shutdown early
When using the multi interface and a handle using SFTP was removed very
early on, we would get a segfault due to the code assumed data was there
that hadn't yet been setup.
Bug: http://curl.haxx.se/mail/lib-2011-03/0066.html
Reported by: Saqib Ali
Manuel Massing [Sat, 12 Mar 2011 22:38:10 +0000 (23:38 +0100)]
CURL_CHECK_FUNC_RECVFROM: android/bionic fix
recvfrom in bionic (the android libc) deviates from POSIX and uses a
const in the 5th argument ("const struct sockaddr *") so the check now
tests for that as well.
Daniel Stenberg [Sat, 12 Mar 2011 22:08:10 +0000 (23:08 +0100)]
PROT_CLOSEACTION: added SFTP and SCP
Both SFTP and SCP are protocols that need to shut down stuff properly
when the connection is about to get torned down. The primary effect of
not doing this shows up as memory leaks (when using SCP or SFTP with the
multi interface).
Daniel Stenberg [Sat, 12 Mar 2011 22:02:04 +0000 (23:02 +0100)]
sftp upload: expire to advance state machine
When using the multi_socket API to do SFTP upload, it is important that
we set a quick expire when leaving the SSH_SFTP_UPLOAD_INIT state as
there's nothing happening on the socket so there's no read or write to
wait for, but the next libssh2 API function needs to be called to get
the ball rolling.
Daniel Stenberg [Thu, 10 Mar 2011 10:48:02 +0000 (11:48 +0100)]
sources: update source headers
All C and H files now (should) feature the proper project curl source
code header, which includes basic info, a copyright statement and some
basic disclaimers.
Daniel Stenberg [Tue, 8 Mar 2011 10:43:42 +0000 (11:43 +0100)]
curl.1: clarify -E
Stress that it is for client certificates and then mention that it also
works for all other SSL-based protocols apart from HTTPS and
FTPS. Namely POP3S, IMAPS and SMTPS for now.
Daniel Stenberg [Sat, 26 Feb 2011 09:59:03 +0000 (10:59 +0100)]
ssh_connect: treat libssh2 return code better
libssh2_knownhost_readfile() returns a negative value on error or
otherwise number of parsed known hosts - this was previously not
documented correctly in the libssh2 man page for the function.
Bug: http://curl.haxx.se/mail/lib-2011-02/0327.html
Reported by: murat
Daniel Stenberg [Tue, 22 Feb 2011 12:28:27 +0000 (13:28 +0100)]
runtests.pl/stopserver: space separate pids
The stopserver function would append pids to kill and could append them
without separating them with space properly. The result would be a very
large number that by (some implementations of) kill would be interpreted
as a negative number and that process group would be wiped...
Julien Chaffraix [Mon, 21 Feb 2011 05:10:36 +0000 (21:10 -0800)]
tests: Cleaned up netrc testing.
Removed the "netrc_debug" keyword replaced with --netrc-file additions.
Removed the debug code from Curl_parsenetrc as it is superseeded by
--netrc-file.
Julien Chaffraix [Mon, 21 Feb 2011 05:10:03 +0000 (21:10 -0800)]
curl: Added --netrc-file.
This enables people to specify a path to the netrc file to use.
The new option override --netrc if both are present. However it
does follow --netrc-optional if specified.
Mike Crowe [Fri, 18 Feb 2011 22:19:14 +0000 (23:19 +0100)]
multi: close connection on timeout
After a request times out, the connection wasn't properly closed and
prevented to get re-used, so subsequent transfers could still mistakenly
get to use the previously aborted connection.
Daniel Stenberg [Thu, 17 Feb 2011 22:51:43 +0000 (23:51 +0100)]
multi: better failed connect treatment
When failing to connect the protocol during the CURLM_STATE_PROTOCONNECT
state, Curl_done() has to be called with the premature flag set TRUE as
for the pingpong protocols this can be important.
When Curl_done() is called with premature == TRUE, it needs to call
Curl_disconnect() with its 'dead_connection' argument set to TRUE as
well so that any protocol handler's disconnect function won't attempt to
use the (control) connection for anything.
This problem caused the pingpong protocols to fail to disconnect when
STARTTLS failed.
Daniel Stenberg [Wed, 9 Feb 2011 14:46:41 +0000 (15:46 +0100)]
SOCKOPTFUNCTION: callback can say already-connected
Introducing a few CURL_SOCKOPT* defines for conveniance. The new
CURL_SOCKOPT_ALREADY_CONNECTED signals to libcurl that the socket is to
be treated as already connected and thus it will skip the connect()
call.
Daniel Stenberg [Mon, 14 Feb 2011 12:42:01 +0000 (13:42 +0100)]
gmtime: remove define
It turns out some systems rely on the gmtime or gmtime_r to be defined
already in the system headers and thus my "precaution" redefining of
them only caused trouble. They are now removed.