Skip to content
Merged
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
2 changes: 1 addition & 1 deletion SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Requests that arrived on one connection MAY be in flight at the same time (secti

`body` MUST be `nil` (empty), a `String` (its bytes are used as-is; encoding is not interpreted), an `IO::Buffer` (its backing bytes are used without an intermediate String), or an object responding to `#each`.

The bridge enumerates such a body at most once: it calls `#each` with a block, and the body yields each chunk to that block as a `String` or an `IO::Buffer`. The block MAY take arbitrarily long to return, which is how the host's backpressure reaches the application. The bridge MUST NOT pass on a zero-length chunk. A response to HEAD, a 204 and a 304 carry no content, so the bridge need not enumerate their bodies.
The bridge enumerates such a body at most once: it calls `#each` with a block, and the body yields each chunk to that block as a `String` or an `IO::Buffer`. The block MAY take arbitrarily long to return, which is how the host's backpressure reaches the application. The bridge MUST NOT pass on a zero-length chunk. A response to HEAD, a 204, a 205 and a 304 carry no content, so the bridge need not enumerate their bodies.

The bridge MAY stop enumerating before the body is complete, so a body with side effects MUST tolerate being abandoned part-way. The bridge MUST call `#close` on a body that responds to it once it is finished with the body, whether or not it enumerated the body to completion.

Expand Down
2 changes: 1 addition & 1 deletion lib/nack/spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def valid_content_length?(value)

def no_entity_body?(status, request)
request.request_method.get_string == "HEAD" ||
((100..199).cover?(status) && status != 101) || status == 204 || status == 304
((100..199).cover?(status) && status != 101) || status == 204 || status == 205 || status == 304
end

def valid_interim_status?(status)
Expand Down
1 change: 1 addition & 0 deletions test/spec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
Nack::Spec.no_entity_body?(100, get).must_equal true
Nack::Spec.no_entity_body?(199, get).must_equal true
Nack::Spec.no_entity_body?(204, get).must_equal true
Nack::Spec.no_entity_body?(205, get).must_equal true
Nack::Spec.no_entity_body?(304, get).must_equal true
Nack::Spec.no_entity_body?(200, head).must_equal true
Nack::Spec.no_entity_body?(101, get).must_equal false
Expand Down
Loading