aboutsummaryrefslogtreecommitdiff
path: root/server_test.go
AgeCommit message (Collapse)AuthorFilesLines
2024-03-28test: remove redundant error check (#1741)Gravatar Oleksandr Redko 1-2/+2
2024-02-21Upgrade golangci-lint to v1.56.2; fix gocritic issues (#1722)Gravatar Oleksandr Redko 1-3/+3
2024-02-10Implement `GetRejectedConnectionsCount` function (#1704)Gravatar mopeneko 1-0/+56
* Implement `GetRejectedConnectionsCount` * Implement test for `GetRejectedConnectionsCount`
2023-12-13chore: Add missing dots at the end of comments (#1677)Gravatar Oleksandr Redko 1-1/+1
2023-11-24chore: Use 'any' instead of 'interface{}' (#1666)Gravatar Oleksandr Redko 1-2/+2
gofmt -w -r "interface{} -> any" -l .
2023-11-24Enable wastedassign, whitespace linters; fix issues (#1665)Gravatar Oleksandr Redko 1-1/+0
2023-08-30docs: fix typos in comments and testsGravatar Oleksandr Redko 1-3/+3
2023-07-02Auto add 'Vary' header after compression (#1585)Gravatar AutumnSun 1-0/+141
* Auto add 'Vary' header after compression Add config `SetAddVaryHeaderForCompression` to enable 'Vary: Accept-Encoding' header when compression is used. * feat: always set the Vary header * create and use `ResponseHeader.AddVaryBytes` * not export 'AddVaryBytes'
2023-06-13Enable gofumpt linter; format code `gofumpt -w .` (#1576)v1.48.0Gravatar Oleksandr Redko 1-2/+5
2023-05-23Don't run test that times out often in parallelGravatar Erik Dubbelboer 1-2/+0
2023-05-07Fix tests (#1552)Gravatar Erik Dubbelboer 1-9/+10
2023-04-28test: refactor to use WriteString (#1546)v1.47.0Gravatar Oleksandr Redko 1-2/+2
2023-03-06test: fix typos in function, error message, comment (#1512)Gravatar Oleksandr Redko 1-4/+4
2023-03-06test: use Fprintf to simplify writing headers (#1510)Gravatar Oleksandr Redko 1-3/+3
2023-02-11docs: replace links to golang.org with go.dev (#1489)Gravatar Oleksandr Redko 1-3/+3
- Replace https://godoc.org with https://pkg.go.dev. - Replace https://golang.org with https://go.dev. - Replace https://golang.org/pkg with https://pkg.go.dev. - Replace https://blog.golang.org with https://go.dev/blog. - Use https://pkg.go.dev/golang.org/x/net/http2 instead of non-existing https://http2.golang.org/. - Remove trailing slashes.
2023-02-10Rename unexported funcs, vars to match common Go (#1488)Gravatar Oleksandr Redko 1-1/+1
See https://github.com/golang/go/wiki/CodeReviewComments#initialisms and https://go.dev/doc/effective_go#mixed-caps
2023-02-09doc,test: correct typos (#1484)Gravatar Oleksandr Redko 1-33/+33
2023-01-06server.go Simplify default Server name logic (#1467)Gravatar Sergey Ponomarev 1-2/+2
The serverName atomic.Value field is used as a cache. This is not needed and logic can be simplified. See related #1458
2022-12-25feat: support custom formvalue function (#1453)Gravatar kinggo 1-0/+36
2022-11-20feat: add ShutdownWithContext (#1383)v1.42.0Gravatar kinggo 1-0/+52
2022-10-06make RequestCtx's userdata accept keys that are of type: interface{} (#1387)Gravatar pj 1-1/+1
Co-authored-by: rocketlaunchr-cto <rocketlaunchr.cloud@gmail.com>
2022-09-15Deprecate Go 1.15 (#1379)Gravatar Aoang 1-27/+24
* Dropping support for 1.15. * Replaces Go 1.16 Deprecated functions * Update test build flag * Fix import sort and comment * Update github.com/klauspost/compress to v1.15.9 https://github.com/klauspost/compress improved performance and changed Minimum version is 1.16, this should be the final supported release for Go 1.16 (https://github.com/klauspost/compress/commit/6d0019a95afa3221f7522d1f2eed0033b5e79470) .
2022-07-29Improve Client timeout (#1346)Gravatar Erik Dubbelboer 1-4/+5
Don't run requests in a separate Goroutine anymore. Instead use proper conn deadlines to enforce timeouts. - Also contains some linting fixes.
2022-06-05Response.ContentEncoding(): store as field and avoid using ↵Gravatar Sergey Ponomarev 1-6/+6
Header.SetCanonical() (#1311) * Response.ContentEncoding(): store as field The CE is not so often used for plain APIs responses and even not so often used for static files and on the fly compression. But still it should be checked each time. Also having a dedicated field getter and setter simplifies code * header.go Use shorter Response.setNonSpecial() and Request.setNonSpecial() methods instead of SetCanonical() The change should improve performance because the setSpecialHeader() call is omitted. As a downside on adding a new basic header field all putHeader() must be replaced with a direct getter and setter.
2022-04-01Use %v for errors and %q for strings (#1262)v1.35.0Gravatar Erik Dubbelboer 1-235/+235
Mostly in tests.
2022-03-04Fix windows tests (#1235)Gravatar Erik Dubbelboer 1-4/+8
* Fix windows tests Just ignore /../ tests on windows until we have proper suppor. * Remove useless test code This code was basically just testing if tcp works. To test if SO_REUSEPORT works we only have to try to listen on the same addr:port twice. * Fix test
2022-01-22fix(hijack): reuse RequestCtx (#1201)Gravatar Sergio VS 1-51/+169
* fix(hijack): reuse RequestCtx * fix(test/hijack): increase wait time * fix(test/hijack): wait for all connections to finish to check responses
2022-01-18fix(hijack): reset userValues after hijack handler execution (#1199)Gravatar Sergio VS 1-0/+31
* fix(hijack): reset userValues after hijack handler execution * feat: add test * fix: typo * fix(test): race condition
2022-01-10Make tests less flaky (#1189)v1.32.0Gravatar Erik Dubbelboer 1-1/+1
2021-12-16fix: reset response after reset user values on keep-alive connections (#1176)Gravatar Sergio VS 1-2/+12
2021-12-05Add trailer support (#1165)Gravatar ichx 1-1/+62
* Add trailer support * fix issue and add documentation * remove redundant code * add error return for add/set trailer method * fix lint error * fix bad trailer error return issue and update bad content-length error * update errNonNumericChars * update errNonNumericChars * fix issue about error and fix typo
2021-11-23fix: reset request after reset user values on keep-alive connections (#1162)Gravatar Sergio VS 1-0/+46
* fix: reset request after reset user values on keep-alive connections * test: add test for reset request after reset user values
2021-11-13feat: close idle connections when server shutdown (#1155)Gravatar ichx 1-0/+41
* feat: close idle connections when server shutdown * Fix redundant code * Update test * Update test
2021-11-08uri: isHttps() and isHttp() (#1150)Gravatar Sergey Ponomarev 1-3/+2
* uri: isHttps() and isHttp() Use them instead of manual schema comparison * uri: use SetSchemeBytes()
2021-10-31Don't run all race tests on windows (#1143)Gravatar Erik Dubbelboer 1-0/+2
* Don't run all race tests on windows It's too slow and gives a lot of false positives in our tests. * No FS tests on windows
2021-08-28Various deadline fixes (#1081)Gravatar Erik Dubbelboer 1-0/+4
2021-08-28Fix various Windows Github Action errors (#1082)Gravatar Erik Dubbelboer 1-282/+53
* Fix various Windows Github Action errors These tests keep giving errors because Windows Actions are slower. * Remove some timeouts We don't need timeouts in all tests, only in the ones where we are actually testing timeout logic.
2021-08-24Increase various test timeoutsGravatar Erik Dubbelboer 1-1/+1
Github workers on windows are slow.
2021-08-18Add Go 1.17 support (#1074)Gravatar Erik Dubbelboer 1-3/+3
* Add Go 1.17 support * Increase test timeouts
2021-08-04Handle perIPConn in RequestCtx.IsTLS() specially (#1064)Gravatar Tianyi Song 1-0/+5
2021-07-01Add ResetUserValues() and test (#1056)Gravatar Sujit Baniya 1-0/+9
2021-06-28Flush buffered responses if we have to wait for the next request (#1050)Gravatar Erik Dubbelboer 1-0/+149
* Flush buffered responses if we have to wait for the next request Don't wait for the next request as this can take some time, instead flush the outstanding responses already. Fixes #1043 * Only peek 1 byte Make sure old clients that send bogus \r\n still work. See: https://github.com/golang/go/commit/bf5e19fbaf02b1b25fbe50c27ec301fe830a28d0
2021-06-18Increase TestServerTLSReadTimeout timeoutGravatar Erik Dubbelboer 1-2/+2
And TestFSCompressConcurrent timeout
2021-06-18Fix race condition in TestPipelineClientIssue832Gravatar Erik Dubbelboer 1-1/+1
2021-06-18Lower go test timeGravatar Erik Dubbelboer 1-1/+13
2021-06-18fix: set content-length properly when StreanRequestBody was enabled (#1049)Gravatar Meng 1-1/+41
* fix: set content-length properly when StreanRequestBody was enabled * fix: add test cases for validating content length of streaming request
2021-04-23Add option for middleware to set custom remote address (#1009)v1.24.0Gravatar Lauris BH 1-0/+50
* Add option for middleware to set custom remote address * Update Init2 to clear custom context remoteAddr
2021-02-16Streaming fixes (#970)v1.21.0Gravatar Erik Dubbelboer 1-83/+100
- Allow DisablePreParseMultipartForm in combination with StreamRequestBody. - Support streaming into MultipartForm instead of reading the whole body first. - Support calling ctx.PostBody() when streaming is enabled.
2021-02-07fix gracefilly shutdown bug, issue #958 (#960)v1.20.0Gravatar AlphaBaby 1-2/+66
* fix gracefilly shutdown bug, issue #958 * fix golangci-lint * add option: CloseOnShutdown into Sever * Update server.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * Update server.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> Co-authored-by: fujianhao3 <fujianhao3@jd.com> Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2021-02-06Add request body streaming. Fixes #622 (#911)Gravatar Kirill Danshin 1-0/+111
* Add request body streaming. Fixes #622 * Add test cases for StreamRequestBody Co-authored-by: Kiyon <kiyonlin@163.com> Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> Co-authored-by: Fiber