liblink: pull linker i/o into separate liblink C library (CL 35790044)
misc/benchcmp: removed and replaced by go.tools/cmd/benchcmp (CL 47980043)
misc/dist: renamed misc/makerelease (CL 39920043)
+net/http: add Request.TLS (CL 52660047)
net/http: add Server.ErrorLog; log and test TLS handshake errors (CL 70250044)
net/http: add Server.SetKeepAlivesEnabled (CL 69670043)
net/http: add Transport.TLSHandshakeTimeout; set it by default (CL 68150045)
if err != nil {
t.Fatal(err)
}
+ defer res.Body.Close()
if res.TLS == nil {
t.Fatal("Response didn't set TLS Connection State.")
}
- if res.TLS.CipherSuite != tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA {
- t.Errorf("Unexpected TLS Cipher Suite: %d != %d",
- res.TLS.CipherSuite, tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA)
+ if got, want := res.TLS.CipherSuite, tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA; got != want {
+ t.Errorf("TLS Cipher Suite = %d; want %d", got, want)
}
- res.Body.Close()
}
// Verify Response.ContentLength is populated. http://golang.org/issue/4126
// This is only populated for Client requests.
Request *Request
- // TLS allows information about the TLS connection on which the
- // response was received. The Transport in this package sets the field
- // for TLS-enabled connections before returning the Response otherwise
- // it leaves the field nil.
+ // TLS contains information about the TLS connection on which the
+ // response was received. It is nil for unencrypted responses.
+ // The pointer is shared between responses and should not be
+ // modified.
TLS *tls.ConnectionState
}
return nil, err
}
}
+ cs := tlsConn.ConnectionState()
+ pconn.tlsState = &cs
pconn.conn = tlsConn
}
t *Transport
cacheKey connectMethodKey
conn net.Conn
+ tlsState *tls.ConnectionState
closed bool // whether conn has been closed
br *bufio.Reader // from conn
bw *bufio.Writer // to conn
}
}
- if tlsConn, ok := pc.conn.(*tls.Conn); resp != nil && ok {
- resp.TLS = new(tls.ConnectionState)
- *resp.TLS = tlsConn.ConnectionState()
+ if resp != nil {
+ resp.TLS = pc.tlsState
}
hasBody := resp != nil && rc.req.Method != "HEAD" && resp.ContentLength != 0