url: keep the question mark for empty queries

Reported-by: Bill Mill
Fixes #21544

Verified by test 1721

Closes #21584
This commit is contained in:
Daniel Stenberg 2026-05-13 10:35:02 +02:00
parent 11df1251e5
commit b079595f2e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 49 additions and 3 deletions

View file

@ -1543,7 +1543,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
}
/* after it was parsed, get the generated normalized version */
uc = curl_url_get(uh, CURLUPART_URL, &newurl, 0);
uc = curl_url_get(uh, CURLUPART_URL, &newurl, CURLU_GET_EMPTY);
if(uc) {
result = Curl_uc_to_curlcode(uc);
goto out;
@ -1600,7 +1600,8 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
goto out;
}
uc = curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0);
uc = curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query,
CURLU_GET_EMPTY);
if(uc && (uc != CURLUE_NO_QUERY)) {
result = CURLE_OUT_OF_MEMORY;
goto out;