oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.29k stars 2.5k forks source link

Proxy don't works on windows #11111

Open nospher3x2 opened 2 weeks ago

nospher3x2 commented 2 weeks ago

What version of Bun is running?

1.1.8+89d25807f

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

proxy on bun fetch doesn't work on windows. In linux works fine, but on windows i got: (verbose mode on)

request: GET /
        Connection: keep-alive
        User-Agent: Bun/1.1.8
        Accept: */*
        Host: api.ipify.org
        Accept-Encoding: gzip, deflate, br

Response: < 200 Connection established

Syscall fetching "https://api.ipify.org/". For more information, pass verbose: true in the second argument to fetch()
 path: "https://api.ipify.org/"`

The code:

export async function getProxyIp(proxy: Proxy): Promise<string> {
  return fetch("https://api.ipify.org/", {
    proxy: `http://${proxy.ip}:${proxy.port}`,
    verbose: true
  }).then((response) => response.text());
}

What is the expected behavior?

Should return 200 and the IP of the proxy.

What do you see instead?

Syscall fetching "https://api.ipify.org/". For more information, pass verbose: true in the second argument to fetch() path: "https://api.ipify.org/"

Additional information

in linux this code works fine, but only on windows that not.