-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
net/http: add Server.OptionsHandler to allow custom handling of OPTIONS * #41773
Comments
Adding |
This is a pretty niche thing but seems small enough. Does anyone object to adding this? |
Based on the discussion, this seems like a likely accept. |
No change in consensus, so accepted. |
@rsc what happens with this proposal now that it has been accepted? Do you accept pull requests? Anything I can do to help get this implemented, please let me know. |
@simonmittag thank you for this feature request, and congrats on having it accepted. Thanks Russ, Ian, Brad and the proposal review committee for the review! Yes we do accept Pull Requests as well as Change Lists (CLs). If using PRs, please read https://golang.org/doc/contribute#sending_a_change_github, and sign the Google CLA and then you'll be set. The resource is a good place to start https://golang.org/doc/contribute. Once you have submitted the change, please let me know and myself and other reviewers will take a look. Thank you, and I look forward to having you as a new Go contributor! |
Change https://golang.org/cl/356409 mentions this issue: |
Change https://golang.org/cl/356410 mentions this issue: |
I've implemented |
Interesting related comment #26918 (comment) that possibly explains how default |
I agree that separate OPTIONS * handling is warranted, and the proposed alternative implementation also works. Personally would have preferred a customisable handler over a global boolean flag. Has this been slated for release yet? |
Wanted to bump this issue and ask if we can expect this in an upcoming release of go? |
… of OPTIONS * Fixes golang#41773
… of OPTIONS * Fixes golang#41773
We need this feature to allow us disabling OPTIONS method. When will this change be available? Thanks! |
… of OPTIONS * Fixes golang#41773
is this slated for a release yet? I could also really use this feature. |
Go follows the release cycle as described in https://go.dev/s/release |
Change https://go.dev/cl/450515 mentions this issue: |
For #41773 For #41773 For #50465 For #51914 For #53002 For #53896 For #53960 For #54136 For #54299 Change-Id: I729d5eafc1940d5706f980882a08ece1f69bb42c Reviewed-on: https://go-review.googlesource.com/c/go/+/450515 Auto-Submit: Damien Neil <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Damien Neil <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Global options requests are described here: https://tools.ietf.org/html/rfc7231#page-31
Run this request against an instance of golang http.Server (I'm using this one: https://github.com/simonmittag/j8a/blob/master/server.go), like so:
curl -v -X OPTIONS --request-target '*' --http1.1 https://j8a.io
What did you see?
A canned response from net.http built-in serverHandler, bypassing any handlers I specify.
What did you expect to see?
Would like to customise the server response to this request and include
"Allow"
HTTP headers to limit the global HTTP methods made available by the server instance. However response for this request is hardcoded into net/http serverHandler: https://github.com/golang/go/blob/master/src/net/http/server.go, line 2859 which overrides handler with the built-in globalOptionsHandlerCan you allow users to specify this handler as an argument to http.Server?
The text was updated successfully, but these errors were encountered: