Skip to content

Commit 907520c

Browse files
jaybagder
authored andcommitted
progress callback: skip last callback update on errors
When an error has been detected, skip the final forced call to the progress callback by making sure to pass the current return code variable in the Curl_done() call in the CURLM_STATE_DONE state. This avoids the "extra" callback that could occur even if you returned error from the progress callback. Bug: http://curl.haxx.se/mail/lib-2014-06/0062.html Reported by: Jonathan Cardoso Machado
1 parent 1c1d9a3 commit 907520c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/multi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
16101610
Curl_multi_process_pending_handles(multi);
16111611

16121612
/* post-transfer command */
1613-
res = Curl_done(&data->easy_conn, CURLE_OK, FALSE);
1613+
res = Curl_done(&data->easy_conn, data->result, FALSE);
16141614

16151615
/* allow a previously set error code take precedence */
16161616
if(!data->result)

lib/url.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5796,9 +5796,9 @@ CURLcode Curl_done(struct connectdata **connp,
57965796
if(conn->handler->done)
57975797
result = conn->handler->done(conn, status, premature);
57985798
else
5799-
result = CURLE_OK;
5799+
result = status;
58005800

5801-
if(Curl_pgrsDone(conn) && !result)
5801+
if(!result && Curl_pgrsDone(conn))
58025802
result = CURLE_ABORTED_BY_CALLBACK;
58035803

58045804
/* if the transfer was completed in a paused state there can be buffered

0 commit comments

Comments
 (0)