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

Add configuration to not pre-read multipart form data #778

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

Markmerc
Copy link
Contributor

Some servers want to treat the multipart form data as a binary blob, or at least not read/parse it until other decisions are made about the request.

Copy link
Collaborator

@erikdubbelboer erikdubbelboer left a comment

Choose a reason for hiding this comment

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

I think the term pre-read is a bit wrong (also in the original code). Can you change it to pre-parse?

http.go Outdated
@@ -979,24 +979,26 @@ func (req *Request) MayContinue() bool {
//
// If maxBodySize > 0 and the body size exceeds maxBodySize,
// then ErrBodyTooLarge is returned.
func (req *Request) ContinueReadBody(r *bufio.Reader, maxBodySize int) error {
func (req *Request) ContinueReadBody(r *bufio.Reader, maxBodySize int, preReadMultipartForm bool) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The only problem I see with this pull request is that this changes the API. Anyone using this function that upgrades fasthttp will have it break their build.

I guess you could make it a ...bool so it becomes optional and backwards compatible.

Copy link
Contributor Author

@Markmerc Markmerc Apr 13, 2020

Choose a reason for hiding this comment

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

switched to ...bool

@Markmerc
Copy link
Contributor Author

I think the term pre-read is a bit wrong (also in the original code). Can you change it to pre-parse?

Fixed

@Markmerc Markmerc requested a review from erikdubbelboer April 13, 2020 17:46
@erikdubbelboer erikdubbelboer merged commit db18810 into valyala:master Apr 14, 2020
@erikdubbelboer
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants