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

crypto/tls, net/http: make PeerCertificates and other information availabe from within an http Handler #1317

Closed
gopherbot opened this issue Dec 2, 2010 · 4 comments

Comments

@gopherbot
Copy link

by mseigneurin@aliceadsl.fr:

The http.ResonseWriter exposes a UsingTLS() method which is good, but the other info
stored in the tls.Conn structure is not available. Could the interface be
extended/changed to allow access to more of the TLS properties?

(this is related to https://golang.org/issue/155)

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
linux,x86_64

Which revision are you using?  (hg identify)
d206790cdd7d tip

Please provide any additional information below.

I can "patch in" by creating a custom Listener that mimics the
tls.Listener and gets the information there, but I can't figure out a
way of propagating that info up the stack to the actual handlers
without:
a) hacking in the http/server.go and adding an accessor there similar
to the way UsingTLS() is implemented - which is not real nice I guess.
or b) writing a custom equivalent of http.conn/http.response, which is
a lot of duplicated code.
@rsc
Copy link
Contributor

rsc commented Dec 8, 2010

Comment 1:

Status changed to Accepted.

@bradfitz
Copy link
Contributor

bradfitz commented Mar 4, 2011

Comment 2:

This reminds me that I hate the fat ResponseWriter interface, which has several things
that are unrelated to either responses or writing:
    RemoteAddr() string
    UsingTLS() bool
    Hijack() (io.ReadWriteCloser, *bufio.ReadWriter, os.Error)
All of those feel sorely out of place.

@rsc
Copy link
Contributor

rsc commented Mar 4, 2011

Comment 3:

I'm happy to work out a plan for how to fix up the server API.
I'd like to get the client to a not-changing point first though.

@bradfitz
Copy link
Contributor

@mikioh mikioh changed the title http & tls: make PeerCertificates and other information availabe from within an http Handler crypto/tls, net/http: make PeerCertificates and other information availabe from within an http Handler Jan 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants