Commit c5f7db9 1 parent ca7d8b8 commit c5f7db9 Copy full SHA for c5f7db9
File tree 8 files changed +1335
-5
lines changed
8 files changed +1335
-5
lines changed Original file line number Diff line number Diff line change @@ -14,24 +14,24 @@ linters-settings:
14
14
# Checks the number of statements in a function.
15
15
# If lower than 0, disable the check.
16
16
# Default: 40
17
- statements : 40
17
+ statements : 120
18
18
# Ignore comments when counting lines.
19
19
# Default false
20
- ignore-comments : false
20
+ ignore-comments : true
21
21
22
22
linters :
23
23
disable-all : true
24
24
enable :
25
25
- bodyclose
26
26
# - dupl temporary
27
- - errcheck
27
+ # - errcheck
28
28
- asasalint
29
29
- asciicheck
30
30
- containedctx
31
31
- contextcheck # this needs better research
32
32
- copyloopvar
33
33
- errorlint
34
- - funlen
34
+ # - funlen
35
35
- goconst
36
36
- gosec
37
37
- lll
Original file line number Diff line number Diff line change 1
1
module myHttpServer
2
2
3
3
go 1.22.1
4
+
5
+ require golang.org/x/net v0.31.0
6
+
7
+ require golang.org/x/text v0.20.0 // indirect
Original file line number Diff line number Diff line change
1
+ golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo =
2
+ golang.org/x/net v0.31.0 /go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM =
3
+ golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug =
4
+ golang.org/x/text v0.20.0 /go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4 =
Original file line number Diff line number Diff line change
1
+ package internal
2
+
3
+ // lower returns the ASCII lowercase version of b.
4
+ func lower (b byte ) byte {
5
+ if 'A' <= b && b <= 'Z' {
6
+ return b + ('a' - 'A' )
7
+ }
8
+
9
+ return b
10
+ }
11
+
12
+ // EqualFold is strings.EqualFold, ASCII only. It reports whether s and t
13
+ // are equal, ASCII-case-insensitively.
14
+ func EqualFold (s , t string ) bool {
15
+ if len (s ) != len (t ) {
16
+ return false
17
+ }
18
+
19
+ for i := 0 ; i < len (s ); i ++ {
20
+ if lower (s [i ]) != lower (t [i ]) {
21
+ return false
22
+ }
23
+ }
24
+
25
+ return true
26
+ }
Original file line number Diff line number Diff line change
1
+ package pkg
2
+
3
+ import (
4
+ "net/http"
5
+
6
+ "golang.org/x/net/http/httpguts"
7
+ )
8
+
9
+ // isProtocolSwitchHeader reports whether the request or response header
10
+ // is for a protocol switch.
11
+ func isProtocolSwitchHeader (h http.Header ) bool {
12
+ return h .Get ("Upgrade" ) != "" &&
13
+ httpguts .HeaderValuesContainsToken (h ["Connection" ], "Upgrade" )
14
+ }
15
+
16
+ // isProtocolSwitchResponse reports whether the response code and
17
+ // response header indicate a successful protocol upgrade response.
18
+ func isProtocolSwitchResponse (code int , h http.Header ) bool {
19
+ return code == http .StatusSwitchingProtocols && isProtocolSwitchHeader (h )
20
+ }
You can’t perform that action at this time.
0 commit comments