10 Commits

Author SHA1 Message Date
Dmitri Shuralyov
7c360367ab http2, webdav, websocket: fix %q verb uses with wrong type
Caught early by the improved vet check gated behind the 1.26 language
version combined with a tiplang builder that tests with 1.26 language
version.

Fixes golang/go#76574.
Fixes golang/go#76599.
Fixes golang/go#76547.

Change-Id: If8e2266013df0a39fc980a1e9287f8cb75949811
Cq-Include-Trybots: luci.golang.try:x_net-gotip-linux-amd64-tiplang
Reviewed-on: https://go-review.googlesource.com/c/net/+/725220
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-11-28 14:06:04 -08: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
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
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
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
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