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

Could golang net package automatically add `Expect: 100-continue` header if body size > 1024 #39637

Closed
xqzhang2015 opened this issue Jun 17, 2020 · 7 comments

Comments

@xqzhang2015
Copy link

@xqzhang2015 xqzhang2015 commented Jun 17, 2020

What version of Go are you using (go version)?

go version go1.13.3 linux/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

GO111MODULE=""
GOARCH="amd64"
GOBIN=""

What did you expect to see?

  • C++ libcurl library could automatically add Expect: 100-continue header if body size > 1024. Do golang net package support it?
/* EXPECT_100_THRESHOLD is the request body size limit for when libcurl will
 * automatically add an "Expect: 100-continue" header in HTTP requests. When
 * the size is unknown, it will always add it.
 *
 */
#ifndef EXPECT_100_THRESHOLD
#define EXPECT_100_THRESHOLD 1024
#endif

What did you see instead?

@davecheney
Copy link
Contributor

@davecheney davecheney commented Jun 17, 2020

Adding the header is one thing, the client and the server has to also have expect support.

Expect support was added back in the day when modems were so slow you didn't want to try to send a large request only to find the server hung up 80% of the way through because the request was larger than it permitted.

What is the problem you are trying to solve?

@xqzhang2015
Copy link
Author

@xqzhang2015 xqzhang2015 commented Jul 13, 2020

@davecheney thanks for the reply.

Not for a specific problem. The main idea is to follow up RFC protocol and conform to most HTTP client libraries, which could help to avoid potential issues for development.

@davecheney
Copy link
Contributor

@davecheney davecheney commented Jul 13, 2020

Thanks for your reply. I’d like to see some analysis on which clients, and more importantly, servers correctly implement expect 100. From my experience the prevalence of expect usage is very low.

@davecheney
Copy link
Contributor

@davecheney davecheney commented Jul 13, 2020

/cc @bradfitz as presumptive owner for a decision.

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jul 14, 2020

I think this would probably cause more troubles overall. Also, the Request.Body length can be unknown.

@xqzhang2015
Copy link
Author

@xqzhang2015 xqzhang2015 commented Aug 17, 2020

@davecheney agree with the idea that "the prevalence of expect usage is very low"

@davecheney
Copy link
Contributor

@davecheney davecheney commented Aug 17, 2020

Based on the responses so far I am closing this ticket for now.

@davecheney davecheney closed this Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.