Commit Graph

324 Commits

Author SHA1 Message Date
Corey Daley 4d0a40247b
Merge branch 'main' into tls-proxy 2023-07-30 14:22:40 -04:00
Corey Daley 8983b96324
Merge pull request #839 from gorilla/coreydaley-patch-1
Update README.md
2023-07-15 16:04:06 -04:00
Corey Daley 931041c5ee
Update README.md
Signed-off-by: Corey Daley <cdaley@redhat.com>
2023-07-15 10:54:14 -04:00
Matt Silverlock 76ecc29eff
archive mode 2022-12-09 11:03:16 -05:00
Ye Sijun af47554f34 check error before GotConn for trace
Signed-off-by: Ye Sijun <junnplus@gmail.com>
2022-07-12 08:37:30 -07:00
Chan Kang bc7ce893c3
Check for and report bad protocol in TLSClientConfig.NextProtos (#788)
* return an error when Dialer.TLSClientConfig.NextProtos contains a protocol that is not http/1.1

* include the likely cause of the error in the error message

* check for nil-ness of Dialer.TLSClientConfig before attempting to run the check

* addressing the review

* move the NextProtos test into a separate file so that it can be run conditionally on go versions >= 1.14

* moving the new error check into existing http response error block to reduce the possibility of false positives

* wrapping the error in %w

* using %v instead of %w for compatibility with older versions of go

* Revert "using %v instead of %w for compatibility with older versions of go"

This reverts commit d34dd940ee.

* move the unit test back into the existing test code since golang build constraint is no longer necessary

Co-authored-by: Chan Kang <chankang@chankang17@gmail.com>
2022-06-21 10:54:14 -07:00
Chan Kang 27d91a9be5 drop the versions of go that are no longer supported + add 1.18 to ci 2022-06-20 16:42:42 -07:00
JWSong 78cf1bc733
Changed the method name UnderlyingConn to NetConn to align the methods names with Go 1.18 standard library (#773) 2022-04-17 06:01:17 -07:00
Philip Hamer 444f3c080f
gofmt 2022-02-17 13:00:00 -05:00
Philip Hamer 9fb72e3db2
Merge branch 'master' into tls-proxy-build 2022-02-17 12:51:27 -05:00
Yuki Hirasawa 69d0eb9187
Add check for Sec-WebSocket-Key header (#752)
* add Sec-WebSocket-Key header verification

* add testcase to Sec-WebSocket-Key header verification
2022-02-15 17:15:20 -08:00
Lluis Campos 9111bb834a
Dialer: add optional method NetDialTLSContext (#746)
Fixes issue: https://github.com/gorilla/websocket/issues/745

With the previous interface, NetDial and NetDialContext were used for
both TLS and non-TLS TCP connections, and afterwards TLSClientConfig was
used to do the TLS handshake.

While this API works for most cases, it prevents from using more advance
authentication methods during the TLS handshake, as this is out of the
control of the user.

This commits introduces another a new dial method, NetDialTLSContext,
which is used when dialing for TLS/TCP. The code then assumes that the
handshake is done there and TLSClientConfig is not used.

This API change is fully backwards compatible and it better aligns with
net/http.Transport API, which has these two dial flavors. See:
https://pkg.go.dev/net/http#Transport

Signed-off-by: Lluis Campos <lluis.campos@northern.tech>
2022-01-03 17:59:52 -08:00
Gary Burd 2f25f7843d
Update README (#757)
- Note that a new maintainer is needed.
- Remove comparison with x/net/websocket. There's no need to describe
  the issues with that package now that the package's documentation
  points people here and elsewhere.
2022-01-03 17:49:10 -08:00
Gary Burd 4fad403619
Remove support for Go 1.8 2022-01-02 15:53:55 -08:00
Gary Burd f0643a3a18
Improve protocol error messages
To aid protocol error debugging, report all errors found in the first two bytes of a message header.
2022-01-02 12:16:08 -08:00
Gary Burd 2d6ee4c55c
Update autobahn example
- Update instructions to use docker.
- Cleanup config file.
2022-01-02 11:21:21 -08:00
Alexander Emelin beca1d3940
Fix broadcast benchmarks (#542)
* do not use cached PreparedMessage in broadcast benchmarks

* pick better name for benchmark method
2022-01-02 07:35:34 -08:00
Gary Burd bcef8431c9
Use context.Context in TLS handshake (#751)
Continued work on #730.
2022-01-01 08:43:22 -08:00
Rn 2c89656910
Modify http Method String Literal to Variable (#728) 2021-12-19 11:21:45 -05:00
Gary Burd 1905f7e442
Update source to match output from gofmt 1.17 2021-12-17 22:48:51 -05:00
Gary Burd b4b5d887ad
Document the allowed concurrency on Upgrader and Dialer (#636)
* Document allowed concurrency on Dialer.
* Document allowed concurrency on Upgrader.
2021-12-16 11:07:50 -08:00
Philip Hamer bb146cd3fd
fix build error 2021-12-06 18:52:57 -05:00
Philip Hamer b484a6e5a0
try compatibility with pre 1.15 as noop 2021-12-06 18:49:39 -05:00
Philip Hamer d16969baa1
add unit test for https proxy 2021-12-06 10:29:48 -05:00
Philip Hamer 2553869a29
clean up comment 2021-12-06 09:30:42 -05:00
Philip Hamer f724bd6a6c
do not edit the generated x_net_proxy.go 2021-12-03 15:59:00 -05:00
Philip Hamer 7f3a5bcae0
make it more intuitive for tls proxy 2021-11-29 14:49:47 -05:00
Philip Hamer 2a082eee69
simplify proxying with tls proxy 2021-11-29 14:19:00 -05:00
Philip Hamer d229c9f93d
try https proxy 2021-11-16 23:26:29 -05:00
hellflame e8629af678
improve echo example (#671) 2021-04-24 09:20:22 -07:00
Matt Silverlock c3dd95aea9
build: use build matrix; drop Go <= 1.10 (#629) 2020-09-12 12:32:13 -07:00
Matt Silverlock 78ab81e242
docs: clarify that sub protocols are not set via responseHeader arg. 2020-08-22 14:03:32 -07:00
Ran Benita 873e67e4d5
Fix how the client checks for presence of Upgrade: websocket, Connection: upgrade (#604)
The values of the `Upgrade` and `Connection` response headers can
contain multiple tokens, for example

    Connection: upgrade, keep-alive

The WebSocket RFC describes the checking of these as follows:

   2.  If the response lacks an |Upgrade| header field or the |Upgrade|
       header field contains a value that is not an ASCII case-
       insensitive match for the value "websocket", the client MUST
       _Fail the WebSocket Connection_.

   3.  If the response lacks a |Connection| header field or the
       |Connection| header field doesn't contain a token that is an
       ASCII case-insensitive match for the value "Upgrade", the client
       MUST _Fail the WebSocket Connection_.

It is careful to note "contains a value", "contains a token".

Previously, the client would reject with "bad handshake" if the header
doesn't contain exactly the value it looks for.

Change the checks to use `tokenListContainsValue` instead, which is
incidentally what the server is already doing for similar checks.
2020-08-20 06:43:18 -07:00
Matt Silverlock b65e62901f
build: clean up go.sum (#584) 2020-03-19 10:50:51 -07:00
Jon Gillham 8c288dca3e
docs: Fix typo. (#568) 2020-03-19 10:45:00 -07:00
Maxim Fominykh d11356942f
Duration order consistency when multiplying number by time unit (#570) 2020-03-19 07:01:23 -07:00
Sry Back I 81cef7da56
echo example: handle received messages as text, not HTML (#563) 2020-03-19 06:53:02 -07:00
ferhat elmas 015e196e21
Use empty struct to protect writing (#566)
Using empty struct for signaling is more idiomatic
compared to booleans because users might wonder
what happens on false or true. Empty struct removes
this problem.

There is also a side benefit of occupying less memory
but it should be negligible in this case.
2020-03-19 06:52:00 -07:00
Rubi e90f6db575
input autofocus (#564) 2020-03-19 06:50:48 -07:00
John Johnson III 0a093fcde5
Fix a couple of small typo's (#567)
Fixes a couple of small typo's in the example test docs.
2020-03-19 06:49:51 -07:00
Dave Baker ed9368d0b7
typo (#583) 2020-03-19 06:46:44 -07:00
prophecy 836e821143
Changed the link of API references to pkg.go.dev (#577) 2020-03-19 06:46:16 -07:00
Matt Silverlock c3e18be99d
Create release-drafter.yml (#538) 2019-08-24 18:20:11 -07:00
Matt Silverlock 5b740c2926
Read Limit Fix (#537)
This fix addresses a potential denial-of-service (DoS) vector that can cause an integer overflow in the presence of malicious WebSocket frames.

The fix adds additional checks against the remaining bytes on a connection, as well as a test to prevent regression.

Credit to Max Justicz (https://justi.cz/) for discovering and reporting this, as well as providing a robust PoC and review.

* build: go.mod to go1.12
* bugfix: fix DoS vector caused by readLimit bypass
* test: update TestReadLimit sub-test
* bugfix: payload length 127 should read bytes as uint64
* bugfix: defend against readLength overflows
2019-08-24 18:17:28 -07:00
xiaobogaga 7e9819d926 fix typos (#532) 2019-08-23 06:05:46 -07:00
Matt Silverlock ae1634f6a9
Create CircleCI config.yml (#519)
* Create config.yml
* Delete .travis.yml
* Added CircleCI badge to README
* Add golint; run on latest only
2019-06-29 11:55:28 -07:00
Jürgen Etzlstorfer 80c2d40e9b fix autobahn test suite link (#503) 2019-04-26 23:03:06 -05:00
Tariq Ibrahim 6a67f44b69 remove redundant err!=nil check in conn.go Close method (#505) 2019-04-26 23:02:11 -05:00
Gary Burd 0ec3d1bd7f
Fix typo 2019-03-05 16:42:57 -08:00
Steven Scott 856ca61301 Add buffer commentary 2019-03-05 16:15:07 -08:00