Commit Graph

120 Commits

Author SHA1 Message Date
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
Gary Burd 5ed2f4547d Refactor client handshake
- To take advantage of the Host header cleanup in the net/http
  Request.Write method, use a net/http Request to write the handshake to
  the wire.
- Move code from the deprecated NewClientConn function to Dialer.Dial.
  This change makes it easier to add proxy support to Dialer.Dial. Add
  comment noting that NewClientConn is deprecated.
- Update the code so that parseURL can be replaced with net/url Parse.
  We need to wait until we can require 1.5 before making the swap.
2015-10-21 10:08:33 -07:00
Gary Burd 423912737d Improve documentation 2015-10-19 15:05:01 -07:00
Gary Burd d14d8b4715 Add pinging to command example 2015-10-18 18:17:26 -07:00
Gary Burd 7f59b56ea4 Fix DefaultDialar value
Initialize as pointer to struct with zero values as as implied by the
doc comment. This initialization matches similar values in the standard
library.
2015-10-18 15:41:02 -07:00
Gary Burd 0e33ab35f9 Fix race in command example
Close files in handler goroutine to avoid race.
Remove use of exec.Cmd. It's not adding anything.
2015-10-18 15:32:45 -07:00
Gary Burd f9219095ab Add command example 2015-10-18 13:32:14 -07:00
Gary Burd f71d4a996f Return write errors from default pong handler
Fixes issue #86.
2015-10-15 10:18:08 -07:00
Gary Burd c66b764651 Add test for bufio.ReadBytes on connection reader
Test for issue #85.
2015-10-08 22:47:23 -07:00
Gary Burd 00ae02c5f5 Merge pull request #82 from heppu/master
Small typo fix in comment
2015-10-06 13:46:28 -07:00
Henri Koski 20b4ee30ab Small typo fix in comment 2015-10-06 21:40:04 +03:00
Gary Burd 13e4d0621c Do not build files in echo example 2015-09-23 15:29:30 -07:00
Gary Burd d051d29231 Add client and server example 2015-09-23 15:23:26 -07:00
Gary Burd 39cd638460 Document ping and pong handler argument
Closes #76
2015-09-15 11:02:48 -07:00
Gary Burd b6ab76f1fe Provide all close frame data to application
- Export closeError.
- Do not convert normal closure and going away to io.EOF.
2015-08-11 10:14:32 -07:00
Gary Burd 6eb6ad425a Improve chat example documentation 2015-07-14 07:06:27 -07:00
Gary Burd a3ec486e6a Merge pull request #67 from cjellick/fix-typo
Fix typo
2015-05-29 20:03:52 -07:00
Craig Jellick 8ba5eaa6df Fix typo 2015-05-29 16:26:01 -07:00
Gary Burd 1551221275 Reject URIs containing user information
WebSocket URIs do not contain user information per section 3 of RFC
6455.

Fixes #65
2015-05-15 09:26:38 -07:00
Peter Waller 6fd0f867fe Allow separate specification of http/dial Hosts
Enable the Host: header to be customized in a Dialer.Dial call.

This is needed to implement websocket proxies.
2015-05-10 11:51:08 +01:00
Gary Burd b2fa8f6d58 Return response body on bad handshake.
The Dialer.Dial method returns an *http.Response on a bad handshake.
This CL updates the Dial method to include up to 1024 bytes of the
response body in the returned *http.Response. Applications may find the
response body helpful when debugging bad handshakes.

Fixes issue #62.
2015-05-08 15:39:37 -07:00
Gary Burd ecff5aabe4 Merge pull request #59 from gansidui/master
Fix typo in comment
2015-04-18 03:52:33 -07:00
Jie Li db3e79986d Fix typo in comment 2015-04-18 13:58:37 +08:00
Gary Burd 2dbddebb82 Improve the errors returned from ReadJSON.
The JSON decoder returns io.EOF when a message is empty or all
whitespace. Convert io.EOF return values from the JSON decoder to
io.ErrUnexpectedEOF so that applications can distinguish between an
error reading the JSON value and the connection closing.
2015-03-09 12:10:02 -07: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 1f87405cd9 Merge pull request #53 from gaku/master
Fixed broken HTML for autobahn test server.
2014-12-24 08:19:31 -08:00
Gaku Ueda 9dc53c0673 Fixed broken HTML for autobahn test server. 2014-12-24 03:15:18 -08:00
Gary Burd 9007e29a7c Add test for function tokenListContainsValue 2014-11-17 04:16:34 -08:00
Gary Burd f761cdb666 Update README to use new path for Go sub-repos. 2014-11-10 09:56:46 -08:00
Gary Burd ea78a26f80 Don't hide Timeout on errors from underying net conn. 2014-11-06 16:56:58 -08:00
Gary Burd 7d2ea39ebc Cleanup buffer size calculations. 2014-11-05 12:26:52 -08:00
Gary Burd 79b87dd5c7 Merge pull request #45 from attilaolah/patch-1
Fix typo in conn.go
2014-11-03 07:50:49 -08:00
Attila Oláh 6af932933a fix typo in conn.go 2014-11-03 16:48:34 +01:00
Gary Burd a6366fbf9d Merge pull request #44 from attilaolah/patch-1
fix typo in README.md
2014-11-03 07:27:07 -08:00
Attila Oláh d9b6ff71d6 fix typo in README.md 2014-11-03 16:02:20 +01:00
Gary Burd 47f93dfaed Improve errors.
- Use new closeError type for reporting close frames to the application.
- Use closeError with code 1006 when the peer closes connection without
  sending a close frame. The error io.ErrUnexpectedEOF was used
  previously. This change helps developers distinguish abnormal closure
  and an unexpected EOF in the JSON parser.
2014-10-31 14:52:20 -07:00
Gary Burd 02eec998da Improve documentation. 2014-10-31 14:51:45 -07:00
Gary Burd 87f6f6a22e Add documentation about origin policy. 2014-10-12 09:34:51 -07:00
Gary Burd a6f041ac33 Merge pull request #40 from stchris/patch-1
fixed typo in comment
2014-09-10 23:42:24 -07:00
Christian Stefanescu 0a52d61198 fixed typo in comment 2014-09-11 08:36:21 +02:00