Commit Graph

302 Commits

Author SHA1 Message Date
Pablo Carranza 8c40c0b5bd Bump default handshake timetout to 45 seconds 2018-03-06 09:50:53 -08:00
Pablo Carranza 196b8d0585 Add a default handshake timeout of 5 seconds 2018-03-06 09:50:53 -08:00
Julien Salleyron e426f23f06 Sec-WebSocket-Protocol is capitalize instead of canonical 2018-03-06 09:05:33 -08:00
Carter Jones 6656ddce91 add newline and remove extra space 2018-03-04 15:22:45 -08:00
unknown 0647012449 Modify http status code to variable 2018-02-28 13:09:02 -08:00
Gary Burd f37d158860 Travis config: add Go 1.10.x, revert 1.4.x to 1.4
1.4.x is missing go vet
2018-02-18 23:13:02 -08:00
Alexey Palazhchenko 2967b101a5 Use latest patch releases of Go 2018-02-18 23:13:02 -08:00
claudia-jones 8fbc40be62 Simplify echo example client (#349)
Use existing `done` channel to signal that reader is done instead of closing the connection.
2018-02-18 16:00:50 -08:00
Gary Burd 4ac909741d
Improve control message handler doc
Fixes #338
2018-01-31 17:52:56 -08:00
Gary Burd 91f589db02
Improve check origin documentation
Remove the example code to disable origin checks from the documentation.
I am concerned that developers are copying the code without
understanding the security implications of the code. Most applications
should not use this code.

Change the bad origin error message to mention Upgrader.CheckOrigin

Mention cross-site request forgery in the Upgrader.CheckOrigin doc.
2018-01-25 10:51:21 -08:00
Gary Burd 292fd08b25
Replace "frame" with "message" in documentation
The documentation sometimes used the term "frame" when referring to
single frame control messages.  Use the term "message" for consistency
in the documentation and to hide a detail that most application
programmers do not need to know about.
2018-01-10 06:15:25 -08:00
Gary Burd 58729a2165
Don't log 1006 error in chat example
This error is expected (Safari closes connections without sending a close
frame).

Fixes #323
2018-01-09 12:15:58 -08:00
Gary Burd d965e9adc6
Handle no status in FormatCloseMessage
Return empty message for CloseNoStatusReceived. This status indicates
that the message is empty, so make it so. Because it's illegal to send
CloseNoStatusReceived, this change should not break a correct
application.
2017-12-28 07:29:59 -08:00
Jordan Pittier cdedf21e58 examples/chat/client.go: avoid allocating []byte{} for PingMessage (#312)
It's useless and only gives more work to the GC.
2017-12-09 19:53:53 -08:00
Gary Burd c55883f973
Add parseExtensions test case (#310) 2017-12-05 11:45:40 -08:00
Gary Burd b89020ee79
Add SOCKS5 support
- Bundle the golang.org/x/net/proxy package to x_net_proxy.go. The
package contains a SOCKS5 proxy. The package is bundled to avoid adding
a dependency from the weboscket package to golang.org/x/net.
- Restructure the existing HTTP proxy code so the code can be used as a
dialer with the proxy package.
- Modify Dialer.Dial to use proxy.FromURL.
- Improve tests (avoid modifying package-level data, use timeouts in
tests, use correct proxy URLs in tests).

Fixes #297.
2017-11-30 17:43:01 -08:00
Gary Burd 8c6cfd493d
Improve bad handshake error text
Change the error text for bad handshake errors from

    websocket: not a websocket handshake:

to:

    websocket: the client is not using the websocket protocol:

The new text should be more helpful to developers who do not know or
understand the details of the protocol.

Test for bad handshake before other request errors.
2017-11-30 16:45:44 -08:00
fising 2b58522131 update README.md 2017-11-29 07:20:15 -08:00
David Dollar b648f206c2 Use ASCII case folding in same origin test 2017-11-27 16:10:45 -08:00
Gary Burd 23059f2957 Update with gofmt on tip
The changes are compatible with older versions of gofmt.
2017-11-23 00:11:29 -08:00
Gary Burd 447c2df769 Compare request header tokens with ASCII case folding
Compare request header tokens with ASCII case folding per the WebSocket
RFC.
2017-11-22 23:15:27 -08:00
Gary Burd aa5ed01c91 Improve control message handling documentation
Closes #299
2017-11-19 13:55:18 -08:00
Sebastian Waisbrot 7ca4275b84 More consistent error handling in doc
I noticed the example is actually wrong as the same block both calls `return` with no parameter and `return err`. I think it would be better to allow the code to be used directly. I added calls to log.Println as it was used on the other example as it might be more useful for newcomers to see error messages.
2017-11-12 07:44:06 -08:00
Gary Burd 3da6ca0cb6 Simplify and fix spelling errors in test files
Simplify using gofmt -s.
2017-11-02 08:08:30 -07:00
Jérôme Bernard 71fa72d484 Replace parseURL() with net/url.Parse() (#290) 2017-10-12 19:08:58 -07:00
Gary Burd f918560c4c Improve NextWriter documentation 2017-10-10 09:16:43 -07:00
xPushkin c908dc801c Typo fix
Just a small typo fix.
2017-10-07 13:56:17 -07:00
Gary Burd 4201258b82 Merge pull request #286 from alaingilbert/patch-1
Add missing html tag in example/echo
2017-09-26 16:33:35 -07:00
Alain Gilbert 5755884efa
Add missing html tag in example/echo 2017-09-26 16:13:09 -07:00
Gary Burd 6f34763140 Add Go 1.9 to Travis config 2017-09-13 22:11:54 -07:00
Gary Burd a69d9f6de4 Merge branch 'updoc' 2017-07-18 13:23:41 -07:00
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
Gary Burd 462d5c5828 Merge pull request #261 from kybin/master
doc: use ":=" when check error for conn.WriteMessage
2017-07-08 03:26:55 -04:00
fuzzybear3965 1d375d5a0d distinguish Upgrader.Upgrade from Upgrade 2017-07-07 14:47:14 -04:00
kim yongbin 7a8dacf0a7 doc: use ":=" when check error for conn.WriteMessage 2017-07-02 19:51:28 +09:00
Gary Burd ea4d1f681b Reduce memory used in chat example 2017-06-20 12:01:03 -07:00
Gary Burd a91eba7f97 Merge pull request #230 from FZambia/fix_client_compression
Enable client compression based on response header
2017-03-19 13:27:27 -04:00
Alexander Emelin 8dc1cf94c1 enable client compression based on response header 2017-03-19 11:36:38 +03: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 4873052237 Fix formatting. 2017-03-01 09:42:05 -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
William Wennerström 3f3e394da2 Update cloneTLSConfig to use Go 1.8 Config.Clone method 2017-02-18 08:27:10 -08:00
Gary Burd 9acaa683f0 Add Go 1.8 to Travis config 2017-02-16 13:52:12 -08:00
Gary Burd 5ade364dff Improve examples
- Remove jQuery dependency in command example.
- Fix auto scroll on new content in chat and command example.
- Update chat and command example to use a static HTML file.
2017-02-15 17:01:07 -08:00
Gary Burd 804cb600d0 Prepared Messages (#211) 2017-02-14 09:41:18 -08:00
Shrumit Mehta 9bc973af06 Change text/template to html/template in the examples
Change text/template to html/template in examples
2017-02-13 10:21:12 -08:00
Gary Burd c36f2fe5c3 Merge pull request #210 from nobuf/nobuf/update-doc-about-compression
Add code snippet for EnableCompression in doc.go
2017-01-26 11:14:27 -08:00
Nobu Funaki 1025138dad Add code snippet for EnableCompression in doc.go, change EnableWriteCompression()'s parameter to false since enableWriteCompression is true by default. 2017-01-26 10:48:11 -08:00
Gary Burd 4e4c8d08b4 Merge pull request #208 from FZambia/flate_write_pool_fix
fix flate write pool size to work with best compression
2017-01-24 15:37:53 -08:00