Commit Graph

11 Commits

Author SHA1 Message Date
Dmitri Shuralyov
c289c7ab4f websocket: re-add documentation for DialConfig
The comment of the DialConfig function was dropped during CL 463097.
There doesn't seem to be a good reason to do that, so bring it back.

For golang/go#57953.

Change-Id: I3e458b7d18cdab95763f003da5a644c8287b54ad
Reviewed-on: https://go-review.googlesource.com/c/net/+/568198
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2024-03-04 17:27:04 +00:00
Aleksei Besogonov
3dfd003ad3 websocket: add support for dialing with context
Right now there is no way to pass context.Context to websocket.Dial.
In addition, this method can block indefinitely in the NewClient call.

Fixes golang/go#57953.

Change-Id: Ic52d4b8306cd0850e78d683abb1bf11f0d4247ca
GitHub-Last-Rev: 5e8c3a7cba
GitHub-Pull-Request: golang/net#160
Reviewed-on: https://go-review.googlesource.com/c/net/+/463097
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-02-27 23:21:14 +00:00
Cezar Sa Espinola
819f4c5391 websocket: use net.Dialer to open tcp connection
This change adds a Dialer field to websocket.Config struct. If this
value is set the Dialer will be used. If it's nil, DialConfig will
create an empty Dialer that will maintain the original behavior.

Because before Go 1.3 there was no crypto/tls.DialWithDialer function,
the Dialer will be ignored when opening TLS connections in these
versions.

Fixes golang/go#9198.

Change-Id: If8b5c3c47019a3d367c436e3e60eb54bf0276184
Reviewed-on: https://go-review.googlesource.com/12191
Reviewed-by: Russ Cox <rsc@golang.org>
2016-10-03 02:44:59 +00:00
Mikio Hara
13b0908ee0 websocket: fix socket leak in the case of negotiation failure
Change-Id: Ie5712a49f0c909538f4c36311b591e930a77efb5
Reviewed-on: https://go-review.googlesource.com/5410
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-14 03:04:11 +00:00
Norberto Lopes
5058c78c36 websocket: add support for websocket urls without a port specified
Some servers return a websocket url without a port. This patch
automatically adds :80 for ws and :443 for wss.

Change-Id: Ifdcdbda8f87c994a5f351234c83bf4a07be34ea2
Reviewed-on: https://go-review.googlesource.com/2210
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-01-22 14:46:38 +00:00
Scott Ferguson
38c17adf51 go.net/websocket: drop old versions of the protocol
Most modern web browsers support RFC6455, so it's okay to drop older versions.
Fixes golang/go#5628.

R=golang-dev, ukai
CC=golang-dev
https://golang.org/cl/10480043
2013-09-19 11:03:51 +10:00
Fumitoshi Ukai
0005f0a0c0 go.net/websocket: allow server configurable
Add websocket.Server to configure WebSocket server handler.

- Config.Header is additional headers to send, so you can use it
  to send cookies or so.
  To read cookies, you can use Conn.Request().Header.
- factor out Handshake.
  You can set func to check origin, subprotocol etc.
  Handler checks origin by default.

Fixes golang/go#4198.
Fixes golang/go#5178.

R=golang-dev, mikioh.mikioh, crobin
CC=golang-dev
https://golang.org/cl/8731044
2013-05-12 13:50:10 +09:00
Fumitoshi Ukai
5a65403107 go.net/websocket: Use protocol parameter in websocket.Dial.
Fixes golang/go#4157

R=golang-dev, rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6571064
2012-10-10 07:45:07 +09:00
Francisco Souza
3b94eae23e go.net/websocket: fix server and client examples
Fix import path, and remove some unnecessary semicolons.

R=golang-dev, dave, adg
CC=golang-dev
https://golang.org/cl/6506068
2012-09-06 15:22:57 +10:00
David Symonds
359f934a65 go.net: gofix for net/url API changes.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5672082
2012-02-18 12:49:41 +11:00
Russ Cox
3294cb5d6c go.net: initial code
Manual edits to README.
Moved from main Go repository, deleted Makefiles, ran gofix -r go1rename.

Tested with: go test code.google.com/p/go.net/...

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5574065
2012-01-25 15:31:30 -05:00