armeria icon indicating copy to clipboard operation
armeria copied to clipboard

Fix not to set chunked encoding header when 304 response is sent

Open minwoox opened this issue 2 years ago • 1 comments

Motivation: When an HTTP/1.1 304(Not Modified) response is sent, Transfer-Encoding: chunked header cannot be sent because the content of the response is always empty. https://datatracker.ietf.org/doc/html/rfc7232#section-4.1

A 304 response cannot contain a message-body; it is always terminated
by the first empty line after the header fields.

Modification:

  • Do not set chunked encoding header when the content of the response is always empty.

Result:

  • Armeria server no longer sends chunked encoding header with 304(Not Modified) status.

minwoox avatar Aug 08 '22 14:08 minwoox

Codecov Report

Merging #4386 (d05c7c0) into master (4a97e31) will increase coverage by 0.03%. The diff coverage is 90.90%.

@@             Coverage Diff              @@
##             master    #4386      +/-   ##
============================================
+ Coverage     73.82%   73.86%   +0.03%     
- Complexity    17699    17712      +13     
============================================
  Files          1505     1505              
  Lines         66126    66109      -17     
  Branches       8311     8309       -2     
============================================
+ Hits          48820    48831      +11     
+ Misses        13303    13284      -19     
+ Partials       4003     3994       -9     
Impacted Files Coverage Δ
...ecorp/armeria/server/ServerHttp1ObjectEncoder.java 86.56% <90.90%> (+2.44%) :arrow_up:
...server/grpc/UnframedGrpcStatusMappingFunction.java 77.77% <0.00%> (-22.23%) :arrow_down:
.../armeria/server/grpc/UnframedGrpcErrorHandler.java 66.66% <0.00%> (-8.34%) :arrow_down:
...m/linecorp/armeria/client/DecodedHttpResponse.java 85.00% <0.00%> (-5.00%) :arrow_down:
...rmeria/common/stream/ConcatArrayStreamMessage.java 83.14% <0.00%> (-2.25%) :arrow_down:
...rmeria/internal/client/grpc/ArmeriaClientCall.java 80.24% <0.00%> (-1.24%) :arrow_down:
.../linecorp/armeria/client/Http2ResponseDecoder.java 70.62% <0.00%> (ø)
...inecorp/armeria/server/HttpResponseSubscriber.java 80.51% <0.00%> (ø)
...com/linecorp/armeria/client/RedirectingClient.java 73.21% <0.00%> (+0.44%) :arrow_up:
.../linecorp/armeria/client/Http1ResponseDecoder.java 57.89% <0.00%> (+0.58%) :arrow_up:
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 08 '22 15:08 codecov[bot]

Thanks for reviewing guys. 😉

minwoox avatar Aug 23 '22 03:08 minwoox