Commit Graph

341 Commits

Author SHA1 Message Date
misu 985aed2c33 mod: doc 2019-02-03 14:49:04 +09:00
misu 62bb07b760 add: comment 2019-02-03 11:30:02 +09:00
misu a8d45c1b96 merge: master 2019-02-02 13:48:39 +09:00
Ankur Gupta 95ba29eb98 Updated autobahn test suite URL
Fixes #436
2018-12-05 23:02:39 -08:00
kanozec 483fb8d7c3 Add "in bytes" to sizes in documentation 2018-10-30 07:45:53 -07:00
Jeff R. Allen 76e4896901 Fix formatting problem in the docs. (#435)
Sorry for the dumbest PR ever, but this tiny addition of a period changes the formatting of this sentence from a header to a regular paragraph in godoc.
2018-10-11 19:01:31 -07:00
Steven Scott a51a35ae32 Improve header parsing code
Because the net/http server removes \r\n from multi-line header values,
there's no need to to check for \r or \n when skipping whitespace in
headers (see https://godoc.org/net/textproto#Reader.ReadMIMEHeader).
Given this fact, the whitespace test can be simplified to b == ' ' || b
== '\t'.  There's no need for the isSpaceOctet bit field in octetTypes.

The isTokenOctet bit field is the only bit field remaining after the
removal of isSpaceOctet.  Simplify the code by replacing the
isTokenOctet bit test in octetTypes with an array of booleans called
isTokenOctet.

Declare isTokenOctet as a composite literal instead of constructing it
at runtime.

Add documentation to core functions for parsing HTTP headers.
2018-10-06 11:35:33 -04:00
Steven Scott 3130e8d3f1 Return write buffer to pool on write error (#427)
Fix bug where connection did not return the write buffer to the pool
after a write error. Add test for the same.

Rename messsageWriter.fatal method to endMessage and consolidate all
message cleanup code there. This ensures that the buffer is returned to
pool on all code paths.

Rename Conn.prepMessage to beginMessage for symmetry with endMessage.
Move some duplicated code at calls to prepMessage to beginMessage.

Bonus improvement: Adjust message and buffer size in TestWriteBufferPool
to test that pool works with fragmented messages.
2018-09-24 16:26:12 -07:00
Steven Scott cdd40f587d Add comprehensive host test (#429)
Add table driven test for handling of host in request URL, request
header and TLS server name. In addition to testing various uses of host
names, this test also confirms that host names are handled the same as
the net/http client.

The new table driven test replaces TestDialTLS, TestDialTLSNoverify,
TestDialTLSBadCert and TestHostHeader.

Eliminate duplicated code for constructing root CA.
2018-09-24 16:10:46 -07:00
misu 89ee8d4670 mod: test 2018-09-11 18:21:37 +09:00
misu 6f489dbdf7 merge: v1.4.0 2018-09-11 17:52:11 +09:00
Mathias Fredriksson 66b9c49e59 Move context to first parameter in DialContext
Follows best practice and pkg/context documentation:

> The Context should be the first parameter, typically named ctx
2018-08-25 08:15:06 -07:00
Steven Scott a9dd6e8839 miscellaneous cleanup
- Add Go 1.11 to Travis config
- Use short variable declarations where possible.
- Remove unnecessary build tags after move to Go 1.7 min version.
- Simplify composite literals.
- Remove unused fields (err in PerparedMessage)
- Fix errors reported by golint and goword.
2018-08-24 14:03:26 -07:00
SALLEYRON Julien ceae45234a Add context in the Dialer 2018-08-24 13:45:12 -07:00
Steven Scott b378caee5b Add write buffer pooling
Add WriteBufferPool to Dialer and Upgrader. This field specifies a pool
to use for write operations on a connection.  Use of the pool can reduce
memory use when there is a modest write volume over a large number of
connections.

Use larger of hijacked buffer and buffer allocated for connection (if
any) as buffer for building handshake response. This decreases possible
allocations when building the handshake response.

Modify bufio reuse test to call Upgrade instead of the internal
newConnBRW. Move the test from conn_test.go to server_test.go because
it's a serer test.

Update newConn and newConnBRW:

- Move the bufio "hacks" from newConnBRW to separate functions and call
these functions directly from Upgrade.
- Rename newConn to newTestConn and move to conn_test.go. Shorten
argument list to common use case.
- Rename newConnBRW to newConn.
- Add pool code to newConn.
2018-08-22 14:11:59 -07:00
Adam Shannon 5fb94172f4 drop Go versions prior to 1.7 in CI
* drop Go versions prior to 1.7 in CI

* consolidate conn*.go files after dropping old Go support
2018-08-22 14:10:37 -07:00
stevenscott89 3ff3320c2a Improve server subprotocol documentation
Partial fix for 404.
2018-08-16 15:18:03 -07:00
Matt Silverlock 5ed622c449 Update LICENSE file to reflect Google employee contributions. 2018-06-05 13:25:52 -07:00
Kamil Kisiel c17c80cb48
Merge pull request #385 from dottyjones/master
Add test for handshake deadline
2018-05-28 18:35:52 -07:00
dottyjones badcf87185
Improve names in handshake deadline test 2018-05-28 12:07:56 -07:00
dottyjones f90b62c3ce
Add test for handshake deadline 2018-05-28 07:28:04 -07:00
misu e82d2a9ad7 mod: fmt 2018-04-23 11:29:20 +09:00
Gary Burd 21ab95fa12
Modify headers to match case used in RFC examples
Change the subprotocol and extension header names to match the case used
in RFC examples. Other headers names already match the case used in the
examples.

Although the headers names in the handshake are case insensitive, some
libraries expect the exact case used in the RFC examples. This change
allows the package to interoperate with those broken libraries.
2018-04-20 10:16:12 -07:00
misu b27407e5fd mod: no need to change line feed 2018-04-20 10:07:26 +09:00
misu cd973fdcfc mod: pointed out part 2018-04-20 09:55:11 +09:00
Petr cd94665a65 Minor fixes in comments
* Fix typo

"netowrk" is a misspelling of "network"

* Fix export comment

Comment on exported type Hub should be of the form "Hub ..." (golint)
2018-04-15 20:20:28 -07:00
misu 6caf089088 mod: examples/autobahn/server.go to pass build go 1.4, 1.5 2018-04-06 14:01:48 +09:00
misu 811803b3ed add: comment 2018-04-06 13:30:19 +09:00
misu 658a2fb894 temp: autobahn/server.go 2018-04-01 15:12:58 +09:00
Gary Burd eb92580837
Use net.Buffers to write multiple slices to connection
Closes #346.
2018-03-06 10:15:48 -08:00
Gary Burd 4835f71f2a Improve client default timeout code
- Remove duplicate code.
- Don't update deprecated functions.
2018-03-06 09:50:53 -08:00
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
misu 360a199e48 mod: doc.go 2018-03-05 18:37:27 +09:00
misu 1727e3467e resolve: conflict 2018-03-05 17:59:35 +09:00
misu af46d4fe1f mod: modification of review 2018-03-05 17:57:15 +09:00
Carter Jones 416a1d5b7b add newline and remove extra space 2018-03-05 13:03:15 +09:00
unknown c13439fe37 Modify http status code to variable 2018-03-05 13:03:15 +09:00
Gary Burd 3ab5e92ee8 Travis config: add Go 1.10.x, revert 1.4.x to 1.4
1.4.x is missing go vet
2018-03-05 13:03:15 +09:00
Alexey Palazhchenko 5241e533fa Use latest patch releases of Go 2018-03-05 13:03:15 +09:00
claudia-jones d0111e646e Simplify echo example client (#349)
Use existing `done` channel to signal that reader is done instead of closing the connection.
2018-03-05 13:03:15 +09:00
misu 7ce5144165 Merge branch 'master' of github.com:gorilla/websocket into upstream 2018-03-05 12:59:52 +09:00
misu 7fa60f84a1 mod: gitignore 2018-03-05 10:03:17 +09: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
misu f68770a434 mod: unnecessary format change 2018-02-09 10:16:19 +09:00