Commit Graph

33 Commits

Author SHA1 Message Date
Gary Burd 92f772e4b3 Misc cleanup
- Fix lint warnings.
- Use standard comment format to mark deprecated identifiers.
- Remove redundant paragraph from doc.
2017-07-18 13:21:30 -07:00
fuzzybear3965 f4f69d2d8d implementing (some of) @garyburd's suggestions 2017-07-10 10:21:27 -04:00
fuzzybear3965 1d375d5a0d distinguish Upgrader.Upgrade from Upgrade 2017-07-07 14:47:14 -04:00
Gary Burd b258b4fadb Use bufio.Writer returned from hijack in upgrade
Reuse the buffer backing the bufio.Writer returned from hijack if that
buffer is large enough to be generally useful and
Upgrader.WriteBufferSize == 0.

Update the logic for reusing bufio.Reader returned from hijack to match
the logic for bufio.Reader:  The buffer backing the reader must be
sufficiently large to be generally useful and Upgrader.ReadBufferSize ==
0.

Improve the documentation for ReadBufferSize and WriterBufferSize in
Dialer and Upgrader.
2017-03-02 14:46:13 -08:00
Gary Burd 286b5c9371 Use bufio.Reader returned from hijack in upgrade
Use the bufio.Reader returned from hijack if the reader's buffer size is
equal to the buffer size specified in Upgrader.ReadBufferSize.
2017-03-01 09:36:54 -08:00
Gary Burd 0674c7c796 Improve upgrade error messages
Upgrade typically fails because the request is not a handshake, not
because the handshake is malformed. To help developers diagnose the
common case, state explicitly that the request is not a handshake in
error messages.

To help diagnose malformed requests, capitalize and 'quote' header names
in error messages.
2017-01-23 10:55:51 -08:00
Gary Burd a0ef436d00 compression: add tests, rename option 2016-10-17 17:30:22 -07:00
Cyrus Katrak c09b72d2ee per message compression; only no context modes 2016-10-14 12:08:39 -07:00
Gary Burd b5389d0dc2 Implement RFC 6455, section 4.4 2016-06-29 13:56:55 -07:00
Gary Burd a622679ebd Add IsWebSocketUpgrade 2016-03-09 10:36:44 -08:00
Gary Burd 5c91b59efa Improve Upgrader.Upgrade doc 2016-02-21 13:34:30 -08:00
Gary Burd 567453a710 Require GET in Upgrader.Upgrade.
Return error if the request method is not GET.

Remove all request method tests from the examples.
2015-11-02 09:08:11 -08:00
Gary Burd ab5b3a61f5 Improve server error messages
Update the error messages for missing 'Connection: upgrade' and
'Upgrade: websocket' tokens to indicate that the header might not be
present. The previous error message implied that the header is present,
but has the wrong value. This leads to some confusion for those
debugging connection problems.
2015-01-14 22:19:51 -08:00
Gary Burd 7d2ea39ebc Cleanup buffer size calculations. 2014-11-05 12:26:52 -08:00
Gary Burd 4292df70df Check and handle error return from hijack. 2014-08-15 20:25:38 -07:00
Gary Burd 0f32413e5e Relax default origin test.
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.
2014-06-30 14:57:20 -07:00
Gary Burd 3d0e89148e Clear deadlines set by HTTP server. 2014-06-29 19:47:15 -07:00
Gary Burd 1e6e1281b0 Clear upgrader handshake deadline. 2014-04-21 06:28:28 -07:00
Gary Burd df94ef6daa Various improvements to Upgrader.
- Revert back to using Subprotocols []string. The protocol negotiation
  using Subprotocols should meet the needs of most applications.
  Applications are not locked into using this negotiation. An
  application can pick a protocol some other way and specify the
  protocol using the Sec-Websocket-Protocol response header.
- Parse the origin using url.Parse. This is the correct function to use
  when parsing a full URL.
- Improve comments.
2014-04-20 11:38:35 -07:00
Gary Burd 15aed3b4a4 Relicense to the Gorilla WebSocket Authors. 2014-04-18 14:25:11 -07:00
Joachim Bauch ecf9b98e31 Updated docs. 2014-04-18 00:40:10 +02:00
Joachim Bauch 0a7cd15dd1 Make subprotocol negotiation more flexible. 2014-04-18 00:25:32 +02:00
Joachim Bauch 2b15a66741 Simplified returning of errors. 2014-04-18 00:20:46 +02:00
Joachim Bauch b03dcbad2a Updated Origin check.
The host in the Origin header must match the host of the request by default.
2014-04-18 00:07:36 +02:00
Joachim Bauch f99474eb97 Renamed constants to match Go style guidelines. 2014-04-17 23:46:48 +02:00
Joachim Bauch 56543ef6d6 Moved Upgrader code to server implementation. 2014-04-17 23:45:40 +02:00
Joachim Bauch b2f990180a Implement Upgrader API (#6). 2014-04-16 17:25:17 +02:00
Gary Burd 9cdec41bda Improve Upgrade documentation. 2013-12-20 14:54:49 -08:00
Gary Burd b118f62ec0 Add subprotocol negotiation to Dialer. 2013-12-14 08:06:24 -08:00
Gary Burd 93b1570a27 Improve documentation.
- Introduce ReadMessage and WriteMessage before NextReader and
  NextWriter in the package comment. It's better to introduce the easy
  methods first.
- Move sections on message of types before the concurrency section.
2013-10-29 17:43:03 -07:00
Gary Burd 1627eef2a3 Improve documentation. 2013-10-27 08:34:33 -07:00
Gary Burd 80c1e5a741 Add Subprotocols helper function. 2013-10-26 06:52:30 -07:00
Gary Burd 273ecadfca Initial commit 2013-10-16 16:30:59 -07:00