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 d34dd940eeb29b6f4d21d3ab9148893b4019afd1.

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

Co-authored-by: Chan Kang <>
2 files changed
tree: bd35e8dacd726a8df5133442d0bd3997d20c49da
  1. .circleci/
  2. .github/
  3. examples/
  4. .gitignore
  6. client.go
  7. client_server_test.go
  8. client_test.go
  9. compression.go
  10. compression_test.go
  11. conn.go
  12. conn_broadcast_test.go
  13. conn_test.go
  14. doc.go
  15. example_test.go
  16. go.mod
  17. go.sum
  18. join.go
  19. join_test.go
  20. json.go
  21. json_test.go
  23. mask.go
  24. mask_safe.go
  25. mask_test.go
  26. prepared.go
  27. prepared_test.go
  28. proxy.go
  30. server.go
  31. server_test.go
  32. tls_handshake.go
  33. tls_handshake_116.go
  34. util.go
  35. util_test.go
  36. x_net_proxy.go

Gorilla WebSocket

GoDoc CircleCI

Gorilla WebSocket is a Go implementation of the WebSocket protocol.

⚠️ The Gorilla WebSocket Package is looking for a new maintainer



The Gorilla WebSocket package provides a complete and tested implementation of the WebSocket protocol. The package API is stable.


go get

Protocol Compliance

The Gorilla WebSocket package passes the server tests in the Autobahn Test Suite using the application in the examples/autobahn subdirectory.