Skip to content

“invalid dns name” error when fetching IPv6 host over proxy #31504

@0f-0b

Description

@0f-0b

With an HTTP proxy listening on port 8888:

$ export all_proxy=http://127.0.0.1:8888
$ curl 'https://[2001:4860:4860::64]' # ensure that the proxy works
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://dns.google/">here</A>.
</BODY></HTML>
$ deno eval 'await fetch("https://[2001:4860:4860::64]", { redirect: "manual" })'
error: Uncaught (in promise) TypeError: error sending request for url (https://[2001:4860:4860::64]/): client error (Connect): invalid dns name
await fetch("https://[2001:4860:4860::64]", { redirect: "manual" })
^
    at async mainFetch (ext:deno_fetch/26_fetch.js:192:12)
    at async fetch (ext:deno_fetch/26_fetch.js:475:11)
    at async …/$deno$eval.mts:1:1
$ deno --version
deno 2.5.6+dd3a7d3 (canary, release, aarch64-apple-darwin)
v8 14.2.231.17-rusty
typescript 5.9.2

The same issue happens with a SOCKS5 proxy.

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