Skip to content

Commit

Permalink
Capital "Content-Length" in reply Header
Browse files Browse the repository at this point in the history
  • Loading branch information
windkit committed Jun 15, 2015
1 parent 021f4f6 commit 22a4dcf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cowboy_req.erl
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ reply(Status, Headers, Body, Req=#http_req{
%% We stream the response body for ContentLength bytes.
RespConn = response_connection(Headers, Connection),
{RespType, Req2} = response(Status, Headers, RespHeaders, [
{<<"content-length">>, integer_to_list(ContentLength)},
{<<"Content-Length">>, integer_to_list(ContentLength)},

This comment has been minimized.

Copy link
@yosukehara

yosukehara Jun 15, 2015

Member

Which is reason of modifying this line Cowboy's issue or S3 client support or other?

This comment has been minimized.

Copy link
@windkit

windkit Jun 15, 2015

Author

While HTTP Headers are supposed to be case insensitive (Stated in RFC 2616), web clients may not follow the rule.

Here, aws-sdk-java assumes headers are capitalized, that is, "Content-Length" instead of "content-length" sent by cowboy. (Actually I suspect this is the usual case for web clients)

Therefore, here we modify the line to send a capitalized one.

{<<"date">>, cowboy_clock:rfc1123()},
{<<"server">>, <<"Cowboy">>}
|HTTP11Headers], stream, Req),
Expand Down

1 comment on commit 22a4dcf

@yosukehara
Copy link
Member

Choose a reason for hiding this comment

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

@windkit I've understood and just remembered we took a measure of s3-clients as follows:

Please sign in to comment.