Commit Graph

341 Commits

Author SHA1 Message Date
Daniel Stenberg 32bc30e210 Based on an error report by Philippe Vaucher, we no longer count a retried
connection setup as a follow-redirect. It turns out 1) this fails when a FTP
connection is re-setup and 2) it does make the max-redirs counter behave
wrong. This fix was not verified since the reporter vanished, but I believe
this is the right fix nonetheless.
2006-01-30 08:20:52 +00:00
Daniel Stenberg 74e5beab9d Doug Kaufman's set of patches to make curl build fine on DJGPP again using
configure.
2005-11-24 10:22:46 +00:00
Daniel Stenberg 0264faaa4e fix compiler warning 2005-11-18 07:23:50 +00:00
Daniel Stenberg 4022a60ea7 I extended a patch from David Shaw to make libcurl _always_ provide an error
string in the given error buffer to address the flaw mention on 21 sep 2005.
2005-11-17 14:29:54 +00:00
Daniel Stenberg 966fa848a0 Nis Jorgensen filed bug report #1338648
(http://curl.haxx.se/bug/view.cgi?id=1338648) which really is more of a
feature request, but anyway. It pointed out that --max-redirs did not allow
it to be set to 0, which then would return an error code on the first
Location: found. Based on Nis' patch, now libcurl supports CURLOPT_MAXREDIRS
set to 0, or -1 for infinity. Added test case 274 to verify.
2005-10-27 22:05:38 +00:00
Daniel Stenberg b4c53e2cfd An anonymous submitter filed bug #1299181
(http://curl.haxx.se/bug/view.cgi?id=1299181) that identified a silly problem
with Content-Range: headers with the 'bytes' keyword written in a different
case than all lowercase! It would cause a segfault!
2005-09-27 09:13:39 +00:00
Daniel Stenberg b6f0aa4394 return an error string for the missing URL case 2005-09-21 06:38:33 +00:00
Daniel Stenberg a4773fcbbb Toby Peterson added CURLOPT_IGNORE_CONTENT_LENGTH to the library, accessible
from the command line tool with --ignore-content-length. This will make it
easier to download files from Apache 1.x (and similar) servers that are
still having problems serving files larger than 2 or 4 GB. When this option
is enabled, curl will simply have to wait for the server to close the
connection to signal end of transfer. I wrote test case 269 that runs a
simple test that this works.
2005-08-24 10:57:28 +00:00
Daniel Stenberg a676c18502 - Jeff Pohlmeyer found out that if you ask libcurl to load a cookiefile (with
CURLOPT_COOKIEFILE), add a cookie (with CURLOPT_COOKIELIST), tell it to
  write the result to a given cookie jar and then never actually call
  curl_easy_perform() - the given file(s) to read was never read but the
  output file was written and thus it caused a "funny" result.

- While doing some tests for the bug above, I noticed that Firefox generates
  large numbers (for the expire time) in the cookies.txt file and libcurl
  didn't treat them properly. Now it does.
2005-08-17 08:55:43 +00:00
Daniel Stenberg 35110eca73 James Bursa identified a libcurl HTTP bug and a good way to repeat it. If a
site responds with bad HTTP response that doesn't contain any header at all,
only a response body, and the write callback returns 0 to abort the
transfer, it didn't have any real effect but the write callback would be
called once more anyway.
2005-08-13 21:28:46 +00:00
Daniel Stenberg 465e19dbe9 Adrian Schuur added trailer support in the chunked encoding stream. The
trailer is then sent to the normal header callback/stream.
2005-07-12 18:15:34 +00:00
Daniel Stenberg a7846189cd Eric Cooper reported about a problem with HTTP servers that responds with
binary zeroes within the headers. They confused libcurl to do wrong so the
downloaded headers become incomplete. The fix is now verified with test case
262.
2005-05-29 22:30:48 +00:00
Daniel Stenberg a90e33ad71 Hm, this doesn't feel right. The error bits returned from Curl_select() can
be returned at times when we want to ignore them. Test case 160 fails on Linux,
so I modify the comparison to check for _only_ the error bit set...
2005-05-10 23:02:37 +00:00
Daniel Stenberg 62ab21ce7d me stupid, errno is not set for mere select()-exceptions 2005-05-10 22:48:26 +00:00
Daniel Stenberg cc8e8db1e5 include protos to fix warnings 2005-05-10 22:46:24 +00:00
Daniel Stenberg b19cba2016 If Curl_select() returns with the error bit set, bail out. 2005-05-10 22:44:08 +00:00
Daniel Stenberg 41e6292e7b there cannot be chunked problem when no_body (HEAD) is true since without
body there is nothing chunked-encoded!
2005-04-30 23:07:38 +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 fb3c85ab2f fixed the 304 response-with-content-length problem reported by Cory Nelson 2005-04-08 16:59:13 +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 ac022b2e30 Christopher R. Palmer reported a problem with HTTP-POSTing using "anyauth"
that picks NTLM. Thanks to David Byron letting me test NTLM against his
servers, I could quickly repeat and fix the problem. It turned out to be:

When libcurl POSTs without knowing/using an authentication and it gets back a
list of types from which it picks NTLM, it needs to either continue sending
its data if it keeps the connection alive, or not send the data but close the
connection. Then do the first step in the NTLM auth. libcurl didn't send the
data nor close the connection but simply read the response-body and then sent
the first negotiation step. Which then failed miserably of course. The fixed
version forces a connection if there is more than 2000 bytes left to send.
2005-02-16 14:31:23 +00:00
Daniel Stenberg 0a3065a2f2 Rename Curl_pretransfersec() to *_second_connect() since it does not just
do pretransfer stuff like Curl_pretransfer().
2005-02-14 09:30:40 +00:00
Daniel Stenberg 8c83422fe2 David Byron identified the lack of SSL_pending() use, and this is my take
at fixing this issue.
2005-02-09 23:09:12 +00:00
Daniel Stenberg 6a2e21ec8c FTP code turned into state machine. Not completely yet, but a good start.
The tag 'before_ftp_statemachine' was set just before this commit in case
of future need.
2005-02-09 13:06:40 +00:00
Daniel Stenberg e36fb1ecda Curl_wait_for_resolv() no longer disconnects on failure, but leaves that
operation to the caller. Disconnecting has the disadvantage that the conn
pointer gets completely invalidated and this is not handled on lots of places
in the code.
2005-02-08 07:36:57 +00:00
Daniel Stenberg 83c470a443 David Byron pointed out that this -1 on the buffer size is pointless since
the buffer is already BUFSIZE +1 one big to fit the extra trailing zero. This
change is reported to fix David's weird SSL problem...
2005-02-04 13:42:41 +00:00
Daniel Stenberg 8dbaf534c8 Using the multi interface, and doing a requsted a re-used connection that
gets closed just after the request has been sent failed and did not re-issue
a request on a fresh reconnect like the easy interface did. Now it does!
(define CURL_MULTIEASY, run test case 160)
2005-01-29 22:31:06 +00:00
Daniel Stenberg 7e42cb61f7 FTP third transfer support overhaul. See CHANGES for details. 2005-01-21 09:32:32 +00:00
Daniel Stenberg c5b2e85b47 Dan Torop cleaned up a few no longer used variables from David Phillips'
select() overhaul fix.
2005-01-11 20:22:44 +00:00
Daniel Stenberg 29102befa6 Cyrill Osterwalder posted a detailed analysis about a bug that occurs when
using a custom Host: header and curl fails to send a request on a re-used
persistent connection and thus creates a new connection and resends it. It
then sent two Host: headers. Cyrill's analysis was posted here:
http://curl.haxx.se/mail/archive-2005-01/0022.html
2005-01-11 14:00:45 +00:00
Daniel Stenberg ac269a8f68 Dan Fandrich added the --disable-cookies option to configure to build
libcurl without cookie support. This is mainly useful if you want to build a
minimalistic libcurl with no cookies support at all. Like for embedded
systems or similar.
2004-12-05 23:59:32 +00:00
Daniel Stenberg 2c27e4ee76 Bug report #1078066: when a chunked transfer was pre-maturely closed exactly
at a chunk boundary it was not considered an error and thus went unnoticed.
Added test case 207 to verify.
2004-12-03 09:31:25 +00:00
Gisle Vanem d85bc18178 I changed my mind. Remove ioctl() macro in setup.h instead. 2004-11-26 16:08:15 +00:00
Gisle Vanem af114358c8 Renamed urldata.h members 'ioctl*' to 'ioctrl*' due to
clash with djgpp ioctl() macro in setup.h.
2004-11-26 14:57:01 +00:00
Daniel Stenberg ffe17a8197 As reported in Mandrake's bug tracker bug 12289
(http://qa.mandrakesoft.com/show_bug.cgi?id=12289), curl would print a newline
to "finish" the progress meter after each redirect and not only after a
completed transfer.
2004-11-26 14:33:13 +00:00
Daniel Stenberg 3e1caa6185 HTTP "auth done right". See lib/README.httpauth 2004-11-24 16:11:35 +00:00
Daniel Stenberg 1a05a90f1c David Phillips' FD_SETSIZE fix 2004-11-19 08:52:33 +00:00
Daniel Stenberg dcea109bb5 Dan Fandrich fix: eliminates some pedantic CodeWarrior compiler warnings and
errors.
2004-11-18 14:04:40 +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 a00e7f0f5e Tomas Pospisek filed bug report #1053287 that proved -C - and --fail on a
file that was already completely downloaded caused an error, while it
doesn't if you don't use --fail! I added test case 194 to verify the fix.
Grrr. CURLOPT_FAILONERROR is now added to the list stuff to remove in
libcurl v8 due to all the kludges needed to support it.
2004-10-25 11:28:40 +00:00
Daniel Stenberg 38b1d96750 Alexander Krasnostavsky made it possible to make FTP 3rd party transfers with
both source and destination being the same host. It can be useful if you want
to move a file on a server or similar.
2004-10-19 18:26:35 +00:00
Daniel Stenberg 9a2aed7d7a Chih-Chung Chang reported that if you use CURLOPT_RESUME_FROM and enabled
CURLOPT_FOLLOWLOCATION, libcurl reported error if a redirect happened even if
the new URL would provide the resumed file. Test case 188 added to verify the
fix (together with existing test 99).
2004-10-06 13:37:12 +00:00
Daniel Stenberg 25bf23105d Location: problem with bad original URL, identified in bug report #1029478 2004-09-16 21:28:38 +00:00
Daniel Stenberg 6c3a87a599 no longer includes getdate.h, there's no need for it 2004-09-13 20:47:31 +00:00
Daniel Stenberg 05825a8a9f Make "Proxy-Connection: close" close the current proxy connection, as
Roman Koifman found out.
2004-08-30 12:51:32 +00:00
Daniel Stenberg cd52b9f0da Alexander Krasnostavsky made the write callback get called even when a zero
byte file is downloaded.
2004-08-20 12:09:09 +00:00
Daniel Stenberg 9dbd6659dc more typecasts to please picky compilers 2004-08-10 06:41:13 +00:00
Daniel Stenberg 827a805966 typecast the assigment of an unsigned variable to a signed one to prevent
picky warnings
2004-08-09 08:29:39 +00:00
Daniel Stenberg e23ba31eb9 ->fread() should get a size_t variable passed in 2004-08-09 08:28:17 +00:00
Daniel Stenberg cd2e99e980 deal with negative Content-Length: headers by ignoring the info 2004-07-16 21:01:16 +00:00
Daniel Stenberg 090b89cc76 Variable type cleanups to please the picky MIPSPro compiler. 2004-07-01 08:10:21 +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 dca6386234 pass an int pointer when it expects an int pointer... 2004-06-22 06:50:41 +00:00
Daniel Stenberg 8e28721057 The read callback can now return CURL_READFUNC_ABORT to stop a transfer. 2004-06-21 14:07:38 +00:00
Daniel Stenberg a76288b99a Alexander Krasnostavsky fixed a flaw in the 3rd party transfer code that
didn't properly check return code.
2004-06-16 09:05:22 +00:00
Daniel Stenberg 90037b85d1 Alexander Krasnostavsky's fix to make libcurl build fine with configure
--disable-http, which thus builds a libcurl without HTTP support.
2004-06-09 08:23:55 +00:00
Daniel Stenberg ea81dd9e2e Alexander Krasnostavsky's FTP third party transfer (proxy) support 2004-06-03 11:41:05 +00:00
Daniel Stenberg fd802db39f initial support for "uploading" to file:// URLs 2004-05-25 21:47:29 +00:00
Daniel Stenberg 8001921112 I made Curl_done() take a pointer-pointer in the first argument instead, and
if the connection is killed it blanks the pointer it points to, to make it
easier to detect usage problems whereever Curl_done() is used.
2004-05-17 08:05:46 +00:00
Daniel Stenberg 6176f14141 fixed a warning on IRIX, deleted trailing whitespace 2004-05-17 06:50:08 +00:00
Daniel Stenberg d60c22572b Curl_done() and the protocol-specific conn->curl_done() functions now all
take a CURLcode as a second argument, that is non-zero when Curl_done()
is called after an error was returned from Curl_do() (or similar).
2004-05-12 12:06:39 +00:00
Daniel Stenberg a219d774fe even if Curl_do() fails, we must call Curl_done() to do proper cleaning up 2004-05-12 09:02:54 +00:00
Daniel Stenberg c9bab31a7f use size_t better for buffer and alloc lengths 2004-05-12 08:00:21 +00:00
Daniel Stenberg 853134017d minor leak in case of error, thanks to "./runtests.pl -n -t 25" 2004-05-11 14:53:24 +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 4d9517f0b4 prevent warnings when using the gcc option -Wunreachable-code 2004-05-05 06:57:26 +00:00
Daniel Stenberg fc6eff13b5 General HTTP authentication cleanup and fixes 2004-05-04 07:52:53 +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 712c67b4ae no longer include curl/types.h, it serves no purpose 2004-04-26 14:02:51 +00:00
Daniel Stenberg 9befc682ee added many comments 2004-04-26 07:12:52 +00:00
Daniel Stenberg 2ff30d067c - David Byron found and fixed a small bug with the --fail and authentication
stuff added a few weeks ago.  Turns out that if you specify --proxy-ntlm and
  communicate with a proxy that requires basic authentication, the proxy
  properly returns a 407, but the failure detection code doesn't realize it
  should give up, so curl returns with exit code 0. Test case 162 verifies
  this.
2004-04-22 20:07:41 +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 b7a7600465 Cleaned up hostname/name/gname and path/ppath confusion. Removed the fixed-
length limit of the hostname part of the URL.
2004-04-20 07:53:24 +00:00
Daniel Stenberg ee7d1d0701 remove an long time #defined struct member and use the actual "real" name
instead to make it easier to find/read
2004-04-13 07:37:28 +00:00
Daniel Stenberg 72b1144b8c getting only a 100 Continue response and nothing else, when talking HTTP,
is now treated as an error by libcurl
2004-04-07 14:27:54 +00:00
Daniel Stenberg cf1f46e1ca renamed the strtoofft() macro to curlx_strtoofft() to adjust to the curlx_*
concept, and added lib/README.curlx to explain details about it
2004-04-07 07:30:40 +00:00
Daniel Stenberg 8ed44e8dfb New authentication code added, particularly noticable when doing POST or PUT
with Digest or NTLM. libcurl will now use HEAD to negotiate the authentication
and when done perform the requested POST.
2004-04-06 15:14:10 +00:00
Daniel Stenberg 8e92600ddd David Byron made CURLOPT_FAILONERROR work with authentications such as NTLM
or Digest.
2004-03-30 06:40:01 +00:00
Daniel Stenberg 76c36688d0 Makes CURLINFO_CONTENT_LENGTH_DOWNLOAD work even if CURLOPT_NOBODY is set
true.
2004-03-22 22:38:12 +00:00
Daniel Stenberg fc67cca882 removed the min() macro define 2004-03-16 09:16:38 +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 0d1fc73f21 Use more curl_off_t variables when doing the progress meter calculations and
argument passing and try to convert to double only when providing data to the
external world.
2004-03-10 16:20:33 +00:00
Daniel Stenberg 7225b14002 curl_socket_t mistakes cleanup 2004-03-10 16:01:47 +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 6717240650 more fixing to make the progress/getinfo stuff to work properly when doing
file: transfers too
2004-03-05 09:40:16 +00:00
Daniel Stenberg 353f764119 Yet another curl_off_t printf format attempt, we now exclude the %-letter from
FORMAT_OFF_T to allow additional options to get specified, like with '"%5"
FORMAT_OFF_T'.
2004-03-02 09:31:18 +00:00
Daniel Stenberg 7ab3b5b3bb use FORMAT_OFF_T instead of CURL_FORMAT_OFF_T to reduce the complexity of
having to redef that name
2004-03-02 07:25:39 +00:00
Daniel Stenberg 71d81f1f75 Now uses CURL_FORMAT_OFF_T instead of %Od
Fixed the check for bad resumes. Made test case 99 work and proved a bug
in test case ... eh, was it 32?
2004-03-01 16:27:34 +00:00
Daniel Stenberg a39669198f we call the macro CURLMAX() isntead of MAX(), just because it turned up
it collides with another MAX define on some platforms (like netbsd 1.6.1)
2004-02-20 08:47:23 +00:00
Daniel Stenberg 9efddfedab removed some "jhrg" from comments 2004-02-18 15:28:56 +00:00
Daniel Stenberg f3d91528a1 CURLcode/int cleanup to reduce IRIX warnings
Removed some dates/names in the comments.
2004-02-15 13:48:28 +00:00
Daniel Stenberg e7d9ea8919 Greg Hewgill found out 'contentlength' wasn't big enough to hold a large file! 2004-02-13 07:12:40 +00:00
Daniel Stenberg e5165af5a6 The MIPSPro compiler complains on constructs such as "(void)foo;" so
we avoid it where possible.
2004-02-06 07:59:16 +00:00
Daniel Stenberg b84eaff1d5 set the 'retry' bit to TRUE when the connection is about to be retried,
this allows the HTTP code to *not* return a failure just because no data
has been received from the server
2004-02-02 14:49:54 +00:00
Daniel Stenberg 14cb9d296c make sure the connection is closed when it was detected reset! 2004-01-30 12:41:27 +00:00
Daniel Stenberg df750c236c Somewhat crude attempt at fixing the test 91 failures. I commit this now
so that the automatic testing hosts will test these changes over the weekend.
2004-01-30 12:08:18 +00:00
Daniel Stenberg 958987c214 Chunked-transfers should have an additional CRLF after the final 0 CRLF
sequence.
2004-01-28 17:07:22 +00:00
Daniel Stenberg b791e158f0 use curl_off_t instead of off_t! 2004-01-22 12:45:50 +00:00
Daniel Stenberg e262a7265a use the proper timecond defines, not the obsolete ones! 2004-01-21 08:47:21 +00:00
Daniel Stenberg 053f6c85ef updated year in the copyright string 2004-01-07 09:19:33 +00:00