1
0
mirror of https://github.com/moparisthebest/curl synced 2024-10-31 15:45:12 -04:00
Commit Graph

5715 Commits

Author SHA1 Message Date
Marcel Roelofs
48a40f0402 negotiate sspi: fix sequential requests 2011-05-16 15:21:32 +02:00
Dan Fandrich
2a02c07a15 Fixed compilation when RTSP is disabled 2011-05-06 13:48:59 -07:00
Dan Fandrich
212d8c8f65 Fixed LDAP after RTSP readwrite change 2011-05-06 13:48:24 -07:00
Daniel Stenberg
32001ac414 set_userpass: convert from protocol-specific to generic
The protocol handler's flags field now can set that the protocol
requires a password, so that the set_userpass function doesn't have to
have the specific knowledge of which protocols that do.
2011-05-05 17:07:21 +02:00
Daniel Stenberg
9c629e5348 RTSP: cleanups
Made several functions static

Made one function defined to nothing when RTSP is disabled to avoid
the #ifdefs in code.

Removed explicit rtsp.h includes
2011-05-05 16:53:05 +02:00
Daniel Stenberg
f0612f166a RTSP: convert protocol-specific checks to generic
Add a 'readwrite' function to the protocol handler struct and use that
for the extra readwrite functionality RTSP needs.
2011-05-05 16:27:03 +02:00
Daniel Stenberg
e34131db78 SSL: check for SSL, not specific protocols
Code cleanup to check less for protocols and more for the specific
relevant feature. Like if SSL is required.
2011-05-05 15:49:43 +02:00
Daniel Stenberg
335dfa793c http_perhapsrewind: remove HTTP check
No need to check for HTTP as this is now a HTTP-specific function
2011-05-05 15:38:01 +02:00
Daniel Stenberg
574aecee20 http_perhapsrewind:
make it static, remove Curl_ prefix
2011-05-05 15:18:31 +02:00
Daniel Stenberg
51075a6777 remove FILE protocol-specific checks
Also, convert the BANPROXY flag into NONETWORK for the protocols
(file:// only atm) that don't work over networks.
2011-05-05 15:14:19 +02:00
Daniel Stenberg
558f997e99 socks proxy: allow socks5h:// prefix too
Using 'socks5h' as proxy protocol will make it a
CURLPROXY_SOCKS5_HOSTNAME proxy which is SOCKS5 and asking the proxy to
resolve host names. I found no "standard" protocol name for this.
2011-05-05 11:47:55 +02:00
Daniel Stenberg
61877b569f Corrected comments
closepolicy has been deprecated and unused for years
2011-05-05 00:02:39 +02:00
Daniel Stenberg
dc15a88076 ConnectionStore: remove unused return code 2011-05-04 23:56:18 +02:00
Daniel Stenberg
adae5926dd indent correctly 2011-05-04 23:45:30 +02:00
Daniel Stenberg
7d94af497d SSH: set non-blocking earlier
Introduce an INIT state for the SSH state machine and set libssh2
non-blocking in that so that it is set properly before
libssh2_session_startup() is called.

Bug: http://curl.haxx.se/mail/archive-2011-05/0001.html
2011-05-01 23:02:39 +02:00
Daniel Stenberg
821301de15 ConnectionExists: avoid NULL dereference
When checking for connections that are bound to a particular device we
must make sure we don't compare with a NULL pointer.
2011-04-29 16:46:49 +02:00
Daniel Stenberg
3440f4d374 resolver_error: remove bad semicolon 2011-04-29 16:33:45 +02:00
Daniel Stenberg
5b7e1f9efe gai_strerror: provide private implementation
There are systems (like NetWare) without its own gai_strerror()
function.
2011-04-28 15:25:03 +02:00
Daniel Stenberg
c33aee1667 treaded-resolver: better error messages
Now use gai_strerror() to get proper error messages when getaddrinfo()
has failed. Detect the function in configure.

Code based on work and suggestions by Jeff Pohlmeyer and Guenter Knauf
2011-04-28 15:25:03 +02:00
Daniel Stenberg
3b1b26578f proxy: allow socks:// prefix in proxy string
Inspired by a patch from OB.Conseil. Added test case 708 to verify.
2011-04-28 15:08:09 +02:00
Zmey Petroff
2cbe885c1a CMake: improve library search, implement install.
Improved library search by check_function_exists_concat() macro:
it does not revert the list of libraries any more.

Improved OpenSSL library search: first find zlib, then search for
openssl libraries that may depend on zlib.

For Unix: openssl libraries can now be detected in nonstandard
locations. Supply CMAKE_LIBRARY_PATH to CMake on command line.

Added installation capability (very basic one yet).
2011-04-28 10:12:33 +02:00
Daniel Stenberg
4a42e5cdaa multi-socks: fix connect to proxy
When connecting to a socks or similar proxy we do the proxy handshake at
once when we know the TCP connect is completed and we only consider the
"connection" complete after the proxy handshake. This fixes test 564
which is now no longer considered disabled.

Reported by: Dmitri Shubin
Bug: http://curl.haxx.se/mail/lib-2011-04/0127.html
2011-04-28 10:06:49 +02:00
Daniel Stenberg
53ef3493bf cleanup: remove old unused debug code 2011-04-28 09:21:20 +02:00
Dan Fandrich
cbd98b2c28 Make checksrc.pl work on out-of-tree builds
Source files given with absolute paths do not have the
-D directory specifier prepended.
2011-04-27 12:42:15 -07:00
Daniel Stenberg
4685db9462 make: add checksrc.pl to dist 2011-04-27 11:42:02 +02:00
Daniel Stenberg
45de057920 make: add 'checksrc' as target to check code style
The make target checksrc now works in the root makefile and in both the
src and lib directories.

It is also run automatically on "all" if configure --enable-debug was
used.
2011-04-27 10:23:27 +02:00
Daniel Stenberg
6a6981503e checksrc: add -W to allow a file to be whitelisted
Useful when a known file just doesn't comply and there's no intention to
make it do so.
2011-04-27 09:09:35 +02:00
Daniel Stenberg
889d1e973f whitespace cleanup: no space first in conditionals
"if(a)" is our style, not "if( a )"
2011-04-27 09:09:35 +02:00
Daniel Stenberg
1b758b01c1 lib/make: run checksrc.pl once for all files
Since it now supports multiple files this will be faster and will show
problems for more file than one at a time - more convenient.
2011-04-27 09:09:35 +02:00
Daniel Stenberg
7ddcc8fea4 checksrc: scan many files, more checks
It now scans multiple files and outputs an error+warning count summary
at the end in case at least one was detected.

-D can be used to specify in which dir the files are located

The script now scans for conditions that starts with a space for
if/while/for lines.
2011-04-27 09:09:35 +02:00
Daniel Stenberg
068d656c6d Makefile: run checksrc if debug enabled
And make the build fail if a warning or error was detected
2011-04-27 09:09:35 +02:00
Daniel Stenberg
92f722017c checksrc: exit error code if warnings or errors 2011-04-27 09:09:35 +02:00
Daniel Stenberg
9869668884 SSH: move knownhost logic to separate function 2011-04-27 09:09:35 +02:00
Daniel Stenberg
b903186fa0 source cleanup: unify look, style and indent levels
By the use of a the new lib/checksrc.pl script that checks that our
basic source style rules are followed.
2011-04-27 09:09:35 +02:00
Guenter Knauf
592eda8e3f Windows native IDN fixes.
For now provide prototypes instead of including the
non-standard normalisation.h which is only available in the
"Internationalized Domain Names Mitigation APIs" download.
2011-04-27 03:53:03 +02:00
Dan Fandrich
6d013b0aab Fixed compiler warning in Windows SSPI case 2011-04-25 21:58:37 -07:00
Dan Fandrich
bcc29cda8e Fixed compilation when the synchronous resolver is used 2011-04-25 19:01:40 -07:00
Dan Fandrich
4235457129 Added new resolver sources to Symbian and VC6 build files 2011-04-25 18:07:32 -07:00
Daniel Stenberg
e9542ccab6 hostip: comment fixed to state current situation 2011-04-25 19:50:56 +02:00
Daniel Stenberg
7de2f9271c async resolvers: further cleanups
asyn-ares.c and asyn-thread.c are two separate backends that implement
the same (internal) async resolver API for libcurl to use. Backend is
specified at build time.

The internal resolver API is defined in asyn.h for asynch resolvers.
2011-04-25 19:47:16 +02:00
Daniel Stenberg
24d84da073 asynch resolvers: cleanup
Fixed indents, coding conventions and white space edits.

Modified the c-ares completion callback function to again NOT read the
conn data when the ares handle is being taken down as then it may have
been freed already.
2011-04-25 19:47:16 +02:00
Vsevolod Novikov
ca015f1a45 asynch resolvers: unified
Introducing an internal API for handling of different async resolver
backends.
2011-04-25 19:47:16 +02:00
Guenter Knauf
722f286f80 Enabled OpenWatcom native Windows IDN build.
For now we directly import the Idn* symbols with the linker;
an upcoming release of OWC will have these added to the import
lib normaliz.lib, and prototypes are added to winnnls.h.
2011-04-24 18:58:07 +02:00
Daniel Stenberg
f20b4606de NTLM: work with unicode
Rewritten code from a patch brought by Matteo Rocco.
2011-04-22 22:04:10 +02:00
Dan Fandrich
17df5d8caa Include unistd.h to declare close() 2011-04-21 14:47:07 -07:00
Fabian Keil
210278d9a1 In lib/, change 'wanna' to 'want to'.
Found with codespell.
2011-04-21 07:55:53 -07:00
Fabian Keil
1702a2c08d Fix a couple of spelling errors in lib/
Found with codespell.
2011-04-21 07:55:53 -07:00
Julien Chaffraix
9230be0797 transfer.c: Fixed indentation in readwrite_data. 2011-04-21 07:55:53 -07:00
Daniel Stenberg
3242abd87a SFTP: close file before postquote
Make sure that files are closed before the post quote commands run as if
they operate on the just transferred file they could otherwise easily
fail.

Patch by: Rajesh Naganathan (edited)
2011-04-20 23:37:29 +02:00
Daniel Stenberg
c2c8948190 Curl_http_connect: detect HTTPS properly after CONNECT
libcurl failed to check the correct struct for HTTPS after CONNECT was
issued to the proxy, so it didn't do the TLS handshake and subsequently
failed the connection. A regression released in 7.21.5 (introduced
around commit 8831000bc0).

Bug: http://curl.haxx.se/mail/lib-2011-04/0134.html
Reported by: Josue Andrade Gomes
2011-04-20 22:50:04 +02:00
Gisle Vanem
9039d19f01 CURL_DOES_CONVERSIONS: fixes
Made it compile and work again after the code move.
2011-04-20 15:23:57 +02:00
Daniel Stenberg
c828646f60 CURL_DOES_CONVERSIONS: cleanup
Massively reduce #ifdefs all over (23 #ifdef lines less so far)
Moved conversion-specific code to non-ascii.c
2011-04-20 00:50:07 +02:00
Guenter Knauf
eb65a49bef Improve MinGW static makefile builds.
It is now possible to use any combination of features without
having to 1st add makefile targets to the main makefile. The
main makefile now passes the 'mingw32-feat1-feat2' as var CFG,
and the ./[lib|src]/Makefile.m32 parses the CFG var to determine
the features to be enabled.
2011-04-19 20:59:24 +02:00
Guenter Knauf
b2140a09f8 Enabled MinGW native Windows IDN build. 2011-04-19 17:28:28 +02:00
Guenter Knauf
519bec7c91 Windows native IDN fixes.
changed windows.h include to system header;
changed obsolete 2nd check for str_w to str_utf8 in order to catch
malloc() failure and avoid a free(NULL);
changed calls to GetLastError() to void to kill unsused var compiler
warnings;
moved one call to GetLastError() into else case so that its only
called when WideCharToMultiByte() really fails.
2011-04-19 17:13:09 +02:00
Guenter Knauf
24e5a40156 Windows native IDN fixes.
Provide prototype for curl_win32_idn_to_ascii();
remove wrong 3rd parameter from curl_win32_idn_to_ascii() call.
2011-04-19 16:48:32 +02:00
Guenter Knauf
24667466f0 Updated default (recommended) dependency versions. 2011-04-19 14:26:51 +02:00
Daniel Stenberg
5aae3c13e2 transfer-encoding: document the options
The new libcurl and command line options are now described.
2011-04-18 19:46:21 +02:00
Daniel Stenberg
8e4fb01e64 transfer-encoding: added new option and cmdline
Added CURLOPT_TRANSFER_ENCODING as the option to set to request Transfer
Encoding in HTTP requests (if built zlib enabled). I also renamed
CURLOPT_ENCODING to CURLOPT_ACCEPT_ENCODING (while keeping the old name
around) to reduce the confusion when we have to encoding options for
HTTP.

--tr-encoding is now the new command line option for curl to request
this, and thus I updated the test cases accordingly.
2011-04-18 19:46:21 +02:00
Daniel Stenberg
ebb37eac8b CURLE_BAD_CONTENT_ENCODING: now used for transfer encoding too 2011-04-18 19:46:21 +02:00
Daniel Stenberg
9d191a6a40 TE: do the Connection: header
When TE: is inserted in the request, we must add a "Connection: TE" as
well to be HTTP 1.1 compliant. If a custom Connection: header is passed
in, we must use that and only append TE to it. Test case 1125 verifies
TE: + custom Connection:.
2011-04-18 19:46:21 +02:00
Daniel Stenberg
2db6f7e703 TE: rename struct field content_encoding
Since this struct member is used in the code to determine what and how
to decode automatically and since it is now also used for compressed
Transfer-Encodings, I renamed it to the more suitable 'auto_decoding'
2011-04-18 19:46:21 +02:00
Daniel Stenberg
0790b27910 HTTP: add support for gzip and deflate Transfer-Encoding
Transfer-Encoding differs from Content-Encoding in a few subtle ways,
but primarily it concerns the transfer only and not the content so when
discovered to be compressed we know we have to uncompress it. There will
only arrive compressed transfers in a response after we have requested
them with the appropriate TE: header.

Test case 1122 and 1123 verify.
2011-04-18 19:46:21 +02:00
Daniel Stenberg
a5ee8d50c3 base64.c: removed wrong comment 2011-04-17 23:03:33 +02:00
Daniel Stenberg
6cfbf21acf Curl_ssl_shutdown: restore send/recv pointers
When going back from SSL, put the send/recv function pointers back to
the plain versions.

Bug: http://curl.haxx.se/mail/lib-2011-04/0070.html
Reported by: Mehmet Bozkurt
2011-04-16 00:16:25 +02:00
Guenter Knauf
72da921942 Changed email per Gisle's request. 2011-04-16 00:11:43 +02:00
Andrei Benea
fb80a0a082 Fix a buffer overflow in pubkey_show(). 2011-04-14 23:02:29 +02:00
Guenter Knauf
e84730948d Replaced var manipulations with perlish hacks. 2011-04-14 01:27:39 +02:00
Daniel Stenberg
f01df19798 checkconnection: don't call with NULL pointer
When checking if an existing RTSP connection is alive or not, the
checkconnection function might be called with a SessionHandle pointer
being NULL and then referenced causing a crash. This happened only using
the multi interface.

Reported by: Tinus van den Berg

Bug: http://curl.haxx.se/bug/view.cgi?id=3280739
2011-04-11 13:17:55 +02:00
Daniel Stenberg
c66b0b32fb OpenSSL: no-sslv2 aware
Allow openSSL without SSL2 to be used. This fix is inspired by the fix
provided by Cristian Rodrguez.

Reported by: Cristian Rodrguez
2011-04-10 19:14:22 +02:00
Kamil Dudka
1a6e7da13d nss: allow to use multiple client certificates for a single host
In case a client certificate is used, invalidate SSL session cache
at the end of a session.  This forces NSS to ask for a new client
certificate when connecting second time to the same host.

Bug: https://bugzilla.redhat.com/689031
2011-04-08 13:35:26 +02:00
Daniel Stenberg
23544f35fd mk-ca-bundle.pl: show full URL in output
When I decided to search for a potential error with the cacert bundle it
struck me I wanted to see the full source URL in the output...
2011-04-07 22:42:22 +02:00
Gisle Vanem
89fa3b3efb lib/Makefile.b32: updates
* Rename the object object directory from 'objs' to 'BCC_obj'. I feel
 it should be named properly. Ref. Makefile.Watcom where it's called
 'WC_Win32.obj'.

* Turn off these warnings to keep the build totally silent (with CBuilder-6
 that is).
  -w-inl    8026 Functions X are not expanded inline.
  -w-pia   8060 Possibly incorrect assignment
  -w-pin  8061 Initialization is only partially bracketed

I'm sure the warnings could be fixed the "proper" way or with some added
"#pragma" statements. But that just clutters the sources IMHO.

* $(MKDIR) and $(RMDIR) have been replaced with the shell-commands 'md'
 and 'rd'. When having MingW/Msys programs 'mkdir.exe' and 'rmdir.exe' in
$PATH, this confuses Borland's make and the result (the cleaning etc.) would
 not be as expected.

* Added a ".path.int = $(OBJDIR)" to tell make where the $(PREPROCESSED)
 files are. Why we need the preprocess step in the fist place is beyond me
(Yang?). But I'll leave that for now.
2011-04-07 15:17:58 +02:00
Chris Smowton
d54668eb00 HTTP pipelining: Fix handling of zero-length responses
Also add test case 584 for the same

Bug: http://curl.haxx.se/bug/view.cgi?id=3214223
2011-04-07 14:18:07 +02:00
Dan Fandrich
c22c258029 Changed some nonportable types 2011-04-05 22:31:45 -07:00
Dan Fandrich
6eb484942b Don't list NTLM in curl-config when HTTP is disabled
Also, fixed Curl_proxyCONNECT() stub with HTTP disabled.
2011-04-05 22:29:21 -07:00
Daniel Stenberg
01f05d0c75 return code cleanup: build, init and run-time errors
Stop the abuse of CURLE_FAILED_INIT as return code for things not being
init related by introducing two new return codes:

CURLE_NOT_BUILT_IN and CURLE_UNKNOWN_OPTION

CURLE_NOT_BUILT_IN replaces return code 4 that has been obsoleted for
several years. It is used for returning error when something is
attempted to be used but the feature/option was not enabled or
explictitly disabled at build-time. Getting this error mostly means that
libcurl needs to be rebuilt.

CURLE_FAILED_INIT is now saved and used strictly for init
failures. Getting this problem means something went seriously wrong,
like a resource shortage or similar.

CURLE_UNKNOWN_OPTION is the option formerly known as
CURLE_UNKNOWN_TELNET_OPTION (and the old name is still present,
separately defined to be removed in a very distant future). This error
code is meant to be used to return when an option is given to libcurl
that isn't known. This problem would mostly indicate a problem in the
program that uses libcurl.
2011-04-05 15:14:02 +02:00
Daniel Stenberg
8321a367ee FTP+proxy: macrofied functions when proxy disabled
In my attempts to reduce #ifdefs in code, the SOCKS functions are now
macros when libcurl is built without proxy support and therefore the FTP
code could avoid some #ifs.
2011-04-05 13:55:11 +02:00
Ben Noordhuis
db59b6202d [pop3 starttls] PASS command was not sent after upgrade to TLS. 2011-04-05 13:38:31 +02:00
Ben Noordhuis
e7837bfd03 [pop3 starttls] the command to send is STLS, not STARTTLS. 2011-04-05 13:38:31 +02:00
Daniel Stenberg
02dbfa2192 http-proxy: move proxy code to http_proxy.c
The new http_proxy.* files now host HTTP proxy specific code (500+ lines
moved out from http.c), and as a consequence there is a macro introduced
for the Curl_proxyCONNECT() function so that code can use it without
actually supporting proxy (or HTTP) in builds.
2011-04-04 19:38:00 +02:00
Daniel Stenberg
9d1e914a56 disable cookies: remove ifdefs, move code
1 - make sure to #define macros for cookie functions in the cookie
header when cookies are disabled to avoid having to use #ifdefs in code
using those functions.

2 - move cookie-specific code to cookie.c and use the functio
conditionally as mentioned in (1).

net result: 6 #if lines removed, and 9 lines of code less
2011-04-04 19:27:26 +02:00
Kamil Dudka
d3408d0593 nss: fix a crash within SSL_AuthCertificate()
The bug was introduced in 806dbb0 (a wrong value was passed in as the
first argument to the default callback in our wrapper).
2011-04-04 18:34:19 +02:00
Daniel Stenberg
318c5c802b multi: shorten lines
We keep them less than 80 columns
2011-04-03 00:07:32 +02:00
Daniel Stenberg
c2459c4328 multi: conn goes bad when data change
Within multi_socket when conn is used as a shorthand, data could be
changed and multi_runsingle could modify the connectdata struct to deal
with. This bug has not been included in a public release.

Using 'conn' like that turned out to be ugly. This change is a partial
revert of commit f1c6cd42f4.

Reported by: Miroslav Spousta
Bug: http://curl.haxx.se/bug/view.cgi?id=3265485
2011-04-02 23:44:11 +02:00
Guenter Knauf
c37ad9e909 Increased script version. 2011-04-01 15:04:53 +02:00
Guenter Knauf
5eda4bf726 Make use of proxy vars if set.
Posted to the list by Quanah Gibson-Mount [quanah zimbra.com].
2011-04-01 14:58:36 +02:00
Guenter Knauf
e02c90dc19 Use var again instead of hard-coded filename. 2011-04-01 14:38:01 +02:00
Gisle Vanem
f1c6cd42f4 typo fix 2011-03-29 13:08:01 +02:00
Peter Sylvester
2531cd94a5 TSL-SRP: enabled with OpenSSL
If a new enough OpenSSL version is used, configure detects the TLS-SRP
support and enables it.
2011-03-25 23:09:28 +01:00
Daniel Stenberg
11c2db2aa2 fix: re-use of bound connections
When asked to bind the local end of a connection when doing a request,
the code will now disqualify other existing connections from re-use even
if they are connected to the correct remote host.

This will also affect which connections that can be used for pipelining,
so that only connections that aren't bound or bound to the same
device/port you're asking for will be considered.
2011-03-25 16:03:37 +01:00
Daniel Stenberg
cc9e4321d3 rtsp: move protocol code to dedicated file
The RTSP-specific function for checking for "dead" connection is better
located in rtsp.c. The code using this is now written without #ifdefs as
the function call is instead turned into a macro (in rtsp.h) when RTSP
is disabled.
2011-03-23 17:27:58 +01:00
Daniel Stenberg
67eb679264 ipv6: only probe once
Move ipv6-functional-probe into a single function that is used from all
places that need to know.

Make the probe function store the result in a static variable so that
subsequent invokes just returns the previous result and won't have to
probe again.
2011-03-23 11:10:55 +01:00
Julien Chaffraix
34ef39015e progress: don't print the last update on a separate line.
Curl_posttransfer is called too soon to add the final new line.
Moved the new line logic to pgrsDone as there is no more call to
update the progress status after this call.

Reported by: Dmitri Shubin <sbn_at_tbricks.com>
http://curl.haxx.se/mail/lib-2010-12/0162.html
2011-03-21 21:00:56 -07:00
Daniel Stenberg
058fb33557 retry-request: rewind if data was sent
When libcurl sends a HTTP request on a re-used connection and detects it
being closed (ie no data at all was read from it), it is important to
rewind if any data in the request was sent using the read callback or
was read from file, as otherwise the retried request will be broken.

Reported by: Chris Smowton
Bug: http://curl.haxx.se/bug/view.cgi?id=3195205
2011-03-20 23:24:45 +01:00
Julien Chaffraix
0f07142509 url: 0 is PROTOPT_NONE.
Tiny tweak after Daniel's refactoring of the protocol handlers.
2011-03-19 22:42:12 -07:00
Daniel Stenberg
3a87dd8b20 pop3: add state name in debug array
We have an array with the state names only built and used when built
debug enabled and this need to list all the states from the .h
2011-03-19 11:05:45 +01:00
Dan Fandrich
663a52c2f8 pop3: use Curl_safefree() to allow torture tests to succeed 2011-03-18 11:20:24 -07:00
Daniel Stenberg
0c05ee3a33 pop3: remove unused variable 2011-03-18 09:18:22 +01:00
Dan Fandrich
ef1c18b952 Added support for LISTing a single POP3 message
Added tests for a number of POP3 LIST operations, including one
that shows a curl problem when listing no messages, so is
disabled.
2011-03-17 16:59:30 -07:00
Dan Fandrich
409867e62b pop3: fixed memory leak in an error retrieval case 2011-03-17 16:28:12 -07:00
Daniel Stenberg
93290f69d0 connection setup: if HTTP is disabled asking for HTTP proxy is bad 2011-03-17 11:45:58 +01:00
Daniel Stenberg
e114648991 scan-build warning
Value stored to 'len' is never read
2011-03-16 00:19:26 +01:00
Daniel Stenberg
b8118dd495 ldap_recv: check return code from ldap_get_dn_ber 2011-03-16 00:16:34 +01:00
Daniel Stenberg
025b9368f8 compiler warnings fixed
Use (void)[variable] to inhibit unused argument/variables warnings.
2011-03-16 00:08:32 +01:00
Ben Noordhuis
521e88e009 SMTP-multi: non-blocking connect
Use Curl_ssl_connect_nonblocking() when upgrading the connection to
TLS/SSL while using the multi interface.
2011-03-15 20:10:02 +01:00
Ben Noordhuis
88e825de86 SMTP in multi mode: use Curl_ssl_connect_nonblocking() when connecting. 2011-03-15 20:09:51 +01:00
Daniel Stenberg
36cb24ec19 buildfix: spell define correctly 2011-03-15 16:49:27 +01:00
Kamil Dudka
806dbb022b 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.

Bug: https://bugzilla.redhat.com/678580
2011-03-15 15:48:24 +01:00
Daniel Stenberg
cc228ea6f6 protocol handler cleanup: SSL awareness
As a follow-up to commit 8831000bc0: don't assume that the SSL powered
protocol alternatives are available.
2011-03-15 10:02:05 +01:00
Daniel Stenberg
211504ba8a ldap: use the new protocol handler setup
Use the new flags field and stop using the old protocol defines.
2011-03-15 09:13:11 +01:00
Daniel Stenberg
13b64d7558 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.
2011-03-14 22:52:14 +01:00
Daniel Stenberg
8831000bc0 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.
2011-03-14 22:22:22 +01:00
Daniel Stenberg
fdaa8da75d sslgen: define Curl_ssl_connect_nonblocking for non-SSL
The non-blocking connect improvement for IMAP showed that we didn't
properly define the Curl_ssl_connect_nonblocking function for non-SSL
builds.

Reported by: Tor Arntsen
2011-03-14 11:13:12 +01:00
Ask Bjørn Hansen
3e00af34c8 mk-ca-bundle.pl: Only download if modified
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.
2011-03-14 10:20:21 +01:00
Daniel Stenberg
3eac14b43c 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.
2011-03-13 23:21:03 +01:00
Daniel Stenberg
60406ff7f8 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...
2011-03-13 14:19:16 +01:00
Daniel Stenberg
ca37692bf4 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.

Fixes test 582.
2011-03-13 14:10:27 +01:00
Daniel Stenberg
c8fba59731 Merge branch 'imap' of https://github.com/bnoordhuis/curl into bnoordhuis-imap 2011-03-13 00:36:38 +01:00
Karl M
05ebc6f0cc VC: add missing file
http_negotiate_sspi.c was added to the source tree recently
2011-03-13 00:23:04 +01:00
Marcus Sundberg
6f0ee717c3 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>
2011-03-13 00:21:07 +01:00
Daniel Stenberg
60172a0446 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
2011-03-13 00:15:59 +01:00
Daniel Stenberg
bec9692a77 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).

This is one of the problems detected by test 582.
2011-03-12 23:08:10 +01:00
Daniel Stenberg
a07a865d5d readwrite_upload: stop upload at file size
As we know how much to send, we can and should stop once we've sent that
much data as it avoids having to rely on other mechanisms to detect the
end.

This is one of the problems detected by test 582.

Reported by: Henry Ludemann <misc@hl.id.au>
2011-03-12 23:05:11 +01:00
Daniel Stenberg
cccba72920 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.

This is one of the problems detected by test 582.

Reported by: Henry Ludemann <misc@hl.id.au>
2011-03-12 23:02:04 +01:00
Daniel Stenberg
1aeb635cdd 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.
2011-03-10 12:04:33 +01:00
Daniel Stenberg
d6b9f76943 cyassl: fix compiler warnings 2011-03-08 14:09:20 +01:00
Todd A Ouska
9e60d8fd9e SSL: (part 2) Added CyaSSL to SSL abstraction layer
This is the modified existing files commit.
2011-03-08 13:54:58 +01:00
Todd A Ouska
a8f30fa555 SSL: Added CyaSSL to SSL abstraction layer
CyaSSL (available from git@github.com:cyassl/cyassl.git) has been
added to the SSL abstraction layer.

To test:
1) git CyaSSL sources
2) autoreconf -i
3) ./configure --disable-static
4) make
5) sudo make install
6) autoreconf -i
7) git curl sources (and this patch)
8) ./configure --disable-shared --with-cyassl --without-ssl --enable-debug
9) make
10) normal testing

