Commit Graph

292 Commits

Author SHA1 Message Date
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
Gary Burd 4292df70df Check and handle error return from hijack. 2014-08-15 20:25:38 -07:00
Gary Burd 365b7a442d Merge pull request #38 from hydrogen18/master
Correct documentation of "ReadJSON"
2014-08-11 07:57:55 -07:00
Eric Urban ade0fc90f7 Correct documentation, the "ReadJSON" function depends on "Unmarshal", not "Marshal" 2014-08-10 20:42:52 -05:00
Gary Burd f940e88c0e Merge pull request #37 from jcbohin/patch-1
Changing a swap in README.md for autobahn
2014-08-04 22:03:22 -07:00
Jean-Christophe Bohin acc8d8706f Changing a swap in README.md for autobahn
Autobahn test suite configuration fuzzingclient.json refers to 'clients' folder, but README.md refers to server. I changed README.md to clients, although I can't figure a good way to choose between changing README.md for 'clients' or fuzzingclient.json for servers. both seems legit to me, depending on what side you see things. Feel free to dismiss/decline my PR if you think the former makes more sense in this context.
2014-08-04 23:58:41 +02:00
Gary Burd bda3d7d128 Fix mask key. 2014-07-23 20:32:33 -07:00
Gary Burd 10afcadf69 Cleanup EOF handling.
- Modify data message reader to return io.ErrUnexpectedEOF if a close
  message is received before the final frame of the message.
- Modify NextReader to return io.ErrUnexpectedEOF if underlying
  connection returns io.EOF before a close message.
2014-07-10 19:36:51 -07:00
Gary Burd aef42a8ae6 Add note about reading the connection. 2014-07-07 09:33:43 -07:00
Gary Burd 0e7b5f878f Do not mask bytes when reading on the client.
- The bytes were masked with zero, a nop.
- Add test for control messages.
2014-07-05 13:56:34 -07:00
Gary Burd 411599d366 Cleanup client/server tests. 2014-07-05 08:49:11 -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 bc19d3d337 Improve chat example.
- Log all handshake errors.
- Prevent double close on send channel.
2014-06-27 13:08:22 -07:00
Gary Burd d2dc86f575 Add maskBytes benchmark. 2014-06-27 13:06:07 -07:00
Gary Burd efd7f76a14 Cleanup read operations.
- Use io.ReadFull instead of similar function in package.
- Return from Read with partial data. Don't attempt to fill buffer.
- Do not return net.Error with Temporary() == true
2014-06-06 09:48:50 -07:00
Gary Burd f4076986b6 Improve Set{Read,Write}Deadline doc.
The new doc is inspired by the crypto/tls doc.
2014-06-05 15:19:54 -07:00
Gary Burd 95caf726f7 Update README.md
typos
2014-06-05 13:56:06 -07:00
Gary Burd 6afc23d053 Improve readme. 2014-06-03 15:01:48 -07:00
Gary Burd d832908d2b Add note about Chrome message fragmentation to readme 2014-06-03 14:47:02 -07:00
Gary Burd 10a95d14a3 Merge pull request #27 from AeroNotix/patch-1
Typo fix
2014-05-10 06:54:10 -07:00
Aaron France b98fe92f10 Typo fix 2014-05-10 14:30:27 +02:00
Gary Burd db7a2a1679 Improve client host header handling.
- Set request host header to substring of the URL. Do not add default
  port to string.
- Do not include port when verifying TLS host name.
2014-05-08 11:21:56 -07:00
Gary Burd 1e6e1281b0 Clear upgrader handshake deadline. 2014-04-21 06:28:28 -07:00
Gary Burd db1c080f90 Improve readme. 2014-04-20 21:48:25 -07:00
Gary Burd 82a29af075 Update readme files
- Improve comparison with go.net package.
- Improve autobahn server description.
2014-04-20 21:14:06 -07:00
Gary Burd bbe4cde693 Use Upgrader in client/server test. 2014-04-20 12:08:24 -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 f867cb5c72 Cleanup issues reported by golint. 2014-04-20 07:20:03 -07:00