-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: invalid method strings #12078
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
Comments
We should also investigate whether Newrequest and Transport.Roundtrip and Request.Write return errors with bogus methods. |
Note that there are lots of APIs out there which use custom HTTP methods (google |
This is only about malformed method names. |
CL https://golang.org/cl/16860 mentions this issue. |
CL https://golang.org/cl/16829 mentions this issue. |
Fixes #12078 Change-Id: If09c927fae639ec4ed3894a2b393a87c1e677803 Reviewed-on: https://go-review.googlesource.com/16829 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Andrew Gerrand <[email protected]>
Hi.
Following the discussion at net/http: add method constants from RFC 2616 and net/http: HTTP methods check.
go version
)?go version 1.4.2 linux/amd64
Archlinux 4.1.4-1-ck cmd/cgo: fails with gcc 4.4.1 #1 SMP PREEMPT Mon Aug 3 16:56:11 EDT 2015 x86_64 GNU/Linux
req, err := http.NewRequest("GET ", url, nil)
, notice the extra space.An error as it is not a valid HTTP method.
For https://golang.org, the proper response for a GET request is send but it is inconsistent between servers. For instance, if we use " GET", some servers will respond with a bad request status.
It would also be useful to add the commonly used method constants to net/http from RFC 7231 along with PATCH from RFC 5789:
Regards, sw.
The text was updated successfully, but these errors were encountered: