#1302 IPv6 as http “host” not recognized: port wrongly stripped

Reporter Garreau, Alexandre
Owner Nobody
Created
Updated
Stars ★ (1)
Tags
  • Type-Defect
  • Status-Accepted
  • Priority-Medium
  1. Garreau, Alexandre on

    What steps will reproduce the problem? 1. make bosh works on, say, localhost, on an IPv6-enabled machine 2. try to contact through http [::1]:5280 ([::1] is IPv6 localhost, and firefox puts port in http host when it’s not implicit, aka not 80 or 443 I guess) 3. Enjoy how prosody believe the “host” is “[” with a 404 error: “Unknown host: [” What is the expected output? I’d say, since that’s also what’s done when trying the same with “127.0.0.1” or “localhost”, a 404 error, with “Unknown host: [::1]”, instead of “Unknown host: [::1]:5280” (what it would have been without port-stripping, which would have then become a nightmare as bosh by default use neither 80 nor 443 for http), or… What do you see instead? …instead of “Unknown host: [” (current) What version of the product are you using? On what operating system? Prosody 0.9.12-2+deb9u2, on Debian stable (stretch, 9,6) GNU/Linux. Please provide any additional information below. Not sure of what to say more, ask me whatever you want.

  2. Zash on

    Thanks for the report. The code in question¹ strips everything until the first ':', which works for everything except IPv6 literals. Using "localhost" or "ip6-localhost" should work as a workaround. ¹ https://hg.prosody.im/trunk/file/dcc85d72d5b3/net/http/server.lua#l210

    Changes
    • tags Status-Accepted

New comment

Not published. Used for spam prevention and optional update notifications.