Commit Graph

483 Commits

Author SHA1 Message Date
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
Dan Fandrich 95456b8e78 Added const to some pointer variables 2008-10-08 01:17:51 +00:00
Daniel Stenberg 038542ea3e - The libcurl FTP code now returns CURLE_REMOTE_FILE_NOT_FOUND error when SIZE
gets a 550 response back for the cases where a download (or NOBODY) is
  wanted. It still allows a 550 as response if the SIZE is used as part of an
  upload process (like if resuming an upload is requested and the file isn't
  there before the upload). I also modified the FTP test server and a few test
  cases accordingly to match this modified behavior.
2008-09-30 09:51:58 +00:00
Daniel Stenberg f3ab5d5500 - Daniel Egger provided a patch that allows you to disable proxy support in
libcurl to somewhat reduce the size of the binary. Run configure
  --disable-proxy.
2008-09-29 21:46:04 +00:00
Yang Tse 4e909ee8b1 ntoa() and inet_ntoa_r() no longer used 2008-09-24 12:22:16 +00:00
Yang Tse 59e378f48f remove unnecessary typecasting of malloc() 2008-09-06 05:29:05 +00:00
Yang Tse a622fd90b4 remove unnecessary typecasting of calloc() 2008-09-06 04:47:14 +00:00
Dan Fandrich 29ec219b82 Fixed an out of memory problem that caused torture test failures in tests
706 and 707.
2008-09-02 23:12:00 +00:00
Yang Tse ad638da2c2 Library internal only C preprocessor macros FORMAT_OFF_T and FORMAT_OFF_TU
remain in use as internal curl_off_t print formatting strings for the internal
*printf functions which still cannot handle print formatting string directives
such as "I64d", "I64u", and others available on MSVC, MinGW, Intel's ICC, and
other DOS/Windows compilers.

This reverts previous commit part which did:

FORMAT_OFF_T  -> CURL_FORMAT_CURL_OFF_T
FORMAT_OFF_TU -> CURL_FORMAT_CURL_OFF_TU
2008-08-16 01:33:59 +00:00
Yang Tse 66fb9ca5f6 For congruency sake with the naming of other CURL_XXXXXX_CURL_OFF_T macros,
the names of the curl_off_t formatting string directives now become
CURL_FORMAT_CURL_OFF_T and CURL_FORMAT_CURL_OFF_TU.

CURL_FMT_OFF_T  -> CURL_FORMAT_CURL_OFF_T
CURL_FMT_OFF_TU -> CURL_FORMAT_CURL_OFF_TU

Remove the use of an internal name for the curl_off_t formatting string directives
and use the common one available from the inside and outside of the library.

FORMAT_OFF_T  -> CURL_FORMAT_CURL_OFF_T
FORMAT_OFF_TU -> CURL_FORMAT_CURL_OFF_TU
2008-08-15 02:58:15 +00:00
Dan Fandrich f1fe04245a Fixed a boundary condition error in ftp_readresp() whereby a non-terminal
line of a multiline FTP response whose last byte landed exactly at the end
of the BUFSIZE-length buffer would be treated as the terminal response
line.  The following response code read in would then actually be the
end of the previous response line, and all responses from then on would
correspond to the wrong command. Test case 1062 verifies this.

Stop closing a never-opened ftp socket.
2008-08-11 23:16:08 +00:00
Daniel Stenberg 0e5da5b8bc - Scott Barrett provided a test case for a segfault in the FTP code and the
fix for it. It occured when you did a FTP transfer using
  CURLFTPMETHOD_SINGLECWD and then did another one on the same easy handle but
  switched to CURLFTPMETHOD_NOCWD. Due to the "dir depth" variable not being
  cleared properly.  Scott's test case is now known as test 539 and it
  verifies the fix.
2008-07-07 20:37:07 +00:00
Daniel Stenberg e481d679b2 - Liam Healy filed the debian bug report #480044
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=480044) identifying a
  segfault when using krb5 ftp, but the krb4 code had the same problem.
2008-05-07 21:02:21 +00:00
Daniel Stenberg 7a6cff4b3a - Norbert Frese filed bug report #1951588: "Problem with curlftpfs and
libcurl" (http://curl.haxx.se/bug/view.cgi?id=1951588) which seems to be an
  identical report to what Denis Golovan reported in
  http://curl.haxx.se/mail/lib-2008-02/0108.html The FTP code didn't reset the
  user/password pointers properly even though there might've been a new
  struct/cconnection getting used.
2008-04-28 21:29:17 +00:00
Dan Fandrich 1960eebc2d Added support for running on Symbian OS. 2008-04-22 22:53:53 +00:00
Dan Fandrich 09777a4fc2 Some trivial changes 2008-04-17 00:45:33 +00:00
Daniel Stenberg 7607d5145b - Based on the Debian bug report #474224 that complained about the FTP error
message when libcurl doesn't get a 220 back immediately on connect, I now
  changed it to be more specific on what the problem is. Also worth noticing:
  while the bug report contains an example where the response is:

    421 There are too many connected users, please try again later

  we cannot assume that the error message will always be this readable nor
  that it fits within a particular boundary etc.
2008-04-05 21:02:38 +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
Daniel Stenberg b620e62f0f - Dmitry Kurochkin moved several struct fields from the connectdata struct to
the SingleRequest one to make pipelining better. It is a bit tricky to keep
  them in the right place, to keep things related to the actual request or to
  the actual connection in the right place.
2008-01-31 12:04:33 +00:00
Daniel Stenberg ed6466d176 Calls to Curl_failf() are not supposed to provide a trailing newline as the
function itself adds that. Fixed on 50 or something strings!
2008-01-15 23:19:02 +00:00
Yang Tse 3564aec388 fix compiler warning 2008-01-11 17:35:10 +00:00
Daniel Stenberg 18faa50940 Georg Lippitsch brought CURLOPT_SEEKFUNCTION and CURLOPT_SEEKDATA to allow
libcurl to seek in a given input stream. This is particularly important when
doing upload resumes when there's already a huge part of the file present
remotely. Before, and still if this callback isn't used, libcurl will read
and through away the entire file up to the point to where the resuming
begins (which of course can be a slow opereration depending on file size,
I/O bandwidth and more). This new function will also be preferred to get
used instead of the CURLOPT_IOCTLFUNCTION for seeking back in a stream when
doing multi-stage HTTP auth with POST/PUT.
2008-01-10 10:30:19 +00:00
Daniel Stenberg f111c9edae more SOCKS5_HOSTNAME adjustments from Richard Atterer 2008-01-06 21:41:38 +00:00
Daniel Stenberg 7138296633 make sure we deal with SOCKS5_HOSTNAME as a proxy type as well 2008-01-06 12:56:34 +00:00
Gisle Vanem 083d3190e5 'false' and 'true' are not built-ins on most compilers.
Use TRUE/FALSE from setup_once.h.
2008-01-03 15:18:27 +00:00
Daniel Stenberg a46b40b7fd Richard Atterer brought a patch that added support for SOCKS4a proxies, which
is an inofficial PROXY4 variant that sends the hostname to the proxy instead
of the resolved address (which is already supported by SOCKS5).  --socks4a is
the curl command line option for it and CURLOPT_PROXYTYPE can now be set to
CURLPROXY_SOCKS4A as well.
2008-01-02 21:40: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 f75ba55b51 Fixed the resumed FTP upload loop to not require that the read callback
returns a full buffer on each invoke.
2007-11-29 22:14:33 +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
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
Daniel Stenberg 2ec8f77f21 avoid setting up a transfer when the state machine failed previously 2007-11-02 23:34:00 +00:00
Daniel Stenberg d34fe06fb0 minor re-indent 2007-11-01 21:43:56 +00:00
Dan Fandrich d3ee83747c Fixed a valgrind uninitialized variable error. 2007-10-26 19:26:41 +00:00
Daniel Stenberg 8997d258f7 Curl_ftp_disconnect() no longer relies on anything in the reqdata struct. That
was even mentioned to be bad in a comment! Should make test 2000 and 2001 work
fine.

Also, freedirs() now take a ftp_conn struct pointer which saves some extra
unnecessary variable assignments.
2007-10-24 21:14:11 +00:00
Daniel Stenberg 5b358603bd Michal Marek forwarded the bug report
https://bugzilla.novell.com/show_bug.cgi?id=332917 about a HTTP redirect to
FTP that caused memory havoc. His work together with my efforts created two
fixes:

#1 - FTP::file was moved to struct ftp_conn, because is has to be dealt with
     at connection cleanup, at which time the struct HandleData could be
     used by another connection.
     Also, the unused char *urlpath member is removed from struct FTP.

#2 - provide a Curl_reset_reqproto() function that frees
     data->reqdata.proto.* on connection setup if needed (that is if the
     SessionHandle was used by a different connection).
2007-10-22 15:05:35 +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
Dan Fandrich 61ffcd7815 Made a few more functions static with the protocol handler table in place. 2007-10-13 00:47:53 +00:00
Dan Fandrich 7831c1ae44 Fixed a few compile errors and warnings. 2007-10-12 18:49:14 +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
Yang Tse 08b9f73219 Fix memory leak under low memory conditions. 2007-10-02 19:19:47 +00:00
Yang Tse 048bfeaaef Fix compiler warning 2007-10-02 15:26:30 +00:00
Dan Fandrich 0bd2d54814 Renamed a few variables to avoid shadowing global declarations. 2007-09-27 02:45:58 +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
Daniel Stenberg a6315359d7 Max Katsev reported that when doing a libcurl FTP request with
CURLOPT_NOBODY enabled but not CURLOPT_HEADER, libcurl wouldn't do TYPE
before it does SIZE which makes it less useful. I walked over the code and
made it do this properly, and added test case 542 to verify it.
2007-09-26 12:00:01 +00:00
Daniel Stenberg 775f86cb5a Immanuel Gregoire fixed KNOWN_BUGS #44: --ftp-method nocwd did not handle
URLs ending with a slash properly (it should list the contents of that
directory). Test case 351 brought back and also test 1010 was added.
2007-09-24 21:47:35 +00:00
Daniel Stenberg 1ce732e9d6 - I noticed while writing test 541 that the FTP code wrongly did a CWD on the
second transfer as it didn't store and remember the "" path from the
  previous transfer so it would instead CWD to the entry path as stored. This
  worked, but did a superfluous command. Thus, test case 541 now also verifies
  this fix.
2007-09-11 22:21:39 +00:00
Daniel Stenberg 73e91ce20c Curl_GetFTPResponse() now checks and properly deals with the fact that the
underlying ftp_readresp() function has a separate "cache" where there might
in fact be leftover data...
2007-09-05 21:41:07 +00:00
Dan Fandrich 3fa60164af Renamed the CURLE_FTP_SSL_FAILED error code to CURLE_USE_SSL_FAILED.
Renamed the curl_ftpssl enum to curl_usessl and its enumerated constants,
creating macros for backward compatibility.
2007-08-31 19:36:32 +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