Skip to content

Commit c639d72

Browse files
committed
url: handle abortion by read/write callbacks, too
Otherwise, the FTP protocol would unnecessarily hang 60 seconds if aborted in the CURLOPT_HEADERFUNCTION callback. Reported by: Tomas Mlcoch Bug: https://bugzilla.redhat.com/1005686
1 parent 857f999 commit c639d72

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

RELEASE-NOTES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This release includes the following bugfixes:
2929
o TFTP: make the CURLOPT_LOW_SPEED* options work [4]
3030
o curl.h: name space pollution by "enum type" [5]
3131
o multi: move on from STATE_DONE faster [6]
32+
o FTP: 60 secs delay if aborted in the CURLOPT_HEADERFUNCTION callback [11]
3233

3334
This release includes the following known bugs:
3435

@@ -55,3 +56,4 @@ References to bug reports and discussions on issues:
5556
[8] = http://curl.haxx.se/bug/view.cgi?id=1267
5657
[9] = http://curl.haxx.se/mail/lib-2013-08/0234.html
5758
[10] = http://curl.haxx.se/mail/lib-2013-08/0136.html
59+
[11] = https://bugzilla.redhat.com/1005686

lib/url.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5743,12 +5743,18 @@ CURLcode Curl_done(struct connectdata **connp,
57435743
conn->dns_entry = NULL;
57445744
}
57455745

5746-
if(status == CURLE_ABORTED_BY_CALLBACK)
5746+
switch(status) {
5747+
case CURLE_ABORTED_BY_CALLBACK:
5748+
case CURLE_READ_ERROR:
5749+
case CURLE_WRITE_ERROR:
57475750
/* When we're aborted due to a callback return code it basically have to
57485751
be counted as premature as there is trouble ahead if we don't. We have
57495752
many callbacks and protocols work differently, we could potentially do
57505753
this more fine-grained in the future. */
57515754
premature = TRUE;
5755+
default:
5756+
break;
5757+
}
57525758

57535759
/* this calls the protocol-specific function pointer previously set */
57545760
if(conn->handler->done)

0 commit comments

Comments
 (0)