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

Always set content-length #71

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .release-notes/set-content-length.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Always set Content-Length

There was a bug where the Content-Length header could end up not being sent. This would cause many clients (such as curl) to hang.
2 changes: 1 addition & 1 deletion http_server/_test_reponse.pony
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class \nodoc\ iso _BuildableResponseTest is UnitTest

fun apply(h: TestHelper) ? =>
let without_length = BuildableResponse()
h.assert_is[None](None, without_length.header("Content-Length") as None)
h.assert_is[String]("0", without_length.header("Content-Length") as String)

let with_length = BuildableResponse(where content_length' = 42)
h.assert_eq[String]("42", with_length.header("Content-Length") as String)
4 changes: 2 additions & 2 deletions http_server/response.pony
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ class val BuildableResponse is (Response & ByteSeqIter)
match cl
| let clu: USize =>
set_header("Content-Length", cl.string())
// | None =>
// TODO: drop header
| None =>
set_header("Content-Length", "0")
end
this

Expand Down
Loading