Add table driven test for handling of host in request URL, request
header and TLS server name. In addition to testing various uses of host
names, this test also confirms that host names are handled the same as
the net/http client.
The new table driven test replaces TestDialTLS, TestDialTLSNoverify,
TestDialTLSBadCert and TestHostHeader.
Eliminate duplicated code for constructing root CA.
- Bundle the golang.org/x/net/proxy package to x_net_proxy.go. The
package contains a SOCKS5 proxy. The package is bundled to avoid adding
a dependency from the weboscket package to golang.org/x/net.
- Restructure the existing HTTP proxy code so the code can be used as a
dialer with the proxy package.
- Modify Dialer.Dial to use proxy.FromURL.
- Improve tests (avoid modifying package-level data, use timeouts in
tests, use correct proxy URLs in tests).
Fixes#297.
Change the error text for bad handshake errors from
websocket: not a websocket handshake:
to:
websocket: the client is not using the websocket protocol:
The new text should be more helpful to developers who do not know or
understand the details of the protocol.
Test for bad handshake before other request errors.
- To take advantage of the Host header cleanup in the net/http
Request.Write method, use a net/http Request to write the handshake to
the wire.
- Move code from the deprecated NewClientConn function to Dialer.Dial.
This change makes it easier to add proxy support to Dialer.Dial. Add
comment noting that NewClientConn is deprecated.
- Update the code so that parseURL can be replaced with net/url Parse.
We need to wait until we can require 1.5 before making the swap.
The Dialer.Dial method returns an *http.Response on a bad handshake.
This CL updates the Dial method to include up to 1024 bytes of the
response body in the returned *http.Response. Applications may find the
response body helpful when debugging bad handshakes.
Fixes issue #62.
Update the default origin test to treat no origin specified as OK. If
the client can create a request without the origin set, then the client
can also create a request with an arbitrary origin.