Commit Graph

290 Commits

Author SHA1 Message Date
Daniel Stenberg 169b2eeb94 Fixes bug #669059. We now extract the Content-Type better and more accurate. 2003-01-30 05:04:02 +00:00
Daniel Stenberg 30a46e1135 John McGowan found a problem where the DEBUGFUNCTION was called with bad
data on uploads.
2003-01-29 12:52:45 +00:00
Daniel Stenberg a7c72b7abf removed the local variables for emacs and vim, use the new sample.emacs
way for emacs, and vim users should provide a similar non-polluting style
2003-01-29 10:14:20 +00:00
Daniel Stenberg 2b054e5309 Bertrand Demiddelaer found and fixed this memory leak. 2003-01-24 11:13:59 +00:00
Daniel Stenberg dee3163d95 when a chunked error is noticed, store the error number in the error string
to enable better error-tracking
2003-01-21 16:03:38 +00:00
Daniel Stenberg 5a83976c99 Markus F.X.J. Oberhumer's patch that reduces memory usage quite a bit by
only allocating the scratch memory buffer once it is needed and not always
in the handle.
2003-01-20 12:52:34 +00:00
Daniel Stenberg f26a338a54 copyright year update in the source header 2003-01-16 21:08:12 +00:00
Daniel Stenberg 63667dfd96 no TABs in source code 2003-01-15 11:44:33 +00:00
Daniel Stenberg ec24efda74 Simon Liu's HTTP200ALIASES-patch! 2003-01-07 16:15:53 +00:00
Daniel Stenberg efbe930a69 CURLE_HTTP_NOT_FOUND => CURLE_HTTP_RETURNED_ERROR 2002-12-18 16:51:02 +00:00
Daniel Stenberg db6ff224f8 The initial HTTP request can now be sent in multiple parts, as part of the
regular transfer process. This required some new tweaks, like for example
we need to be able to tell the tranfer loop to not chunky-encode uploads
while we're transferring the rest of the request...
2002-12-10 13:10:00 +00:00
Daniel Stenberg 4bcc866c52 The fread() callback pointer and associated pointer is now stored in the
connectdata struct instead, and is no longer modified within the 'set' struct
as previously (which was a really BAAAD thing).
2002-12-09 15:37:54 +00:00
Daniel Stenberg f6cdb820af read and write as much as possible until end of data or EWOULDBLOCK before
returning back to the select() loop. Consider this a test so far.
2002-12-05 14:26:30 +00:00
Daniel Stenberg 1c49a00d64 compareheader() was moved over to http.c and got a Curl_ prefix
The chunked transfer upload never stopped due to a silly add before we checked
for >0!
2002-11-28 15:46:22 +00:00
Daniel Stenberg 42acb00c81 moved the bools in the connectdata struct into the substruct named
ConnectBits where the other bools already are
2002-11-11 23:03:03 +00:00
Daniel Stenberg 03c22b4576 Now supports "Transfer-Encoding: chunked" for HTTP PUT operations where the
size of the uploaded file is unknown.
2002-11-11 08:40:37 +00:00
Daniel Stenberg cdba92ac3c when using checkprefix(), the first argument must be the prefix! 2002-10-28 22:19:23 +00:00
Daniel Stenberg 6d28f92ffe Transfer-Encoding: needs 17 bytes passed, not 18 2002-10-28 21:52:27 +00:00
Daniel Stenberg 01387f42c5 kromJx@crosswinds.net's fix that now uses checkprefix() instead of
strnequal() when the third argument was strlen(first argument) anyway.
This makes it less prone to errors. (Slightly edited by me)
2002-10-28 21:52:00 +00:00
Daniel Stenberg b5a74715cf bad headers can come in two kinds, we either treat everything as one big
badly assumed header, or we think that parts of the buffer is a bad header
and the rest is treated as a normal body part
2002-10-23 13:48:37 +00:00
Daniel Stenberg 0fa512f26d Nikita Schmidt's fix to debian bug report #165382. This is verified with
the new test case 55.
2002-10-21 12:07:02 +00:00
Daniel Stenberg 9e612b5550 make very sure that we return 'done' properly when a transfer is done, as
otherwise the multi interface gets problems
2002-10-18 15:28:33 +00:00
Daniel Stenberg 45bd009bb1 if we found no string on the Location: line, don't try to follow it 2002-10-18 13:51:00 +00:00
Daniel Stenberg 156aad198f Make the COOKIESESSION work better by creating a list of cookie files files
when given in the curl_easy_setopt() and then parse them all on the first
curl_easy_perform() call instead.
2002-10-17 07:10:39 +00:00
Daniel Stenberg 265c58611f When we receive a "bad header" we must sure not to write down the data part
as well, as then we write the same data twice.
2002-10-11 20:55:08 +00:00
Daniel Stenberg c3cc616264 Junk data could get inserted when saving/getting HTTP headers, as discovered
by Craig Davison. Now we deal with the 'nread' variable correctly between
each header line.
2002-10-09 13:03:51 +00:00
Daniel Stenberg 5f649a1649 Move the URL concat code to Curl_follow(), and added a proto for that
function. For Location: following.
2002-10-07 13:38:34 +00:00
Daniel Stenberg 3d5820648b as Ralph Mitchell pointed out, the Location: following code needs some
basic ./ and ../ strip-off understanding, and this change introduces with.
test cases 49 - 52 test this.
2002-10-04 14:15:01 +00:00
Daniel Stenberg 5b3069e265 spell fix comment 2002-09-23 12:55:36 +00:00
Daniel Stenberg fb5d267bd0 a follow-up fix to the previous fix for HTTP servers that don't reply *any*
headers at all
2002-09-16 14:02:08 +00:00
Daniel Stenberg c19844a0a3 better deal with HTTP(S) servers that respond with no headers at all, test
case 306 added to verify that we do right
2002-09-13 12:40:36 +00:00
Daniel Stenberg 371da7132f remove redundant comment 2002-09-09 11:23:13 +00:00
Daniel Stenberg ba4e69bebc updated source code boilerplate/header 2002-09-03 11:52:59 +00:00
Daniel Stenberg 64bbe9dfaf James Gallagher's Content-Encoding work 2002-09-02 22:31:18 +00:00
Daniel Stenberg 7140baae72 remove the data and conn fields from the Curl_transfer_keeper struct, they
weren't used anyway and mostly caused confusion
2002-08-29 06:09:21 +00:00
Daniel Stenberg 4cf953678d Markus F.X.J. Oberhumer's CURLOPT_NOSIGNAL patch 2002-08-08 22:52:50 +00:00
Daniel Stenberg 108cb14d1f Make SessionHandle keep record if it is used with the multi interface or
the easy interface, it CANNOT be used by a mixture.
2002-08-05 17:04:39 +00:00
Daniel Stenberg 7313501e30 fixed the Curl_cookie_add() invoke to not assume a space after the colon 2002-07-29 22:23:55 +00:00
Daniel Stenberg e54e0c7877 CURLOPT_BUFFERSIZE allows an application to set a prefered buffer size
for receiving data from the network. It is meant as a hint, not as a forced
limit.
2002-06-15 21:00:54 +00:00
Daniel Stenberg 407583e8e2 Moved the secondarysocket cleanup. The 'conn' struct may have been cleared
already at that other place.
2002-06-12 22:04:25 +00:00
Daniel Stenberg d866716565 Gautam Mani found a socket descriptor leak that happened when FTP transfers
failed and you reinvoked curl_easy_perform().
2002-06-10 12:34:04 +00:00
Daniel Stenberg 99c0456872 Adjusted to make curl_multi_perform() work properly even when
curl_multi_fdset() is not used.
2002-05-28 14:18:36 +00:00
Daniel Stenberg 44debdde62 Better support for being used with the multi interface without the *fd_set()
and proper select()ing have been made.
2002-05-05 12:11:03 +00:00
Daniel Stenberg 86cc34c0de made the DEBUGFUNCTION get called properly on a few more places, especially
for DATA_IN and DATA_OUT.
2002-05-03 12:07:32 +00:00
Daniel Stenberg 913e997061 use and set the fd_set pointers instead of the actual values, as then we
work properly with the multi interface when the user has provided the
fd_sets!
2002-05-02 22:14:31 +00:00
Daniel Stenberg 35d04c5398 Hanno Kranzhoff noticed we didn't properly reset the download/upload counters
before transfers, when doing multiple ones on the same handle.
2002-05-02 08:52:09 +00:00
Daniel Stenberg 08f8917acb Dirk Manske's fix for HTTP response code 301, that now behaves more like
browsers do. Which thus *breaks* the RFC 2616...
2002-04-17 07:16:49 +00:00
Daniel Stenberg 62d205a2ec Dirk Manske brought the patch that introduces two new CURLINFO_* values:
CURLINFO_REDIRECT_TIME and CURLINFO_REDIRECT_COUNT.
2002-04-16 07:59:20 +00:00
Daniel Stenberg 29e873b12d Jonatan Lander fixed the "Disables POST, goes with GET" output to be more
connected with reality! ;-)
2002-04-15 13:47:06 +00:00
Daniel Stenberg e8109b09b1 error code cleanup, use the new SEND/RECV errors 2002-04-10 13:44:42 +00:00
Daniel Stenberg 5d28a857a4 based on Jacky Lam's "HTTP 1.0 304-only" fix, this change makes a 304 reply
always stop reading after the headers no matter what 'close' is.
2002-04-08 07:27:22 +00:00
Daniel Stenberg 1cfcbc50a6 Fixes the problem Jacky Jam pointed out, where libcurl will "hang" for an
extra second after having downloaded headers-only
2002-04-04 12:19:56 +00:00
Daniel Stenberg 854277bae5 crlf replacement on uploads did not work. test case 128 was added just now
to make sure it remains functional.
2002-03-20 10:53:24 +00:00
Daniel Stenberg 974f314f57 copyright string (year) update 2002-03-19 07:54:55 +00:00
Daniel Stenberg 5f758fbd11 make sure we return CURLE_WRITE_ERROR if the write callback returned
an error, even if we were decoding a chunked-encoded transfer
2002-03-15 12:42:41 +00:00
Daniel Stenberg cfdb6f851c 2002 2002-03-14 14:37:41 +00:00
Daniel Stenberg ea8476a2dc Ralph Mitchell's SSL problems made me notice that we didn't increase the
header byte counter properly
2002-02-28 15:13:35 +00:00
Daniel Stenberg a333bddeeb Andrs Garca solved bug report #515228 by making sure the progress meter
is updated even if everything is read in one single pass, as the windows
functions apparantly does more often than other systems.
2002-02-20 13:38:34 +00:00
Daniel Stenberg e9bfef0eb1 Brent Beardsley found the content-type bug! 2002-02-06 07:02:13 +00:00
Daniel Stenberg a4934387d5 upload progress counter fix, removed the adjustable upload buffer size 2002-01-29 20:28:59 +00:00
Daniel Stenberg 76c53c690c Giaslas Georgios introduced CURLINFO_CONTENT_TYPE 2002-01-29 10:49:32 +00:00
Daniel Stenberg 4146ce8267 bug report #508235 identified a non-working Location: following, and this
little fix seems to correct it. another case where we just returned and
didn't shut off the reading. This bug is introduced in 7.9.3 due to the
new internal "order".
2002-01-25 08:35:49 +00:00
Daniel Stenberg 2db894807b Andrs Garca found out that we didn't properly stop reading from a connection
after the headers on a HEAD request. This bug has been added in 7.9.3 and was
mnot present earlier.
2002-01-23 07:15:32 +00:00
Daniel Stenberg 8d07c87be7 modified to deal with the new non-blocking versions of Curl_read() and
Curl_write().
2002-01-16 14:50:53 +00:00
Daniel Stenberg 4931fbce49 Curl_read() now returns a negative return code if EWOULDBLOCK or similar 2002-01-14 23:14:59 +00:00
Daniel Stenberg 1de82b220d removed silly check for >=0 of a supposedly unsigned value! 2002-01-07 22:46:38 +00:00
Daniel Stenberg c69c0c0446 added proper breaks in the switch() 2002-01-07 15:24:52 +00:00
Daniel Stenberg e31a306a38 HTTP response 204 should be treated similar to 304, that is we must not
expect (nor read) any response-body
2002-01-07 14:57:18 +00:00
Daniel Stenberg 8b6314ccfb merged the multi-dev branch back into MAIN again 2002-01-03 15:01:22 +00:00
Daniel Stenberg 7ee6a9dc25 i'm soooo funny 2001-12-04 09:14:41 +00:00
Daniel Stenberg ca0fd33d2d Georg Horn's STARTTRANSFER_TIME patch 2001-11-20 15:00:50 +00:00
Daniel Stenberg fe3a78ab19 we use signal() to ignore signals only as long as we have to, and we now
restore the previous (if any) signal handler properly on return.
2001-11-07 14:13:29 +00:00
Daniel Stenberg 2e32d415c0 myalarm() is history, we now use HAVE_ALARM and we now do our very best to
1 - restore the previous sigaction struct as soon as we are about to shut
off our timeout
2 - restore the previous alarm() timeout, in case an application or similar
had it running before we "borrowed" it for a while.

No, this does not fix the multi-thread problem you get with alarm(). This
patch should correct bug report #478780:
//sourceforge.net/tracker/?func=detail&atid=100976&aid=478780&group_id=976

If not, please post details!
2001-11-06 19:33:13 +00:00
Daniel Stenberg 4163b86cd2 failf() now only overwrites the error buffer the first time it gets called
for each *_perform(). It makes things a lot easier, as the first one that
detects the error get to write the final error reason...
2001-11-02 22:30:34 +00:00
Daniel Stenberg 617d6eb7ce Update the byte counters in the loop so that aborted transfers have the
information as well. Improves debug outputs etc.
2001-11-01 12:18:53 +00:00
Daniel Stenberg 542055074b If Curl_do() fails with CURLE_WRITE_ERROR on a re-used connection, this
new logic can retry the same operation on a new connection!
2001-10-31 15:13:19 +00:00
Daniel Stenberg 29b76a52fb failed transfers will now close the connection 2001-10-22 06:34:14 +00:00
Daniel Stenberg 4e37187e44 now counts header size return from server and if nothing is returned from a
HTTP server we return error
2001-10-19 11:58:32 +00:00
Daniel Stenberg 45cc78fdbc CURLOPT_FAILONERROR now only returns error if the HTTP code is 400 or above
unconditionalliy. Previously, the code check was for >= 300 unless follow-
location was enabled...
2001-10-19 06:27:24 +00:00
Daniel Stenberg db0e3cc60c call Curl_done() in Curl_perform() after Transfer() was called, even it it
returned an error as there might be stuff in there we must free/cleanup.
This fixes the memory leak Yanick Pelletier posted about 16 Oct 2001
2001-10-17 12:24:51 +00:00
Daniel Stenberg 2c5e416591 better check for absolute URL redirects, adjusted to new Curl_tvdiff() proto 2001-10-12 12:30:06 +00:00
Sterling Hughes 8e91d5de8e looks nicer and is better compatible with older vim versions 2001-10-11 09:32:19 +00:00
Daniel Stenberg 5cd267b2be removed obsoletetd myalarm() calls 2001-10-01 11:35:29 +00:00
Daniel Stenberg e9aa07f660 filetime should be -1 if the remote time was unknown as 0 is actually a
valid time. we now store the filetime as a long to know for sure it can
hold -1 (there exist some unsigned time_t cases)
2001-09-28 11:04:43 +00:00
Daniel Stenberg 598e8dfbfb Now we're setting a default domain for received cookies so that we can
properly match those cookies in subsequent requests
2001-09-26 07:08:29 +00:00
Daniel Stenberg 2cb893575d moved a 100K buffer from the transfer loop to the urlstate struct, as it
seriously decreases the amount of used stack space
2001-09-12 12:02:12 +00:00
Sterling Hughes 6147879837 Added formatting sections for emacs and vim 2001-09-07 04:01:32 +00:00
Daniel Stenberg 0ece1b5c34 Major rename and redesign of the internal "backbone" structs. Details will
be posted in a minute to the libcurl list.
2001-08-30 22:48:34 +00:00
Daniel Stenberg 9835629801 Georg Huettenegger added code to deal with error 417 when doing form posts.
NOTE: we might do this for *ALL* errors when doing form posts.
2001-08-28 08:54:09 +00:00
Daniel Stenberg 3c52c53ddd Added SSL session ID caching, moved some SSL code from url.c to ssluse.c 2001-08-28 08:37:54 +00:00
Daniel Stenberg 08655d8d5d Georg Huettenegger's patch curl-7.8.1-pre5-patch-20010819 2001-08-21 13:18:07 +00:00
Daniel Stenberg db9bb9221f calls Curl_initinfo() in perform(). 2001-08-15 06:53:10 +00:00
Daniel Stenberg 85bb25e628 const and (un)signed fixes 2001-08-14 08:39:01 +00:00
Daniel Stenberg f8c357e4ff corrected minor source indentation error 2001-08-10 14:10:19 +00:00
Daniel Stenberg 47bb09e908 - Sergio Ballestrero provided a patch for reading responses from NCSA httpd
1.5.x servers, as they return really screwed up response headers when asked
  for with HTTP 1.1.
2001-08-05 12:30:57 +00:00
Daniel Stenberg 8987244758 httpreq cleanup fix 2001-08-03 11:52:53 +00:00
Daniel Stenberg 3e0a95bb78 FD_ZERO() the keepfd variables properly when keepon is modified (Tomasz Lacki
reported 12 Jul 2001)
2001-08-02 16:52:12 +00:00
Daniel Stenberg 2966ef6661 store httpcode _before_ doing the FAILONERROR check so that getinfo works
afterwards (bug #426442)
2001-05-22 21:09:09 +00:00
Daniel Stenberg adc0edc44b slightly "hackish" approach to disable SSL during download if the connection
is a FTPS connection as the data transfer is then done unencrypted!
2001-05-21 13:30:01 +00:00
Daniel Stenberg c7c942861a Added tons of comments all over 2001-05-12 16:11:14 +00:00
Daniel Stenberg 291075b12f checkheader() added to check headers+contents instead of the previous
strnequal() approach that really didn't follow the RFC properly
2001-05-11 07:52:58 +00:00
Daniel Stenberg fef1fc0d32 Ingo Wilken's redirect fixes 2001-05-11 06:10:48 +00:00
Daniel Stenberg dc6da007ad Ingo Wilken's patch to support multiple spaces after "Location:" 2001-05-10 11:29:47 +00:00
Daniel Stenberg a33eb9881c Cris Bailiff's fix to never attempt to get the body of a 304-reply! 2001-05-03 10:45:39 +00:00
Daniel Stenberg 2eb94acb95 When Content-Length:0 is received, we now bail now and return success
directly after all the headers are received!
2001-04-27 18:03:44 +00:00
Daniel Stenberg 3974f30ed4 improved treatment of "Content-Length: 0", which is done by having
maxdownload set to -1 when not used
2001-04-27 08:02:10 +00:00
Daniel Stenberg 3fd65fb7d8 Remade resume stuff to keep data in the connectdata struct instead of the
main handle struct to work with persistant connections
2001-04-18 07:25:11 +00:00
Daniel Stenberg 879c6c5711 calling curl_easy_perform() with no URL set, now returns an error as
early as possible
2001-04-11 14:14:28 +00:00
Daniel Stenberg 6bd1ed034a bugfixed the Location: following that must've been bad since the persistant
connections were introduced
2001-04-03 13:37:53 +00:00
Daniel Stenberg fa491ed910 - disabling port on absolute redirects is wrong
- removed #ifdefed code
2001-04-03 13:18:41 +00:00
Daniel Stenberg 28497e7ee4 better error checks for failure conditions (based on Puneet Pawaia's reports) 2001-04-03 10:20:23 +00:00
Daniel Stenberg 3e65062be2 make sure the alarm is off when returning from curl_easy_perform() 2001-03-27 21:24:46 +00:00
Daniel Stenberg 31f9d4016d 'Connection: keep-alive' is now understood when sent by a HTTP/1.0 server
as an indication of a persistant connection
2001-03-26 06:19:11 +00:00
Daniel Stenberg 1e14f8d4c7 DONT TOUCH the data->url as it may point to read-only memory!!! 2001-03-23 08:24:47 +00:00
Daniel Stenberg 02f6894af5 now always stops reading a HEAD reply after all the headers have been returned
RFC 2616, section 9.4 says: "The HEAD method is identical to GET except that
the server MUST NOT return a message-body in the response."
2001-03-23 07:52:45 +00:00
Daniel Stenberg ec1f42a154 Treat 302-redirects the same way we treat 303-redirects 2001-03-22 20:02:52 +00:00
Daniel Stenberg aa1c3bb46d reset the follow location counter in Curl_perform() so that we can follow
new locations on the same connection that was previously followed on
2001-03-22 19:14:35 +00:00
Daniel Stenberg 78b4851da1 Added support for HTTP code 100 continue, as 8.2.3 in RFC2616 defines 2001-03-19 07:47:57 +00:00
Daniel Stenberg 38c47803dd detect if chunked transfers are aborted 2001-03-16 15:45:12 +00:00
Daniel Stenberg f9cde0646f Added a failf() error message when the chunked read returns failure 2001-03-13 22:20:14 +00:00
Daniel Stenberg 46c9075eab updated the comment for the chunked reading 2001-03-12 15:21:11 +00:00
Daniel Stenberg d774b10afb Added infof() calls for persistant connection info, we are very likely to
need these at least for debugging 7.7 and probably later as well...
2001-03-12 13:58:03 +00:00
Daniel Stenberg 67d5c0a970 for HTTP/1.0 we default to non keep-alive connections, but when we get a
1.0-reply from a proxy we use and the Proxy-Connection: keep-alive header
is used, we switch it on and live happily ever after
2001-03-09 16:02:59 +00:00
Daniel Stenberg 781dd7a9bf prefix changes curl_ to Curl_
made it work (partly) with persistant connections for HTTP/1.0 replies
moved the 'newurl' struct field for Location: to the connectdata struct
2001-03-09 15:16:28 +00:00
Daniel Stenberg 5cd4c3ed24 return from transfer when all headers have been received and nobody is set,
as is the case when doing HEAD requests
2001-03-08 10:32:27 +00:00
Daniel Stenberg a23db7b7c7 "Transfer-Encoding: chunked" support added 2001-03-07 23:51:41 +00:00
Daniel Stenberg 91e4da7ddb initial chunked transfer-encoding support 2001-03-07 17:12:12 +00:00
Daniel Stenberg 07ce7539a8 set download size properly for HTTP downloads 2001-03-05 13:40:31 +00:00
Daniel Stenberg d1cfbd51b5 remade the port number stuff so that following locations work and doing
intermixed HTTP and FTP persistant connections also work!
2001-03-02 15:34:15 +00:00
Daniel Stenberg 1f17fb5f89 Now persistant connection download works thanks to the Content-Length taken
into account
2001-02-22 23:32:41 +00:00
Daniel Stenberg a1d6ad2610 multiple connection support initial commit 2001-02-20 17:35:51 +00:00
Daniel Stenberg 58d70db92e no longer #includes "getenv.h" 2001-02-07 08:36:23 +00:00
Daniel Stenberg 9464c5430d Curl_read() uses ssize_t now 2001-01-31 15:06:56 +00:00
Daniel Stenberg a14aaaf23f fixed up the telnet to work (using support from Linus Nielsen) 2001-01-31 15:05:44 +00:00
Daniel Stenberg 1bcd3e601a changed order of the range and follow-location checks so that a range-request
will work even when following a Location:
2001-01-30 11:52:59 +00:00
Daniel Stenberg c69c79dd04 bettersupport for HTTP return codes 300-399 2001-01-27 20:31:51 +00:00
Daniel Stenberg c331ef02f9 The check for that content-range is received must only be made if we requested
GET resume. Other resumes are upload-wise and don't care about this header
in the download stream
2001-01-26 15:50:56 +00:00
Daniel Stenberg e49a82b06c converted to use Curl_read() and Curl_write() 2001-01-25 12:23:12 +00:00
Daniel Stenberg faa5c14aee No more URL length restrictions 2001-01-19 12:15:23 +00:00
Daniel Stenberg e09eda9c7c download and highlevel are replaced with transfer 2001-01-17 13:19:01 +00:00