Please send questions or comments to todd@yassl.com .
2011-03-08 13:06:38 +01:00
Dan Fandrich
29f0898525 Fixed libcurl to honour the --disable-ldaps configure option 2011-03-07 17:45:33 -08:00
Daniel Stenberg
c9ee341bfb cpp: correct #endif placement
The end-of-file #endif in rawstr.h was not correcly positioned after all
prototypes.

Reported by: Boris
Bug: http://curl.haxx.se/bug/view.cgi?id=3195205
2011-03-06 23:00:28 +01:00
Stefan Krause
8511b6436c transfer: avoid insane conversion of time_t 2011-03-04 21:17:08 +01:00
Daniel Stenberg
17de1cc382 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
2011-02-26 11:00:44 +01:00
Julien Chaffraix
5719e56168 http: removed wrong unused comment.
|premature| is used in Curl_http_done.
2011-02-25 20:54:39 -08:00
Julien Chaffraix
d7846237a4 http: removed code duplication for stubbed https_getsock function. 2011-02-25 20:50:26 -08:00
Kamil Dudka
7aa2d10e0d nss: do not ignore failure of SSL handshake
Flaw introduced in fc77790 and present in curl-7.21.4.
Bug: https://bugzilla.redhat.com/669702#c16
2011-02-22 13:19:57 +01:00
Julien Chaffraix
0b8cdc0635 netrc: Removed _NETRC_DEBUG code.
This is not needed anymore as we have unit testing running on it.
2011-02-20 21:11:53 -08:00
Julien Chaffraix
9f8e960a1a 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.
2011-02-20 21:11:52 -08:00
Ben Noordhuis
dd3760f2eb IMAP in multi mode: use Curl_ssl_connect_nonblocking() when upgrading the connection to TLS/SSL. 2011-02-20 21:11:12 +01:00
Ben Noordhuis
45ca048f44 IMAP in multi mode: use Curl_ssl_connect_nonblocking() when connecting. 2011-02-20 21:11:12 +01:00
Mike Crowe
c4369f34b9 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.
2011-02-18 23:19:14 +01:00
Daniel Stenberg
d85cae9225 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.

Reported by: Alona Rossen
Bug: http://curl.haxx.se/mail/lib-2011-02/0195.html
2011-02-18 23:01:55 +01:00
Hoi-Ho Chan
05895927f5 PolarSSL: Return 0 on receiving TLS CLOSE_NOTIFY alert
Signed-off-by: Hoi-Ho Chan <hoiho.chan@gmail.com>
2011-02-18 09:17:32 +01:00
Daniel Stenberg
1c3c0162c6 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.
2011-02-17 22:32:01 +01:00
Kamil Dudka
a40f58d2ef nss: avoid memory leak on SSL connection failure 2011-02-17 17:57:16 +01:00
Guenter Knauf
827f0a318c Set -fpcc-struct-return only for gcc compiler. 2011-02-17 11:46:41 +01:00
Daniel Stenberg
c3a6116dc9 nss_load_key: fix unused variable warning 2011-02-16 19:34:04 +01:00
Daniel Stenberg
f19ace8d33 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.
2011-02-14 13:42:01 +01:00
Guenter Knauf
c2dff28c41 Added -m32 to CFLAGS to compile with x86_64 gcc. 2011-02-13 14:31:22 +01:00
Guenter Knauf
e36c039a07 Updated OpenSSL version, added links to docu. 2011-02-13 12:13:21 +01:00
Dan Fandrich
61fc9044c7 Call ERR_peek_error instead of ERR_peek_last_error
The latter isn't available in older OpenSSL versions, and is
less useful since it returns the most recent error instead of
the first one encountered.
2011-02-10 12:29:34 -08:00
Julien Chaffraix
39d0d787d2 test1304: Added some unit tests for Curl_parsenetrc.
Moved some definitons into the header file so that we can reuse them.
2011-02-10 07:38:48 -08:00
Quinn Slack
3cffcba3d0 CURLE_TLSAUTH_FAILED: removed
On second thought, I think CURLE_TLSAUTH_FAILED should be eliminated. It
was only being raised when an internal error occurred while allocating
or setting the GnuTLS SRP client credentials struct. For TLS
authentication failures, the general CURLE_SSL_CONNECT_ERROR seems
appropriate; its error string already includes "passwords" as a possible
cause. Having a separate TLS auth error code might also cause people to
think that a TLS auth failure means the wrong username or password was
entered, when it could also be a sign of a man-in-the-middle attack.
2011-02-09 23:34:30 +01:00
Daniel Stenberg
b370fcd300 CURLOPT_SOCKOPTFUNCTION: return proper error code
When the callback returns an error, this function must make sure to return
CURLE_ABORTED_BY_CALLBACK properly and not CURLE_OK as before to allow the
callback to properly abort the operation.
2011-02-09 15:36:36 +01:00
Julien Chaffraix
266bcb06d7 netrc: Removed dead code.
The main has not been updated from some time and is out of sync with
the code. The code is now tested by several test cases so no need for
a seperate code path.
2011-02-07 20:15:35 -08:00
Julien Chaffraix
fe165c69de netrc: Tightened up the type checks.
The state should not be anonymous so that we can check if the values
are fine. Added 2 unreachables states to the switch as a result of this
change.
2011-02-07 20:15:35 -08:00
Julien Chaffraix
4e2ac742c9 imap: Fixed typo in a comment. 2011-02-07 20:15:35 -08:00
Daniel Stenberg
0696260122 Curl_gmtime: avoid future mistakes
Document Curl_gmtime() and define away the old functions so that they
won't be used internally again by mistake.
2011-02-07 15:09:24 +01:00
Daniel Stenberg
54d9f060b4 Curl_gmtime: added a portable gmtime
Instead of polluting many places with #ifdefs, we create a single place
for this function, and also check return code properly so that a NULL
pointer returned won't cause problems.
2011-02-07 15:00:48 +01:00
Guenter Knauf
2cacd82661 mk-ca-bundle.vbs: use new cacert url
The official Mozilla page at http://www.mozilla.org/projects/security/certs/
points out a new place as the "proper" place to get Mozilla's CA certs from
so this script is now updated to use that instead.

Reported by: Daniel Mentz
2011-02-03 09:59:00 +01:00
Daniel Stenberg
ec7978c512 mk-ca-bundle.pl: use new cacert url
The official Mozilla page at
http://www.mozilla.org/projects/security/certs/ points out a new place
as the "proper" place to get Mozilla's CA certs from so this script is
now updated to use that instead.

Reported by: Daniel Mentz
2011-02-02 22:22:15 +01:00
Bjoern Sikora
0e9626ba39 ssluse: improved error message on SSL_CTX_new failures
"SSL: couldn't create a context" really isn't that helpful, now it'll
also extract an explanation from OpenSSL and append to the right.
2011-02-02 18:25:57 +01:00
Nicholas Maniscalco
73eb9965cf multi: fix CURLM_STATE_TOOFAST for multi_socket
The code in the toofast state needs to first recalculate the values
before it uses them again since it may have been a while since it last
did it when it reaches this point.
2011-02-02 13:41:22 +01:00
Dave Reisner
b89122a2bf file: add support for CURLOPT_TIMECONDITION 2011-01-31 14:49:51 +01:00
Dave Reisner
99dcb11ed8 transfer: add Curl_meets_timecondition()
This will be used by file_do() and Curl_readwrite() as a unified method
of checking to see if a remote document meets the supplied
CURLOPT_TIMEVAL and CURLOPT_TIMECONDITION.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-01-31 14:29:48 +01:00
Daniel Stenberg
ef19e30985 ares: memory leak fix
The double name resolve trick used with c-ares could leave allocated
memory in 'temp_ai' if the operation was aborted in the middle.
2011-01-27 14:41:07 +01:00
Daniel Stenberg
2d356ba168 ares_query_completed_cb: don't touch invalid data
When this callback is called due to the destruction of the ares handle,
the connection pointer passed in as an argument may no longer pointing
to valid data and this function doesn't need to do anything with it
anyway so we make sure it doesn't.

Bug: http://curl.haxx.se/mail/lib-2011-01/0333.html
Reported by: Vsevolod Novikov
2011-01-27 14:41:07 +01:00
Kamil Dudka
dc0a7161f8 nss: avoid memory leaks and failure of NSS shutdown
... in case more than one CA is loaded.

Bug: https://bugzilla.redhat.com/670802
2011-01-27 11:14:18 +01:00
Daniel Stenberg
dbcaa00657 HTTP: memory leak on multiple Location:
The HTTP parser allocated memory on each received Location: header
without properly freeing old data. Starting now, the code only considers
the first Location: header and will blissfully ignore subsequent ones.

Bug: http://curl.haxx.se/bug/view.cgi?id=3165129
Reported by: Martin Lemke
2011-01-25 12:06:50 +01:00
Darshan Mody
03be2c99ba Fixed compile using OpenSSL versions < 0.9.4a 2011-01-20 12:11:22 -08:00
Quinn Slack
59cf93ccdb TLS-SRP: support added when using GnuTLS 2011-01-19 20:35:02 +01:00
Kamil Dudka
fc77790bcd nss: fix a bug in handling of CURLOPT_CAPATH
... and update the curl.1 and curl_easy_setopt.3 man pages such that
they do not suggest to use an OpenSSL utility if curl is not built
against OpenSSL.

Bug: https://bugzilla.redhat.com/669702
2011-01-18 14:30:49 +01:00
Guenter Knauf
ef46fcdd90 Avoid redefines. 2011-01-17 01:27:57 +01:00
Guenter Knauf
8fa7b8cb9b Added casts to silent gcc warnings. 2011-01-14 12:39:54 +01:00
Yang Tse
fd6b4b3e9b build: BCC - makefile.b32 tweak
Get rid of stdout redirection to NUL and move stderr redirection
into RM and RMDIR macros.
2011-01-13 15:54:14 +01:00
Yang Tse
1da65c3d4d build: BCC - makefile.b32 tweak
Check for BCCDIR environment var done now as other checks.
2011-01-13 15:33:34 +01:00
Guenter Knauf
d541085407 Use env var for PSDK instead of hardcoded path. 2011-01-13 05:55:09 +01:00
Guenter Knauf
c73e5e839d Enabled SSPI support by default. 2011-01-13 02:55:26 +01:00
Yang Tse
61623b74e3 build: BCC - require Borlands's MAKE for Makefile.b32 processing. 2011-01-12 20:53:28 +01:00
Yang Tse
5f7d34811a build: BCC - recover lost functionality from commit 3d81320426
Borland's $(MAKEDIR) expands to the path where make.exe is located,
use this feature to define BCCDIR when user has not defined BCCDIR.
2011-01-12 18:07:04 +01:00
Yang Tse
42f5e8a0f1 build: use external preprocessor cpp32 when building with Borland C 2011-01-12 02:35:14 +01:00
Guenter Knauf
b5cc77bd25 Disable LDAP support since BCC headers are insufficient. 2011-01-11 18:32:38 +01:00
Guenter Knauf
3d81320426 Instead of exiting with error lets set BCCDIR self. 2011-01-11 18:22:42 +01:00
Guenter Knauf
308db9d780 Some Borland C++ makefile tweaks. 2011-01-11 17:51:14 +01:00
Guenter Knauf
03ea06b8e3 Borland C++ doesnt have struct sockaddr_storage. 2011-01-11 17:40:13 +01:00
Daniel Stenberg
08a65b10fb connect: use UDP correctly
The idea that the protocol and socktype is part of name resolving in the
libc functions is nuts. We keep the name resolver functions assume
TCP/STREAM and we make sure that when we want to connect to a UDP
service we use the correct UDP/DGRAM set instead. This bug was because
the ->protocol field was not always set correctly.

This bug was only affecting ipv6-disabled non-cares non-threaded builds.

Bug: http://curl.haxx.se/bug/view.cgi?id=3154436
Reported by: "dperham"
2011-01-11 00:14:36 +01:00
Quinn Slack
1238edaeaf SSL: fix memory leak
In OOM situation. Follow-up fix to commit a9cd4f4ed4.
2011-01-10 13:53:57 +01:00
Daniel Stenberg
a9cd4f4ed4 gtls: fix memory leak
Bug: http://curl.haxx.se/mail/lib-2011-01/0079.html
Reported by: Quinn Slack
2011-01-08 19:14:28 +01:00
Marcel Roelofs
1d28efb9d1 HTTP: HTTP Negotiate authentication using SSPI
Only under Windows
2011-01-07 23:48:40 +01:00
Daniel Stenberg
53014175e8 SSH: speedcheck clobbered existing error
The just added speedcheck must not ruin the error code if already set
due to a problem.
2011-01-06 00:19:17 +01:00
Daniel Stenberg
d45ed0ecf5 SSH: acknowledge speedcheck
Check for speedcheck limits during the state machine traversals
2011-01-05 14:09:53 +01:00
Daniel Stenberg
adb49ad8bb Curl_timeleft: s/conn/data in first argument
As the function doesn't really use the connectdata struct but only the
SessionHanadle struct I modified what argument it wants.
2011-01-04 23:13:10 +01:00
Kamil Dudka
d8f6d1c334 nss: avoid CURLE_OUT_OF_MEMORY given a file name without any slash
Bug: https://bugzilla.redhat.com/623663
2011-01-04 17:20:43 +01:00
Daniel Stenberg
c0c89cd44e get_cert_chain: support larger data sets
512 bytes turned out too short for some data, so now we allocate a
larger buffer instead

Bug: http://curl.haxx.se/mail/archive-2011-01/0002.html
2011-01-04 10:20:28 +01:00
Daniel Stenberg
53640a3ce0 unittesting: build a separate static lib
When configure --enable-debug has been used, all files in lib/ are now
built twice and a separate static library crafted for unit-testing will
be linked. The unit tests in the tests/unit subdir will use that
library.
2011-01-03 22:16:16 +01:00
Daniel Stenberg
45cea71968 SSH: avoid PATH_MAX with alloc
We cannot assume that PATH_MAX will be enough for the remote path name
so allocating room for it is the only sensible approach.
2011-01-03 13:36:45 +01:00
Daniel Stenberg
2b3fbc8cdb Curl_nss_connect: avoid PATH_MAX
Since some systems don't have PATH_MAX and it isn't that clever to
assume a fixed maximum path length, the code now allocates buffer space
instead of using stack.

Reported by: Samuel Thibault
Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608521
2011-01-02 23:43:03 +01:00
Daniel Stenberg
1ad5764feb SFTP: make pwd output result to header callback
Sending "pwd" as a QUOTE command only sent the reply to the
DEBUGFUNCTION. Now it also sends an FTP-like header to the header
callback to allow similar operations as with FTP, and apps can re-use
the same parser.
2011-01-01 15:35:53 +01:00
Daniel Stenberg
ae29142198 pubkey_show: allocate buffer to fit any-size result
The loop condition was wrong so keys larger than 340 bits would overflow
the local stack-based buffer.
2011-01-01 15:33:57 +01:00
Luke Amery
0dc8479b89 ssh: honour the CURLINFO_FTP_ENTRY_PATH curl_getinfo option 2010-12-30 23:42:44 +01:00