← Commit list

b27e828b93

Daniel Stenberg
Daniel Stenberg
2026-04-02
SUCCESS Duration: 259s

Subject

url: init req.no_body in DO so that it works for h2 push

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/url.c+1 -0
@@ -3514,6 +3514,7 @@ CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn)
data->state.done = FALSE; /* *_done() is not called yet */
+ data->req.no_body = data->set.opt_no_body;
if(data->req.no_body)
/* in HTTP lingo, no body means using the HEAD request... */
data->state.httpreq = HTTPREQ_HEAD;
tests/unit/unit1620.c+18 -0
@@ -72,6 +72,7 @@ static CURLcode test_unit1620(const char *arg)
CURLcode result;
struct Curl_easy *empty;
+ struct Curl_easy *dupe = NULL;
enum dupstring i;
bool connected = FALSE;
@@ -95,6 +96,20 @@ static CURLcode test_unit1620(const char *arg)
result = Curl_init_do(empty, empty->conn);
fail_unless(result == CURLE_OK, "Curl_init_do() failed");
+ result = curl_easy_setopt((CURL *)empty, CURLOPT_NOBODY, 1L);
+ fail_unless(result == CURLE_OK, "curl_easy_setopt(CURLOPT_NOBODY) failed");
+
+ dupe = (struct Curl_easy *)curl_easy_duphandle((CURL *)empty);
+ if(!dupe)
+ 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");
+ 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");
+
t1620_parse("hostname", "hostname", NULL, NULL);
t1620_parse("user:password", "user", "password", NULL);
t1620_parse("user:password;options", "user", "password", "options");
@@ -116,6 +131,9 @@ static CURLcode test_unit1620(const char *arg)
fail_unless(empty->set.str[i] == NULL, "Curl_free() did not set to NULL");
}
+ result = Curl_close(&dupe);
+ fail_unless(result == CURLE_OK, "Curl_close() failed for duplicate");
+
result = Curl_close(&empty);
fail_unless(result == CURLE_OK, "Curl_close() failed");