Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
5981-inets-httpd-Use-inet-ntoa-to-get-ip-addres...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5981-inets-httpd-Use-inet-ntoa-to-get-ip-address-string-f.patch of Package erlang
From cae30c876450e8b0bb3f125024984cf3d9baf319 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin <ingela@erlang.org> Date: Fri, 24 Mar 2023 10:00:37 +0100 Subject: [PATCH] inets: httpd - Use inet:ntoa to get ip address string format --- lib/inets/src/http_lib/http_transport.erl | 28 +++++------------------ 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/lib/inets/src/http_lib/http_transport.erl b/lib/inets/src/http_lib/http_transport.erl index 9b76acfc12..2a51529621 100644 --- a/lib/inets/src/http_lib/http_transport.erl +++ b/lib/inets/src/http_lib/http_transport.erl @@ -36,12 +36,10 @@ resolve/0 ]). -export([negotiate/3]). --export([ipv4_name/1, ipv6_name/1]). -include_lib("inets/src/inets_app/inets_internal.hrl"). -include("http_internal.hrl"). - %%%========================================================================= %%% Internal application API %%%========================================================================= @@ -404,11 +402,11 @@ peername({ssl, _}, Socket) -> do_peername({ok, {Addr, Port}}) when tuple_size(Addr) =:= 4 -> - PeerName = ipv4_name(Addr), + PeerName = ip_name(Addr), {Port, PeerName}; do_peername({ok, {Addr, Port}}) when tuple_size(Addr) =:= 8 -> - PeerName = ipv6_name(Addr), + PeerName = ip_name(Addr), {Port, PeerName}; do_peername({error, _}) -> {-1, "unknown"}. @@ -437,11 +435,11 @@ sockname({ssl, _}, Socket) -> do_sockname({ok, {Addr, Port}}) when tuple_size(Addr) =:= 4 -> - SockName = ipv4_name(Addr), + SockName = ip_name(Addr), {Port, SockName}; do_sockname({ok, {Addr, Port}}) when tuple_size(Addr) =:= 8 -> - SockName = ipv6_name(Addr), + SockName = ip_name(Addr), {Port, SockName}; do_sockname({error, _}) -> {-1, "unknown"}. @@ -457,31 +455,8 @@ resolve() -> {ok, Name} = inet:gethostname(), Name. - -%%------------------------------------------------------------------------- -%% ipv4_name(Ipv4Addr) -> string() -%% ipv6_name(Ipv6Addr) -> string() -%% Ipv4Addr = ip4_address() -%% Ipv6Addr = ip6_address() -%% -%% Description: Returns the local hostname. -%%------------------------------------------------------------------------- -ipv4_name({A, B, C, D}) -> - integer_to_list(A) ++ "." ++ - integer_to_list(B) ++ "." ++ - integer_to_list(C) ++ "." ++ - integer_to_list(D). - -ipv6_name({A, B, C, D, E, F, G, H}) -> - http_util:integer_to_hexlist(A) ++ ":"++ - http_util:integer_to_hexlist(B) ++ ":" ++ - http_util:integer_to_hexlist(C) ++ ":" ++ - http_util:integer_to_hexlist(D) ++ ":" ++ - http_util:integer_to_hexlist(E) ++ ":" ++ - http_util:integer_to_hexlist(F) ++ ":" ++ - http_util:integer_to_hexlist(G) ++ ":" ++ - http_util:integer_to_hexlist(H). - +ip_name(Ip) -> + inet:ntoa(Ip). close_tag(ip_comm) -> tcp_closed; -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor