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

Reporter Garreau, Alexandre
Owner Zash
Created
Updated
Stars ★ (1)
Tags
  • Milestone-0.11
  • Status-Fixed
  • Type-Defect
  • 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
  3. Zash on

    Fixed in https://hg.prosody.im/0.11/rev/a23328c46389

    Changes
    • tags Milestone-0.11
    • owner Zash
  4. Zash on

    Changes
    • tags Status-Fixed

New comment

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