fix: ensure websocket close messages are truncated to 123 bytes (#779)

It's possible for websocket close messages to be too long, which cause
them to silently fail without a proper close message. See error below:

```
2022-03-31 17:08:34.862 [INFO]	(stdlib)	<close_notjs.go:72>	"2022/03/31 17:08:34 websocket: failed to marshal close frame: reason string max is 123 but got \"insert provisioner daemon:Cannot encode []database.ProvisionerType into oid 19098 - []database.ProvisionerType must implement Encoder or be converted to a string\" with length 161"
```
This commit is contained in:
Colin Adler
2022-04-01 13:17:45 -05:00
committed by GitHub
parent 4601a35c01
commit dc46ff407b
7 changed files with 52 additions and 12 deletions

View File

@ -4,16 +4,14 @@ import (
"context"
"path/filepath"
"github.com/cli/safeexec"
"github.com/hashicorp/go-version"
"github.com/hashicorp/hc-install/product"
"github.com/hashicorp/hc-install/releases"
"golang.org/x/xerrors"
"cdr.dev/slog"
"github.com/cli/safeexec"
"github.com/coder/coder/provisionersdk"
"github.com/hashicorp/hc-install/product"
"github.com/hashicorp/hc-install/releases"
)
var (