-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http/httptest: Server does not check GetCertificate #63812
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
The source of the issue is here: go/src/net/http/httptest/server.go Lines 167 to 169 in 883f062
I guess it could also check if I'll also note that this behavior of |
I thnk |
|
@rittneje, yes, I know. What I mean that it should be a dummy |
I think this is out of scope, if you already have a complete http.Server, you should be testing that directly, rather than some mutated version of it with httptest.Server. |
Testing server does a lot of useful plumbing real server does not: like exposing a client which terminates all connections when test finishes. |
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?
I am trying to test a
http.Server
instance with httptest'sServer
:I want to check that server's TLS configuration works. Server's TLS configuration uses
GetCertificate
What did you expect to see?
That once I call
StartTLS
is called,GetCertificate
is called to obtain the certificate to configure the testing server and testing client.What did you see instead?
StartTLS
ignores and never callsGetCertificate
but instead configures testing server and testing client to use testing certificate.Discussion
I can call something like:
before calling
StartTLS
. But ideally that should be called byStartTLS
. This is documented intls.Config
:Currently only
Certificates
is checked, butGetCertificate
orGetConfigForClient
are ignored.My motivation is to do a test with
golang.org/x/crypto/acme/autocert
serving as manager against Pebble to test thathttp.Server
's configuration and everything works correctly.The text was updated successfully, but these errors were encountered: