summaryrefslogtreecommitdiff
path: root/lib/progress.c
Commit message (Collapse)AuthorAgeFilesLines
...
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* mprintf.h: remove #ifdef CURLDEBUGDaniel Stenberg2015-03-031-4/+2
| | | | | ... and as a consequence, introduce curl_printf.h with that re-define magic instead and make all libcurl code use that instead.
* Ensure progress.size_dl/progress.size_ul are always >= 0Brandon Casey2014-09-071-8/+14
| | | | | | | | | | | | | | | | | | | | Historically the default "unknown" value for progress.size_dl and progress.size_ul has been zero, since these values are initialized implicitly by the calloc that allocates the curl handle that these variables are a part of. Users of curl that install progress callbacks may expect these values to always be >= 0. Currently it is possible for progress.size_dl and progress.size_ul to by set to a value of -1, if Curl_pgrsSetDownloadSize() or Curl_pgrsSetUploadSize() are passed a "size" of -1 (which a few places currently do, and a following patch will add more). So lets update Curl_pgrsSetDownloadSize() and Curl_pgrsSetUploadSize() so they make sure that these variables always contain a value that is >= 0. Updates test579 and test599. Signed-off-by: Brandon Casey <drafnel@gmail.com>
* timers: fix timer regression involving redirects / reconnectsDaniel Stenberg2014-05-151-2/+6
| | | | | | | | | | | | | | | | | | | | In commit 0b3750b5c23c25f (released in 7.36.0) we fixed a timeout issue but instead broke the timings. To fix this, I introduce a new timestamp to use for the timeouts and restored the previous timestamp and timestamp position so that the old timer functionality is restored. In addition to that, that change also broke connection timeouts for when more than one connect was used (as it would then count the total time from the first connect and not for the most recent one). Now Curl_timeleft() has been modified so that it checks against different start times depending on which timeout it checks. Test 1303 is updated accordingly. Bug: http://curl.haxx.se/mail/lib-2014-05/0147.html Reported-by: Ryan Braud
* mprintf: Replaced internal usage of FORMAT_OFF_T and FORMAT_OFF_TUSteve Holme2013-12-311-20/+21
| | | | | | | | | Following commit 0aafd77fa4c6f2, replaced the internal usage of FORMAT_OFF_T and FORMAT_OFF_TU with the external versions that we expect API programmers to use. This negates the need for separate definitions which were subtly different under different platforms/compilers.
* CURLOPT_XFERINFOFUNCTION: introducing a new progress callbackDaniel Stenberg2013-07-181-5/+14
| | | | | | | | | | | | | | | CURLOPT_XFERINFOFUNCTION is now the preferred progress callback function and CURLOPT_PROGRESSFUNCTION is considered deprecated. This new callback uses pure 'curl_off_t' arguments to pass on full resolution sizes. It otherwise retains the same characteristics: the same call rate, the same meanings for the arguments and the return code is used the same way. The progressfunc.c example is updated to show how to use the new callback for newer libcurls while supporting the older one if built with an older libcurl or even built with a newer libcurl while running with an older.
* build: fix circular header inclusion with other packagesYang Tse2013-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit renames lib/setup.h to lib/curl_setup.h and renames lib/setup_once.h to lib/curl_setup_once.h. Removes the need and usage of a header inclusion guard foreign to libcurl. [1] Removes the need and presence of an alarming notice we carried in old setup_once.h [2] ---------------------------------------- 1 - lib/setup_once.h used __SETUP_ONCE_H macro as header inclusion guard up to commit ec691ca3 which changed this to HEADER_CURL_SETUP_ONCE_H, this single inclusion guard is enough to ensure that inclusion of lib/setup_once.h done from lib/setup.h is only done once. Additionally lib/setup.h has always used __SETUP_ONCE_H macro to protect inclusion of setup_once.h even after commit ec691ca3, this was to avoid a circular header inclusion triggered when building a c-ares enabled version with c-ares sources available which also has a setup_once.h header. Commit ec691ca3 exposes the real nature of __SETUP_ONCE_H usage in lib/setup.h, it is a header inclusion guard foreign to libcurl belonging to c-ares's setup_once.h The renaming this commit does, fixes the circular header inclusion, and as such removes the need and usage of a header inclusion guard foreign to libcurl. Macro __SETUP_ONCE_H no longer used in libcurl. 2 - Due to the circular interdependency of old lib/setup_once.h and the c-ares setup_once.h header, old file lib/setup_once.h has carried back from 2006 up to now days an alarming and prominent notice about the need of keeping libcurl's and c-ares's setup_once.h in sync. Given that this commit fixes the circular interdependency, the need and presence of mentioned notice is removed. All mentioned interdependencies come back from now old days when the c-ares project lived inside a curl subdirectory. This commit removes last traces of such fact.
* Revert changes relative to lib/*.[ch] recent renamingYang Tse2013-01-061-0/+474
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts renaming and usage of lib/*.h header files done 28-12-2012, reverting 2 commits: f871de0... build: make use of 76 lib/*.h renamed files ffd8e12... build: rename 76 lib/*.h files This also reverts removal of redundant include guard (redundant thanks to changes in above commits) done 2-12-2013, reverting 1 commit: c087374... curl_setup.h: remove redundant include guard This also reverts renaming and usage of lib/*.c source files done 3-12-2013, reverting 3 commits: 13606bb... build: make use of 93 lib/*.c renamed files 5b6e792... build: rename 93 lib/*.c files 7d83dff... build: commit 13606bbfde follow-up 1 Start of related discussion thread: http://curl.haxx.se/mail/lib-2013-01/0012.html Asking for confirmation on pushing this revertion commit: http://curl.haxx.se/mail/lib-2013-01/0048.html Confirmation summary: http://curl.haxx.se/mail/lib-2013-01/0079.html NOTICE: The list of 2 files that have been modified by other intermixed commits, while renamed, and also by at least one of the 6 commits this one reverts follows below. These 2 files will exhibit a hole in history unless git's '--follow' option is used when viewing logs. lib/curl_imap.h lib/curl_smtp.h
* build: rename 93 lib/*.c filesYang Tse2013-01-031-474/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 93 lib/*.c source files renamed to use our standard naming scheme. This commit only does the file renaming. ---------------------------------------- renamed: lib/amigaos.c -> lib/curl_amigaos.c renamed: lib/asyn-ares.c -> lib/curl_asyn_ares.c renamed: lib/asyn-thread.c -> lib/curl_asyn_thread.c renamed: lib/axtls.c -> lib/curl_axtls.c renamed: lib/base64.c -> lib/curl_base64.c renamed: lib/bundles.c -> lib/curl_bundles.c renamed: lib/conncache.c -> lib/curl_conncache.c renamed: lib/connect.c -> lib/curl_connect.c renamed: lib/content_encoding.c -> lib/curl_content_encoding.c renamed: lib/cookie.c -> lib/curl_cookie.c renamed: lib/cyassl.c -> lib/curl_cyassl.c renamed: lib/dict.c -> lib/curl_dict.c renamed: lib/easy.c -> lib/curl_easy.c renamed: lib/escape.c -> lib/curl_escape.c renamed: lib/file.c -> lib/curl_file.c renamed: lib/fileinfo.c -> lib/curl_fileinfo.c renamed: lib/formdata.c -> lib/curl_formdata.c renamed: lib/ftp.c -> lib/curl_ftp.c renamed: lib/ftplistparser.c -> lib/curl_ftplistparser.c renamed: lib/getenv.c -> lib/curl_getenv.c renamed: lib/getinfo.c -> lib/curl_getinfo.c renamed: lib/gopher.c -> lib/curl_gopher.c renamed: lib/gtls.c -> lib/curl_gtls.c renamed: lib/hash.c -> lib/curl_hash.c renamed: lib/hmac.c -> lib/curl_hmac.c renamed: lib/hostasyn.c -> lib/curl_hostasyn.c renamed: lib/hostcheck.c -> lib/curl_hostcheck.c renamed: lib/hostip.c -> lib/curl_hostip.c renamed: lib/hostip4.c -> lib/curl_hostip4.c renamed: lib/hostip6.c -> lib/curl_hostip6.c renamed: lib/hostsyn.c -> lib/curl_hostsyn.c renamed: lib/http.c -> lib/curl_http.c renamed: lib/http_chunks.c -> lib/curl_http_chunks.c renamed: lib/http_digest.c -> lib/curl_http_digest.c renamed: lib/http_negotiate.c -> lib/curl_http_negotiate.c renamed: lib/http_negotiate_sspi.c -> lib/curl_http_negotiate_sspi.c renamed: lib/http_proxy.c -> lib/curl_http_proxy.c renamed: lib/idn_win32.c -> lib/curl_idn_win32.c renamed: lib/if2ip.c -> lib/curl_if2ip.c renamed: lib/imap.c -> lib/curl_imap.c renamed: lib/inet_ntop.c -> lib/curl_inet_ntop.c renamed: lib/inet_pton.c -> lib/curl_inet_pton.c renamed: lib/krb4.c -> lib/curl_krb4.c renamed: lib/krb5.c -> lib/curl_krb5.c renamed: lib/ldap.c -> lib/curl_ldap.c renamed: lib/llist.c -> lib/curl_llist.c renamed: lib/md4.c -> lib/curl_md4.c renamed: lib/md5.c -> lib/curl_md5.c renamed: lib/memdebug.c -> lib/curl_memdebug.c renamed: lib/mprintf.c -> lib/curl_mprintf.c renamed: lib/multi.c -> lib/curl_multi.c renamed: lib/netrc.c -> lib/curl_netrc.c renamed: lib/non-ascii.c -> lib/curl_non_ascii.c renamed: lib/curl_non-ascii.h -> lib/curl_non_ascii.h renamed: lib/nonblock.c -> lib/curl_nonblock.c renamed: lib/nss.c -> lib/curl_nss.c renamed: lib/nwlib.c -> lib/curl_nwlib.c renamed: lib/nwos.c -> lib/curl_nwos.c renamed: lib/openldap.c -> lib/curl_openldap.c renamed: lib/parsedate.c -> lib/curl_parsedate.c renamed: lib/pingpong.c -> lib/curl_pingpong.c renamed: lib/polarssl.c -> lib/curl_polarssl.c renamed: lib/pop3.c -> lib/curl_pop3.c renamed: lib/progress.c -> lib/curl_progress.c renamed: lib/qssl.c -> lib/curl_qssl.c renamed: lib/rawstr.c -> lib/curl_rawstr.c renamed: lib/rtsp.c -> lib/curl_rtsp.c renamed: lib/security.c -> lib/curl_security.c renamed: lib/select.c -> lib/curl_select.c renamed: lib/sendf.c -> lib/curl_sendf.c renamed: lib/share.c -> lib/curl_share.c renamed: lib/slist.c -> lib/curl_slist.c renamed: lib/smtp.c -> lib/curl_smtp.c renamed: lib/socks.c -> lib/curl_socks.c renamed: lib/socks_gssapi.c -> lib/curl_socks_gssapi.c renamed: lib/socks_sspi.c -> lib/curl_socks_sspi.c renamed: lib/speedcheck.c -> lib/curl_speedcheck.c renamed: lib/splay.c -> lib/curl_splay.c renamed: lib/ssh.c -> lib/curl_ssh.c renamed: lib/sslgen.c -> lib/curl_sslgen.c renamed: lib/ssluse.c -> lib/curl_ssluse.c renamed: lib/strdup.c -> lib/curl_strdup.c renamed: lib/strequal.c -> lib/curl_strequal.c renamed: lib/strerror.c -> lib/curl_strerror.c renamed: lib/strtok.c -> lib/curl_strtok.c renamed: lib/strtoofft.c -> lib/curl_strtoofft.c renamed: lib/telnet.c -> lib/curl_telnet.c renamed: lib/tftp.c -> lib/curl_tftp.c renamed: lib/timeval.c -> lib/curl_timeval.c renamed: lib/transfer.c -> lib/curl_transfer.c renamed: lib/url.c -> lib/curl_url.c renamed: lib/version.c -> lib/curl_version.c renamed: lib/warnless.c -> lib/curl_warnless.c renamed: lib/wildcard.c -> lib/curl_wildcard.c ----------------------------------------
* build: make use of 76 lib/*.h renamed filesYang Tse2012-12-281-4/+4
| | | | | | 76 private header files renamed to use our standard naming scheme. This change affects 322 files in libcurl's source tree.
* Curl_pgrsDone: return int and acknowledge return codeDaniel Stenberg2012-06-101-2/+10
| | | | | | | | | 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)
* HTTP: reset expected DL/UL sizes on redirectsDaniel Stenberg2012-04-011-3/+6
| | | | | | | | | | | | | | | | | 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
* FTP: perform active connections non-blockingGokhan Sengun2011-12-201-0/+4
| | | | | | | | | | | | | | | | | | | | 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.
* Curl_pgrsTime: store now in an auto variableDaniel Stenberg2011-12-201-8/+9
| | | | | | 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.
* Curl_pgrsStartNow: keep HEADERS_OUT setDaniel Stenberg2011-09-221-1/+2
| | | | | | | 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
* Curl_pgrsStartNow: clear all flags but HIDEDaniel Stenberg2011-08-151-1/+1
| | | | | | | | 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
* Curl_pgrsStartNow: clear all bits except HIDEDaniel Stenberg2011-08-071-1/+1
| | | | | Bug: http://curl.haxx.se/bug/view.cgi?id=3385258 Reported by: Ben Winslow
* progress: reset flags at transfer startBen Winslow2011-07-221-0/+1
| | | | | | | | | | | 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
* source cleanup: unify look, style and indent levelsDaniel Stenberg2011-04-271-3/+5
| | | | | By the use of a the new lib/checksrc.pl script that checks that our basic source style rules are followed.
* Fix a couple of spelling errors in lib/Fabian Keil2011-04-211-3/+3
| | | | Found with codespell.
* progress: don't print the last update on a separate line.Julien Chaffraix2011-03-211-0/+6
| | | | | | | | | 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
* remove the CVSish $Id$ linesDaniel Stenberg2010-03-241-1/+0
|
* avoid division by zeroYang Tse2009-11-051-6/+6
|
* - I fixed several problems with the transfer progress meter. It showed theDaniel Stenberg2009-11-041-11/+21
| | | | | | | 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.
* - Gabriel Kuri reported a problem with CURLINFO_CONTENT_LENGTH_DOWNLOAD if theDaniel Stenberg2009-10-311-3/+3
| | | | | 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.
* fix compiler warning: explicit conversion of a 64-bit integral type to a ↵Yang Tse2008-10-111-33/+39
| | | | smaller integral type
* Use SIZEOF_OFF_T definition from config fileYang Tse2008-08-261-1/+1
|
* Library internal only C preprocessor macros FORMAT_OFF_T and FORMAT_OFF_TUYang Tse2008-08-161-13/+13
| | | | | | | | | | | | 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
* For congruency sake with the naming of other CURL_XXXXXX_CURL_OFF_T macros,Yang Tse2008-08-151-13/+13
| | | | | | | | | | | | | | 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
* Fix curl_off_t sized constants usageYang Tse2008-08-121-41/+36
|
* s/SIZEOF_CURL_OFF_T/CURL_SIZEOF_CURL_OFF_T/gYang Tse2008-08-111-1/+1
|
* Introcuding a new timestamp for curl_easy_getinfo():Daniel Stenberg2008-07-031-1/+5
| | | | | | | | 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.
* struct HandleData is now called struct SingleRequest, and is only for data thatDaniel Stenberg2007-11-241-4/+3
| | | | | | | | | | | 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!
* - Prevent the internal progress meter from updating more frequently than onceDaniel Stenberg2007-04-181-2/+9
| | | | per second.
* Change spelling, ONE_TERRABYTE -> ONE_TERABYTEYang Tse2007-03-231-8/+10
| | | | | | | Shave off a couple of function calls in the part of Curl_pgrsUpdate() which is always executed when called. Fix a couple of comments.
* Bryan Henderson fixed the progress function so that it can get calledYang Tse2007-03-191-154/+156
| | | | | | 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.
* reverted the pselect patch => http://curl.haxx.se/mail/lib-2007-03/0100.htmlDaniel Stenberg2007-03-111-4/+3
|
* - Bryan Henderson introduces two things:Daniel Stenberg2007-03-101-3/+4
| | | | | 1) the progress callback gets called more frequently (at times) 2) libcurl *might* call the callback when it receives a signal
* Update copyright year, since the file has been modifiedYang Tse2006-10-271-1/+1
|
* Major overhaul introducing http pipelining support and shared connectionDaniel Stenberg2006-09-071-2/+2
| | | | cache within the multi handle.
* As reported in Mandrake's bug tracker bug 12289Daniel Stenberg2004-11-261-4/+2
| | | | | | (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.
* prevent warning with comparison between signed and unsignedDaniel Stenberg2004-10-081-1/+1
|
* removed tabs and trailing whitespace from sourceDaniel Stenberg2004-10-061-1/+1
|
* more typecasts to please picky compilersDaniel Stenberg2004-08-101-1/+1
|
* explicit typecasts to double to prevent warnings about implicit conversionsDaniel Stenberg2004-07-021-5/+5
| | | | that might lose accuracy
* typecast to int when the variable is int!Daniel Stenberg2004-07-011-2/+2
|
* Replaced all uses of sprintf() with the safer snprintf(). It is just aDaniel Stenberg2004-06-241-17/+18
| | | | precaution to prevent mistakes to lead to buffer overflows.
* quickfix to avoid division by zero, possibly we should go over all of theseDaniel Stenberg2004-05-211-2/+4
| | | | once and for all
* calculate upload and download speed using doubles to keep precision.Daniel Stenberg2004-05-201-14/+16
| | | | deleted trailing whitespace
* hm, avoid division by zero more carefully with that new percentage mathDaniel Stenberg2004-05-051-3/+3
|