Skip to content

hyper-util: SOCKS proxying IPv6 address forwarded as domain name #4136

Description

@FrankTaylorLieder

Version

hyper-util 0.1.20

Platform

Linux workstation-lh5kn 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 GNU/Linux

Summary

When attempting to connect to a service using an IPv6 address in the URI through a SOCKS proxy, hyper-util incorrectly extracts the IPv6 address (hostname) from the URI and forwards it as a domain name for the proxy to resolve.

E.g. Requesting: http://[2001:db8::1]:8080 causes hyper-util to extract [2001:db8::1] as the hostname part of the URI. It attempts to parse it as an IP address which fails because of the square brackets. It there assumes it's a domain name and forwards it to the SOCKS proxy using ATYP=0x03 (Domain name) instead of ATYP=0x04 (Address).

I raised PR hyperium/hyper-util#302 with a proposed fix. Happy to discuss alternative solutions if needed.

(Note: the application is using the kube crate, with hyper-socks2. The URLs in this report are sample, but representative of the real URLs.)

Code Sample

Expected Behavior

I should be able to proxy http://[2001:db8::1]:8080

Actual Behavior

I get this error: Service(hyper_util::client::legacy::Error(Connect, Io(Custom { kind: UnexpectedEof, error: "unexpected eof" })))

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug. Something is wrong. This is bad!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions