Commit Graph

228 Commits

Author SHA1 Message Date
Yang Tse d30ddd9977 compiler warning: fix
Fix compiler warning: enumerated type mixed with another type
2011-05-21 14:55:10 +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 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
Fabian Keil 1702a2c08d Fix a couple of spelling errors in lib/
Found with codespell.
2011-04-21 07:55:53 -07: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
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 c2bfe60086 Curl_send/recv_plain: return errno on failure
When send() and recv() fail, we now store the errno value to allow the
app to access it.

Bug: http://curl.haxx.se/bug/view.cgi?id=3128121
Reported by: Yuri
2010-12-05 23:04:11 +01:00
Daniel Stenberg 1b15b31c86 sendrecv: treat all negative values from send/recv as errors
For example the libssh2 based functions return other negative
values than -1 to signal errors and it is important that we catch
them properly. Right before this, various failures from libssh2
were treated as negative download amounts which caused havoc.
2010-06-19 00:18:14 +02:00
Howard Chu bc8fc9803f sendrecv: make them two pairs of send/recv to properly deal with FTPS
FTP(S) use two connections that can be set to different recv and
send functions independently, so by introducing recv+send pairs
in the same manner we already have sockets/connections we can
work with FTPS fine.

This commit fixes the FTPS regression introduced in change d64bd82.
2010-05-11 22:48:38 +02:00
Howard Chu d64bd82bdc sendrecv: split the I/O handling into private handler
Howard Chu brought the bulk work of this patch that properly
moves out the sending and recving of data to the parts of the
code that are properly responsible for the various ways of doing
so.

Daniel Stenberg assisted with polishing a few bits and fixed some
minor flaws in the original patch.

Another upside of this patch is that we now abuse CURLcodes less
with the "magic" -1 return codes and instead use CURLE_AGAIN more
consistently.
2010-05-07 15:05:34 +02:00
Kamil Dudka 10977f57de qssl: reflect recent code changes in SSL interface
Reported by Guenter Knauf.
2010-04-07 10:47:19 +02:00
Kamil Dudka ff8711135e refactorize interface of Curl_ssl_recv/Curl_ssl_send 2010-04-04 23:37:18 +02:00
Daniel Stenberg 49f3160d69 fix SFTP download hang
Matt Wixson found and fixed a bug in the SCP/SFTP area where the
code treated a 0 return code from libssh2 to be the same as
EAGAIN while in reality it isn't. The problem caused a hang in
SFTP transfers from a MessageWay server.
2010-04-01 22:39:15 +02:00
Daniel Stenberg 2309b4e330 remove the CVSish $Id$ lines 2010-03-24 11:02:54 +01:00
Kamil Dudka 19ca0c0fbe - Improved Curl_read() to not ignore the error returned from Curl_ssl_recv(). 2010-03-19 15:43:11 +00:00
Yang Tse 7aef172a34 fix printf-style format strings 2010-02-04 19:44:31 +00:00
Yang Tse d1717e7c90 Fix compiler warning: conditional expression is constant 2010-02-02 16:25:07 +00:00
Daniel Stenberg 33ce0ec1f1 wrap long lines and do some indent policing 2010-01-22 23:21:39 +00:00
Daniel Stenberg bc4582b68a Chris Conroy brought support for RTSP transfers, and with it comes 8(!) new
libcurl options for controlling what to get and how to receive posssibly
interleaved RTP data. Initial commit.
2010-01-21 13:58:30 +00:00
Daniel Stenberg 352177090f - Fabian Keil ran clang on the (lib)curl code, found a bunch of warnings and
contributed a range of patches to fix them.
2009-06-10 21:26:11 +00:00
Daniel Stenberg 3aa3d7e629 Internal cleanup: KEEP_WRITE and KEEP_READ are now called KEEP_SEND and
KEEP_RECV to better match the general terminology: receive and send is what we
do from the (remote) servers. We read and write from and to the local fs.
2009-05-11 07:53:38 +00:00
Yang Tse 33a3753c3f libcurl's memory.h renamed to curl_memory.h 2009-04-21 11:46:16 +00:00
Daniel Stenberg bdec6f2b20 - Frank Hempel found out a bug and provided the fix:
curl_easy_duphandle did not necessarily duplicate the CURLOPT_COOKIEFILE
  option. It only enabled the cookie engine in the destination handle if
  data->cookies is not NULL (where data is the source handle). In case of a
  newly initialized handle which just had the cookie support enabled by a
  curl_easy_setopt(handle, CURL_COOKIEFILE, "")-call, handle->cookies was
  still NULL because the setopt-call only appends the value to
  data->change.cookielist, hence duplicating this handle would not have the
  cookie engine switched on.

  We also concluded that the slist-functionality would be suitable for being
  put in its own module rather than simply hanging out in lib/sendf.c so I
  created lib/slist.[ch] for them.
2009-03-09 12:21:46 +00:00
Dan Fandrich 80ffd3581f Created a CURLMIN macro to match CURLMAX 2009-01-07 19:39:35 +00:00
Daniel Stenberg c76d939563 Christian Krause fixed a build failure when building with gss support
enabled and FTP disabled.
2008-11-16 12:42:53 +00:00
Michal Marek c331c73ec6 - Fixed a potential data loss in Curl_client_write() when the transfer is
paused.
2008-11-13 08:20:23 +00:00
Dan Fandrich 484d549ece Marked with TODO comments a number of problems in the Kerberos code detected
while investigating the issue in http://curl.haxx.se/mail/lib-2008-09/0262.html
I'm hesitant to fix them because I have no way of testing the result.
2008-11-02 05:01:39 +00:00
Dan Fandrich 7fc4e8af0a Changed some arrays of char* to arrays of char[] to reduce data size and
run-time relocations.
2008-10-22 05:46:29 +00:00
Yang Tse d61688923d fix compiler warning: enumerated type mixed with another type 2008-09-30 12:50:52 +00:00
Daniel Stenberg aff5408633 made Curl_read_plain() return an 'int' instead of CURLcode since it actually
returns -1 in EAGAIN cases and that's not valid CURLcode
2008-09-29 11:13:37 +00:00
Daniel Stenberg 391e8afd1f - Made the SOCKS code use the new Curl_read_plain() function to fix the bug
Markus Moeller reported: http://curl.haxx.se/mail/archive-2008-09/0016.html

- recv() errors other than those equal to EAGAIN now cause proper
  CURLE_RECV_ERROR to get returned. This made test case 160 fail so I've now
  disabled it until we can figure out another way to exercise that logic.
2008-09-22 23:12:00 +00:00
Yang Tse 59e378f48f remove unnecessary typecasting of malloc() 2008-09-06 05:29:05 +00:00
Dan Fandrich 3acd1146f9 Use realloc when paused in Curl_client_write 2008-09-05 17:21:54 +00:00
Daniel Stenberg 4c9768565e - Introducing CURLOPT_CERTINFO and the corresponding CURLINFO_CERTINFO. By
enabling this feature with CURLOPT_CERTINFO for a request using SSL (HTTPS
  or FTPS), libcurl will gather lots of server certificate info and that info
  can then get extracted by a client after the request has completed with
  curl_easy_getinfo()'s CURLINFO_CERTINFO option. Linus Nielsen Feltzing
  helped me test and smoothen out this feature.

  Unfortunately, this feature currently only works with libcurl built to use
  OpenSSL.

  This feature was sponsored by networking4all.com - thanks!
2008-09-05 14:29:21 +00:00
Dan Fandrich bb67388bbe Made some variables const 2008-09-04 19:43:35 +00:00
Daniel Stenberg 422fd933f5 - Hans-Jurgen May pointed out that trying SCP or SFTP over a SOCKS proxy
crashed libcurl. This is now addressed by making sure we use "plain send"
  internally when doing the socks handshake instead of the Curl_write()
  function which is designed to use the "target" protocol. That's then SCP or
  SFTP in this case. I also took the opportunity and cleaned up some ssh-
  related #ifdefs in the code for readability.
2008-06-20 10:43:32 +00:00
Michal Marek e2b82b4325 - Make Curl_write and it's callees accept a const pointer, in preparation
of tetetest's patch for curl_easy_send()
2008-05-09 11:27:54 +00:00
Daniel Stenberg 53a549000c - Based on initial work done by Gautam Kachroo to address a bug, we now keep
better control at the exact state of the connection's SSL status so that we
  know exactly when it has completed the SSL negotiation or not so that there
  won't be accidental re-uses of connections that are wrongly believed to be
  in SSL-completed-negotiate state.
2008-02-20 09:56:26 +00:00
Daniel Stenberg 33d68653f0 this was modified this year so we bump the copyright year 2008-01-28 11:56:13 +00:00
Daniel Stenberg ef0ed9b720 Dmitry Kurochkin removed the cancelled state for pipelining, as we agreed
that it is bad anyway. Starting now, removing a handle that is in used in a
pipeline will break the pipeline - it'll be set back up again but still...
2008-01-21 23:48:58 +00:00
Daniel Stenberg de23b98522 Introducing curl_easy_pause() and new magic return codes for both the read
and the write callbacks that now can make a connection's reading and/or
writing get paused.
2008-01-08 14:52:05 +00:00
Daniel Stenberg b0b40d9a00 Andrew Moise filed bug report #1847501
(http://curl.haxx.se/bug/view.cgi?id=1847501) and pointed out a memcpy()
that should be memmove() in the convert_lineends() function.
2007-12-09 22:31:53 +00:00
Daniel Stenberg 662bee7193 All static functions that were previously name Curl_* something no longer
use that prefix as we use that prefix only for library-wide internal global
symbols.
2007-12-08 22:50:55 +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
Dan Fandrich 0f77fe55b6 Reverted the const change--what was I thinking? 2007-10-29 20:57:03 +00:00
Dan Fandrich 68ee002ad0 Made some pointers const 2007-10-29 18:32:20 +00:00
Dan Fandrich 16b95fc773 Enabled a few more gcc warnings with --enable-debug. Renamed a few
variables to avoid shadowing global declarations.
2007-09-27 01:45:22 +00:00
Dan Fandrich 5ecd56d964 Implemented only the parts of Patrick Monnerat's OS/400 patch that renamed
some few internal identifiers to avoid conflicts, which could be useful on
other platforms.
2007-07-23 18:51:22 +00:00
Daniel Stenberg 54967d2a3a Thomas J. Moore provided a patch that introduces Kerberos5 support in
libcurl. This also makes the options change name to --krb (from --krb4) and
CURLOPT_KRBLEVEL (from CURLOPT_KRB4LEVEL) but the old names are still
2007-07-01 22:01:18 +00:00
Daniel Stenberg 3d513f7ab1 spell and language fix 2007-05-02 11:14:55 +00:00
Daniel Stenberg bc1ae973da Robert Iakobashvili made the 'master_buffer' get allocated first once it is
can/will be used as it then makes the common cases save 16KB of data for each
easy handle that isn't used for pipelining.
2007-04-24 10:18:06 +00:00
Yang Tse 90ce18019c reverted back to previous version => http://curl.haxx.se/mail/lib-2007-03/0258.html 2007-03-21 13:09:39 +00:00
Yang Tse fe10cb2ef5 avoid the use of variadic macros for greater portability 2007-03-21 08:17:13 +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 a1d5983991 use macros ERRNO, SET_ERRNO(), SOCKERRNO and SET_SOCKERRNO() for errno handling 2007-02-16 18:19:35 +00:00
Gisle Vanem 6a175b42db Suppress warning "'nread' might be used uninitialized in this function". 2007-02-04 12:18:22 +00:00
Daniel Stenberg abe90019d3 prefer using the (upcoming) non-blocking libssh2 API 2007-02-02 15:26:57 +00:00
Yang Tse cdbbb7d900 Compiler warning fix 2007-01-27 03:14:25 +00:00
Gisle Vanem 7b704e173c Supress "comparison between signed and unsigned" warning. 2007-01-17 15:15:21 +00:00
Daniel Stenberg 1886388791 restore previous addition to the amount of data that is returned 2007-01-16 21:28:45 +00:00
Daniel Stenberg 0fb5a65a58 - David McCreedy provided libcurl changes for doing HTTP communication on
non-ASCII platforms. It does add some complexity, most notably with more
  #ifdefs, but I want to see this supported added and I can't see how we can
  add it without the extra stuff added.
2007-01-14 14:57:51 +00:00
Daniel Stenberg d8ff0336a5 - Matt Witherspoon fixed the flaw which made libcurl 7.16.0 always store
downloaded data in two buffers, just to be able to deal with a special HTTP
  pipelining case. That is now only activated for pipelined transfers. In
  Matt's case, it showed as a considerable performance difference,
2007-01-03 22:18:38 +00:00
Daniel Stenberg 5fd096da8d Stefan Krause pointed out a compiler warning with a picky MSCV compiler when
passing a curl_off_t argument to the Curl_read_rewind() function which takes
an size_t argument. Curl_read_rewind() also had debug code left in it and it
was put in a different source file with no good reason when only used from
one single spot.
2006-12-05 21:40:14 +00:00
Daniel Stenberg a634f64400 James Housley did lots of work and introduced SFTP downloads. 2006-11-24 22:14:39 +00:00
Daniel Stenberg be0d17e812 cleaned up Curl_write() and the sub functions it uses for various protocols.
They all now return ssize_t to Curl_write().

Unfortunately, Curl_read() is in a sorrier state but it too would benefit from
a similar cleanup.
2006-11-11 21:34:43 +00:00
Yang Tse 01926d66d7 add TODO note 2006-11-06 18:28:34 +00:00
Daniel Stenberg 2147284cad James Housley brought support for SCP transfers 2006-11-02 21:56:40 +00:00
Daniel Stenberg e1edd41e1b Ravi Pratap provided a major update with pipelining fixes. We also no longer
re-use connections (for pipelining) before the name resolving is done.
2006-10-23 20:34:56 +00:00
Yang Tse 3cd95eacdf Compiler warning fix 2006-10-21 12:35:16 +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
Yang Tse ec956b0334 Explicit typecast for Curl_debug() size argument 2006-10-17 10:04:13 +00:00
Daniel Stenberg 5e0d9aea32 Support for FTP third party transfers is now dropped 2006-09-30 20:31:11 +00:00
Yang Tse 733a184ce0 Compiler warning fix 2006-09-12 23:51:01 +00:00
Daniel Stenberg b7eeb6e67f Major overhaul introducing http pipelining support and shared connection
cache within the multi handle.
2006-09-07 21:49:20 +00:00
Daniel Stenberg cfdcae4bc7 Based on a patch by Armel Asselin, the FTP code no longer re-issues the TYPE
command on subsequent requests on a re-used connection unless it has to.
2006-08-19 21:18:36 +00:00
Yang Tse 58176d1484 Use platform's native types for recv() and send() arguments. 2006-07-12 05:19:00 +00:00
Daniel Stenberg 9bece2b313 additional renames of Curl_ourerrno => Curl_sockerrno 2006-05-05 10:24:27 +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 95152aec68 David McCreedy brought line end conversions when doing FTP ASCII
transfers. They are done on non-windows systems and translate CRLF to LF.
2006-04-26 07:40:37 +00:00
Daniel Stenberg 5a4b43848a First commit of David McCreedy's EBCDIC and TPF changes. 2006-04-07 21:50:47 +00:00
Daniel Stenberg 6e61939382 GnuTLS support added. There's now a "generic" SSL layer that we use all over
internally, with code provided by sslgen.c. All SSL-layer-specific code is
then written in ssluse.c (for OpenSSL) and gtls.c (for GnuTLS).

As far as possible, internals should not need to know what SSL layer that is
in use. Building with GnuTLS currently makes two test cases fail.

TODO.gnutls contains a few known outstanding issues for the GnuTLS support.

GnuTLS support is enabled with configure --with-gnutls
2005-04-07 15:27:13 +00:00
Daniel Stenberg 62970da675 Removed security.h since it shadows an include file mingw needs when building
for SSPI support. The contents of the file has been moved into the krb4.h file.
2005-03-14 00:00:45 +00:00
Daniel Stenberg 7e42cb61f7 FTP third transfer support overhaul. See CHANGES for details. 2005-01-21 09:32:32 +00:00
Daniel Stenberg 444f6427b8 oops, variables first then code 2004-12-21 14:33:37 +00:00
Daniel Stenberg a173e07eec Prevent failf() from using the va_list variable more than once.
See bug report #1088962 and  Single Unix Specification:
http://www.opengroup.org/onlinepubs/007908799/xsh/vfprintf.html
2004-12-21 14:22:10 +00:00
Daniel Stenberg 4435e3b269 Fixed so that the final error message is sent to the verbose info "stream"
even if no errorbuffer is set.
2004-12-06 23:04:30 +00:00
Daniel Stenberg 411e9b0c45 #include "strerror.h" to get the strerror proto 2004-10-12 12:49:38 +00:00
Daniel Stenberg 557b6cfd3f add proper error message when send() fails 2004-10-12 07:24:19 +00:00
Daniel Stenberg 39af394a1c removed tabs and trailing whitespace from source 2004-10-06 07:50:18 +00:00
Daniel Stenberg 89c312691e additional typecasts to please MIPSPro on 64bit IRIX 2004-07-29 07:30:38 +00:00
Daniel Stenberg bd3d5a17b4 Gisle's "SSL patch" from June 16th 2004, modified by me as discussed on the
mailing list.
2004-06-18 06:20:43 +00:00
Daniel Stenberg f0969c9692 prevent compiler warning with picky compilers 2004-06-07 10:28:14 +00:00
Daniel Stenberg 4c58797607 When sending info about which host that sends what, include proper direction
to/from, based on a suggestion from Alexander Krasnostavsky
2004-06-07 07:01:29 +00:00
Daniel Stenberg ea81dd9e2e Alexander Krasnostavsky's FTP third party transfer (proxy) support 2004-06-03 11:41:05 +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 b8541929c8 curl_slist_append() fixed to clear up properly if a memory function fails 2004-05-10 14:21:19 +00:00
Daniel Stenberg dcf5e52b62 ERR_error_string() returns an unsigned long so we should use one of those
for the return code
2004-05-05 07:01:33 +00:00
Daniel Stenberg 1401d909e8 Fix the "lingering close" problem when re-using a connection, as test case
160 shows.

We got no data and we attempted to re-use a connection. This might happen if
the connection was left alive when we were done using it before, but that was
closed when we wanted to read from it again. Bad luck. Retry the same request
on a fresh connect!

Deleted the sockerror variable again, it serves no purpose anymore.
2004-04-21 08:49:14 +00:00
Daniel Stenberg c39c55cb2d Minor edit to avoid an unreachable break and to remove the extra {} body
within the switch.
2004-03-10 09:50:12 +00:00