Sean Liao
2914f46773
websocket: re-recommend gorilla/websocket
...
Undoes CL 457356 now that it has new maintainers.
Change-Id: I4e05c72d5dec98f7893e6bea38db19916fc03bbb
Reviewed-on: https://go-review.googlesource.com/c/net/+/655195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Damien Neil <dneil@google.com >
Auto-Submit: Damien Neil <dneil@google.com >
2025-03-05 13:52:38 -08:00
Mathias Fredriksson
f88258d67e
websocket: update nhooyr.io/websocket to github.com/coder/websocket
...
Maintenance of nhooyr.io/websocket has moved to github.com/coder/websocket.
Read more about the transition at https://coder.com/blog/websocket
Updates golang/go#18152
Change-Id: Ia2b11c9a57ad7ded775b50a5bbb7ea91562d39b5
GitHub-Last-Rev: 59cea5e101
GitHub-Pull-Request: golang/net#222
Reviewed-on: https://go-review.googlesource.com/c/net/+/614075
Reviewed-by: Ian Lance Taylor <iant@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Damien Neil <dneil@google.com >
Auto-Submit: Damien Neil <dneil@google.com >
2024-09-25 22:53:10 +00:00
Dmitri Shuralyov
9bf379fa3e
websocket: fix printf(var) mistake detected by latest printf checker
...
For golang/go#69267 .
Change-Id: Ica6d123312495966ad6d222d67944fd602216853
Reviewed-on: https://go-review.googlesource.com/c/net/+/610799
Reviewed-by: Alan Donovan <adonovan@google.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2024-09-04 22:19:48 +00:00
Damien Neil
c1f5833288
all: replace deprecated io/ioutil calls
...
The io/ioutil package's features were moved to
the io and os packages in Go 1.16.
x/net depends on Go 1.18. Drop ioutil calls,
so gopls doesn't warn about them.
Change-Id: Ibdb576d94f250808ae285aa142e2fd41e7e9afc9
Reviewed-on: https://go-review.googlesource.com/c/net/+/586244
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
2024-05-21 19:59:00 +00:00
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
Oleksandr Redko
7e3c19ca52
all: correct typos in comments
...
Change-Id: Idc75240e5546be2f2b091878910339b4967c93c7
GitHub-Last-Rev: c78560c06f
GitHub-Pull-Request: golang/net#166
Reviewed-on: https://go-review.googlesource.com/c/net/+/465715
Run-TryBot: Ian Lance Taylor <iant@google.com >
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
2023-02-07 17:08:46 +00:00
Ian Lance Taylor
ad92d3db36
websocket: don't recommend Gorilla
...
It's no longer maintained.
Fixes golang/go#57228
Change-Id: I6678d1959a36761477e5c634c21305f775c80761
Reviewed-on: https://go-review.googlesource.com/c/net/+/457356
Run-TryBot: Ian Lance Taylor <iant@golang.org >
Reviewed-by: Damien Neil <dneil@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Auto-Submit: Ian Lance Taylor <iant@golang.org >
2022-12-13 21:41:14 +00:00
Russ Cox
290c469a71
all: gofmt
...
Gofmt to update doc comments to the new formatting.
For golang/go#51082 .
Change-Id: Iae68a9cd600060577271575e893ecb23bed1e509
Reviewed-on: https://go-review.googlesource.com/c/net/+/399599
Run-TryBot: Russ Cox <rsc@golang.org >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Auto-Submit: Russ Cox <rsc@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
2022-04-12 02:06:05 +00:00
Anmol Sethi
1a5e07d1ff
websocket: Add nhooyr.io/websocket to the deprecation message
...
My library is a well maintained alternative as well and is easier to transition to thanks to the [NetConn](https://godoc.org/nhooyr.io/websocket#NetConn ) wrapper.
Updates https://github.com/golang/go/issues/18152
Change-Id: Iff9addebcee4f39dbd9f015d0fbe7613e4ee45dd
GitHub-Last-Rev: 0ae267b16a
GitHub-Pull-Request: golang/net#51
Reviewed-on: https://go-review.googlesource.com/c/net/+/193217
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2019-09-21 01:59:27 +00:00
Gauthier Jolly
afe8f62b1d
websocket: add documentation to IsServerConn and IsClientConn
...
Those function names are ambiguous. These functions don't check if a
client/server is connected but if the connection is client or server
side. Adding some documentation should avoid any mistake.
Change-Id: I0522e176d58c558fd880d49b980b0152b96823bc
Reviewed-on: https://go-review.googlesource.com/120146
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2018-06-21 14:42:59 +00:00
Brad Fitzpatrick
97edce0b2e
websocket: mention the gorilla package
...
Updates golang/go#18152
Change-Id: Ia3df3f9668847690e60a2af0680cf1bd66042384
Reviewed-on: https://go-review.googlesource.com/33806
Reviewed-by: Ross Light <light@google.com >
2016-12-02 00:11:43 +00:00
Mikio Hara
8b4af36cd2
websocket: drop support for go1.4 or below
...
Change-Id: I228f1405aac4ed058dafdfd5fc4cc609c56004fa
Reviewed-on: https://go-review.googlesource.com/30897
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2016-10-13 03:57:02 +00:00
Mikio Hara
236cde1758
websocket: use of crypto/rand package in test
...
The Read function of math/rand package doesn't exist on Go 1.5 or below.
Change-Id: If837bbd0a862726be93e07b021701004ba0f0fad
Reviewed-on: https://go-review.googlesource.com/30896
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2016-10-13 03:56:52 +00:00
Artyom Pervukhin
6dba816f10
websocket: limit incoming payload size
...
Codec's Receive method calls io.ReadAll of the whole frame payload,
which can be abused by user sending large payloads in order to exhaust
server memory.
Introduce limit on received payload size defined by
Conn.MaxPayloadBytes. If payload size of the message read with
Codec.Receive exceeds limit, ErrFrameTooLarge error is returned; the
connection can still be recovered if required: the next call to Receive
would at first discard leftovers of previous oversized message before
processing the next one.
Fixes golang/go#5082 .
Change-Id: Ib04acd7038474fee39a1719324daaec1c0c496b1
Reviewed-on: https://go-review.googlesource.com/23590
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2016-10-12 14:08:20 +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
Dave Cheney
7553b97266
websocket: fix Read behaviour in hybiFrameReader.Read
...
The contract for Read specifies that a caller should process n bytes of
data before handling an error value. The previous implementation may
have discarded the final data read from the underlying reader if err
was non nil.
Change-Id: I81547cd9ea62c4060f79523679beed6bbc6ccd95
Reviewed-on: https://go-review.googlesource.com/23534
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2016-05-31 06:23:09 +00:00
Sam Whited
318395d8b1
websocket: remove redundant error handling
...
Change-Id: I1b0e8812ca5b2e3ca72948d5414d569879e54f35
Reviewed-on: https://go-review.googlesource.com/21461
Reviewed-by: Andrew Gerrand <adg@golang.org >
2016-04-05 03:06:35 +00:00
Sam Whited
3e5cd1ed14
websocket: Be explicit about goroutine safety
...
Specifically state that it is safe to call methods on Conn from multiple
goroutines in the docs.
Fixes #6692
Change-Id: I1b0e8812ca5b2e3ca72948c5404d569879e54f34
Reviewed-on: https://go-review.googlesource.com/20455
Reviewed-by: Andrew Gerrand <adg@golang.org >
2016-03-09 02:44:09 +00:00
Mikio Hara
b026840ad5
websocket: don't send IPv6 zone identifier in outbound request, per RFC 6874
...
When making a request to an IPv6 address with a zone identifier, for
exmaple [fe80::1%en0], RFC 6874 says HTTP clients must remove the zone
identifier "%en0" before writing the request for security reason.
This change removes any IPv6 zone identifer attached to URI in the Host
header field in requests.
See golang/go#9544 .
Change-Id: Ie5d18a0bc5f2768a95c59ec2b159ac0abdf685e8
Reviewed-on: https://go-review.googlesource.com/13296
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2015-08-13 11:46:27 +00:00
Mikio Hara
b963d2882a
websocket: handle solicited and unsolicited Ping/Pong frames correctly
...
This change prevents Read from failing with io.EOF, ErrNotImplemented on
exchanging control frames such as ping and pong.
Fixes golang/go#6377 .
Fixes golang/go#7825 .
Fixes golang/go#10156 .
Change-Id: I600cf493de3671d7e3d11e2e12d32f43928b7bfc
Reviewed-on: https://go-review.googlesource.com/13054
Reviewed-by: Andrew Gerrand <adg@golang.org >
2015-08-04 03:35:05 +00:00
Mikio Hara
84649876d0
websocket: add extented payload length check for the case of 7+64 bits
...
Fixes golang/go#11999 .
Change-Id: I7ee0966d2e8f79973814f48afc7e8f2cd4af1e50
Reviewed-on: https://go-review.googlesource.com/13059
Reviewed-by: Andrew Gerrand <adg@golang.org >
2015-08-04 03:31:07 +00:00
Mikio Hara
19fe7f4f42
websocket: drop unreachable code
...
Change-Id: I54bcd2803ef270e8bb785a3ecb85ee7bf0a5b18b
Reviewed-on: https://go-review.googlesource.com/13053
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2015-08-03 20:45:16 +00:00
Mikio Hara
51854aba46
websocket: fix build
...
Change-Id: I414c02fb0178e3280e1df4c04f0cff528f5de341
Reviewed-on: https://go-review.googlesource.com/12910
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
2015-07-30 12:28:25 +00:00
Mikio Hara
46f551b6cf
websocket: skip TestClose on Plan 9
...
Updates golang/go#11454 .
Change-Id: Ib3762897b15d47d42002aafcdb1f634504c5d82c
Reviewed-on: https://go-review.googlesource.com/12889
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2015-07-30 12:08:30 +00:00
Mikio Hara
d9b482f8ab
websocket: fix mis-handshake in the case of lack of HTTP origin header
...
Fixes golang/go#10102 .
Change-Id: I34779a81797cb3b7e8820f5af8b0dde54f949164
Reviewed-on: https://go-review.googlesource.com/7034
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2015-07-30 07:09:39 +00:00
Nigel Tao
8d6170202b
websocket: fix a minor grammar issue in a comment.
...
Fixes golang/go#10881
Change-Id: I9f16dd0425d4e3c4a05530411eb29a7193a9d242
Reviewed-on: https://go-review.googlesource.com/10621
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2015-06-03 06:18:02 +00:00
Dave Cheney
bb64f4dc73
x/net/websocket: always close underlying connection on ws.Close
...
Fixes #10866
When ws.Close is called, always close the underlying ws.rwc.
Change-Id: Ia709d5e0bc51ffb7194668d2764848d012e0c652
Reviewed-on: https://go-review.googlesource.com/10135
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2015-05-18 01:39:50 +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
David Symonds
8aa6e209cb
net: add import comments.
...
Change-Id: Ifab0fdaec1d810d268b7c19ad30f476802203b37
2014-12-09 14:17:11 +11:00
Andrew Gerrand
fbe893ddcd
go.net: use golang.org/x/... import paths
...
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/167030043
2014-11-10 09:04:43 +11:00
Robert Griesemer
a6927df230
go.net: fix various typos
...
LGTM=adonovan
R=adonovan
CC=golang-codereviews, golang-dev
https://golang.org/cl/97950043
2014-05-02 14:50:26 -07:00
Mikio Hara
e970ddb60a
go.net/websocket: fix nits found by go tool vet
...
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/27440043
2013-11-17 13:42:09 +09:00
Andrew Gerrand
f9a9acba57
go.net/websocket: remove defunct hixie.go file
...
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13233046
2013-09-19 15:35:31 +10: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
4c1c96f7e0
go.net/websocket: fix handshake error.
...
If client sent no subprotocol (e.g. no Sec-WebSocket-Protocol),
websocket server responded with the following header
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: E7SRWRnZL9RuGFLuZ0j4508nqdg=
Sec-WebSocket-Protocol:
So, client may close the connection because it contains
wrong empty Sec-WebSocket-Protocol header.
If client didn't offer any subprotocol, don't set
config.Protocol, so that not emit empty Sec-WebSocket-Protocol.
Fixes golang/go#5457 .
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/9379044
2013-05-14 15:08:31 +09: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
Shenghou Ma
94458b3b47
go.net/websocket: optimize frame masking code
...
From Jens.Alfke@gmail.com .
Fixes golang/go#5269 .
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8748050
2013-04-18 02:50:09 +08:00
Fumitoshi Ukai
68e1a2128a
go.net/websocket: update package comment to refer RFC 6455
...
Fixes golang/go#5222
R=golang-dev, mikioh.mikioh, minux.ma, r
CC=golang-dev
https://golang.org/cl/8651044
2013-04-15 10:16:23 -07:00
Mikio Hara
811c2f5ee8
go.net: gofmt -w -s
...
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6811084
2012-11-06 22:00:43 +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
Francisco Souza
dbb2a3601f
websocket: fix typo
...
Small fix missed in CL 6446061.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6457047
2012-07-30 12:03:42 +10:00
Shenghou Ma
8e3008acf4
websocket: fix typos
...
Fixes golang/go#3880 .
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6446061
2012-07-28 22:14:35 -04:00
Fumitoshi Ukai
675d40ba14
go.net/websocket: fix error check in Send
...
Fixes golang/go#3727
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6306080
2012-06-18 08:55:57 -07: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