tool_ipfs: accept IPFS gateway URL without set port number

Follow-up to: 56129718b8

Test 1851 added to verify

Pointed out by Codex Security

Closes #20957
This commit is contained in:
Daniel Stenberg 2026-03-17 13:39:28 +01:00
parent f1a5343f5e
commit f4c0590b1c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 58 additions and 2 deletions

View file

@ -166,7 +166,8 @@ CURLcode ipfs_url_rewrite(CURLU *uh, const char *protocol, char **url,
/* get gateway parts */
if(curl_url_get(gatewayurl, CURLUPART_HOST, &gwhost, CURLU_URLDECODE) ||
curl_url_get(gatewayurl, CURLUPART_SCHEME, &gwscheme, CURLU_URLDECODE) ||
curl_url_get(gatewayurl, CURLUPART_PORT, &gwport, CURLU_URLDECODE) ||
curl_url_get(gatewayurl, CURLUPART_PORT, &gwport,
CURLU_URLDECODE | CURLU_DEFAULT_PORT) ||
curl_url_get(gatewayurl, CURLUPART_PATH, &gwpath, CURLU_URLDECODE))
goto clean;