Commit Graph

424 Commits

Author SHA1 Message Date
Yang Tse 3184a91ec8 VMS specific preprocessor symbol checking adjustments 2009-12-30 17:59:56 +00:00
Daniel Stenberg b233957885 - Tom Mueller correctly reported in bug report #2870221
(http://curl.haxx.se/bug/view.cgi?id=2870221) that libcurl returned an
  incorrect return code from the internal trynextip() function which caused
  him grief. This is a regression that was introduced in 7.19.1 and I find it
  strange it hasn't hit us harder, but I won't persue into figuring out
  exactly why.
2009-10-01 07:59:45 +00:00
Daniel Stenberg 5ed274d0b7 - Constantine Sapuntzakis: The current implementation will always set
SO_SNDBUF to CURL_WRITE_SIZE even if the SO_SNDBUF starts out larger.  The
  patch doesn't do a setsockopt if SO_SNDBUF is already greater than
  CURL_WRITE_SIZE. This should help folks who have set up their computer with
  large send buffers.
2009-10-01 07:05:07 +00:00
Gunter Knauf 39704bec3c add cast to silent compiler warning with 64bit systems. 2009-08-29 04:12:51 +00:00
Daniel Stenberg d709cb2ae3 - Eric Wong introduced curlx_nonblock() that the curl tool now (re-)uses for
setting a file descriptor non-blocking. Used by the functionality Eric
  himself brough on June 15th.
2009-07-09 21:47:24 +00:00
Daniel Stenberg 6ca321ca75 Curl_sndbufset is (at times) defined in the header, no need to do it again here 2009-05-07 20:02:51 +00:00
Daniel Stenberg 9c788a529b - Made the SO_SNDBUF setting for the data connection socket for ftp uploads as
well. See change 28 Apr 2009.
2009-05-07 20:00:44 +00:00
Yang Tse 9137e717b0 Use build-time configured curl_socklen_t instead of socklen_t 2009-05-02 02:37:32 +00:00
Yang Tse c174b13f8b fix compiler warning: unused parameter 2009-04-30 09:32:02 +00:00
Daniel Stenberg d068001102 - Constantine Sapuntzakis filed bug report #2783090
(http://curl.haxx.se/bug/view.cgi?id=2783090) pointing out that on windows
  we need to grow the SO_SNDBUF buffer somewhat to get really good upload
  speeds. http://support.microsoft.com/kb/823764 has the details. Friends
  confirmed that simply adding 32 to CURL_MAX_WRITE_SIZE is enough.
2009-04-28 20:27:06 +00:00
Yang Tse 33a3753c3f libcurl's memory.h renamed to curl_memory.h 2009-04-21 11:46:16 +00:00
Yang Tse 8d78a33e60 for portability reasons: s/inet_pton/Curl_inet_pton/ 2009-02-28 01:35:53 +00:00
Daniel Stenberg 7b7db23633 - Senthil Raja Velu reported a problem when CURLOPT_INTERFACE and
CURLOPT_LOCALPORT were used together (the local port bind failed), and
  Markus Koetter provided the fix!
2009-02-27 12:07:14 +00:00
Gunter Knauf 1cc50d31f9 changed HAVE_SIN6_SCOPE_ID define to HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID since just found that ares already uses this define. 2008-12-30 08:05:38 +00:00
Gisle Vanem 418683f537 Added the use of Watt-32 tcp/ip stack for Win32 targets. 2008-12-16 08:25:55 +00:00
Dan Fandrich ea8fbb5233 Added some #ifdefs around header files and change the EAGAIN test to
fix compilation on Cell (reported by Jeff Curley).
2008-11-14 23:17:32 +00:00
Yang Tse 17d2a464ad Refactor configure script detection of functions used to set sockets into
non-blocking mode, and decouple function detection from function capability.
2008-11-13 18:56:55 +00:00
Yang Tse a0ef686c54 Merged existing IPv4 and IPv6 Curl_ip2addr functions into a single one
which now also takes a protocol address family argument.
2008-11-06 17:19:56 +00:00
Daniel Stenberg d0b8b5a199 - Bug #2218480 (http://curl.haxx.se/bug/view.cgi?id=2218480) pointed out a
problem with my CURLINFO_PRIMARY_IP fix from October 7th that caused a NULL
  pointer read. I also took the opportunity to clean up this logic (storing of
  the connection's IP address) somewhat as we had it stored in two different
  places and ways previously and they are now unified.
2008-11-03 16:24:56 +00:00
Dan Fandrich 8693afdfea Stop using in6addr_any because it's not available everywhere (e.g. Symbian)
and isn't strictly needed here.
2008-10-24 18:59:51 +00:00
Yang Tse 10035c898b fix compiler warning 2008-10-24 16:59:35 +00:00
Yang Tse 29f09f71b4 portability fix to avoid memory alignment problems 2008-10-17 03:38:36 +00:00
Yang Tse c3a959cc37 There's no guarantee that a socket was involved at this point, so avoid displaying any error code.
And on the other hand a message after setsockopt() certainly must use SOCKERRNO.
2008-10-13 06:16:02 +00:00
Yang Tse a754ea1326 fix compiler warning 2008-10-11 15:32:32 +00:00
Dan Fandrich 8cd76d3921 Allow compilation when no IPv6 stack is available. 2008-10-10 03:46:32 +00:00
Dan Fandrich fad3288d20 Fixed the --interface option to work with IPv6 connections on glibc
systems supporting getifaddrs(). Also fixed a problem where an IPv6
address could be chosen instead of an IPv4 one for --interface when it
involved a name lookup.
2008-10-09 19:23:50 +00:00
Yang Tse 2ef72f7abb fix compiler warning 2008-09-08 19:34:58 +00:00
Dan Fandrich 4b01dfe369 Fixed out of memory problems that caused torture test failures in tests
1021 and 1067.
2008-08-26 21:28:57 +00:00
Daniel Stenberg 5aed78e183 - Phil Blundell added the CURLOPT_SCOPE option, as well as adjusted the URL
parser to allow numerical IPv6-addresses to be specified with the scope
  given, as per RFC4007 - with a percent letter that itself needs to be URL
  escaped. For example, for an address of fe80::1234%1 the HTTP URL is:
  "http://[fe80::1234%251]/"
2008-07-30 21:55:26 +00:00
Dan Fandrich bc0ebfcdeb Fixed display of the interface bind address in the trace output when it's
an IPv6 address.
2008-07-28 18:35:34 +00:00
Gunter Knauf d8bc4a0e9a use our *printf functions only. 2008-06-08 15:52:03 +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
Dan Fandrich 100945694a Removed some duplicated #includes 2008-05-21 21:08:31 +00:00
Daniel Stenberg 514592b892 - Introducing curl_easy_send() and curl_easy_recv(). They can be used to send
and receive data over a connection previously setup with curl_easy_perform()
  and its CURLOPT_CONNECT_ONLY option. The sendrecv.c example was added to
  show how they can be used.
2008-05-12 21:43:24 +00:00
Daniel Stenberg b84b71f524 - Jean-Francois Bertrand reported a libcurl crash with CURLOPT_TCP_NODELAY
since libcurl used getprotobyname() and that isn't thread-safe. We now
  switched to use IPPROTO_TCP unconditionally, but perhaps the proper fix is
  to detect the thread-safe version of the function and use that.
  http://curl.haxx.se/mail/lib-2008-05/0011.html
2008-05-03 13:43:35 +00:00
Daniel Stenberg 3d29bda9f8 - Bart Whiteley provided a patch that made libcurl work properly when an app
uses the CURLOPT_OPENSOCKETFUNCTION callback to create a unix domain socket
  to a http server.
2008-05-01 21:34:34 +00:00
Dan Fandrich 1960eebc2d Added support for running on Symbian OS. 2008-04-22 22:53:53 +00:00
Daniel Stenberg 1b701c746f - Refactored a lot of timeout code into a few functions in an attempt to make
them all use the same (hopefully correct) logic to make it less error-prone
  and easier to introduce library-wide where it should be used.
2008-02-07 22:25:04 +00:00
Yang Tse 59b4bdf78d Change typecast due to http://cool.haxx.se/cvs.cgi/curl/include/curl/curl.h.diff?r1=1.336&r2=1.337 2008-01-08 01:05:50 +00:00
Daniel Stenberg ad6e28073c removed space after if and while before the parenthesis for better source code
consistency
2007-11-05 09:45:09 +00:00
Yang Tse 949073d448 Fix compiler warning: signed and unsigned type in conditional expression 2007-10-17 00:44:48 +00:00
Yang Tse 85877dae9a Fix compiler warning: comparison between signed and unsigned 2007-10-17 00:10:00 +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 4bf28cb904 exported symbols must use lowercase "curl_", and I also fixed two compiler
warnings, one C99 thing and the bad pointer sent to the callback
2007-10-03 08:58:40 +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
Dan Fandrich 8147c3659d Minix doesn't support getsockopt on UDP sockets or send/recv on TCP
sockets.
2007-09-05 22:01:57 +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
Daniel Stenberg 188b08ca55 Patrick Monnerat's cleanup fix after my alloc-strings commit 2007-08-02 14:42:16 +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 46c699c483 Colin Hogben filed bug report #1750274
(http://curl.haxx.se/bug/view.cgi?id=1750274) and submitted a patch for the
case where libcurl did a connect attempt to a non-listening port and didn't
provide a human readable error string back.
2007-07-13 20:17:35 +00:00
Daniel Stenberg cf5378b366 Daniel Cater made libcurl build with CURL_NO_OLDIES defined (which doesn't
define the symbols for backwards source compatibility)
2007-07-13 20:04:53 +00:00
Gunter Knauf c0095d6dd9 removed now obsolete NETDB_DEFINE_CONTEXT macro calls. 2007-07-11 21:47:31 +00:00
Gunter Knauf afdfa4bed2 minor patches to enable building for NetWare CLIB.
sent by Dmitry Mityugov.
2007-06-30 20:08:13 +00:00
Yang Tse 3616912d22 Avoid an unnecessary call to gettimeofday() when
using custom timeout values.
2007-04-22 18:17:46 +00:00
Yang Tse b0e909329e fix comment and line spacing 2007-04-19 20:16:28 +00:00
Daniel Stenberg 76627b322e - Robert Iakobashvil added curl_multi_socket_action() to libcurl, which is a
function that deprecates the curl_multi_socket() function. Using the new
  function the application tell libcurl what action that was found in the
  socket that it passes in. This gives a significant performance boost as it
  allows libcurl to avoid a call to poll()/select() for every call to
  curl_multi_socket*().
2007-04-16 16:34:08 +00:00
Yang Tse fba4cd0e62 Internal function Curl_select() renamed to Curl_socket_ready() 2007-03-26 23:23:46 +00:00
Gisle Vanem 0188493d54 Use Curl_inet_pton() instead of inet_pton(). 2007-03-13 12:52:28 +00:00
Yang Tse 40e9e40cb4 fix compiler warning: unused variable 2007-03-11 00:26:01 +00:00
Daniel Stenberg 1e55ed5c7d - Robert Iakobashvili fixed CURLOPT_INTERFACE for IPv6. 2007-03-09 22:48:07 +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 69565afab0 Check for stdbool.h at configuration stage, and include it if available.
Check for lowercase 'bool' type at configuration stage. If not available
provide a suitable replacement with a type definition of 'unsigned char'
in setup_once.h

Move definitions of TRUE and FALSE to setup_once.h
2007-02-22 02:51:54 +00:00
Yang Tse 3a634a273a curlassert macro replaced with DEBUGASSERT macro defined in setup_once.h 2007-02-21 19:03:20 +00:00
Yang Tse d9bf55570b Move portable error number symbolic name definitions to setup_once.h 2007-02-17 13:51:24 +00:00
Yang Tse a1d5983991 use macros ERRNO, SET_ERRNO(), SOCKERRNO and SET_SOCKERRNO() for errno handling 2007-02-16 18:19:35 +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 ebee2e323d - David McCreedy fixed a bad call to getsockname() that wrongly used a size_t
variable to point to when it should be a socklen_t.
2006-12-22 13:30:54 +00:00
Yang Tse 5df4be1165 Check for USE_WINSOCK instead of WIN32 where the check was done
to verify winsock API availability.
2006-10-18 21:05:40 +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
Gisle Vanem c4ad533300 Constify some arguments in Curl_connecthost() and singleipconnect(). 2006-07-21 06:50:39 +00:00
Yang Tse ef82da93fb "*connected" must be set to FALSE if trynextip() fails. 2006-07-17 19:22:28 +00:00
Yang Tse d2cefc140a Change the ai_addrlen type of struct addrinfo from size_t to socklen_t, per RFC 3493. 2006-07-14 10:30:44 +00:00
Yang Tse dcc7900e7c Socket must be set to CURL_SOCKET_BAD after closing it. 2006-07-11 00:23:21 +00:00
Daniel Stenberg e85e30546c Roland Blom filed bug report #1481217
(http://curl.haxx.se/bug/view.cgi?id=1481217), with follow-ups by Michele Bini
and David Byron. libcurl previously wrongly used GetLastError() on windows to
get error details after socket-related function calls, when it really should
use WSAGetLastError() instead.

When changing to this, the former function Curl_ourerrno() is now instead
called Curl_sockerrno() as it is necessary to only use it to get errno from
socket-related functions as otherwise it won't work as intended on Windows.
2006-05-04 22:39:47 +00:00
Daniel Stenberg db03d4bdd0 Ale Vesely fixed CURLOPT_INTERFACE when using a hostname 2006-04-21 13:46:19 +00:00
Daniel Stenberg 17bf5ac2fc avoid a warning about declaring a variable that shadows an earlier declared
one
2006-04-18 10:51:07 +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
Gisle Vanem dc4fbd2e97 Small fix. 2006-02-26 18:20:43 +00:00
Gisle Vanem 60b029869f Use getprotobyname() to retrieve protocol number for TCP
(sorry, I don't know how to add this to the configure process).
2006-02-26 17:08:33 +00:00
Gisle Vanem 5994b62930 Squelch the "warning: 'port' might be used uninitialized in this function".
(occurs w/o ENABLE_IPV6).
2006-01-30 18:57:02 +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
Yang Tse d6c5d24af3 Cleanup windows header includes. Where aplicable, inclusion of
windows.h winsock.h winsock2.h ws2tcpip.h is done in setup.h
2005-12-18 15:36:14 +00:00
Dan Fandrich e2df946eee Fixed some compiler warnings on lcc. 2005-12-13 18:54:31 +00:00
Daniel Stenberg 9e0882ba98 close the existing socket when trying next IP, as otherwise we leak one!
bug #1326306
2005-10-25 13:15:11 +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 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
Dan Fandrich 6e87cf5b30 Fixed some typos in output messages. 2005-07-21 22:18:35 +00:00
Daniel Stenberg 944af98be6 fix warning about redefined symbol 2005-05-14 21:15:36 +00:00
Gisle Vanem 0c96056a94 Change for systems with >1 ways of setting (non-)blocking
mode. (djgpp/Watt-32 has 3 ways). Should rewrite this using
"#elif ..", but maybe there is still broken cpp around?
2005-05-14 05:58:52 +00:00
Daniel Stenberg 44985e8884 improved failf() error messages 2005-05-02 22:53:55 +00:00
Daniel Stenberg ae1d6f29d9 singleipconnect() returns a socket descriptor, not a CURLcode (but perhaps
we should make it do that...)
2005-04-30 15:16:39 +00:00
Daniel Stenberg 6b1220b61d Cory Nelson's work on nuking compiler warnings when building on x64 with
VS2005.
2005-04-26 13:08:49 +00:00
Daniel Stenberg 3916d1e6cb silence compiler warnings for mingw win32 builds --enable-debug 2005-03-14 15:43:23 +00:00
Daniel Stenberg 176981b529 close the socket properly when returning error due to failing localbind
Bug report #1124588 by David
2005-02-17 14:45:03 +00:00
Daniel Stenberg 9a820d7a98 include "url.h" for the Curl_safefree() proto 2005-01-29 22:38:45 +00:00
Daniel Stenberg c4ff5eb0ca conn->ip_addr MUST NOT be used on re-used connections 2005-01-29 13:07:16 +00:00
Daniel Stenberg f661475962 Connect failures with the multi interface was often returned as "connect()
timed out" even though the reason was different. Fixed this problem by not
setting this timeout to zero when using multi.
2005-01-28 23:21:24 +00:00
Gisle Vanem 1dc15ec1bc Set 'data->state.os_errno = error' in some places.
Needed elsewhere too?
2004-12-13 17:52:55 +00:00
Daniel Stenberg b96a0dba90 Gisle Vanem's fix for better info messages when failing to connect using
the multi interface
2004-12-06 22:45:45 +00:00
Daniel Stenberg 8e34e75100 Curl_select's timeout arg is an int 2004-11-22 13:28:44 +00:00
Daniel Stenberg 1a05a90f1c David Phillips' FD_SETSIZE fix 2004-11-19 08:52:33 +00:00
Daniel Stenberg 5931d43a36 clean up start time and t_startsingle use so that redirect_time works properly 2004-11-15 11:27:03 +00:00
Daniel Stenberg 24d47a6e07 Paul Nolan fix to make libcurl build nicely on Windows CE 2004-11-02 10:12:22 +00:00
Daniel Stenberg f4bef25b5e CURLINFO_NUM_CONNECTS and more 2004-10-19 15:30:08 +00:00
Daniel Stenberg 34342bcd19 SO_NOSIGPIPE 2004-10-11 17:23:41 +00:00
Daniel Stenberg 39af394a1c removed tabs and trailing whitespace from source 2004-10-06 07:50:18 +00:00
Daniel Stenberg be1cece69b - Larry Campbell added CURLINFO_OS_ERRNO to curl_easy_getinfo() that allows an
app to retrieve the errno variable after a (connect) failure. It will make
  sense to provide this for more failures in a more generic way, but let's
  start like this.
2004-09-30 21:01:23 +00:00
Daniel Stenberg 6cd2536048 set an error message when connection fails 2004-09-19 14:27:56 +00:00
Daniel Stenberg 55e61c092e Fixed multiple IP connects with the multi interface. This fix is influenced
by Gisle Vanem's patch, only modified by me.
2004-08-04 12:38:01 +00:00
Daniel Stenberg 4c17ba4fc0 make sure the 3rd argument passed to bind() is a socklen_t 2004-07-04 21:48:54 +00:00
Daniel Stenberg 090b89cc76 Variable type cleanups to please the picky MIPSPro compiler. 2004-07-01 08:10:21 +00:00
Daniel Stenberg ba40eccc90 make the SSL connect use the same default connect timeout define as the
generic connect uses
2004-06-30 09:22:48 +00:00
Daniel Stenberg 6ed5feda2b First attempt at making the multi interface work when connecting to a host
that resolves to multiple IP addresses.
2004-06-29 11:20:07 +00:00
Daniel Stenberg 8d0a823124 only use sockaddr_in6 on ipv6-enabled hosts 2004-06-24 09:13:50 +00:00
Daniel Stenberg c39858aac0 Source cleanups. The major one being that we now _always_ use a Curl_addrinfo
linked list for name resolved data, even on hosts/systems with only IPv4
stacks as this simplifies a lot of code.
2004-06-24 07:43:48 +00:00
Daniel Stenberg 818aed35e2 static functions are better not Curl_ prefixed to make their static
status more obvious
2004-06-23 09:08:03 +00:00
Daniel Stenberg 5f1eefd03f prevent a warning 2004-06-23 06:14:23 +00:00
Daniel Stenberg 2494701347 the hostname variable wasn't assigned and we no longer use it 2004-06-22 21:25:53 +00:00
Daniel Stenberg d73425061a Moved the "About to connect() to" text to the place where the host name is
actually known, as before this text lied when used in i.e FTP.
2004-06-22 15:23:01 +00:00
Daniel Stenberg 9f341f9ce5 Gisle Vanem's improved verbose output and timeout handling when connecting to
a host name that resolves to multiple IP addresses.
2004-06-10 11:06:21 +00:00
Daniel Stenberg 1ab4a2f870 delete trailing whitespace 2004-06-08 15:05:20 +00:00
Daniel Stenberg 05d8e56ffd Gisle Vamem reintroduced the verifyconnect() call on windows as well, and
we now use it to provide more info back on connect failures.
2004-05-13 10:40:17 +00:00
Daniel Stenberg bbafb2eb27 curl_global_init_mem() allows the memory functions to be replaced.
memory.h is included everywhere for this.
2004-05-11 11:30:23 +00:00
Daniel Stenberg 4b9f8e766d Made host name and proxy name get stored in a 'struct hostname' and set
all things up to work with encoded host names internally, as well as keeping
'display names' to show in debug messages. IDN resolves work for me now using
ipv6, ipv4 and ares resolving. Even cookies on IDN sites seem to do right.
2004-04-27 13:56:23 +00:00
Daniel Stenberg 245e3122df Made defines instead of plain numbers for the Curl_resolv() return code to
make the code easier to read
2004-04-26 14:18:00 +00:00
Daniel Stenberg d02587750c added function headers and comments 2004-04-26 07:11:06 +00:00
Daniel Stenberg 78ebe3fa5a Gisle made a failed connect output the reason for it 2004-04-17 11:33:47 +00:00
Daniel Stenberg 4e3aa250c4 Moved the 'tcp_nodelay' member to the proper 'UserDefined' struct within the
sessionhandle to make the duphandle() function work as supposed. Also tried
to start document functions the doxygen way (in the headers of the functions).
Can't make it work though...
2004-04-13 07:16:26 +00:00
Daniel Stenberg 40d9855df2 Andrés García fixed a warning in the ioctlsocket() usage. 2004-03-31 10:34:53 +00:00
Daniel Stenberg d5b8971ff3 typecast setsockopt()'s 4th argument to void * to make compilers complain
less
2004-03-30 13:05:45 +00:00
Daniel Stenberg d85c21994f netinet/tcp.h may require netinet/in.h to be include before 2004-03-29 06:22:57 +00:00
Daniel Stenberg ed22afe5fb Tor fixed a left-over from the ip argument to setnodelay 2004-03-27 11:15:50 +00:00
Daniel Stenberg 43137cf595 check for netinet/tcp.h precense before actually including it 2004-03-26 07:10:15 +00:00
Daniel Stenberg db6dc49b0b removed the ip number from the notcpdelay function 2004-03-26 07:03:30 +00:00
Daniel Stenberg e21104a865 only output one line about the nodelay even if it fails 2004-03-25 14:01:01 +00:00
Daniel Stenberg 762dcf0780 include the strerror.h file without curl_ prefix 2004-03-25 13:42:23 +00:00
Daniel Stenberg bb3d6e8552 tcp-nodelay patch by Joe Halpin 2004-03-25 13:37:18 +00:00
Daniel Stenberg b60d6404d8 Gisle Vanem's fix to replace the bad use of strerror(). This introduces
Curl_strerror() that attempts to be thread-safe _and_ works on Windows too!
2004-03-24 22:45:37 +00:00
Daniel Stenberg fe6f0aeb26 switch() on the right variable! 2004-03-23 15:48:27 +00:00
Daniel Stenberg 1f61e7f8f4 If localbind fails, provide a more portable error message. 2004-03-23 14:43:42 +00:00
Daniel Stenberg 5b55f9ecb3 Günter Knauf's NetWare changes. 2004-03-17 12:46:42 +00:00
Daniel Stenberg e545e33d5f Gisle Vanem's fixes to use CURL_SOCKET_BAD more instead of -1 for sockets. 2004-03-11 13:13:35 +00:00
Daniel Stenberg ce5805a955 Use curl_socket_t instead of int for holding sockets. The typedefs and
defines are in setup.h.
2004-03-09 22:52:50 +00:00
Daniel Stenberg 576be36249 waitconnect() takes the timeout argument as a long 2004-03-08 11:36:47 +00:00
Daniel Stenberg e40392ac03 Andrés García's patch to prevent warnings while compiling with mingw, mainly
because it is now possible to have both WIN32 and HAVE_CONFIG_H defined.
2004-03-04 15:32:18 +00:00
Daniel Stenberg 0d3aa8b7be Use the was_iface variable when binding a socket locally, even if no
SO_BINDTODEVICE is present, to prevent compiler warnings about the variable
2004-02-15 13:55:24 +00:00
Daniel Stenberg fa57a8a78e Ben Greear's SO_BINDTODEVICE patch that binds to a network interface "even
more" when the previous approach. Known to work on Linux, possibly on other
platforms as well.
2004-02-13 09:50:23 +00:00
Daniel Stenberg 2d0b2f294f Oops. I broke the flow with the previous commit. 2004-02-09 11:40:00 +00:00
Daniel Stenberg 3bdc883c93 some annoying compilers warn about "(void)foo;" lines so we avoid them 2004-02-09 08:34:19 +00:00
Daniel Stenberg 6b7f169b10 only do the verifyconnect() clear magic on mpeix 2004-01-30 07:51:51 +00:00
Daniel Stenberg bfe5568c85 added verifyconnect proto and use it correctly in the waitconnect function 2004-01-29 15:37:21 +00:00
Daniel Stenberg 76a51ef4b3 1. changed order of two include files to build fine on MPE/iX
2. now reads the socket error before check connect status, also to make us
   run fine on MPE/iX
2004-01-29 15:29:47 +00:00
Daniel Stenberg 4d17d6876e Dan Fandrich's cleanup patch to make pedantic compiler options cause less
warnings. Minor edits by me.
2004-01-29 13:56:45 +00:00
Daniel Stenberg 7052daf475 added missing parenthesis 2004-01-15 09:54:30 +00:00
Daniel Stenberg c5c89862b2 rearranged the connect() call so that there's no interleaved #ifdef, to make
it compiler better on amigaos
2004-01-14 09:11:42 +00:00
Daniel Stenberg 053f6c85ef updated year in the copyright string 2004-01-07 09:19:33 +00:00
Daniel Stenberg 43bb20461f Peter Sylvester found a flaw in the connect code for ipv6-enabled hosts.
I guess it seldomly happens on linux and that's why it wasn't found before.
He used Solaris to notice it.

I took the opportunity to rewrite the Curl_connecthost() slightly to feature
less duplicate code in the two different versions (ipv4/ipv6).
2003-11-13 13:28:40 +00:00
Daniel Stenberg 5eee801d06 don't shadow 'socket' 2003-10-18 20:34:33 +00:00
Daniel Stenberg 7201a5a290 the previous fix left this compiler error 2003-10-15 20:37:00 +00:00
Daniel Stenberg a9af971c59 Avoid doing getsockopt() on Windows to verify connects. It seems that this
hogs Windows machines when libcurl is being used multi-threaded (with > ~50
threads). Andrew Fuller helped us verify and test this.

According to a MSDN web page on connect(), it returns 0 when the connect
is done and thus we don't need the getsockopt() call anyway on Windows.
2003-10-15 11:42:57 +00:00
Daniel Stenberg 749f5387c1 Gisle Vanem's IPv6-on-Windows patch applied! 2003-10-14 12:00:45 +00:00
Daniel Stenberg 5c52cacc98 - Frank Ticheler provided a patch that fixes how libcurl connects to multiple
addresses, if one of them fails (ipv4-code).
2003-10-08 13:32:43 +00:00
Daniel Stenberg 57b6202eaa New code for BeOS-style non-blocking sockets, provided by Shard and
Jeremy Friesner.
2003-10-05 15:02:58 +00:00
Daniel Stenberg 96fecba190 bindlocal works for Windows! 2003-08-11 23:15:13 +00:00
Daniel Stenberg b73612392d ares awareness/usage/support added. If configure --enable-ares is used, we
build libcurl to use ares for asynch name resolves.
2003-08-05 14:40:59 +00:00
Daniel Stenberg 1eef6f44ba CURLDEBUG instead of MALLOCDEBUG 2003-06-26 06:47:20 +00:00
Daniel Stenberg e615d117a0 Setup and use CURL_INADDR_NONE all over instead of INADDR_NONE. We setup
the define accordingly in the hostip.h header to work nicely all over.
2003-05-13 12:12:17 +00:00
Daniel Stenberg 871358a6e5 before checking for network interfaces using if2ip(), check that the given
name isn't an ip address
2003-05-12 13:06:48 +00:00
Daniel Stenberg eb6130baa7 ourerrno became Curl_ourerrno() and is now available to all libcurl 2003-05-01 13:37:05 +00:00
Daniel Stenberg 652683fc04 Martin C. Martin's fix to produce an error message in case of failure
in the Curl_is_connected() function.
2003-03-11 16:28:23 +00:00
Daniel Stenberg c3dfe50aaf Fix Curl_is_connected() even more to deal with waitconnect() return codes
even better (also based on input from Martin).
2003-02-14 09:11:51 +00:00
Daniel Stenberg 498f3985b3 geterrno() renamed to ourerrno() to prevent the name clash that occurred in
AIX 3.2.5 and possibly other OSF-like system headers.
2003-02-14 09:01:01 +00:00
Daniel Stenberg 977175d4fd Martin C. Martin's fix for multi-interface connects to non-listening ports. 2003-02-14 08:02:55 +00:00
Jean-Philippe Barette-LaPierre beb13a1d3e added the sharing of DNS cache 2003-02-04 23:48:46 +00:00
Daniel Stenberg a6c395c156 Duncan Wilcox reported a crash with --interface on FreeBSD when ipv6-enabled
and this has been verified to correct the problem.
2003-01-23 05:38:20 +00:00
Daniel Stenberg f26a338a54 copyright year update in the source header 2003-01-16 21:08:12 +00:00
Daniel Stenberg 6f35ed51dc This fixed yet another connect problem with the multi interface and ipv4
stack. Kjetil Jacobsen reported and verified the fix.
2003-01-09 14:52:51 +00:00
Daniel Stenberg 747f87f61e Removed weird special multi interface condition that caused bug report
#651464.
2002-12-17 10:05:00 +00:00
Daniel Stenberg b528bde470 conn->bits.tcpconnect now keeps track of if this connection is connected
or not
2002-12-13 16:15:19 +00:00
Daniel Stenberg 9ae920c1b6 make a little work-around for file:// in _is_connected() and voila, now the
multi interface works with file:// URLs fine (previously it crashed). This
won't make it work on Windows though...
2002-12-13 13:47:58 +00:00
Daniel Stenberg 66eb98bb0a unlock dns cache entries with a function call instead of a variable fiddle 2002-11-11 22:36:00 +00:00
Daniel Stenberg 0ff1ca30c3 ipv4-fixes for the new Curl_dns_entry struct and Curl_resolv() proto 2002-11-05 11:07:49 +00:00
Daniel Stenberg 2cff251863 Curl_resolv() now returns a different struct, and it contains a reference
counter so that the caller needs to decrease that counter when done with
the returned data.

If compiled with MALLOCDEBUG I've added some extra checking that the counter
is decreased before a handle is closed etc.
2002-11-05 10:51:41 +00:00
Daniel Stenberg b5bbc04ad1 return error properly when a non-blocking connect fails using the multi
interface
2002-10-12 11:18:08 +00:00
Daniel Stenberg cac5251a98 Lukasz Czekierda correctly pointed out that curl used a bad Host: header
when talking to a IPv6-server using IPv6 IP address only.
2002-09-11 10:32:37 +00:00
Daniel Stenberg ba4e69bebc updated source code boilerplate/header 2002-09-03 11:52:59 +00:00
Daniel Stenberg 982c5460f0 Andrew Francis removed the need for/use of MSVC pragmas 2002-08-26 17:20:29 +00:00
Daniel Stenberg 30b7a9f172 fixed a Curl_connecthost() bug, we should default to set connected to false 2002-08-12 12:01:57 +00:00
Daniel Stenberg cb895ec335 Initial fix to make the multi interface return control while waiting for
the initial connect to "come through".

This should work fine for connect and for FTP-PASV connects. Needs massive
testing.
2002-08-12 09:43:20 +00:00
Daniel Stenberg 87afd7686f added a connect failure error message that might get empty otherwise 2002-06-12 09:48:26 +00:00
Daniel Stenberg 78473f71eb added a missing failf() for certain connect failures 2002-06-10 13:25:03 +00:00
Daniel Stenberg 8927ddec16 In order to not get problems with DNS cache pruning, we no longer store
any name resolved data in any curl handle struct. That way, we won't mind
if the cache entries are pruned for the next time we need them. We'll just
resolve them again instead.

This changes the Curl_resolv() proto. It modifies the SessionHandle struct
but perhaps most importantly, it'll make the internals somewhat dependent
on the DNS cache not being disabled as that will cripple operations somewhat.
Especially for persistant connections.
2002-04-25 19:00:57 +00:00
Daniel Stenberg 36e35b6f60 allow binding the local end of a connection even when using IPv6, thus we
now have --interface working properly
2002-04-22 23:56:13 +00:00
Daniel Stenberg 308ae5cbf2 added info in to failf() lines and added a infof() call just before the
connect() so that it tells to which host and what port it is about to
attempt the connection
2002-04-10 14:20:24 +00:00
Daniel Stenberg 974f314f57 copyright string (year) update 2002-03-19 07:54:55 +00:00
Daniel Stenberg b1ffe7b74a better time selection for the connect timeout 2002-02-22 15:44:37 +00:00
Daniel Stenberg 721b05e343 Nico Baggus' VMS tweaks 2002-02-20 13:46:53 +00:00
Daniel Stenberg e21926f7f0 connection timeout comparison fix by Emil 2002-02-18 10:05:18 +00:00
Daniel Stenberg 5c6eddcadd fixed time-out returned without error text set 2002-01-16 22:26:01 +00:00
Daniel Stenberg d3299beec7 Modified to use non-blocking sockets all the time. 2002-01-07 18:38:01 +00:00
Daniel Stenberg 6de7dc5879 Sterling Hughes' provided initial DNS cache source code. 2002-01-03 10:22:59 +00:00
Daniel Stenberg fe37fb5921 Philip Gladstone's 64-bit sparc native compiler compatibility issues fixed. 2002-01-02 10:06:47 +00:00
Daniel Stenberg e192261788 failf() calls should not have newlines in the message string! 2001-12-11 13:13:01 +00:00
Daniel Stenberg 436d147925 Eric's #include fixes for better macos compiles 2001-12-04 13:03:08 +00:00
Daniel Stenberg f0ee7115d3 Andrés García's minor fix to make it compile on win32 2001-11-23 09:04:56 +00:00
Daniel Stenberg 0e7203be89 this fix seems to make the connect fail properly even on IPv4-only Linux
machines!
2001-11-22 13:57:00 +00:00
Daniel Stenberg 17b18bca3c added error text for a failed connect case 2001-11-21 22:57:42 +00:00
Daniel Stenberg b07e2a08f9 nonblock => Curl_nonblock, remade the check for a live SSL connection (again) 2001-10-31 08:44:11 +00:00
Daniel Stenberg 3edd9b4dfc SM's waitconnect return code fix! 2001-10-29 07:49:57 +00:00
Daniel Stenberg b585f411cd make sure the connect can't return OK but return a NULL as addr 2001-10-22 12:52:25 +00:00
Daniel Stenberg 532bca41e5 Curl_tvdiff() now returns a millisecond diff, no double like before 2001-10-12 12:32:20 +00:00
Daniel Stenberg 7b5b60d275 hm, an unknown error from bind() when binding the outgoing socket would
failf("%d") without the error as argument... it would always make a weird
number get output
2001-10-08 06:56:00 +00:00
Daniel Stenberg fdeaae678d SM's patch applied, we should not use arguments or variables that have the
same name as common functions...
2001-10-05 06:05:56 +00:00
Daniel Stenberg 72dbe9da72 praise Bjorn Reese for mastering these dusty corners of socket hacking, now
we check for the error state before believing we are connected in IPv6
cases
2001-10-02 17:18:46 +00:00
Daniel Stenberg ced8955325 IPv6 adjustments, connect()ing to bad ports still don't work properly for
IPv6
2001-10-02 11:26:53 +00:00
Daniel Stenberg 51ca5fcbe0 major connecting updates 2001-10-02 09:40:06 +00:00
Daniel Stenberg 9f77771ff9 faster bailout on timeouts 2001-10-01 23:25:26 +00:00
Daniel Stenberg 3298630500 removed warning 2001-10-01 22:50:03 +00:00
Daniel Stenberg dc27488c47 corrected for IPv6 2001-10-01 22:42:46 +00:00
Daniel Stenberg 6918427fae conn->hp is now conn->hostaddr
changed the Curl_connethost() proto again
2001-10-01 22:32:37 +00:00
Daniel Stenberg ede5b54edc corrected the #include files 2001-10-01 11:25:27 +00:00
Daniel Stenberg c5fdeef41d introduced non-blocking connects 2001-10-01 08:59:17 +00:00