From 7acf124614179f18a66a6d54eef911e75a12db53 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 3 Aug 2026 16:49:40 +0200 Subject: [PATCH] url: rename Curl_init_do => Curl_init_transfer And correct some comments Closes #22474 --- lib/multi.c | 2 +- lib/url.c | 23 ++++++++++------------- lib/url.h | 2 +- lib/urldata.h | 6 +++--- tests/unit/unit1620.c | 8 ++++---- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/lib/multi.c b/lib/multi.c index 7c815b3549..72a6524f8f 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1751,7 +1751,7 @@ CURLMcode Curl_multi_add_perform(struct Curl_multi *multi, /* pass in NULL for 'conn' here since we do not want to init the connection, only this transfer */ - result = Curl_init_do(data, NULL); + result = Curl_init_transfer(data, NULL); if(result) { Curl_multi_remove_handle(multi, data); return CURLM_INTERNAL_ERROR; diff --git a/lib/url.c b/lib/url.c index 12a630e76d..a77309d372 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1051,7 +1051,7 @@ static bool url_match_conn(struct connectdata *conn, void *userdata) if(!url_match_http_multiplex(conn, m)) return FALSE; else if(m->wait_pipe) - /* we decided to wait on PIPELINING */ + /* wait on multiplexing */ return TRUE; if(!url_match_auth(conn, m)) @@ -2005,10 +2005,8 @@ static CURLcode url_create_needle(struct Curl_easy *data, CURLcode result = CURLE_OK; bool network_scheme = TRUE; /* almost all are */ - /* First, split up the current URL in parts so that we can use the - parts for checking against the already present connections. In order - to not have to modify everything at once, we allocate a temporary - connection data struct and fill in for comparison purposes. */ + /* Allocate a temporary connection data struct (needle) and fill in for + comparison purposes. */ needle = allocate_conn(data); if(!needle) { result = CURLE_OUT_OF_MEMORY; @@ -2279,7 +2277,7 @@ static CURLcode url_find_or_create_conn(struct Curl_easy *data) result = setup_range(data); if(!result) { Curl_xfer_setup_nop(data); - result = Curl_init_do(data, data->conn); + result = Curl_init_transfer(data, data->conn); } } @@ -2404,7 +2402,7 @@ static CURLcode url_find_or_create_conn(struct Curl_easy *data) } /* Setup and init stuff before DO starts, in preparing for the transfer. */ - result = Curl_init_do(data, data->conn); + result = Curl_init_transfer(data, data->conn); if(result) goto out; @@ -2497,16 +2495,15 @@ out: } /* - * Curl_init_do() inits the readwrite session. This is inited each time (in - * the DO function before the protocol-specific DO functions are invoked) for - * a transfer, sometimes multiple times on the same Curl_easy. Make sure - * nothing in here depends on stuff that are setup dynamically for the - * transfer. + * Curl_init_transfer() is called each time before the transfer starts - to + * prepare for a transfer, sometimes multiple times on the same Curl_easy. + * Make sure nothing in here depends on stuff that is setup dynamically for + * the transfer. * * Allow this function to get called with 'conn' set to NULL. */ -CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn) +CURLcode Curl_init_transfer(struct Curl_easy *data, struct connectdata *conn) { CURLcode result; diff --git a/lib/url.h b/lib/url.h index c1df2fe811..d481dabb80 100644 --- a/lib/url.h +++ b/lib/url.h @@ -32,7 +32,7 @@ * Prototypes for library-wide functions */ -CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn); +CURLcode Curl_init_transfer(struct Curl_easy *data, struct connectdata *conn); CURLcode Curl_open(struct Curl_easy **curl); void Curl_init_userdefined(struct Curl_easy *data); diff --git a/lib/urldata.h b/lib/urldata.h index 11c11daafb..2b8712f8ca 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -703,9 +703,9 @@ struct UrlState { 417 response */ BIT(use_range); BIT(rangestringalloc); /* the range string is malloc()'ed */ - BIT(done); /* set to FALSE when Curl_init_do() is called and set to TRUE - when multi_done() is called, to prevent multi_done() to get - invoked twice when the multi interface is used. */ + BIT(done); /* set to FALSE when Curl_init_transfer() is called and set to + TRUE when multi_done() is called, to prevent multi_done() from + being invoked twice. */ #ifndef CURL_DISABLE_COOKIES BIT(cookie_engine); #endif diff --git a/tests/unit/unit1620.c b/tests/unit/unit1620.c index 6ba9a5bb0d..a58a586afe 100644 --- a/tests/unit/unit1620.c +++ b/tests/unit/unit1620.c @@ -92,8 +92,8 @@ static CURLcode test_unit1620(const char *arg) fail_unless(result == CURLE_URL_MALFORMAT, "Curl_connect() failed to return CURLE_URL_MALFORMAT"); - result = Curl_init_do(empty, empty->conn); - fail_unless(result == CURLE_OK, "Curl_init_do() failed"); + result = Curl_init_transfer(empty, empty->conn); + fail_unless(result == CURLE_OK, "Curl_init_transfer() failed"); result = curl_easy_setopt((CURL *)empty, CURLOPT_NOBODY, 1L); fail_unless(result == CURLE_OK, "curl_easy_setopt(CURLOPT_NOBODY) failed"); @@ -103,8 +103,8 @@ static CURLcode test_unit1620(const char *arg) Curl_close(&empty); abort_unless(dupe, "curl_easy_duphandle() failed"); - result = Curl_init_do(dupe, NULL); - fail_unless(result == CURLE_OK, "Curl_init_do() on duplicate failed"); + result = Curl_init_transfer(dupe, NULL); + fail_unless(result == CURLE_OK, "Curl_init_transfer() on duplicate failed"); fail_unless(dupe->req.no_body, "duplicate handle should keep no_body"); fail_unless(dupe->state.httpreq == HTTPREQ_HEAD, "duplicate handle should use HTTPREQ_HEAD");