diff options
author | Erlang/OTP <[email protected]> | 2019-02-01 11:39:23 +0100 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2019-02-01 11:39:23 +0100 |
commit | 77704af9ca36204235cee7cfdb89b0643a5693db (patch) | |
tree | 9b5dade0d5bb4e2cb7a270ee3dc156542b54bc12 | |
parent | 35f51c7f057943c25ccb7997526c9d47aed0cd0b (diff) | |
parent | 2be9b5dc9b443efb495742b27823ae9cad40214f (diff) | |
download | otp-77704af9ca36204235cee7cfdb89b0643a5693db.tar.gz otp-77704af9ca36204235cee7cfdb89b0643a5693db.tar.bz2 otp-77704af9ca36204235cee7cfdb89b0643a5693db.zip |
Merge branch 'peterdmv/inets/fix-http-client/ERIERL-289/OTP-15554' into maint-21
* peterdmv/inets/fix-http-client/ERIERL-289/OTP-15554:
inets: Ignore bracket option in format_address
-rw-r--r-- | lib/inets/src/http_client/httpc_handler.erl | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl index 8b356d8026..8d443a1477 100644 --- a/lib/inets/src/http_client/httpc_handler.erl +++ b/lib/inets/src/http_client/httpc_handler.erl @@ -805,12 +805,11 @@ handle_unix_socket_options(#request{unix_socket = UnixSocket}, error({badarg, [{ipfamily, Else}, {unix_socket, UnixSocket}]}) end. -connect_and_send_first_request(Address, #request{ipv6_host_with_brackets = HasBrackets} = Request, - #state{options = Options0} = State) -> +connect_and_send_first_request(Address, Request, #state{options = Options0} = State) -> SocketType = socket_type(Request), ConnTimeout = (Request#request.settings)#http_options.connect_timeout, Options = handle_unix_socket_options(Request, Options0), - case connect(SocketType, format_address(Address, HasBrackets), Options, ConnTimeout) of + case connect(SocketType, format_address(Address), Options, ConnTimeout) of {ok, Socket} -> ClientClose = httpc_request:is_client_closing( @@ -1739,9 +1738,8 @@ update_session(ProfileName, #session{id = SessionId} = Session, Pos, Value) -> {stacktrace, Stacktrace}]}} end. - -format_address({Host, Port}, true) when is_list(Host)-> - {ok, Address} = inet:parse_address(string:strip(string:strip(Host, right, $]), left, $[)), +format_address({[$[|T], Port}) -> + {ok, Address} = inet:parse_address(string:strip(T, right, $])), {Address, Port}; -format_address(HostPort, _) -> +format_address(HostPort) -> HostPort. |