mirror of
https://github.com/curl/curl.git
synced 2026-08-01 15:48:44 +03:00
conncontrol: reuse handling
Add protocol handler flag `PROTOPT_CONN_REUSE` to indicate that the protocol allows reusing connections for other tranfers. Add that to all handlers that support it. Create connections with `conn->bits.close = FALSE` and remove all the `connkeep()` calls in protocol handlers setup/connect implementations. `PROTOPT_CONN_REUSE` assures that the default behaviour applies at the end of a transfer without need to juggle the close bit. `conn->bits.close` now serves as an additional indication that a connection cannot be reused. Only protocol handles that allow reuse need to set it to override the default behaviour. Remove all `connclose()` and `connkeep()` calls from connection filters. Filters should not modify connection flags. They are supposed to run in eyeballing situations where a filter is just one of many determining the outcome. Fix http response header handling to only honour `Connection: close` for HTTP/1.x versions. Closes #19333
This commit is contained in:
parent
a9e7a027ed
commit
feea968512
21 changed files with 93 additions and 114 deletions
|
|
@ -156,7 +156,8 @@ const struct Curl_handler Curl_handler_scp = {
|
|||
PORT_SSH, /* defport */
|
||||
CURLPROTO_SCP, /* protocol */
|
||||
CURLPROTO_SCP, /* family */
|
||||
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY /* flags */
|
||||
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION | /* flags */
|
||||
PROTOPT_NOURLQUERY | PROTOPT_CONN_REUSE
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -185,8 +186,8 @@ const struct Curl_handler Curl_handler_sftp = {
|
|||
PORT_SSH, /* defport */
|
||||
CURLPROTO_SFTP, /* protocol */
|
||||
CURLPROTO_SFTP, /* family */
|
||||
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
|
||||
| PROTOPT_NOURLQUERY /* flags */
|
||||
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION | /* flags */
|
||||
PROTOPT_NOURLQUERY | PROTOPT_CONN_REUSE
|
||||
};
|
||||
|
||||
static CURLcode sftp_error_to_CURLE(int err)
|
||||
|
|
@ -2572,10 +2573,6 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
|
|||
if(!sshc || !ssh)
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
/* We default to persistent connections. We set this already in this connect
|
||||
function to make the reuse checks properly be able to check this bit. */
|
||||
connkeep(conn, "SSH default");
|
||||
|
||||
if(conn->handler->protocol & CURLPROTO_SCP) {
|
||||
conn->recv[FIRSTSOCKET] = scp_recv;
|
||||
conn->send[FIRSTSOCKET] = scp_send;
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ const struct Curl_handler Curl_handler_scp = {
|
|||
PORT_SSH, /* defport */
|
||||
CURLPROTO_SCP, /* protocol */
|
||||
CURLPROTO_SCP, /* family */
|
||||
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
|
||||
| PROTOPT_NOURLQUERY /* flags */
|
||||
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION | /* flags */
|
||||
PROTOPT_NOURLQUERY | PROTOPT_CONN_REUSE
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -154,8 +154,8 @@ const struct Curl_handler Curl_handler_sftp = {
|
|||
PORT_SSH, /* defport */
|
||||
CURLPROTO_SFTP, /* protocol */
|
||||
CURLPROTO_SFTP, /* family */
|
||||
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
|
||||
| PROTOPT_NOURLQUERY /* flags */
|
||||
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION | /* flags */
|
||||
PROTOPT_NOURLQUERY | PROTOPT_CONN_REUSE
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -3323,10 +3323,6 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
|
|||
if(!sshc)
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
/* We default to persistent connections. We set this already in this connect
|
||||
function to make the reuse checks properly be able to check this bit. */
|
||||
connkeep(conn, "SSH default");
|
||||
|
||||
infof(data, "User: '%s'", conn->user);
|
||||
#ifdef CURL_LIBSSH2_DEBUG
|
||||
infof(data, "Password: %s", conn->passwd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue