Skip to content

reply: remove content-length when Transfer-Encoding is added#3814

Merged
mcollina merged 1 commit intofastify:mainfrom
xtx1130:fix-Transfer-Encoding
Apr 2, 2022
Merged

reply: remove content-length when Transfer-Encoding is added#3814
mcollina merged 1 commit intofastify:mainfrom
xtx1130:fix-Transfer-Encoding

Conversation

@xtx1130
Copy link
Copy Markdown
Contributor

@xtx1130 xtx1130 commented Apr 2, 2022

A sender MUST NOT send a Content-Length header field in any message that contains a Transfer-Encoding header field.

Due to https://tools.ietf.org/html/rfc7230#section-3.3.2

Checklist

@climba03003
Copy link
Copy Markdown
Member

climba03003 commented Apr 2, 2022

If my understanding is correct, when Transfer-Encoding: chunked is exist, it will ignore the Content-Length header by default.

After testing, it is actually not.

Copy link
Copy Markdown
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

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

Great catch!
Just a bit :)

// < 200.
// < 200
// A sender MUST NOT send a Content-Length header field in any message
// that contains a Transfer-Encoding header field.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// that contains a Transfer-Encoding header field.
// that contains a Transfer-Encoding header field.
// See: https://tools.ietf.org/html/rfc7230#section-3.3.2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This url has been added at the first line of this code comments

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina added the backport 3.x Issue or pr that should be backported to Fastify v3 label Apr 2, 2022
@mcollina mcollina merged commit edbb820 into fastify:main Apr 2, 2022
@mcollina
Copy link
Copy Markdown
Member

mcollina commented Apr 2, 2022

Can you send a backport PR to v3.x? It did not update automatically

@mcollina
Copy link
Copy Markdown
Member

mcollina commented Apr 2, 2022

Actually no need!

@mcollina mcollina mentioned this pull request Apr 2, 2022
4 tasks
@xtx1130
Copy link
Copy Markdown
Contributor Author

xtx1130 commented Apr 2, 2022

@climba03003 Thanks for your rebase

mcollina pushed a commit that referenced this pull request Apr 4, 2022
* feat: reply trailers support (#3794)

* chore: remove content-length when Transfer-Encoding is added (#3814)

Co-authored-by: 小菜 <xtx1130@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2023

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport 3.x Issue or pr that should be backported to Fastify v3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants