[Libwebsockets] Proxy address parsing is broken on IPv6 input
andy at warmcat.com
Wed Mar 6 12:50:23 CET 2019
On March 6, 2019 7:43:26 PM GMT+08:00, "Mateusz Stępień" <mateusz.stepien at netrounds.com> wrote:
>I tried to pass an IPv6 address as a proxy in a libwebsocket client and
>it looks like it fails on parsing here
> p = strchr(vhost->http.http_proxy_address, ':');
>It parses part of the IPv6 address as port, and it later fails to
>connect because proxy address and port are invalid. Working it around
>with strrchr makes it fail later, because address passed to HTTP
>method is not surrounded by brackets, according to section 3.2.2 of
>RFC3986 ( https://tools.ietf.org/html/rfc3986#section-3.2.2 ).
>Surrounding proxy_address with brackets does not help, it fails on
>getaddrinfo, string passed there does not have the brackets stripped.
Mmm sounds broken for ipv6 case.
IIUI, solving it just means requiring ipv6 addresses with ports like "[::1]:443", and take care about trimming the  cleanly... is that what you also understood from it?
>This was reproduced on lws-minimal-ws-client-echo example, the only
>change that was made to the example is to fill http_proxy_address and
>_port in lws_context_creation_info with IPv6 address and port of a
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets