File tree Expand file tree Collapse file tree 8 files changed +30
-0
lines changed Expand file tree Collapse file tree 8 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ type Args struct {
39
39
args []argsKV
40
40
bufKV argsKV
41
41
buf []byte
42
+
43
+ noCopy
42
44
}
43
45
44
46
type argsKV struct {
Original file line number Diff line number Diff line change @@ -201,6 +201,8 @@ type Client struct {
201
201
mLock sync.Mutex
202
202
m map [string ]* HostClient
203
203
ms map [string ]* HostClient
204
+
205
+ noCopy
204
206
}
205
207
206
208
// Get appends url contents to dst and returns it as body.
@@ -511,6 +513,8 @@ type HostClient struct {
511
513
512
514
readerPool sync.Pool
513
515
writerPool sync.Pool
516
+
517
+ noCopy
514
518
}
515
519
516
520
type clientConn struct {
Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ type Cookie struct {
55
55
56
56
bufKV argsKV
57
57
buf []byte
58
+
59
+ noCopy
58
60
}
59
61
60
62
// CopyTo copies src cookie to c.
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ type ResponseHeader struct {
33
33
bufKV argsKV
34
34
35
35
cookies []argsKV
36
+
37
+ noCopy
36
38
}
37
39
38
40
// RequestHeader represents HTTP request header.
@@ -68,6 +70,8 @@ type RequestHeader struct {
68
70
cookies []argsKV
69
71
70
72
rawHeaders []byte
73
+
74
+ noCopy
71
75
}
72
76
73
77
// SetContentRange sets 'Content-Range: bytes startPos-endPos/contentLength'
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ type Request struct {
37
37
// Group bool members in order to reduce Request object size.
38
38
parsedURI bool
39
39
parsedPostArgs bool
40
+
41
+ noCopy
40
42
}
41
43
42
44
// Response represents HTTP response.
@@ -62,6 +64,8 @@ type Response struct {
62
64
// Response.Write() skips writing body if set to true.
63
65
// Use it for writing HEAD responses.
64
66
SkipBody bool
67
+
68
+ noCopy
65
69
}
66
70
67
71
// SetRequestURI sets RequestURI.
Original file line number Diff line number Diff line change
1
+ package fasthttp
2
+
3
+ // Embed this type into a struct, which mustn't be copied,
4
+ // so `go vet` gives a warning if this struct is copied.
5
+ //
6
+ // See https://github.com/golang/go/issues/8005#issuecomment-190753527 for details.
7
+ type noCopy struct {}
8
+ func (* noCopy ) Lock () {}
Original file line number Diff line number Diff line change @@ -270,6 +270,8 @@ type Server struct {
270
270
writerPool sync.Pool
271
271
hijackConnPool sync.Pool
272
272
bytePool sync.Pool
273
+
274
+ noCopy
273
275
}
274
276
275
277
// TimeoutHandler creates RequestHandler, which returns StatusRequestTimeout
@@ -374,6 +376,8 @@ type RequestCtx struct {
374
376
timeoutTimer * time.Timer
375
377
376
378
hijackHandler HijackHandler
379
+
380
+ noCopy
377
381
}
378
382
379
383
// HijackHandler must process the hijacked connection c.
Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ type URI struct {
50
50
requestURI []byte
51
51
52
52
h * RequestHeader
53
+
54
+ noCopy
53
55
}
54
56
55
57
// CopyTo copies uri contents to dst.
You can’t perform that action at this time.
0 commit comments