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

fix(serve): fix close_connection behaviour in endWithoutBody #6315

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

Hanaasagi
Copy link
Collaborator

What does this PR do?

  • Fix close_connection behaviour. When should_connection is true, set state |= HTTP_CONNECTION_CLOSE.
  • Fix incomplete HTTP response, adding the \r\n between the header and body (even empty).

Close: #6031

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

I wrote automated tests

{
// Some HTTP clients require the complete "<header>\r\n\r\n" to be sent.
// If not, they may throw a ConnectionError.
uwsRes->AsyncSocket<false>::write("\r\n", 2);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If remove this line:

  • curl: work
  • Python requests: work
  • node http client: Error: socket hang up error
  • bun fetch: ConnectionClosed error

@cirospaciari
Copy link
Member

LGTM

@cirospaciari cirospaciari merged commit e0e9bc1 into oven-sh:main Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bun.serve maxRequestBodySize not working as expected
2 participants