summaryrefslogtreecommitdiff
path: root/src/pkg/http
diff options
context:
space:
mode:
authorJukka-Pekka Kekkonen <karatepekka@gmail.com>2010-09-11 00:27:16 -0400
committerJukka-Pekka Kekkonen <karatepekka@gmail.com>2010-09-11 00:27:16 -0400
commit127078c808fa5be77047a4d563987622e34bc1ac (patch)
tree3e51c4029761f5f16d4a7cfafb4a2487794a4044 /src/pkg/http
parentfd90adabbb9459e918ee99dac08c7d911d9bc29e (diff)
downloadgo-127078c808fa5be77047a4d563987622e34bc1ac.tar.gz
websocket: Add support for secure WebSockets
Fixes issue 842. Fixes issue 1061. R=rsc CC=golang-dev http://codereview.appspot.com/2119042 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/http')
-rw-r--r--src/pkg/http/server.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pkg/http/server.go b/src/pkg/http/server.go
index 2de074867..c7fd94213 100644
--- a/src/pkg/http/server.go
+++ b/src/pkg/http/server.go
@@ -63,6 +63,7 @@ type Conn struct {
header map[string]string // reply header parameters
written int64 // number of bytes written in body
status int // status code passed to WriteHeader
+ usingTLS bool // a flag indicating connection over TLS
}
// Create new connection from rwc.
@@ -73,6 +74,7 @@ func newConn(rwc net.Conn, handler Handler) (c *Conn, err os.Error) {
}
c.handler = handler
c.rwc = rwc
+ _, c.usingTLS = rwc.(*tls.Conn)
br := bufio.NewReader(rwc)
bw := bufio.NewWriter(rwc)
c.buf = bufio.NewReadWriter(br, bw)
@@ -151,6 +153,11 @@ func (c *Conn) readRequest() (req *Request, err os.Error) {
return req, nil
}
+// UsingTLS returns true if the connection uses transport layer security (TLS).
+func (c *Conn) UsingTLS() bool {
+ return c.usingTLS
+}
+
// SetHeader sets a header line in the eventual reply.
// For example, SetHeader("Content-Type", "text/html; charset=utf-8")
// will result in the header line