Commit Graph

5225 Commits

Author SHA1 Message Date
Daniel Stenberg 19f45eaa79 duphandle: use ares_dup()
curl_easy_duphandle() was not properly duping the ares channel. The
ares_dup() function was introduced in c-ares 1.6.0 so by starting to use
this function we also raise the bar and require c-ares >= 1.6.0
(released Dec 9, 2008) for such builds.

Reported by: Ning Dong
Bug: http://curl.haxx.se/mail/lib-2010-08/0318.html
2010-09-21 16:41:14 +02:00
Daniel Stenberg 8a00c94b0f FTP: fix bad check of Curl_timeleft() return code
When it returns 0 it means no timeout. Only a negative value means that
we're out of time.
2010-09-18 23:08:32 +02:00
Daniel Stenberg 9de4b26643 LDAP: moved variable declaration to avoid compiler warn
If built without HTTP or proxy support it would cause a compiler warning
due to the unused variable. I moved the declaration of it into the only
scope it is used.
2010-09-18 22:50:04 +02:00
Tor Arntsen 3208757c1a LDAP: Use FALSE instead of bool_false when setting bits.close
bool_false is the internal name used in the setup_once.h definition
we fall back to for non-C99 non-stdbool systems, it's not the actual
name to use in assignments (we use bool_false, bool_true there to
avoid global namespace problems, see comment in setup_once.h).
The correct C99 value to use is 'false', but let's use FALSE as
used elsewhere when assigning to bits.close. FALSE is set equal
to 'false' in setup_once.h when possible.

This fixes a build problem on C99 targets.
2010-09-18 14:27:08 +02:00
Tor Arntsen fae19aed8d LDAP: Add missing declaration for 'result' 2010-09-18 14:23:34 +02:00
Mauro Iorio c59dba338e LDAP: Support for tunnelling queries through HTTP proxy
As of curl-7.21.1 tunnelling ldap queries through HTTP Proxies is not
supported. Actually if --proxytunnel command-line option (or equivalent
CURLOPT_HTTPPROXYTUNNEL) is used for ldap queries like
ldap://ldap.my.server.com/... You are unable to successfully execute the
query. In facts ldap_*_bind is executed directly against the ldap server
and proxy is totally ignored. This is true for both openLDAP and
Microsoft LDAP API.

Step to reproduce the error:
Just launch "curl --proxytunnel --proxy 192.168.1.1:8080
ldap://ldap.my.server.com/dc=... "

This fix adds an invocation to Curl_proxyCONNECT against the provided
proxy address and on successful "CONNECT" it tunnels ldap query to the
final ldap server through the HTTP proxy. As far as I know Microsoft
LDAP APIs don't permit tunnelling in any way so the patch provided is
for OpenLDAP only.  The patch has been developed against OpenLDAP 2.4.23
and has been tested with Microsoft ISA Server 2006 and works properly
with basic, digest and NTLM authentication.
2010-09-18 00:03:23 +02:00
Daniel Stenberg a76f852ca4 timeout: use the correct start value as offset
Rodric provide an awesome recipe that proved libcurl didn't timeout at
the requested time - it instead often timed out at [connect time] +
[timeout time] instead of the documented and intended [timeout time]
only. This bug was due to the code using the wrong base offset when
comparing against "now". I could also take the oppurtinity to simplify
the code by properly using of the generic help function for this:
Curl_timeleft.

Reported by: Rodric Glaser
Bug: http://curl.haxx.se/bug/view.cgi?id=3061535
2010-09-17 23:02:33 +02:00
Daniel Stenberg 3880dd3741 Curl_timeleft: avoid returning "no timeout" by mistake
As this function uses return code 0 to mean that there is no timeout, it
needs to check that it doesn't return a time left value that is exactly
zero. It could lead to libcurl doing an extra 1000 ms select() call and
thus not timing out as accurately as it should.

I fell over this bug when working on the bug 3061535 but this fix does
not correct that problem alone, although this is a problem that needs to
be fixed.

Reported by: Rodric Glaser
Bug: http://curl.haxx.se/bug/view.cgi?id=3061535
2010-09-17 22:58:08 +02:00
Daniel Stenberg 296b246b9c multi: don't do extra expire calls for the connection
The timeout is set for the connect phase already at the start of the
request so we should not add a new one, and we MUST not set expire to 0
as that will remove any other potentially existing timeouts.
2010-09-14 22:40:05 +02:00
Daniel Stenberg 22085f7d6e inflate_stream: remove redundant check that is always true 2010-09-12 16:34:16 +02:00
Daniel Stenberg 2c1b4e74e4 digest: make it clear the condition is always true 2010-09-12 16:29:05 +02:00
Daniel Stenberg aca67e2775 ssluse: removed redundant check that is always true 2010-09-12 16:29:04 +02:00
Daniel Stenberg 18a758d907 chunky parser: only rewind if needed
The code reading chunked encoding attempts to rewind the code if it had
read more data than the chunky parser consumes. The rewinding can fail
and it will then cause an error. This change now makes the rewinding
only happen if pipelining is in use - as that's the only time it really
needs to be done.

Bug: http://curl.haxx.se/mail/lib-2010-08/0297.html
Reported by: Ron Parker
2010-09-07 18:29:03 +02:00
Kamil Dudka 7aea2d522d rtsp: avoid SIGSEGV on malformed header 2010-09-06 16:03:37 +02:00
Kamil Dudka f3e3f5f1b2 rtsp: avoid SIGSEGV on malformed header 2010-09-06 15:31:01 +02:00
Daniel Stenberg 62ef465262 warning: fix conversion to 'int' from 'size_t' 2010-09-06 00:18:58 +02:00
Daniel Stenberg c6fa1952a1 portabilty: use proper variable type to hold sockets
Curl_getconnectinfo() is changed to return a proper curl_socket_t for
the last socket so that it'll work more portably (and cause less
compiler warnings).
2010-09-06 00:02:54 +02:00
Guenter Knauf d47bd396ce Trial to fix another compiler warning with braces. 2010-09-03 20:35:34 +02:00
Guenter Knauf a00297158e Moved S_ISREG define to setup as suggested by Dan. 2010-09-02 04:37:13 +02:00
Guenter Knauf 413cbdce3c Use own typedef as workaround for broken sspi.h header (f.e. Watcom). 2010-09-02 00:38:16 +02:00
Guenter Knauf 3238ef5b69 Added S_ISREG define for Win32. 2010-09-02 00:07:05 +02:00
Daniel Stenberg ca10e28f06 multi: fixes for timing out handles
Add a timeout check for handles in the state machine so that they will
timeout in all states disregarding what actions that may or may not
happen.

Fixed a bug in socket_action introduced recently when looping over timed
out handles: it wouldn't assign the 'data' variable and thus it wouldn't
properly take care of handles.

In the update_timer function, the code now checks if the timeout has
been removed and then it tells the application. Previously it would
always let the remaining timeout(s) just linger to expire later on.
2010-09-01 16:52:23 +02:00
Daniel Stenberg 5e92015711 threaded resolver: no more expire 0 calls
Curl_expire() set to 0 expires ALL timeouts so it should only be called
if we truly and really want to remove all timeouts for the handle.
2010-09-01 16:47:42 +02:00
Daniel Stenberg ce00c2ef5d resolve_server: simplify code
Make use of the helper function Curl_timeleft() instead of duplicating
code.
2010-09-01 16:04:39 +02:00
Daniel Stenberg 0db9140747 multi: make sure the next timeout is used when one expires
Each easy handle has a list of timeouts, so as soon as the main timeout
for a handle expires, we must make sure to get the next entry from the
list and re-add the handle to the splay tree.

This was attempted previously but was done poorly in my commit
232ad6549a.
2010-08-31 00:10:44 +02:00
Daniel Stenberg 3af696f7c4 multi: set timeouts when transfer begins
When a new transfer is about to start we now set the proper timeouts to
expire for the multi interface if they are set for the handle. This is a
follow-up bugfix to make sure that easy handles timeout properly when
the times expire and the multi interface is used. This also improves
curl_multi_timeout().
2010-08-29 00:16:34 +02:00
Daniel Stenberg 29439acfeb Makefile: add gopher.c file to build
As the VC and RISCOS makefiles don't use the .inc file
2010-08-25 15:56:35 +02:00
Daniel Stenberg 40e1623649 gopher: enable the header callback/verbosity 2010-08-25 14:21:25 +02:00
Daniel Stenberg cb64c987a0 gopher: fix memory leak and busyloop
The fix for the busyloop really only is a temporary work-around.  It
causes a BLOCKING behavior which is a NO-NO. This function should rather
be split up in a do and a doing piece where the pieces that aren't
possible to send now will be sent in the doing function repeatedly until
the entire request is sent.
2010-08-25 14:21:25 +02:00
Cameron Kaiser 67d1616018 Gopher using Curl_write; test suite (4 tests) 2010-08-25 14:21:25 +02:00
Cameron Kaiser 65629f2915 Remove url.c test 2010-08-25 14:19:58 +02:00
Cameron Kaiser 795107453d Forgot gopher.h in Makefile.inc 2010-08-25 14:19:58 +02:00
Cameron Kaiser 201637d468 Gopher protocol support (initial release) 2010-08-25 14:19:58 +02:00
Daniel Stenberg 6b6a3bcb61 http: handle trailer headers in all chunked responses
HTTP allows that a server sends trailing headers after all the chunks
have been sent WITHOUT signalling their presence in the first response
headers. The "Trailer:" header is only a SHOULD there and as we need to
handle the situation even without that header I made libcurl ignore
Trailer: completely.

Test case 1116 was added to verify this and to make sure we handle more
than one trailer header properly.

Reported by: Patrick McManus
Bug: http://curl.haxx.se/bug/view.cgi?id=3052450
2010-08-25 13:42:14 +02:00
Ben Greear bed311eda2 multi: Fix compile warning on 64-bit systems 2010-08-24 18:30:26 +02:00
Dirk Manske ab6681c2c8 Curl_is_connected: use correct errno
The correctly extracted errno contents were mistakenly overwritten by a newer
value that wasn't the correct error value.

Bug: http://curl.haxx.se/mail/lib-2010-08/0242.html
2010-08-21 00:29:35 +02:00
Guenter Knauf daa96f9928 Added mk-ca-bundle.vbs script.
The script works exactly same as the Perl one except for one thing:
when the text descriptions generated with openssl are included then
the md5 fingerprints are missing; seems openssl has either a bug or
a feature which prints the md5 fingerprint output to stdout instead
of writing them to specified file; this script could here do the same
as what the Perl scripr does (redirect stdout into file) but this
makes the script take up double the time because it needs to launch
cmd.exe 140 times (fo each openssl call). So I think for now we just
ommit the md5 fingerprints, and see if openssl will be fixed.
2010-08-20 03:02:49 +02:00
Dan Fandrich ab81f6c7c4 Fixed a memory leak during OOM in the multi timeout code 2010-08-18 23:08:18 -07:00
Daniel Stenberg 280d2cff2e multi: avoid sending multiple complete messages
I fell over this bug report that mentioned that libcurl could wrongly
send more than one complete messages at the end of a transfer. Reading
the code confirmed this, so I've added a new multi state to make it not
happen. The mentioned bug report was made by Brad Jorsch but is (oddly
enough) filed in Debian's bug tracker for the "wmweather+" tool.

Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593390
2010-08-18 19:59:46 +02:00
Guenter Knauf 2b6208a6de It is sufficient to pipe stderr to NUL to get rid of the nasty messages. 2010-08-18 16:08:20 +02:00
Guenter Knauf 2f0532a072 Added SSPI build to Watcom makefile. 2010-08-18 15:17:05 +02:00
Julien Chaffraix 6b490ed33c progress: callback for POSTs less than MAX_INITIAL_POST_SIZE
Add a call to Curl_pgrsSetUploadSize in this case valided by a test
case.

Reported by: Никита Дорохин.
Bug: http://curl.haxx.se/mail/lib-2010-04/0173.html
2010-08-16 22:56:43 +02:00
Daniel Stenberg 13b8fc46a3 negotiation: Wrong proxy authorization
There's an error in http_negotiation.c where a mistake is using only
userpwd even for proxy requests. Ludek provided a patch, but I decided
to write the fix slightly different using his patch as inspiration.

Reported by: Ludek Finstrle
Bug: http://curl.haxx.se/bug/view.cgi?id=3046066
2010-08-16 22:26:52 +02:00
Guenter Knauf 8f6189600f Syncroniszed vclean target; fixed some comments. 2010-08-15 16:56:03 +02:00
Daniel Stenberg 9124bfba45 multi: use timeouts properly for MAX_RECV/SEND_SPEED
When detecting that the send or recv speed, the multi interface changes
state to TOOFAST and previously there was no timeout set that would
force a recheck but it would rely on the application to somehow call
libcurl anyway. This now sets a timeout for a suitable future time to
check again if the average transfer speed is then below the threshold
again.
2010-08-15 13:16:39 +02:00
Daniel Stenberg 232ad6549a multi: support timeouts
Curl_expire() is now expanded to hold a list of timeouts for each easy
handle. Only the closest in time will be the one used as the primary
timeout for the handle and will be used for the splay tree (which sorts
and lists all handles within the multi handle).

When the main timeout has triggered/expired, the next timeout in time
that is kept in the list will be moved to the main timeout position and
used as the key to splay with. This way, all timeouts that are set with
Curl_expire() internally will end up as a proper timeout. Previously any
Curl_expire() that set a _later_ timeout than what was already set was
just silently ignored and thus missed.

Setting Curl_expire() with timeout 0 (zero) will cancel all previously
added timeouts.

Corrects known bug #62.
2010-08-15 13:16:39 +02:00
Daniel Stenberg 03da3ba1c0 Curl_llist_insert_next: allow insertion first in the list
When we specify the "insert after" entry as NULL, this function now
inserts the new entry first in the list.
2010-08-15 13:16:39 +02:00
Daniel Stenberg 4d53dc5d80 multi: make curl_multi_info_read perform O(1)
Instead of looping over all attached easy handles, this now keeps a list
of messages in the multi handle. It allows curl_multi_info_read() to
perform O(1) no matter how many easy handles that are handled. This is
of importance since this function may be polled very frequently by apps
using the multi interface.
2010-08-15 13:16:39 +02:00
Guenter Knauf 3c2ee9c341 Added OpenSSL builds to Watcom makefiles. 2010-08-11 18:08:39 +02:00
Daniel Stenberg 8348dd96dd warning: silence the compiler
warning: conversion to 'long int' from 'time_t' may alter its value

... on win64 when time_t is 64bit and long is 32bit.
2010-08-11 00:06:20 +02:00