save the TLS config in the h2quic client

fixes #476
This commit is contained in:
Marten Seemann
2017-03-15 09:16:42 +07:00
parent 0a825a397d
commit 4f16503ab9
2 changed files with 8 additions and 0 deletions

View File

@@ -53,6 +53,7 @@ func NewClient(t *QuicRoundTripper, tlsConfig *tls.Config, hostname string) *Cli
c.cryptoChangedCond = sync.Cond{L: &c.mutex}
c.config = &quic.Config{
ConnState: c.connStateCallback,
TLSConfig: tlsConfig,
}
return c
}

View File

@@ -3,6 +3,7 @@ package h2quic
import (
"bytes"
"compress/gzip"
"crypto/tls"
"errors"
"net"
"net/http"
@@ -39,6 +40,12 @@ var _ = Describe("Client", func() {
client.requestWriter = newRequestWriter(headerStream)
})
It("saves the TLS config", func() {
tlsConf := &tls.Config{InsecureSkipVerify: true}
client = NewClient(&QuicRoundTripper{}, tlsConf, "")
Expect(client.config.TLSConfig).To(Equal(tlsConf))
})
It("adds the port to the hostname, if none is given", func() {
client = NewClient(quicTransport, nil, "quic.clemente.io")
Expect(client.hostname).To(Equal("quic.clemente.io:443"))