[Libwebsockets] Proxy address parsing is broken on IPv6 input

Mateusz Stępień mateusz.stepien at netrounds.com
Wed Mar 6 12:43:26 CET 2019


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 CONNECT 
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.


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 proxy.


More information about the Libwebsockets mailing list