Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionClosed: for some website when using ip and host header [Custom DNS][Bun fetch()] #2565

Closed
RfadnjdExt opened this issue Apr 5, 2023 · 0 comments · Fixed by #2552
Labels
bug Something isn't working

Comments

@RfadnjdExt
Copy link

What version of Bun is running?

0.5.9

What platform is your computer?

Darwin 19.6.0 x86_64 i386

What steps can reproduce the bug?

i only try khaddavi.net and subscene.com with cloudflare dns to get the ip

export {};
console.log(
  await fetch("https://172.67.220.125:443/", {
    headers: { host: "khaddavi.net" },
    redirect: 'manual',
    verbose: true,
  })
);
bun run script.ts

What is the expected behavior?

a succesful request

What do you see instead?

Request: GET /
        host: khaddavi.net
        Connection: keep-alive
        User-Agent: Bun/0.5.9
        Accept: */*
        Accept-Encoding: gzip, deflate

ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()
 path: "https://172.67.220.125:443/"

Additional information

Node JS fetch reproduce

Response {
  [Symbol(realm)]: null,
  [Symbol(state)]: {
    aborted: false,
    rangeRequested: false,
    timingAllowPassed: true,
    requestIncludesCredentials: true,
    type: 'default',
    status: 200,
    timingInfo: {
      startTime: 284.62246100604534,
      redirectStartTime: 0,
      redirectEndTime: 0,
      postRedirectStartTime: 284.62246100604534,
      finalServiceWorkerStartTime: 0,
      finalNetworkResponseStartTime: 0,
      finalNetworkRequestStartTime: 0,
      endTime: 0,
      encodedBodySize: 540,
      decodedBodySize: 0,
      finalConnectionTimingInfo: null
    },
    cacheState: '',
    statusText: 'OK',
    headersList: HeadersList {
      cookies: null,
      [Symbol(headers map)]: [Map],
      [Symbol(headers map sorted)]: null
    },
    urlList: [ [URL] ],
    body: { stream: undefined }
  },
  [Symbol(headers)]: HeadersList {
    cookies: null,
    [Symbol(headers map)]: Map(16) {
      'date' => [Object],
      'content-type' => [Object],
      'transfer-encoding' => [Object],
      'connection' => [Object],
      'vary' => [Object],
      'last-modified' => [Object],
      'x-cache-status' => [Object],
      'strict-transport-security' => [Object],
      'cf-cache-status' => [Object],
      'report-to' => [Object],
      'nel' => [Object],
      'x-content-type-options' => [Object],
      'server' => [Object],
      'cf-ray' => [Object],
      'content-encoding' => [Object],
      'alt-svc' => [Object]
    },
    [Symbol(headers map sorted)]: null
  }
}

I don't mean to compare it to node js but is this really bun.sh behavior? or am I missing something. Thank you and let me know if you need something.

@RfadnjdExt RfadnjdExt added the bug Something isn't working label Apr 5, 2023
@RfadnjdExt RfadnjdExt changed the title ConnectionClosed: The socket connection was closed unexpectedly for some website when using ip and host header ConnectionClosed: for some website when using ip and host header Apr 5, 2023
@RfadnjdExt RfadnjdExt changed the title ConnectionClosed: for some website when using ip and host header ConnectionClosed: for some website when using ip and host header [Custom DNS][Bun fetch()] Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant