Skip to content

Commit 4961549

Browse files
committed
Merge branch 'main' of https://github.com/gorilla/websocket
2 parents 3ec86e8 + 666c197 commit 4961549

33 files changed

+507
-615
lines changed

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
; https://editorconfig.org/
2+
3+
root = true
4+
5+
[*]
6+
insert_final_newline = true
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
indent_style = space
10+
indent_size = 2
11+
12+
[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
13+
indent_style = tab
14+
indent_size = 4
15+
16+
[*.md]
17+
indent_size = 4
18+
trim_trailing_whitespace = false
19+
20+
eclint_indent_style = unset

.github/release-drafter.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/workflows/issues.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add issues or pull-requests created to the project.
2+
name: Add issue or pull request to Project
3+
4+
on:
5+
issues:
6+
types:
7+
- opened
8+
pull_request_target:
9+
types:
10+
- opened
11+
- reopened
12+
13+
jobs:
14+
add-to-project:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Add issue to project
18+
uses: actions/add-to-project@v0.5.0
19+
with:
20+
project-url: https://github.com/orgs/gorilla/projects/4
21+
github-token: ${{ secrets.ADD_TO_PROJECT_TOKEN }}

.github/workflows/test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,21 @@ jobs:
1616
- run: go get -t -v ./...
1717
- run: go vet $(go list ./... | grep -v /vendor/)
1818
- run: go test -v -cover -race ./...
19+
20+
- name: Run GolangCI-Lint
21+
uses: golangci/golangci-lint-action@v3
22+
with:
23+
version: v1.53
24+
args: --timeout=5m
25+
26+
- name: Run GoSec
27+
if: matrix.os == 'ubuntu-latest'
28+
uses: securego/gosec@master
29+
with:
30+
args: -exclude-dir examples ./...
31+
32+
- name: Run GoVulnCheck
33+
uses: golang/govulncheck-action@v1
34+
with:
35+
go-version-input: ${{ matrix.go-version }}
36+
go-package: ./...

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
run:
2+
skip-dirs:
3+
- examples/*.go

AUTHORS

Lines changed: 0 additions & 9 deletions
This file was deleted.

LICENSE

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved.
1+
Copyright (c) 2023 The Gorilla Authors. All rights reserved.
22

33
Redistribution and use in source and binary forms, with or without
4-
modification, are permitted provided that the following conditions are met:
4+
modification, are permitted provided that the following conditions are
5+
met:
56

6-
Redistributions of source code must retain the above copyright notice, this
7-
list of conditions and the following disclaimer.
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following disclaimer
11+
in the documentation and/or other materials provided with the
12+
distribution.
13+
* Neither the name of Google Inc. nor the names of its
14+
contributors may be used to endorse or promote products derived from
15+
this software without specific prior written permission.
816

9-
Redistributions in binary form must reproduce the above copyright notice,
10-
this list of conditions and the following disclaimer in the documentation
11-
and/or other materials provided with the distribution.
12-
13-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2227
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '')
2+
GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest
3+
4+
GO_SEC=$(shell which gosec 2> /dev/null || echo '')
5+
GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest
6+
7+
GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '')
8+
GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest
9+
10+
.PHONY: golangci-lint
11+
golangci-lint:
12+
$(if $(GO_LINT), ,go install $(GO_LINT_URI))
13+
@echo "##### Running golangci-lint"
14+
golangci-lint run -v
15+
16+
.PHONY: gosec
17+
gosec:
18+
$(if $(GO_SEC), ,go install $(GO_SEC_URI))
19+
@echo "##### Running gosec"
20+
gosec -exclude-dir examples ./...
21+
22+
.PHONY: govulncheck
23+
govulncheck:
24+
$(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI))
25+
@echo "##### Running govulncheck"
26+
govulncheck ./...
27+
28+
.PHONY: verify
29+
verify: golangci-lint gosec govulncheck
30+
31+
.PHONY: test
32+
test:
33+
@echo "##### Running tests"
34+
go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./...

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
[![GoDev](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white)](https://pkg.go.dev/github.com/fasthttp/websocket)
66
[![GitHub release](https://img.shields.io/github/release/fasthttp/websocket.svg)](https://github.com/fasthttp/websocket/releases)
77

8-
WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket protocol](http://www.rfc-editor.org/rfc/rfc6455.txt) for [fasthttp](https://github.com/valyala/fasthttp).
8+
WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) for [fasthttp](https://github.com/valyala/fasthttp).
9+
10+
![Gorilla Logo](https://github.com/gorilla/.github/assets/53367916/d92caabf-98e0-473e-bfbf-ab554ba435e5)
911

1012
_This project is a fork of the latest version of [gorilla/websocket](https://github.com/gorilla/websocket) that continues its development independently._
1113

@@ -16,6 +18,7 @@ _This project is a fork of the latest version of [gorilla/websocket](https://git
1618
* [Command example](_examples/command)
1719
* [Client and server example](_examples/echo)
1820
* [File watch example](_examples/filewatch)
21+
* [Write buffer pool example](_examples/bufferpool)
1922

2023
### Status
2124

@@ -33,5 +36,5 @@ But beware that this will fetch the **latest commit of the master branch** which
3336
### Protocol Compliance
3437

3538
The WebSocket package passes the server tests in the [Autobahn Test
36-
Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn
39+
Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [_examples/autobahn
3740
subdirectory](_examples/autobahn).

_examples/autobahn/server.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ func main() {
178178
http.HandleFunc("/r", echoReadAllWriter)
179179
http.HandleFunc("/m", echoReadAllWriteMessage)
180180
http.HandleFunc("/p", echoReadAllWritePreparedMessage)
181-
err := http.ListenAndServe(*addr, nil)
181+
server := &http.Server{
182+
Addr: *addr,
183+
ReadHeaderTimeout: 3 * time.Second,
184+
}
185+
err := server.ListenAndServe()
182186
if err != nil {
183187
log.Fatal("ListenAndServe: ", err)
184188
}

0 commit comments

Comments
 (0)