Commit Graph

159 Commits

Author SHA1 Message Date
Gary Burd a87eae1d6f Add hooks to support RFC 7692 (per-message compression extension)
Add newCompressionWriter and newDecompressionReader fields to Conn. When
not nil, these functions are used to create a compression/decompression
wrapper around an underlying message writer/reader.

Add code to set and check for RSV1 frame header bit.

Add functions compressNoContextTakeover and decompressNoContextTakeover
for creating no context takeover wrappers around an underlying message
writer/reader.

Work remaining:

- Add fields to Dialer and Upgrader for specifying compression options.
- Add compression negotiation to Dialer and Upgrader.
- Add function to enable/disable write compression:

    // EnableWriteCompression enables and disables write compression of
    // subsequent text and binary messages. This function is a noop if
    // compression was not negotiated with the peer.
    func (c *Conn) EnableWriteCompression(enable bool) {
            c.enableWriteCompression = enable
    }
2016-06-29 17:03:55 -07:00
Gary Burd b5389d0dc2 Implement RFC 6455, section 4.4 2016-06-29 13:56:55 -07:00
Gary Burd a68708917c Coalesce outbound messages in chat example 2016-06-06 16:20:22 -07:00
Gary Burd 3ddc984058 Merge pull request #136 from reeze/add-handler-getter
Add Ping/Pong handler Getter functions
2016-05-31 22:17:19 -07:00
Reeze Xia c9ce64ea05 Add Ping/Pong handler getter methods 2016-06-01 11:26:10 +08:00
Gary Burd 8b29b78138 Add Sec-WebSocket-Extensions header parser
Also, improve token list header parser.
2016-05-31 09:32:45 -07:00
Gary Burd be01041b66 Reduce memory allocations in NextReader, NextWriter
Redo 8b209f6317 with support for old
versions of Go.
2016-05-31 05:44:45 -07:00
Gary Burd 50d660d6ac Revert "Reduce memory allocations in NextReader, NextWriter"
This reverts commit 8b209f6317.
2016-05-30 01:53:33 -07:00
Gary Burd afffb15196 Merge branch 'varnames' 2016-05-26 21:01:19 -07:00
Gary Burd 24cddddcc0 Use single character receiver names in chat example 2016-05-26 21:00:24 -07:00
Gary Burd 8b209f6317 Reduce memory allocations in NextReader, NextWriter 2016-05-26 14:07:24 -07:00
Gary Burd 2301bcbf5c Cleanup js in chat example 2016-05-26 10:19:40 -07:00
Jean de Klerk be95f72b73 Meaningful names for connection, message 2016-05-18 08:57:16 -06:00
Jean de Klerk a6108176e8 Meaningful names for hub 2016-05-18 08:56:16 -06:00
Gary Burd 1f512fc3f0 Handle invalid close frames
Send protocol error if close code or payload are invalid.

Fixes Autobahn tests 7.5.1, 7.9.*.
2016-04-28 09:34:18 -07:00
Gary Burd a724ba4528 Test truncated frames at all positions 2016-04-25 08:42:53 -07:00
Tarmigan Casebolt ae46df13e9 Fix Read() to return errUnexpectedEOF when EOF is received before all bytes in the frame have been read 2016-04-24 22:30:05 -07:00
Gary Burd 703e8da19b Drop Go 1.3 from supported configurations
The code does not build on 1.3 because tls.Config does not contain the
GetCertificate field. This can be worked around using build constraints,
but it does not seem worth the trouble.
2016-04-23 15:56:33 -07:00
Gary Burd 5a00fb2e99 Do not shallow copy crypto/tls.Config
The Config contains a sync.Once that should not be copied.
2016-04-23 15:46:58 -07:00
Gary Burd 3d02343cd3 .travis.yml go vet fix. 2016-04-22 22:25:05 -07:00
Gary Burd 6b3d49710b Fix filewatch example
Use last modified time when the time is parsed without error. This prevents an
extra file read at start of watch for a connection.

Fixes #125.
2016-04-21 17:30:17 -07:00
Gary Burd e2e3d8414d Document that default ping handler can block 2016-03-13 12:14:46 -07:00
Gary Burd a622679ebd Add IsWebSocketUpgrade 2016-03-09 10:36:44 -08:00
Gary Burd c45a635370 Remove Go 1.1 from Travis config
Go 1.1 cannot fetch 'go vet'.
2016-03-02 15:27:37 -08:00
Gary Burd 0b8990dd8b Run 'go vet' instead of 'go tool vet' in Travis 2016-03-02 15:14:48 -08:00
Gary Burd be42fcd8c9 Merge pull request #113 from elithrar/patch-1
Update .travis.yml to build Go 1.6
2016-03-02 14:59:35 -08:00
Gary Burd d1d4086b14 Fix go vet warning
Move variables from example function arguments to package level
variables to avoid `go vet` warning.
2016-03-02 14:56:29 -08:00
Matt Silverlock ac929f8383 Update .travis.yml to build Go 1.6 2016-02-26 13:26:45 -08:00
Gary Burd 5c91b59efa Improve Upgrader.Upgrade doc 2016-02-21 13:34:30 -08:00
Gary Burd 4935ba31a2 Merge pull request #111 from seikichi/support_proxy_auth
Support proxy authorization for websocket client
2016-02-17 09:43:51 -08:00
Seiichi KONDO 360dfe00ec Support proxy authorization for websocket client 2016-02-17 21:46:45 +09:00
Gary Burd 0e2713e645 Address common gotchas with package
Update documentation to explicitly state that applications must break out of a
read loop on error.

Detect application read loops spinning on a failed connection and panic.

Detect concurrent writes and panic. The detection is best-effort.

Update documentation to state that connections respond to close frames.
2016-02-16 15:03:54 -08:00
Gary Burd e85d897656 Merge pull request #110 from tabone/close-frame-response
Close Frame Response
2016-02-16 13:07:31 -08:00
Luca Tabone bf696496cb When sending a Close frame in response, the endpoint typically echos the status code it received. 2016-02-16 21:31:16 +01:00
Gary Burd b824a5d853 Merge pull request #109 from vially/patch-1
Fix documentation typos
2016-02-10 16:29:04 -08:00
Valentin Hăloiu 6b3bf61ce8 Fix documentation typos 2016-02-11 02:22:44 +02:00
Gary Burd 234959944d Add text description to close errors 2016-01-28 08:48:56 -08:00
Gary Burd 5434f8b69b Improve IsUnexpectedCloseError examples 2016-01-19 18:24:46 -08:00
Gary Burd 615f23bc98 Add IsUnexpectedCloseError 2016-01-19 13:06:29 -08:00
Gary Burd a2d85bcbfc Add IsCloseError, improve doc about errors 2016-01-19 09:20:21 -08:00
Gary Burd 3986be78bf Split raw query from opaque in URL parser
Prior to this change, the client passed query strings from the
application to the network via the net/url#URL.Opaque field. This works,
but may not be something the authors of the net/url and net/http
packages expect. To play it safe, this change parses the query string to
the net/url#URL.RawQuery field.
2015-12-15 21:10:58 -08:00
Gary Burd 9727ab9cda Test URL path and query 2015-12-15 20:25:50 -08:00
Gary Burd 844dd6d40e Add closing handshake code to echo example client 2015-12-09 16:50:38 -08:00
Gary Burd 361d4c0ffd Improve echo web UI
Based on feedback from anon.
2015-11-02 11:10:34 -08:00
Gary Burd c93e5540b8 Add web client to echo example 2015-11-02 10:39:51 -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 a4e0143e1f Do not allow duplicate headers in handshake 2015-11-02 08:39:02 -08:00
Gary Burd 044091b51d Fix lint warning 2015-11-02 08:25:46 -08:00
Gary Burd 527637c0f3 Merge pull request #90 from wolfeidau/add_proxy_support
Proxy support for websocket clients.
2015-10-22 20:53:04 -07:00
Mark Wolfe 70eca1b8e7 Add Proxy support for websocket clients.
- Uses `http.ProxyFromEnvironment` for configuration in line with the
golang standard library.
2015-10-23 09:28:47 +11:00