mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 16:18:48 -05:00
multi: progress function abort must close connection
When the progress function returns to cancel the request, we must mark the connection to get closed and it must do to the DONE state. do_init() must be called as early as possible so that state variables for new connections are reset early. We could otherwise see that the old values were still there when a connection was to be disconnected very early and it would make it behave wrongly. Bug: http://curl.haxx.se/mail/lib-2011-10/0006.html Reported by: Vladimir Grishchenko
This commit is contained in:
parent
5d45285cf3
commit
9dd85bced5
10
lib/multi.c
10
lib/multi.c
@ -1657,8 +1657,14 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||||||
}
|
}
|
||||||
/* if there's still a connection to use, call the progress function */
|
/* if there's still a connection to use, call the progress function */
|
||||||
else if(easy->easy_conn && Curl_pgrsUpdate(easy->easy_conn)) {
|
else if(easy->easy_conn && Curl_pgrsUpdate(easy->easy_conn)) {
|
||||||
easy->result = CURLE_ABORTED_BY_CALLBACK;
|
/* aborted due to progress callback return code must close the
|
||||||
multistate(easy, CURLM_STATE_COMPLETED);
|
connection */
|
||||||
|
easy->easy_conn->bits.close = TRUE;
|
||||||
|
|
||||||
|
/* if not yet in DONE state, go there, otherwise COMPLETED */
|
||||||
|
multistate(easy, (easy->state < CURLM_STATE_DONE)?
|
||||||
|
CURLM_STATE_DONE: CURLM_STATE_COMPLETED);
|
||||||
|
result = CURLM_CALL_MULTI_PERFORM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} WHILE_FALSE; /* just to break out from! */
|
} WHILE_FALSE; /* just to break out from! */
|
||||||
|
@ -136,6 +136,7 @@ int curl_win32_idn_to_ascii(const char *in, char **out);
|
|||||||
static long ConnectionKillOne(struct SessionHandle *data);
|
static long ConnectionKillOne(struct SessionHandle *data);
|
||||||
static void conn_free(struct connectdata *conn);
|
static void conn_free(struct connectdata *conn);
|
||||||
static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke);
|
static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke);
|
||||||
|
static CURLcode do_init(struct connectdata *conn);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Protocol table.
|
* Protocol table.
|
||||||
@ -4988,6 +4989,9 @@ static CURLcode create_conn(struct SessionHandle *data,
|
|||||||
ConnectionStore(data, conn);
|
ConnectionStore(data, conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Setup and init stuff before DO starts, in preparing for the transfer. */
|
||||||
|
do_init(conn);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup whatever necessary for a resumed transfer
|
* Setup whatever necessary for a resumed transfer
|
||||||
*/
|
*/
|
||||||
@ -5334,9 +5338,6 @@ CURLcode Curl_do(struct connectdata **connp, bool *done)
|
|||||||
struct connectdata *conn = *connp;
|
struct connectdata *conn = *connp;
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
|
|
||||||
/* setup and init stuff before DO starts, in preparing for the transfer */
|
|
||||||
do_init(conn);
|
|
||||||
|
|
||||||
if(conn->handler->do_it) {
|
if(conn->handler->do_it) {
|
||||||
/* generic protocol-specific function pointer set in curl_connect() */
|
/* generic protocol-specific function pointer set in curl_connect() */
|
||||||
result = conn->handler->do_it(conn, done);
|
result = conn->handler->do_it(conn, done);
|
||||||
|
Loading…
Reference in New Issue
Block a user