Commit Graph

54 Commits

Author SHA1 Message Date
Erik Dubbelboer c2b317d47d Go 1.26 and golangci-lint updates (#2146)
Keep Go 1.24 compatibility for now (by not using `wg.Go()`).
2026-02-21 10:28:39 +01:00
Kashiwa ed2d390623 fix: incorrect handling of negative cookie.maxAge #1900 (#1902) 2024-11-15 12:53:08 +08:00
Kashiwa 318e68ece3 Reduce the size of the Cookie by 32 bytes. (#1866)
Replace the field `bufKV` with two `[]byte` fields and remove the filed `buf`.

- Reduce Cookie from **224** to **192** bytes.
- In the benchmark tests, although there is no significant performance improvement, it theoretically reduces memory usage by **14.3%**.
2024-09-21 16:19:53 +02:00
Juan Calderon-Perez 1fb3453165 Use Named Fields and Align Structures to Reduce Memory Usage (#1814)
* Use Named fields and Align Structures to Reduce Memory Usage

* Remove extra spaces
2024-08-02 22:26:52 +02:00
Kashiwa 86c7e844f4 Optimize struct field order to reduce memory usage (#1809)
1. Reduce RequestHeader from 368 bytes to 360 bytes
2. Reduce Request from 816 bytes to 800 bytes
3. Reduce Response from 432 bytes to 416 bytes
4. Reduce Client from 312 bytes to 288 bytes
5. Reduce HostClient from 416 bytes to 392 bytes
6. Reduce PipelineClient from 176 bytes to 168 bytes
7. Reduce pipelineConnClient from 216 bytes to 208 bytes
8. Reduce Cookie from 232 bytes to 224 bytes
9. Reduce FS from 184 bytes to 160 bytes
10. Reduce fsHandler from 168 bytes to 160 bytes
11. Reduce ResponseHeader from 328 bytes to 320 bytes
12. Reduce headerScanner from 128 bytes to 120 bytes
13. Reduce TCPDialer from 104 bytes to 96 bytes
14. Reduce workerPool from 152 btyes to 144 btyes
2024-07-20 19:20:26 +02:00
Gürkan Yeşilyurt a77e9c6b79 add support for CHIPS (Cookies Having Independent Partitioned State) (#1752)
* add support for CHIPS (Cookies Having Independent Partitioned State)

* fix comment lines

* Update cookie.go fix lint error: should omit comparison to bool constant
2024-04-08 18:23:23 +02:00
Oleksandr Redko 9d6b470260 chore: Add missing dots at the end of comments (#1677) 2023-12-13 13:56:24 +08:00
Oleksandr Redko f196617f55 chore: Use 'any' instead of 'interface{}' (#1666)
gofmt -w -r "interface{} -> any" -l .
2023-11-24 11:33:04 +01:00
Oleksandr Redko ffdf59d04c Enable gofumpt linter; format code gofumpt -w . (#1576) 2023-06-13 15:18:59 +02:00
Oleksandr Redko 934f04e330 Refactor golangci-lint config and remove redundant nolints (#1486)
* Refactor golangci-lint config

- Use golangci-lint-action for GitHub workflow.
- Add additional golangci-lint run options.
- Remove unused nolint directives.

* Revert exclude-use-default option
2023-02-11 15:35:15 +08:00
Erik Dubbelboer ffab77a59d Improve return value reusability documentation 2021-10-01 13:38:31 +02:00
tyltr 1647255ec9 remove unnecessary op (#1095) 2021-09-07 09:40:13 +02:00
Erik Dubbelboer a18c6322a2 Fix cookie panic 2021-05-21 12:11:09 +02:00
Erik Dubbelboer 32793db72d Run golangci-lint using a Github Action 2019-11-16 18:09:28 +01:00
Rem 9ba4cef1ba Support SameSite value "None" cookie attribute (#581)
* Support SameSite value "None" cookie attribute

* Fix typo in CookieSameSiteNoneMode comment

* fix comment for SameSite None
2019-06-14 16:07:33 +02:00
xuecai 10b98c2cdf add conn's address info in Response (#537)
* reset commit
* fix response copy bug; add tests;
2019-02-16 10:50:14 +00:00
Matt Reyer 62dcd6fdce Support SameSite cookie attribute (#488)
SameSite cookie attribute implementation.
2018-12-13 21:34:49 +06:30
David Byttow dbc9965d33 Adds support for max-age cookie value. Fixes #184 (#412)
Adds support for max-age cookie value
2018-09-13 12:19:38 +08:00
Erik Dubbelboer 7796335d5f Do case insensitive comparisons for headers and cookies 2018-09-11 20:07:09 +03:00
Erik Dubbelboer 373357d2d4 Try the same formats as net/http for cookie expire
See: https://github.com/golang/go/blob/00379be17e63a5b75b3237819392d2dc3b313a27/src/net/http/cookie.go#L133-L135

Fixes #175
2018-08-29 22:55:21 +08:00
Erik Dubbelboer e277e51b15 Add support for ResponseHeader.Peek("Set-Cookie")
See: https://github.com/erikdubbelboer/fasthttp/issues/4
2018-08-27 21:42:16 +00:00
Aliaksandr Valialkin 45697fe30a Issue #141: do not urlencode cookies
https://tools.ietf.org/html/rfc6265 says nothing about cookies encoding.
2016-07-18 18:25:03 +03:00
Aliaksandr Valialkin 0d43464f64 Renamed unsafeBytes2Str to b2s 2016-03-29 16:26:21 +03:00
Aliaksandr Valialkin 1498d8174e Issue #73: added 'HttpOnly' and 'secure' flags support to Cookie 2016-03-29 16:12:59 +03:00
Aliaksandr Valialkin e0eac18652 use 'switch string(key) {}' instead of 'switch { case bytes.Equal(key, ...) ... }'. This may improve switch statement's performance 2016-03-10 17:44:58 +02:00
Aliaksandr Valialkin 8280b7a162 Moved empty noCopy struct to the top of container structs. See @stemar94 's comment at https://github.com/golang/go/issues/12884 for details 2016-03-06 00:17:08 +02:00
Aliaksandr Valialkin 9f43aa1601 Do not expose noCopy.Lock 2016-03-04 21:20:52 +02:00
Aliaksandr Valialkin 9fa69c74af Embed noCopy struct into structs, which mustn't be copied
This should help `go vet` detecting invalid structs' copyings.
See https://github.com/golang/go/issues/8005#issuecomment-190753527 for details.
2016-03-04 16:57:24 +02:00
Aliaksandr Valialkin 6489c32a90 Added AcquireCookie / ReleaseCookie helpers 2016-02-19 13:03:35 +02:00
Aliaksandr Valialkin fd2887a5fc Issue #53: Clarify that the following instances mustn't be used from concurrently running goroutines: Args, Cookie, URI, RequestCtx, Request, Response, RequestHeader and ResponseHeader 2016-02-17 11:45:21 +02:00
Aliaksandr Valialkin 52ddf98cfd Fixed golint warnings 2016-01-19 12:43:23 +02:00
Aliaksandr Valialkin 485098e5dc Exported AppendQuotedArg 2016-01-13 18:17:03 +02:00
Aliaksandr Valialkin 4bca54c0bb Issue #29: use time.UTC instead of time.LoadLocation, since this call may fail on systems without certain config files 2016-01-04 15:55:30 +02:00
MK a8ab4c12c7 fix typo in comment 2015-12-31 17:34:29 +02:00
Aliaksandr Valialkin 5ff6be8fee Substitute AppendBytesStr by append() 2015-12-19 20:38:10 +02:00
Aliaksandr Valialkin ddfa9f5dc0 Clarify Append* return values 2015-12-19 20:29:17 +02:00
Aliaksandr Valialkin 4ac44f0c6c Mention which structs are safe for use from concurrently running goroutines (Server, Client and HostClient) and which structs are unsafe to use from concurrently running goroutines - all the other 2015-12-03 13:38:59 +02:00
Aliaksandr Valialkin 29b732217a Added CopyTo to Cookie for the sake of API consistency 2015-11-29 12:15:14 +02:00
Aliaksandr Valialkin 9f7463cd28 Access Cookie members via accessors 2015-11-22 13:29:21 +02:00
Aliaksandr Valialkin a862d8592a Documentation update 2015-11-22 06:33:58 +02:00
Aliaksandr Valialkin 924d119e96 Added Cookie.WriteTo 2015-11-22 01:32:39 +02:00
Aliaksandr Valialkin 48c0f89ee7 Added Stringer implementations to URI, Args and Cookie 2015-11-19 12:51:34 +02:00
Aliaksandr Valialkin 835bf87605 API consistency: Clear -> Reset to be consistent with standard go packages 2015-11-18 17:55:28 +02:00
Aliaksandr Valialkin 9735e0127b Exported ParseUint, ParseUfloat and AppendHTTPDate, which may be frequently used in http apps 2015-11-11 11:00:22 +02:00
Aliaksandr Valialkin f1ff68f9f1 Optimized args, cookies and headers parsing 2015-11-05 14:28:07 +02:00
Aliaksandr Valialkin 227b0a4bd3 Trim input buffer inside decodeArg 2015-11-05 13:10:56 +02:00
Aliaksandr Valialkin bb73a5cbfa Trim dst buffer inside decodeCookieArg. This simplifies the code 2015-11-05 12:55:43 +02:00
Aliaksandr Valialkin 236d4bd461 Added Cookie.ParseBytes to be consistent with Args 2015-11-05 12:54:10 +02:00
Aliaksandr Valialkin 6fb8b96152 Increased cookies' parsing performance 2015-11-05 12:47:30 +02:00
Aliaksandr Valialkin dfec0d9d36 Eliminated redundant memory allocation during cookie expiration time parsing 2015-11-05 12:12:15 +02:00