]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
connection bits: move 'connect_only' here
authorStefan Eissing <stefan@eissing.org>
Tue, 17 Mar 2026 12:57:42 +0000 (13:57 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 17 Mar 2026 14:01:29 +0000 (15:01 +0100)
Move the bit `connection_only` from `connectdata` to `ConnectBits`.
Since we keep all other bits there, seems the correct place.

Closes #20959

lib/conncache.c
lib/cshutdn.c
lib/http2.c
lib/multi.c
lib/url.c
lib/urldata.h
lib/vtls/gtls.c
lib/vtls/openssl.c
lib/vtls/wolfssl.c

index 48d9873ea5e9d630acdfb5c23c43974e247783b7..39e4d716664f41b9c61c0cb27576358c3696e91d 100644 (file)
@@ -206,7 +206,7 @@ static void cpool_discard_conn(struct cpool *cpool,
 
   /* treat the connection as aborted in CONNECT_ONLY situations, we do
    * not know what the APP did with it. */
-  if(conn->connect_only)
+  if(conn->bits.connect_only)
     aborted = TRUE;
   conn->bits.aborted = aborted;
 
@@ -354,7 +354,7 @@ static struct connectdata *cpool_get_oldest_idle(struct cpool *cpool,
     for(curr = Curl_llist_head(&bundle->conns); curr;
         curr = Curl_node_next(curr)) {
       conn = Curl_node_elem(curr);
-      if(CONN_INUSE(conn) || conn->bits.close || conn->connect_only)
+      if(CONN_INUSE(conn) || conn->bits.close || conn->bits.connect_only)
         continue;
       /* Set higher score for the age passed since the connection was used */
       score = curlx_ptimediff_ms(pnow, &conn->lastused);
@@ -665,7 +665,7 @@ void Curl_conn_terminate(struct Curl_easy *data,
 
   /* treat the connection as aborted in CONNECT_ONLY situations,
    * so no graceful shutdown is attempted. */
-  if(conn->connect_only)
+  if(conn->bits.connect_only)
     aborted = TRUE;
 
   if(data->multi) {
index 308f2aaa82dfb5f3f389ada7aa8a6320056e7a7a..27b4a9f0dd316025a0819dbd6bdf7319289b17fe 100644 (file)
@@ -87,14 +87,14 @@ static void cshutdn_run_once(struct Curl_easy *data,
     return;
   }
 
-  if(!conn->connect_only && Curl_conn_is_connected(conn, FIRSTSOCKET))
+  if(!conn->bits.connect_only && Curl_conn_is_connected(conn, FIRSTSOCKET))
     r1 = Curl_conn_shutdown(data, FIRSTSOCKET, &done1);
   else {
     r1 = CURLE_OK;
     done1 = TRUE;
   }
 
-  if(!conn->connect_only && Curl_conn_is_connected(conn, SECONDARYSOCKET))
+  if(!conn->bits.connect_only && Curl_conn_is_connected(conn, SECONDARYSOCKET))
     r2 = Curl_conn_shutdown(data, SECONDARYSOCKET, &done2);
   else {
     r2 = CURLE_OK;
index 6869a0fe2f08b55ba22affb1bed4f24e33e5c521..68ee4805e88dad77b9889f815ccd33eb117039a3 100644 (file)
@@ -1821,7 +1821,7 @@ out:
   /* Defer flushing during the connect phase so that the SETTINGS and
    * other initial frames are sent together with the first request.
    * Unless we are 'connect_only' where the request will never come. */
-  if(!cf->connected && !cf->conn->connect_only)
+  if(!cf->connected && !cf->conn->bits.connect_only)
     return CURLE_OK;
   return nw_out_flush(cf, data);
 }
index a0e2cede1d70fdfcbc967714563ce04f6966d0e6..482c160fde6dff6c43c2c50acd35594c10d4f86f 100644 (file)
@@ -729,7 +729,7 @@ static void close_connect_only(struct connectdata *conn,
 {
   (void)userdata;
   (void)data;
-  if(conn->connect_only)
+  if(conn->bits.connect_only)
     connclose(conn, "Removing connect-only easy handle");
 }
 
index e2f4a158aedeff3db6515e093293661d48290b43..a9ef60709a10defac7df5e1bb23b9e218a307300 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -739,7 +739,7 @@ static bool url_match_connect_config(struct connectdata *conn,
                                      struct url_conn_match *m)
 {
   /* connect-only or to-be-closed connections will not be reused */
-  if(conn->connect_only || conn->bits.close || conn->bits.no_reuse)
+  if(conn->bits.connect_only || conn->bits.close || conn->bits.no_reuse)
     return FALSE;
 
   /* ip_version must match */
@@ -1402,7 +1402,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
   conn->bits.ftp_use_eprt = data->set.ftp_use_eprt;
 #endif
   conn->ip_version = data->set.ipver;
-  conn->connect_only = (bool)data->set.connect_only;
+  conn->bits.connect_only = (bool)data->set.connect_only;
   conn->transport_wanted = TRNSPRT_TCP; /* most of them are TCP streams */
 
   /* Store the local bind parameters that will be used for this connection */
index 2509e12e8a6d8d6d16409d1cc24cce5e20214804..e5264b5a3c47eb6c12a567edd1cc0f339d585375 100644 (file)
@@ -250,6 +250,7 @@ typedef enum {
  * Boolean values that concerns this connection.
  */
 struct ConnectBits {
+  BIT(connect_only);
 #ifndef CURL_DISABLE_PROXY
   BIT(httpproxy);  /* if set, this transfer is done through an HTTP proxy */
   BIT(socksproxy); /* if set, this transfer is done through a socks proxy */
@@ -480,7 +481,6 @@ struct connectdata {
    * 0 at start, then one of 09, 10, 11, etc. */
   uint8_t httpversion_seen;
   uint8_t gssapi_delegation; /* inherited from set.gssapi_delegation */
-  BIT(connect_only);
 };
 
 #ifndef CURL_DISABLE_PROXY
index 46fd6658340f6f633ce8606f773ed676b5c82fc0..4ac1913240dce89f206a7e218ff2086666cec2db 100644 (file)
@@ -1138,7 +1138,8 @@ CURLcode Curl_gtls_ctx_init(struct gtls_ctx *gctx,
       else {
         infof(data, "SSL reusing session with ALPN '%s'",
               scs->alpn ? scs->alpn : "-");
-        if(ssl_config->earlydata && scs->alpn && !cf->conn->connect_only) {
+        if(ssl_config->earlydata && scs->alpn &&
+           !cf->conn->bits.connect_only) {
           bool do_early_data = FALSE;
           if(sess_reuse_cb) {
             result = sess_reuse_cb(cf, data, &alpns, scs, &do_early_data);
index 756fc427b386423fafacb7d07562eb9c1b6c9848..cbe7898f10592ddab67e66d9e52c833216cc330a 100644 (file)
@@ -3411,7 +3411,7 @@ ossl_init_session_and_alpns(struct ossl_ctx *octx,
 #ifdef HAVE_OPENSSL_EARLYDATA
             if(ssl_config->earlydata && scs->alpn &&
                SSL_SESSION_get_max_early_data(ssl_session) &&
-               !cf->conn->connect_only &&
+               !cf->conn->bits.connect_only &&
                (SSL_version(octx->ssl) == TLS1_3_VERSION)) {
               bool do_early_data = FALSE;
               if(sess_reuse_cb) {
index 741b1a1c0a41b4a939efc3bcc26a825dc56494e5..b35645b45826b29f6eb6c97034e8d6c815d1411f 100644 (file)
@@ -549,7 +549,7 @@ wssl_setup_session(struct Curl_cfilter *cf,
         infof(data, "SSL reusing session with ALPN '%s'",
               scs->alpn ? scs->alpn : "-");
         if(ssl_config->earlydata &&
-           !cf->conn->connect_only &&
+           !cf->conn->bits.connect_only &&
            !strcmp("TLSv1.3", wolfSSL_get_version(wss->ssl))) {
           bool do_early_data = FALSE;
           if(sess_reuse_cb) {