Skip to content

Warp host preference not binding correctly for !6 and * special values #976

@laurenceisla

Description

@laurenceisla

System info

OS: NixOS 23.05
Cabal: 3.10.1.0
GHC: 9.2.8
Dependencies:

base ^>=4.16.4.0,
warp >= 3.4.0,
wai  >= 3.2.1 && < 3.3
http-types >= 0.12.3 && < 0.13

Uname:

$ command -v uname && uname -a # Kernel version
/nix/store/l9mg93sgx50y88p5rr6x1vib6j1rjsds-coreutils-9.1/bin/uname
Linux nixos 6.5.7 #1-NixOS SMP PREEMPT_DYNAMIC Tue Oct 10 20:03:06 UTC 2023 x86_64 GNU/Linux

Issue

In warp, when setting a !6 host preference it does not seem to bind to ipv6 exclusively, because ipv4 requests do not fail. Also, when setting the preference to *, ipv6 requests fail when they shouldn't. I included a simple example in this Gist: https://gist.github.com/laurenceisla/61af763fb028437f24e5a869225eb1f8

These are the results I got:

It allows both ipv4 and ipv6 requests when setHost !6

$ curl "http://localhost:3000" --ipv4 -I
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Date: Thu, 08 Feb 2024 01:19:54 GMT
Server: Warp/3.4.0
Content-Type: text/plain

It does not allow ipv6 requests when setHost *

$ curl "http://localhost:3000" --ipv6 -I
curl: (7) Failed to connect to localhost port 3000 after 0 ms: Couldn't connect to server

setHost !4 working as expected

$ curl "http://localhost:3000" --ipv6 -I
curl: (7) Failed to connect to localhost port 3000 after 0 ms: Couldn't connect to server

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions