mirror of
https://github.com/curl/curl.git
synced 2026-07-16 09:47:17 +03:00
multi: remove MSTATE_TUNNELING
MSTATE_TUNNELING is no longer in use now that we have proxy connection filters. Remove the state. Remove the http handler `connect_it` method as it was merely a NOP. Closes #19894
This commit is contained in:
parent
5ed7b5b01b
commit
9711c986ba
8 changed files with 39 additions and 83 deletions
|
|
@ -577,7 +577,11 @@ bool Curl_conn_is_connected(struct connectdata *conn, int sockindex)
|
|||
if(!CONN_SOCK_IDX_VALID(sockindex))
|
||||
return FALSE;
|
||||
cf = conn->cfilter[sockindex];
|
||||
return cf && cf->connected;
|
||||
if(cf)
|
||||
return cf->connected;
|
||||
else if(conn->handler->flags & PROTOPT_NONETWORK)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool Curl_conn_is_ip_connected(struct Curl_easy *data, int sockindex)
|
||||
|
|
|
|||
|
|
@ -332,7 +332,6 @@ static const char * const Curl_trc_mstate_names[] = {
|
|||
"CONNECT",
|
||||
"RESOLVING",
|
||||
"CONNECTING",
|
||||
"TUNNELING",
|
||||
"PROTOCONNECT",
|
||||
"PROTOCONNECTING",
|
||||
"DO",
|
||||
|
|
|
|||
13
lib/http.c
13
lib/http.c
|
|
@ -121,7 +121,7 @@ const struct Curl_handler Curl_handler_http = {
|
|||
Curl_http, /* do_it */
|
||||
Curl_http_done, /* done */
|
||||
ZERO_NULL, /* do_more */
|
||||
Curl_http_connect, /* connect_it */
|
||||
ZERO_NULL, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
|
|
@ -152,7 +152,7 @@ const struct Curl_handler Curl_handler_https = {
|
|||
Curl_http, /* do_it */
|
||||
Curl_http_done, /* done */
|
||||
ZERO_NULL, /* do_more */
|
||||
Curl_http_connect, /* connect_it */
|
||||
ZERO_NULL, /* connect_it */
|
||||
NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
NULL, /* proto_pollset */
|
||||
|
|
@ -1533,15 +1533,6 @@ bool Curl_compareheader(const char *headerline, /* line to check */
|
|||
return FALSE; /* no match */
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_http_connect() performs HTTP stuff to do at connect-time, called from
|
||||
* the generic Curl_connect().
|
||||
*/
|
||||
CURLcode Curl_http_connect(struct Curl_easy *data, bool *done)
|
||||
{
|
||||
return Curl_conn_connect(data, FIRSTSOCKET, FALSE, done);
|
||||
}
|
||||
|
||||
/* this returns the socket to wait for in the DO and DOING state for the multi
|
||||
interface and then we are always _sending_ a request and thus we wait for
|
||||
the single socket to become writable only */
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ CURLcode Curl_http_setup_conn(struct Curl_easy *data,
|
|||
struct connectdata *conn);
|
||||
CURLcode Curl_http(struct Curl_easy *data, bool *done);
|
||||
CURLcode Curl_http_done(struct Curl_easy *data, CURLcode, bool premature);
|
||||
CURLcode Curl_http_connect(struct Curl_easy *data, bool *done);
|
||||
CURLcode Curl_http_doing_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
CURLcode Curl_http_perform_pollset(struct Curl_easy *data,
|
||||
|
|
|
|||
53
lib/multi.c
53
lib/multi.c
|
|
@ -142,7 +142,6 @@ static void mstate(struct Curl_easy *data, CURLMstate state
|
|||
Curl_init_CONNECT, /* CONNECT */
|
||||
NULL, /* RESOLVING */
|
||||
NULL, /* CONNECTING */
|
||||
NULL, /* TUNNELING */
|
||||
NULL, /* PROTOCONNECT */
|
||||
NULL, /* PROTOCONNECTING */
|
||||
NULL, /* DO */
|
||||
|
|
@ -1122,7 +1121,6 @@ CURLMcode Curl_multi_pollset(struct Curl_easy *data,
|
|||
break;
|
||||
|
||||
case MSTATE_CONNECTING:
|
||||
case MSTATE_TUNNELING:
|
||||
result = mstate_connecting_pollset(data, ps);
|
||||
break;
|
||||
|
||||
|
|
@ -1862,43 +1860,29 @@ static CURLcode protocol_doing(struct Curl_easy *data, bool *done)
|
|||
*/
|
||||
static CURLcode protocol_connect(struct Curl_easy *data, bool *protocol_done)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct connectdata *conn = data->conn;
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
DEBUGASSERT(conn);
|
||||
DEBUGASSERT(protocol_done);
|
||||
DEBUGASSERT(Curl_conn_is_connected(conn, FIRSTSOCKET));
|
||||
|
||||
*protocol_done = FALSE;
|
||||
|
||||
if(Curl_conn_is_connected(conn, FIRSTSOCKET) && conn->bits.protoconnstart) {
|
||||
/* We already are connected, get back. This may happen when the connect
|
||||
worked fine in the first call, like when we connect to a local server
|
||||
or proxy. Note that we do not know if the protocol is actually done.
|
||||
|
||||
Unless this protocol does not have any protocol-connect callback, as
|
||||
then we know we are done. */
|
||||
if(!conn->handler->connecting)
|
||||
*protocol_done = TRUE;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
if(!conn->bits.protoconnstart) {
|
||||
if(conn->handler->connect_it) {
|
||||
/* is there a protocol-specific connect() procedure? */
|
||||
|
||||
/* Call the protocol-specific connect function */
|
||||
result = conn->handler->connect_it(data, protocol_done);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
else
|
||||
*protocol_done = TRUE;
|
||||
|
||||
/* it has started, possibly even completed but that knowledge is not stored
|
||||
in this bit! */
|
||||
if(!result)
|
||||
conn->bits.protoconnstart = TRUE;
|
||||
conn->bits.protoconnstart = TRUE;
|
||||
}
|
||||
|
||||
return result; /* pass back status */
|
||||
/* Unless this protocol does not have any protocol-connect callback, as
|
||||
then we know we are done. */
|
||||
if(!conn->handler->connecting)
|
||||
*protocol_done = TRUE;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static void set_in_callback(struct Curl_multi *multi, bool value)
|
||||
|
|
@ -2469,21 +2453,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||
rc = state_resolving(multi, data, &stream_error, &result);
|
||||
break;
|
||||
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
case MSTATE_TUNNELING:
|
||||
/* this is HTTP-specific, but sending CONNECT to a proxy is HTTP... */
|
||||
DEBUGASSERT(data->conn);
|
||||
result = Curl_http_connect(data, &protocol_connected);
|
||||
if(!result) {
|
||||
rc = CURLM_CALL_MULTI_PERFORM;
|
||||
/* initiate protocol connect phase */
|
||||
multistate(data, MSTATE_PROTOCONNECT);
|
||||
}
|
||||
else
|
||||
stream_error = TRUE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MSTATE_CONNECTING:
|
||||
/* awaiting a completion of an asynch TCP connect */
|
||||
DEBUGASSERT(data->conn);
|
||||
|
|
|
|||
|
|
@ -51,26 +51,23 @@ struct Curl_message {
|
|||
*/
|
||||
typedef enum {
|
||||
MSTATE_INIT, /* 0 - start in this state */
|
||||
MSTATE_PENDING, /* 1 - no connections, waiting for one */
|
||||
MSTATE_SETUP, /* 2 - start a new transfer */
|
||||
MSTATE_CONNECT, /* 3 - resolve/connect has been sent off */
|
||||
MSTATE_RESOLVING, /* 4 - awaiting the resolve to finalize */
|
||||
MSTATE_CONNECTING, /* 5 - awaiting the TCP connect to finalize */
|
||||
MSTATE_TUNNELING, /* 6 - awaiting HTTPS proxy SSL initialization to
|
||||
complete and/or proxy CONNECT to finalize */
|
||||
MSTATE_PROTOCONNECT, /* 7 - initiate protocol connect procedure */
|
||||
MSTATE_PROTOCONNECTING, /* 8 - completing the protocol-specific connect
|
||||
phase */
|
||||
MSTATE_DO, /* 9 - start send off the request (part 1) */
|
||||
MSTATE_DOING, /* 10 - sending off the request (part 1) */
|
||||
MSTATE_DOING_MORE, /* 11 - send off the request (part 2) */
|
||||
MSTATE_DID, /* 12 - done sending off request */
|
||||
MSTATE_PERFORMING, /* 13 - transfer data */
|
||||
MSTATE_RATELIMITING, /* 14 - wait because limit-rate exceeded */
|
||||
MSTATE_DONE, /* 15 - post data transfer operation */
|
||||
MSTATE_COMPLETED, /* 16 - operation complete */
|
||||
MSTATE_MSGSENT, /* 17 - the operation complete message is sent */
|
||||
MSTATE_LAST /* 18 - not a true state, never use this */
|
||||
MSTATE_PENDING, /* no connections, waiting for one */
|
||||
MSTATE_SETUP, /* start a new transfer */
|
||||
MSTATE_CONNECT, /* resolve/connect has been sent off */
|
||||
MSTATE_RESOLVING, /* awaiting the resolve to finalize */
|
||||
MSTATE_CONNECTING, /* awaiting the TCP connect to finalize */
|
||||
MSTATE_PROTOCONNECT, /* initiate protocol connect procedure */
|
||||
MSTATE_PROTOCONNECTING, /* completing the protocol-specific connect phase */
|
||||
MSTATE_DO, /* start send off the request (part 1) */
|
||||
MSTATE_DOING, /* sending off the request (part 1) */
|
||||
MSTATE_DOING_MORE, /* send off the request (part 2) */
|
||||
MSTATE_DID, /* done sending off request */
|
||||
MSTATE_PERFORMING, /* transfer data */
|
||||
MSTATE_RATELIMITING, /* wait because limit-rate exceeded */
|
||||
MSTATE_DONE, /* post data transfer operation */
|
||||
MSTATE_COMPLETED, /* operation complete */
|
||||
MSTATE_MSGSENT, /* the operation complete message is sent */
|
||||
MSTATE_LAST /* not a true state, never use this */
|
||||
} CURLMstate;
|
||||
|
||||
#define CURLPIPE_ANY (CURLPIPE_MULTIPLEX)
|
||||
|
|
|
|||
|
|
@ -214,13 +214,10 @@ static CURLcode rtsp_connect(struct Curl_easy *data, bool *done)
|
|||
{
|
||||
struct rtsp_conn *rtspc =
|
||||
Curl_conn_meta_get(data->conn, CURL_META_RTSP_CONN);
|
||||
CURLcode httpStatus;
|
||||
|
||||
if(!rtspc)
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
httpStatus = Curl_http_connect(data, done);
|
||||
|
||||
/* Initialize the CSeq if not already done */
|
||||
if(data->state.rtsp_next_client_CSeq == 0)
|
||||
data->state.rtsp_next_client_CSeq = 1;
|
||||
|
|
@ -228,8 +225,8 @@ static CURLcode rtsp_connect(struct Curl_easy *data, bool *done)
|
|||
data->state.rtsp_next_server_CSeq = 1;
|
||||
|
||||
rtspc->rtp_channel = -1;
|
||||
|
||||
return httpStatus;
|
||||
*done = TRUE;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static CURLcode rtsp_done(struct Curl_easy *data,
|
||||
|
|
|
|||
4
lib/ws.c
4
lib/ws.c
|
|
@ -1914,7 +1914,7 @@ const struct Curl_handler Curl_handler_ws = {
|
|||
Curl_http, /* do_it */
|
||||
Curl_http_done, /* done */
|
||||
ZERO_NULL, /* do_more */
|
||||
Curl_http_connect, /* connect_it */
|
||||
ZERO_NULL, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
|
|
@ -1941,7 +1941,7 @@ const struct Curl_handler Curl_handler_wss = {
|
|||
Curl_http, /* do_it */
|
||||
Curl_http_done, /* done */
|
||||
ZERO_NULL, /* do_more */
|
||||
Curl_http_connect, /* connect_it */
|
||||
ZERO_NULL, /* connect_it */
|
||||
NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
NULL, /* proto_pollset */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue