From 739762b7bd53001fbe208925ee37407f53fd1568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=96=87=E6=9D=B0?= Date: Tue, 24 Jun 2025 11:11:05 +0800 Subject: [PATCH] mms opt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张文杰 --- include/curl/curl.h | 3 +++ lib/easyoptions.c | 1 + lib/http.c | 6 +++++- lib/setopt.c | 3 +++ lib/urldata.h | 2 ++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/curl/curl.h b/include/curl/curl.h index 7397ce32b..2deb833ba 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -2227,6 +2227,9 @@ typedef enum { /* Data passed to the CURLOPT_CONNREUSEFUNCTION callback */ CURLOPT(CURLOPT_CONNREUSEDATA, CURLOPTTYPE_CBPOINT, 1002), #endif + + CURLOPT(CURLOPT_MMS_RESERVED_DEFAULT_PORT, CURLOPTTYPE_LONG, 1003), + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; diff --git a/lib/easyoptions.c b/lib/easyoptions.c index 2dadd274c..dbdb0dbe0 100644 --- a/lib/easyoptions.c +++ b/lib/easyoptions.c @@ -371,6 +371,7 @@ struct curl_easyoption Curl_easyopts[] = { {"CONNREUSEFUNCTION", CURLOPT_CONNREUSEFUNCTION, CURLOT_FUNCTION, 0}, {"CONNREUSEDATA", CURLOPT_CONNREUSEDATA, CURLOT_CBPTR, 0}, #endif + {"MMS_RESERVED_DEFAULT_PORT", CURLOPT_MMS_RESERVED_DEFAULT_PORT, CURLOT_LONG, 0}, {NULL, CURLOPT_LASTENTRY, CURLOT_LONG, 0} /* end of table */ }; diff --git a/lib/http.c b/lib/http.c index 2a41f8078..9aed3b502 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1842,7 +1842,11 @@ CURLcode Curl_http_target(struct Curl_easy *data, } } /* Extract the URL to use in the request. */ - uc = curl_url_get(h, CURLUPART_URL, &url, CURLU_NO_DEFAULT_PORT); + if(data->set.mms_reserved_default_port != 1L) + uc = curl_url_get(h, CURLUPART_URL, &url, CURLU_NO_DEFAULT_PORT); + else + uc = curl_url_get(h, CURLUPART_URL, &url, 0); + if(uc) { curl_url_cleanup(h); return CURLE_OUT_OF_MEMORY; diff --git a/lib/setopt.c b/lib/setopt.c index 641fe5c6b..bb5e208a4 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -3189,6 +3189,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) data->set.connreuse_userp = va_arg(param, void *); break; #endif + case CURLOPT_MMS_RESERVED_DEFAULT_PORT: + data->set.mms_reserved_default_port = (0 != va_arg(param, long)) ? 1L:0L; + break; default: /* unknown tag and its companion, just ignore: */ result = CURLE_UNKNOWN_OPTION; diff --git a/lib/urldata.h b/lib/urldata.h index 6588bbf75..df3184151 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1889,6 +1889,8 @@ struct UserDefined { #ifdef USE_ECH int tls_ech; /* TLS ECH configuration */ #endif + + BIT(mms_reserved_default_port); }; #ifndef CURL_DISABLE_MIME -- Gitee