oven-sh / bun

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

Malformed_HTTP_Response on cloudflare 307 Temporary Redirect #12759

Closed loveloki closed 3 months ago

loveloki commented 3 months ago

What version of Bun is running?

1.1.21 and 1.1.20

What platform is your computer?

macos Darwin 23.5.0 arm64 arm

What steps can reproduce the bug?

run this code:

const url = "https://kilianvalkhof.com/feed/"

console.log("fetch")
fetch(url, {
  verbose: true
})
  .then((res) => res.text())
  .then((t) => {
    console.log("text", t)
  })
  .catch((e) => {
    console.log("e", e)
  })

nodejs is ok,but Bun throw a error

bun result:

[fetch] > HTTP/1.1 GET https://kilianvalkhof.com/feed/
[fetch] > Connection: keep-alive
[fetch] > User-Agent: Bun/1.1.21
[fetch] > Accept: */*
[fetch] > Host: kilianvalkhof.com
[fetch] > Accept-Encoding: gzip, deflate, br

[fetch] < 200 Connection established

[fetch] < 307 Temporary Redirect
[fetch] < Date: Wed, 24 Jul 2024 04:05:09 GMT
[fetch] < Content-Type: application/rss+xml; charset=UTF-8
[fetch] < Transfer-Encoding: chunked
[fetch] < Connection: keep-alive
[fetch] < location: http://feeds.feedburner.com/Kilianvalkhofcom
[fetch] < vary: Accept-Encoding, Cookie
[fetch] < cf-edge-cache: cache,platform=wordpress
[fetch] < last-modified: Fri, 19 Jul 2024 09:24:19 GMT
[fetch] < etag: "c41d27093cdb5325489efb6dc0ddd68b"
[fetch] < x-robots-tag: noindex, follow
[fetch] < strict-transport-security: max-age=63072000; includeSubDomains; preload
[fetch] < x-content-type-options: nosniff
[fetch] < x-frame-options: SAMEORIGIN
[fetch] < x-xss-protection: 1; mode=block
[fetch] < content-security-policy-report-only: default-src https: data: blob: 'self' 'unsafe-inline' 'unsafe-eval'; img-src data: https:; font-src data: https:; report-uri https://kilian.report-uri.io/r/default/csp/reportOnlyi; connect-src https: data: blob: 'self' 'unsafe-inline' 'unsafe-eval' https://client.crisp.chat https://storage.crisp.chat wss://client.relay.crisp.chat wss://stream.relay.crisp.chat
[fetch] < content-security-policy: default-src https: data: blob: 'self' 'unsafe-inline' 'unsafe-eval'; img-src data: https:; report-uri https://kilian.report-uri.io/r/default/csp/enforce; connect-src https: data: blob: 'self' 'unsafe-inline' 'unsafe-eval' https://client.crisp.chat https://storage.crisp.chat wss://client.relay.crisp.chat wss://stream.relay.crisp.chat
[fetch] < referrer-policy: strict-origin-when-cross-origin
[fetch] < CF-Cache-Status: DYNAMIC
[fetch] < Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=n62DHmb0my2z5VYAsH3CY4WiBwwSvgQGKBqOWuF8fohxW9v8uaRLCAP1GCTd2Uk8kYkqpVmANs%2FL2KSqYb8N6%2FE8i2zDpkFb5Ef7UjqrcS%2FCgAleOuqTYmwTjziXdIhmy%2F%2Fvfg%3D%3D"}],"group":"cf-nel","max_age":604800}
[fetch] < NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
[fetch] < Server: cloudflare
[fetch] < CF-RAY: 8a8107b4de3a3f7a-SIN
[fetch] < alt-svc: h3=":443"; ma=86400

[fetch] > HTTP/1.1 GET http://feeds.feedburner.com/Kilianvalkhofcom
[fetch] > Connection: keep-alive
[fetch] > User-Agent: Bun/1.1.21
[fetch] > Accept: */*
[fetch] > Host: feeds.feedburner.com
[fetch] > Accept-Encoding: gzip, deflate, br

e Malformed_HTTP_Response: Malformed_HTTP_Response fetching "https://kilianvalkhof.com/feed/". For more information, pass `verbose: true` in the second argument to fetch()
 path: "https://kilianvalkhof.com/feed/"

result image:

image

image

What is the expected behavior?

No error.

or provide a solution to handle this error

What do you see instead?

It may look similar to #12007 and #8599

Additional information

No response

Jarred-Sumner commented 3 months ago

Fixed by @cirospaciari in Bun v1.1.22