From 2ae0f91c5de2ab270a463302904084a8049946f0 Mon Sep 17 00:00:00 2001 From: Marcelino Alberdi Pereira Date: Thu, 25 Sep 2025 16:51:10 +0200 Subject: [PATCH] inets: change uri_string:uri_string() type to string() where needed Some parameters, such as ContentType in httpc:request/4, are wrongly documented as uri_string:uri_string(), but they don't allow binary values. --- lib/inets/src/http_client/httpc.erl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl index 6ccbb63dae56..86c59b8924e3 100644 --- a/lib/inets/src/http_client/httpc.erl +++ b/lib/inets/src/http_client/httpc.erl @@ -91,8 +91,8 @@ profile_name(_Prefix, Profile) when is_pid(Profile) -> , HttpBodyResult} | RequestId | saved_to_file, - HttpBodyResult :: uri_string:uri_string() | binary(), - HttpVersion :: uri_string:uri_string(), + HttpBodyResult :: string() | binary(), + HttpVersion :: string(), StatusCode :: non_neg_integer(), HttpHeader :: { Field :: [byte()] , Value :: binary() | iolist()}, @@ -109,11 +109,11 @@ request(Url) -> | saved_to_file, HttpHeader :: { Field :: [byte()] , Value :: binary() | iolist()}, - HttpBodyResult :: uri_string:uri_string() | binary(), + HttpBodyResult :: string() | binary(), StatusLine :: { HttpVersion , StatusCode , string()}, - HttpVersion :: uri_string:uri_string(), + HttpVersion :: string(), StatusCode :: non_neg_integer(), RequestId :: any(). request(Url, Profile) -> @@ -131,7 +131,7 @@ request(Url, Profile) -> , [HttpHeader] } | { uri_string:uri_string() , [ HttpHeader ] - , ContentType::uri_string:uri_string() + , ContentType::string() , HttpBody}, HttpBody :: iolist() | binary() @@ -173,10 +173,10 @@ request(Url, Profile) -> StatusLine :: { HttpVersion , StatusCode , string()}, - HttpVersion :: uri_string:uri_string(), + HttpVersion :: string(), HttpHeader :: { Field :: [byte()] , Value :: binary() | iolist()}, - HttpBodyResult :: uri_string:uri_string() | binary(), + HttpBodyResult :: string() | binary(), RequestId :: any(). request(Method, Request, HttpOptions, Options) -> request(Method, Request, HttpOptions, Options, default_profile()). @@ -191,7 +191,7 @@ request(Method, Request, HttpOptions, Options) -> , [HttpHeader] } | { uri_string:uri_string() , [ HttpHeader ] - , ContentType::uri_string:uri_string() + , ContentType::string() , HttpBody}, HttpBody :: iolist() | binary() @@ -228,7 +228,7 @@ request(Method, Request, HttpOptions, Options) -> , ReceiverFunction::atom() , ReceiverArgs::list()}, Profile :: atom() | pid(), - HttpVersion :: uri_string:uri_string(), + HttpVersion :: string(), Result :: {StatusLine , [HttpHeader] , HttpBodyResult} @@ -238,7 +238,7 @@ request(Method, Request, HttpOptions, Options) -> | saved_to_file, StatusLine :: { HttpVersion, StatusCode, string()}, StatusCode :: non_neg_integer(), - HttpBodyResult :: uri_string:uri_string() | binary(), + HttpBodyResult :: string() | binary(), RequestId :: any(). request(Method, Request, HTTPOptions, Options, Profile) when is_atom(Profile) orelse is_pid(Profile) -> @@ -334,7 +334,7 @@ cancel_request(RequestId, Profile) PipelineTimeout :: integer(), CookieMode :: enabled | disabled | verify, IpFamily :: inet | inet6 | local | inet6fb4, - IpAddressDesc :: uri_string:uri_string(), + IpAddressDesc :: string(), IpAddress :: inet:ip_address(), VerboseMode :: false | verbose | debug | trace, SocketOpts :: [SocketOpt], @@ -342,7 +342,7 @@ cancel_request(RequestId, Profile) UnixSocket :: file:name_all(), Reason :: term(), DomainDesc :: string(), - HostName :: uri_string:uri_string(). + HostName :: string(). set_options(Options) -> set_options(Options, default_profile()). @@ -375,13 +375,13 @@ set_options(Options) -> PipelineTimeout :: integer(), CookieMode :: enabled | disabled | verify, IpFamily :: inet | inet6 | local | inet6fb4, - IpAddressDesc :: uri_string:uri_string(), + IpAddressDesc :: string(), IpAddress :: inet:ip_address(), VerboseMode :: false | verbose | debug | trace, UnixSocket :: string(), Reason :: term(), DomainDesc :: string(), - HostName :: uri_string:uri_string(). + HostName :: string(). set_options(Options, Profile) when is_atom(Profile) orelse is_pid(Profile) -> case validate_options(Options) of {ok, Opts} ->