Skip to content

Conversation

@robobun
Copy link
Collaborator

@robobun robobun commented Aug 15, 2025

Summary

  • Implements automatic Connection header behavior to match Node.js HTTP standards
  • Automatically adds "Connection: keep-alive" when no Connection header is set and headers are provided to writeHead
  • Automatically adds "Connection: close" when the connection should be closed
  • Respects user-provided Connection headers (doesn't override them)
  • Respects explicitly removed Connection headers via removeHeader() (doesn't add them back)

Test plan

  • Added Node.js test test-http-automatic-headers.js - verifies automatic Connection header addition
  • Added Node.js test test-http-remove-connection-header-persists-connection.js - verifies removeHeader behavior
  • Both tests now pass with the fix
  • Tested all scenarios: automatic addition, user-provided headers, and removed headers
  • Verified fix works for both HTTP and HTTPS

🤖 Generated with Claude Code

Implements automatic Connection header behavior to match Node.js:
- Automatically adds "Connection: keep-alive" when no Connection header is set
- Automatically adds "Connection: close" when connection should be closed
- Respects user-provided Connection headers
- Respects explicitly removed Connection headers (via removeHeader)

Fixes Node.js HTTP compatibility by ensuring proper HTTP/1.1 keep-alive behavior.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@robobun
Copy link
Collaborator Author

robobun commented Aug 15, 2025

Updated 1:01 AM PT - Aug 15th, 2025

@autofix-ci[bot], your commit aec6ffd has 4 failures in Build #23072:


🧪   To try this PR locally:

bunx bun-pr 21889

That installs a local version of the PR into your bun-21889 executable, so you can run:

bun-21889 --bun

}
}
if (!hasConnectionHeader) {
for (auto& header : internalHeaders.uncommonHeaders()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary

Claude Bot and others added 2 commits August 15, 2025 06:50
- Remove complex FetchHeaders header checking as suggested by @Jarred-Sumner
- Keep the basic automatic Connection header logic for regular header objects
- Maintain Node.js compatibility for automatic HTTP headers

Addresses review comment: "not necessary" regarding FetchHeaders complexity

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants