1
0
mirror of https://github.com/moparisthebest/curl synced 2024-10-31 15:45:12 -04:00
Commit Graph

106 Commits

Author SHA1 Message Date
Daniel Stenberg
6cd084a3b5 Curl_pgrsDone: return int and acknowledge return code
Since Curl_pgrsDone() itself calls Curl_pgrsUpdate() which may return an
abort instruction or similar we need to return that info back and
subsequently properly handle return codes from Curl_pgrsDone() where
used.

(Spotted by a Coverity scan)
2012-06-10 23:40:35 +02:00
Daniel Stenberg
c44d45db86 HTTP: reset expected DL/UL sizes on redirects
With FOLLOWLOCATION enabled. When a 3xx page is downloaded and the
download size was known (like with a Content-Length header), but the
subsequent URL (transfered after the 3xx page) was chunked encoded, then
the previous "known download size" would linger and cause the progress
meter to get incorrect information, ie the former value would remain
being sent in. This could easily result in downloads that were WAY
larger than "expected" and would cause >100% outputs with the curl
command line tool.

Test case 599 was created and it was used to repeat the bug and then
verify the fix.

Bug: http://curl.haxx.se/bug/view.cgi?id=3510057
Reported by: Michael Wallner
2012-04-01 00:07:24 +02:00
Gokhan Sengun
c834213ad5 FTP: perform active connections non-blocking
1- Two new error codes are introduced.

CURLE_FTP_ACCEPT_FAILED to be set whenever ACCEPTing fails because of
FTP server connected.

CURLE_FTP_ACCEPT_TIMEOUT to be set whenever ACCEPTing timeouts.

Neither of these errors are considered fatal and control connection
remains OK because it could just be a firewall blocking server to
connect to the client.

2- One new setopt option was introduced.

CURLOPT_ACCEPTTIMEOUT_MS

It sets the maximum amount of time FTP client is going to wait for a
server to connect. Internal default accept timeout is 60 seconds.
2011-12-20 20:30:02 +01:00
Daniel Stenberg
51d4885ca0 Curl_pgrsTime: store now in an auto variable
It makes it easier to introduce debug outputs in this function, and
everything in the function is using the value anyway so it might even be
more efficient.
2011-12-20 15:05:50 +01:00
Daniel Stenberg
40c27e299f Curl_pgrsStartNow: keep HEADERS_OUT set
To avoid that the progress meter headers get output between each
transfer, make sure the bits gets kept when (re-)inited.

Reported by: Christopher Stone
2011-09-22 22:41:06 +02:00
Daniel Stenberg
93ba8b9560 Curl_pgrsStartNow: clear all flags but HIDE
As bug 3385258 pointed out but I missed up the fix for. This is another
take at a fix.

Bug: http://curl.haxx.se/bug/view.cgi?id=3392101
Reported by: Wu Yongzheng
2011-08-15 22:13:18 +02:00
Daniel Stenberg
15379f0614 Curl_pgrsStartNow: clear all bits except HIDE
Bug: http://curl.haxx.se/bug/view.cgi?id=3385258
Reported by: Ben Winslow
2011-08-07 22:26:57 +02:00
Ben Winslow
27b8814017 progress: reset flags at transfer start
When an easy handle is used to download an URI which has no
Content-Length header (or equivalent) after downloading an URI which
does, the value from the previous transfer is reused and returned by
CURLINFO_CONTENT_LENGTH_DOWNLOAD. This is because the progress flags
(used to determine whether such a header was received) are not reset
between transfers.

Bug: http://curl.haxx.se/bug/view.cgi?id=3370895
2011-07-22 22:50:58 +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
Julien Chaffraix
34ef39015e progress: don't print the last update on a separate line.
Curl_posttransfer is called too soon to add the final new line.
Moved the new line logic to pgrsDone as there is no more call to
update the progress status after this call.

Reported by: Dmitri Shubin <sbn_at_tbricks.com>
http://curl.haxx.se/mail/lib-2010-12/0162.html
2011-03-21 21:00:56 -07:00
Daniel Stenberg
2309b4e330 remove the CVSish $Id$ lines 2010-03-24 11:02:54 +01:00
Yang Tse
3f56d12830 avoid division by zero 2009-11-05 15:00:28 +00:00
Daniel Stenberg
257f2376d5 - I fixed several problems with the transfer progress meter. It showed the
wrong percentage for small files, most notable for <1000 bytes and could
  easily end up showing more than 100% at the end. It also didn't show any
  percentage, transfer size or estimated transfer times when transferring
  less than 100 bytes.
2009-11-04 23:09:17 +00:00
Daniel Stenberg
223d848104 - Gabriel Kuri reported a problem with CURLINFO_CONTENT_LENGTH_DOWNLOAD if the
download was 0 bytes, as libcurl would then return the size as unknown (-1)
  and not 0. I wrote a fix and test case 566 to verify it.
2009-10-31 18:51:50 +00:00
Yang Tse
2ecf22e37e fix compiler warning: explicit conversion of a 64-bit integral type to a smaller integral type 2008-10-11 01:56:04 +00:00
Yang Tse
3e2487493e Use SIZEOF_OFF_T definition from config file 2008-08-26 01:40:19 +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
Yang Tse
4d1cd0da93 Fix curl_off_t sized constants usage 2008-08-12 18:49:33 +00:00
Yang Tse
24b1890710 s/SIZEOF_CURL_OFF_T/CURL_SIZEOF_CURL_OFF_T/g 2008-08-11 01:22:57 +00:00
Daniel Stenberg
7c648782bc Introcuding a new timestamp for curl_easy_getinfo():
CURLINFO_APPCONNECT_TIME. This is set with the "application layer"
handshake/connection is completed (typically SSL, TLS or SSH). By using this
you can figure out the application layer's own connect time. You can extract
the time stamp using curl's -w option and the new variable named
'time_appconnect'. This feature was sponsored by Lenny Rachitsky at NeuStar.
2008-07-03 06:56:03 +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
8e719e3ef5 - Prevent the internal progress meter from updating more frequently than once
per second.
2007-04-18 20:02:41 +00:00
Yang Tse
34afb0b257 Change spelling, ONE_TERRABYTE -> ONE_TERABYTE
Shave off a couple of function calls in the part of
Curl_pgrsUpdate() which is always executed when called.

Fix a couple of comments.
2007-03-23 04:23:53 +00:00
Yang Tse
072a8b2955 Bryan Henderson fixed the progress function so that it can get called
more frequently allowing same calling frecuency for the client progress
callback, while keeping the once a second frecuency for speed calculations
and internal display of the transfer progress.
2007-03-19 12:02:33 +00:00
Daniel Stenberg
c8cd13337e reverted the pselect patch => http://curl.haxx.se/mail/lib-2007-03/0100.html 2007-03-11 09:11:29 +00:00
Daniel Stenberg
dbaf4f9361 - Bryan Henderson introduces two things:
1) the progress callback gets called more frequently (at times)
  2) libcurl *might* call the callback when it receives a signal
2007-03-10 12:11:21 +00:00
Yang Tse
772a985dc3 Update copyright year, since the file has been modified 2006-10-27 03:47:57 +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
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
fe46572f2b prevent warning with comparison between signed and unsigned 2004-10-08 08:16:02 +00:00
Daniel Stenberg
39af394a1c removed tabs and trailing whitespace from source 2004-10-06 07:50:18 +00:00
Daniel Stenberg
9dbd6659dc more typecasts to please picky compilers 2004-08-10 06:41:13 +00:00
Daniel Stenberg
aedadfc779 explicit typecasts to double to prevent warnings about implicit conversions
that might lose accuracy
2004-07-02 11:56:26 +00:00
Daniel Stenberg
18dc8fbc26 typecast to int when the variable is int! 2004-07-01 07:28:36 +00:00
Daniel Stenberg
feb2dd2835 Replaced all uses of sprintf() with the safer snprintf(). It is just a
precaution to prevent mistakes to lead to buffer overflows.
2004-06-24 11:54:11 +00:00
Daniel Stenberg
aadc797225 quickfix to avoid division by zero, possibly we should go over all of these
once and for all
2004-05-21 12:23:53 +00:00
Daniel Stenberg
60f9450594 calculate upload and download speed using doubles to keep precision.
deleted trailing whitespace
2004-05-20 20:35:42 +00:00
Daniel Stenberg
9cf04dff6a hm, avoid division by zero more carefully with that new percentage math 2004-05-05 14:22:46 +00:00
Daniel Stenberg
3f21fe60fc Gisle fixed the percentage to work, I adjusted it slightly to not as easily
overflow on 32bit filesize-systems
2004-05-05 13:44:44 +00:00
Daniel Stenberg
6062ac7c37 made the progress meter display not overflow even if _very_ large files
are transfered. The maximum size we support now is 8 exabytes, which equals
to 8192 petabytes...
2004-05-05 08:43:23 +00:00
Daniel Stenberg
caf7854a3c if the values allow it, avoid floting point math for the current speed 2004-05-05 07:45:21 +00:00
Daniel Stenberg
5887945828 Gisle Vanem corrected a mistake in a recent progress fix 2004-04-19 07:18:26 +00:00
Daniel Stenberg
2fd463e979 Dirk Manske increased the resolution for what the CURLINFO_*_TIME return. 2004-04-09 09:36:31 +00:00
Daniel Stenberg
7ba4d3464f Dirk Manske's feedback:
* bring back subsecond resolution to CURLINFO_TOTAL_TIME
* Fix the Curl_pgrsDone() so that the final progress update is shown properly
2004-04-02 07:32:03 +00:00
Daniel Stenberg
306ff5649a made time2str() use longs internally instead to prevent compiler warnings
when converting to ints
2004-03-23 15:06:14 +00:00
Daniel Stenberg
1c652dfc5d added explicit typecasts to prevent compiler warnings on variable conversions 2004-03-23 15:01:19 +00:00
Daniel Stenberg
0aa720fa26 it actually fits to make a NNNd NNh display so this can be used up to
999 days
2004-03-23 11:46:31 +00:00
Daniel Stenberg
d44f3f84f8 Fixed the time fields no never get wider than 8 letters. They can now switch
to a "days + hours" or even "just days" display if the time value is very
large. I also switched several calculations over to fixed-point instead of the
previous doubles.
2004-03-23 11:43:34 +00:00