Commit Graph

123 Commits

Author SHA1 Message Date
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 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
Hacki d2621445f1 moved vars into conditional since seems that winsock implementation doesnt use them. 2010-05-08 05:38:42 +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
Ben Greear 38d2afcefb telnet: Allow programatic use of telnet.
The main change is to allow input from user-specified methods,
when they are specified with CURLOPT_READFUNCTION.
All calls to fflush(stdout) in telnet.c were removed, which makes
using 'curl telnet://foo.com' painful since prompts and other data
are not always returned to the user promptly.  Use
'curl --no-buffer telnet://foo.com' instead.  In general,
the user should have their CURLOPT_WRITEFUNCTION do a fflush
for interactive use.

Also fix assumption that reading from stdin never returns < 0.
Old code could crash in that case.

Call progress functions in telnet main loop.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2010-04-29 08:55:11 +02:00
Daniel Stenberg 2309b4e330 remove the CVSish $Id$ lines 2010-03-24 11:02:54 +01: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
Yang Tse 33a3753c3f libcurl's memory.h renamed to curl_memory.h 2009-04-21 11:46:16 +00:00
Yang Tse fa96436661 Fix TELNET transfers not being aborted upon write callback failures 2009-03-12 13:18:25 +00:00
Yang Tse d15b8273d6 Add Curl_read() return code checking 2009-03-12 02:12:05 +00:00
Yang Tse dd53b356ff fix previous commit misplaced break statement 2009-03-11 04:45:18 +00:00
Yang Tse f1db505778 Added TELNET timeout support for Windows builds 2009-03-11 04:15:33 +00:00
Daniel Stenberg 794b4da840 Indentation fixes, untabify and related whitespace-cleanup. No code changed. 2009-02-27 08:53:10 +00:00
Daniel Stenberg 07416b61e3 - Using the libssh2 0.19 function libssh2_session_block_directions(), libcurl
now has an improved ability to do right when the multi interface (both
  "regular" and multi_socket) is used for SCP and SFTP transfers. This should
  result in (much) less busy-loop situations and thus less CPU usage with no
  speed loss.
2008-12-19 21:14:52 +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
Daniel Stenberg b701ea36a7 moved the Curl_raw_ functions into the new lib/rawstr.c file for easier curlx_
inclusion by the curl tool without colliding with the curl_strequal functions.
2008-10-23 11:49:19 +00:00
Daniel Stenberg 9d16b4081e Renamed Curl_ascii_equal to Curl_raw_equal and bugfixed the my_toupper function
used in strequal.c so now all test cases run fine for me again.
2008-10-16 08:23:48 +00:00
Daniel Stenberg 5175664174 fix warning 2008-10-15 21:44:49 +00:00
Daniel Stenberg a579d67064 - Pascal Terjan filed bug #2154627
(http://curl.haxx.se/bug/view.cgi?id=2154627) which pointed out that libcurl
  uses strcasecmp() in multiple places where it causes failures when the
  Turkish locale is used. This is because 'i' and 'I' isn't the same letter so
  strcasecmp() on those letters are different in Turkish than in English (or
  just about all other languages). I thus introduced a totally new internal
  function in libcurl (called Curl_ascii_equal) for doing case insentive
  comparisons for english-(ascii?) style strings that thus will make "file"
  and "FILE" match even if the Turkish locale is selected.
2008-10-15 21:43:48 +00:00
Dan Fandrich 8f467b4288 Removed unneeded includes of signal.h and setjmp.h 2008-09-29 21:44:50 +00:00
Yang Tse adb974960d fix compiler warning: enumerated type mixed with another type 2008-09-13 01:12:07 +00:00
Yang Tse a622fd90b4 remove unnecessary typecasting of calloc() 2008-09-06 04:47:14 +00:00
Dan Fandrich 6f0a2608b4 Fixed a problem where telnet data would be lost if an EWOULDBLOCK
condition were encountered.
2008-06-03 18:03:11 +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 13648f8ccd struct HandleData is now called struct SingleRequest, and is only for data that
is inited at the start of the DO action. I removed the Curl_transfer_keeper
struct completely, and I had to move out a few struct members (that had to
be set before DO or used after DONE) to the UrlState struct. The SingleRequest
struct is accessed with SessionHandle->req.

One of the biggest reasons for doing this was the bunch of duplicate struct
members in HandleData and Curl_transfer_keeper since it was really messy to
keep track of two variables with the same name and basically the same purpose!
2007-11-24 23:16:55 +00:00
Daniel Stenberg cbd1a77ec2 if () => if()
while () => while()
and some other minor re-indentings
2007-11-07 09:21:35 +00:00
Dan Fandrich 33f7ac06c3 Improved telnet support by drastically reducing the number of write
callbacks needed to pass a buffer to the user.  Instead one per byte it
is now as little as one per segment.
2007-11-07 05:52:03 +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 92433e596b We use this ZERO_NULL to avoid picky compiler warnings,
when assigning a NULL pointer to a function pointer var.
2007-10-17 16:58:32 +00:00
Patrick Monnerat 07b6e7363d Added per-protocol callback static tables, replacing callback ptr storage
in the connectdata structure by a single handler table ptr.
2007-10-12 13:36:37 +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
Yang Tse f08ac86834 fix compiler warning 2007-03-25 02:30:58 +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 3a634a273a curlassert macro replaced with DEBUGASSERT macro defined in setup_once.h 2007-02-21 19:03:20 +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 385e612fa5 - Armel Asselin improved libcurl to behave a lot better when an easy handle
doing an FTP transfer is removed from a multi handle before completion. The
  fix also fixed the "alive counter" to be correct on "premature removal" for
  all protocols.
2007-01-16 22:22:10 +00:00
Yang Tse de59cde155 Fix copy-paste error 2006-10-21 12:36:10 +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
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
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 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 d157c29269 Fix compiler warnings 2006-07-19 21:14:02 +00:00
Yang Tse f975fd03a1 Read the return value of the swrite() macro and 'print' a message in case of failure. 2006-07-12 07:33:54 +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 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