Commit Graph

15 Commits

Author SHA1 Message Date
Canelo Hill 8915bad18b Improve bufio handling in Upgrader.Upgrade
Use Reader.Size() (add in Go 1.10) to get the bufio.Reader's size
instead of examining the return value from Reader.Peek.

Use Writer.AvailableBuffer() (added in Go 1.18) to get the
bufio.Writer's buffer instead of observing the buffer in the underlying
writer.

Allow client to send data before the handshake is complete. Previously,
Upgrader.Upgrade rudely closed the connection.
2024-07-01 13:41:19 +10:00
Konstantin Burkalev f78ed9f987 Added tests for subprotocol selection 2024-06-19 17:13:42 +10:00
merlin c7502098b0 use http.ResposnseController 2024-06-19 17:10:25 +10:00
apoorvajagtap ce903f6d1d Reverts to v1.5.0
This commit reverts the changes back till 8983b96324.
And inherits the README.md changes of 931041c5ee
Relates to:
- https://github.com/gorilla/websocket/issues/880#issuecomment-2081189055
2024-06-13 23:18:03 -04:00
merlin 1e975a03ce use http.ResposnseController 2024-01-21 22:52:10 -05:00
merlin 4a5e66f763 make tests parallel 2024-01-21 22:46:55 -05:00
Konstantin Burkalev aa976062fe
Fixes subprotocol selection (aling with rfc6455) (#823)
Fixes #822

**Summary of Changes**

1. Changed the order of subprotocol selection to prefer client one

---------

Co-authored-by: Corey Daley <cdaley@redhat.com>
2023-11-07 08:35:30 -05:00
JWSong 78cf1bc733
Changed the method name UnderlyingConn to NetConn to align the methods names with Go 1.18 standard library (#773) 2022-04-17 06:01:17 -07:00
Rn 2c89656910
Modify http Method String Literal to Variable (#728) 2021-12-19 11:21:45 -05:00
Steven Scott a9dd6e8839 miscellaneous cleanup
- Add Go 1.11 to Travis config
- Use short variable declarations where possible.
- Remove unnecessary build tags after move to Go 1.7 min version.
- Simplify composite literals.
- Remove unused fields (err in PerparedMessage)
- Fix errors reported by golint and goword.
2018-08-24 14:03:26 -07:00
Steven Scott b378caee5b Add write buffer pooling
Add WriteBufferPool to Dialer and Upgrader. This field specifies a pool
to use for write operations on a connection.  Use of the pool can reduce
memory use when there is a modest write volume over a large number of
connections.

Use larger of hijacked buffer and buffer allocated for connection (if
any) as buffer for building handshake response. This decreases possible
allocations when building the handshake response.

Modify bufio reuse test to call Upgrade instead of the internal
newConnBRW. Move the test from conn_test.go to server_test.go because
it's a serer test.

Update newConn and newConnBRW:

- Move the bufio "hacks" from newConnBRW to separate functions and call
these functions directly from Upgrade.
- Rename newConn to newTestConn and move to conn_test.go. Shorten
argument list to common use case.
- Rename newConnBRW to newConn.
- Add pool code to newConn.
2018-08-22 14:11:59 -07:00
David Dollar b648f206c2 Use ASCII case folding in same origin test 2017-11-27 16:10:45 -08:00
Gary Burd a622679ebd Add IsWebSocketUpgrade 2016-03-09 10:36:44 -08:00
Gary Burd 15aed3b4a4 Relicense to the Gorilla WebSocket Authors. 2014-04-18 14:25:11 -07:00
Gary Burd 80c1e5a741 Add Subprotocols helper function. 2013-10-26 06:52:30 -07:00