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

Use Content-Length header more often. #102

Merged
merged 4 commits into from
Jul 31, 2023
Merged

Conversation

floitsch
Copy link
Member

No description provided.

@floitsch floitsch requested a review from erikcorry July 13, 2023 11:14
@floitsch floitsch marked this pull request as draft July 13, 2023 11:14
src/request.toit Outdated
slash := (path.starts_with "/") ? "" : "/"
body_writer := connection_.send_headers
"$method $slash$path HTTP/1.1\r\n"
headers
--is_client_request=true
--content_length=content_length
--has_body=(body != null)

Choose a reason for hiding this comment

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

Should use has_body here.

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

body_writer_.write data

write_headers_ status_code/int --message/string? --has_body/bool:
write_headers_ status_code/int --message/string? --content_length/int? --has_body/bool:

Choose a reason for hiding this comment

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

I think it would save code to have content_length default to null here.

Copy link
Member Author

Choose a reason for hiding this comment

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

keeping as is, to make callers think about the content-length.

floitsch and others added 3 commits July 28, 2023 17:30
We can't get the content-length in the write method because this
is a method that can be called more than once.

Fix some types in the test.
@floitsch floitsch marked this pull request as ready for review July 31, 2023 09:51
@floitsch floitsch merged commit 50c983a into main Jul 31, 2023
@floitsch floitsch deleted the floitsch/add_content_size branch July 31, 2023 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants