Commit Graph

1901 Commits

Author SHA1 Message Date
tyltr 711e421685 feat: improve TCPDialer by sync.map instead of map+mutex (#1106) 2021-09-20 16:44:32 +02:00
Oleg Kovalov adc0e57d0d Remove useless runtime.KeepAlive (#1107)
* Remove useless runtime.KeepAlive

* Update bytesconv.go
2021-09-20 16:33:03 +02:00
tyltr 44d0333ba3 fix: typo (#1105) 2021-09-17 09:16:52 +02:00
Evgenii 06b464f084 fix typo in deadline (#1099) 2021-09-11 12:05:40 +02:00
Erik Dubbelboer 46d92356a8 Check go fmt during lint (#1097) 2021-09-10 18:49:45 +02:00
Kyle Unverferth 713da4e33f Adding new compressible prefixes (#1092)
* Adding "image/svg" as compressible prefix

* Adding additional compressible prefixes from https://support.cloudflare.com/hc/en-us/articles/200168396-What-will-Cloudflare-compress-
v1.30.0
2021-09-07 10:03:41 +02:00
tyltr 1647255ec9 remove unnecessary op (#1095) 2021-09-07 09:40:13 +02:00
tyltr f0a21893b9 feat: improve IsMethod (#1088)
* feat: improve bytesEqual

* benchmark

* nolint:unused

* remove unused  code

* Update client.go

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2021-09-06 12:06:21 +02:00
Mikhail Faraponov 5d73da31ae Update status.go (#1093) 2021-09-06 09:43:29 +02:00
Erik Dubbelboer 3f70d780be Some FS tests can't run in parallel
These tests all try to create the compressed versions of files at the
same time which might lead to concurrency errors.
2021-09-05 10:45:21 +02:00
tyltr ba401075d3 compatible with new build tag (#1087) 2021-09-02 00:18:53 +02:00
tyltr d9c75732a6 improve invalidStatusLine by appending a []byte directly (#1086)
* improve invalidStatusLine

* append []byte directly

* AppendUint

* negetive

* AppendInt
2021-09-01 19:27:14 +02:00
Andy Pan cad867ad92 Remove the redundant badage (#1085) 2021-09-01 12:28:46 +02:00
Erik Dubbelboer 38992dafcf Fix []byte reuse bug
The return value of normalizePath should be a reusable []byte.
Returning strSlash could cause the strSlash constant to be reused and
resulted in very weird behavior. This specific case of normalizePath
almost never happens which made it even harder to spot.

The race detector on Windows was the only clue that something was
happening:

WARNING: DATA RACE
Write at 0x000001d082e3 by goroutine 446:
  github.com/valyala/fasthttp.addLeadingSlash()
      D:/a/fasthttp/fasthttp/uri_windows.go:8 +0xa5
  github.com/valyala/fasthttp.normalizePath()
      D:/a/fasthttp/fasthttp/uri.go:343 +0xbd
  github.com/valyala/fasthttp.(*URI).parse()
      D:/a/fasthttp/fasthttp/uri.go:314 +0x1606
  github.com/valyala/fasthttp.(*URI).Parse()
      D:/a/fasthttp/fasthttp/uri.go:266 +0xb3
  github.com/valyala/fasthttp.testURIPathNormalize()
      D:/a/fasthttp/fasthttp/uri_test.go:195 +0x47
  github.com/valyala/fasthttp.TestURIPathNormalize()
      D:/a/fasthttp/fasthttp/uri_test.go:176 +0x38e
  testing.tRunner()
      C:/hostedtoolcache/windows/go/1.15.15/x64/src/testing/testing.go:1123 +0x202

Previous read at 0x000001d082e3 by goroutine 332:
  runtime.slicecopy()
      C:/hostedtoolcache/windows/go/1.15.15/x64/src/runtime/slice.go:246 +0x0
  github.com/valyala/fasthttp.(*RequestHeader).AppendBytes()
      D:/a/fasthttp/fasthttp/header.go:1726 +0x24d
  github.com/valyala/fasthttp.(*RequestHeader).Header()
      D:/a/fasthttp/fasthttp/header.go:1698 +0x84
  github.com/valyala/fasthttp.(*RequestHeader).Write()
      D:/a/fasthttp/fasthttp/header.go:1682 +0x10f
  github.com/valyala/fasthttp.(*Request).Write()
      D:/a/fasthttp/fasthttp/http.go:1370 +0x1ab
  github.com/valyala/fasthttp.testRequestSuccess()
      D:/a/fasthttp/fasthttp/http_test.go:1788 +0x32a
  github.com/valyala/fasthttp.TestRequestSuccess()
      D:/a/fasthttp/fasthttp/http_test.go:1678 +0x2dd
  testing.tRunner()
      C:/hostedtoolcache/windows/go/1.15.15/x64/src/testing/testing.go:1123 +0x202
2021-08-28 11:54:58 +02:00
Erik Dubbelboer 63211032d4 Various deadline fixes (#1081) 2021-08-28 11:19:32 +02:00
Erik Dubbelboer 51508d7480 Fix various Windows Github Action errors (#1082)
* 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-28 09:42:38 +02:00
YenForYang c7ce95f778 Fix s2b (#1079)
Ensure `len(b)` <= `cap(b)` at all times. Additionally, use `runtime.KeepAlive()` to prevent `s` from being GC-ed.
2021-08-26 10:09:45 +02:00
Erik Dubbelboer a50f59be52 Increase various test timeouts
Github workers on windows are slow.
2021-08-24 11:18:22 +02:00
Lanco 0fe8cddd97 Optimize size of Server by moving bool fields (#1077) 2021-08-23 11:27:51 +02:00
Erik Dubbelboer a6f9c8a442 Fix Client doc and mCleaner (#1076)
- Reduce mCleaner goroutine time.
- Add comment about changing Client fields while in use.
2021-08-20 14:52:06 +02:00
Erik Dubbelboer 5a6e6e102b Add Go 1.17 support (#1074)
* Add Go 1.17 support

* Increase test timeouts
2021-08-18 21:38:21 +02:00
Mikhail Faraponov 97e1319927 Update compress (#1069) v1.29.0 2021-08-16 18:09:31 +02:00
Erik Dubbelboer 0263cae5a2 Fix FasthttpSocksDialer example 2021-08-14 10:28:45 +02:00
Tianyi Song d31e6dbdba Handle perIPConn in RequestCtx.IsTLS() specially (#1064) 2021-08-04 20:15:05 +02:00
Kazumasa Takenaka (Bamboo) 9466cd7657 fix typo: occured -> occurred (#1061) 2021-07-17 17:51:59 +02:00
Darío b3ece39dcd Update README.md (#1058) 2021-07-08 09:55:08 +02:00
Sujit Baniya d0df1e1dde Add ResetUserValues() and test (#1056) 2021-07-01 10:57:21 +02:00
Erik Dubbelboer 1504a84ed7 Increase TestHostClientMaxConnWaitTimeoutSuccess timeout v1.28.0 2021-06-29 09:36:30 +02:00
Erik Dubbelboer f6560bebb2 Flush buffered responses if we have to wait for the next request (#1050)
* 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-28 17:38:39 +02:00
Erik Dubbelboer 874c8cad76 Increase timeouts for Windows github actions v1.27.0 2021-06-18 15:46:40 +02:00
Erik Dubbelboer 924a63fdeb Increase TestServerTLSReadTimeout timeout
And TestFSCompressConcurrent timeout
2021-06-18 15:41:42 +02:00
Erik Dubbelboer 410bde6009 Fix race condition in TestPipelineClientIssue832 2021-06-18 15:28:58 +02:00
Erik Dubbelboer 9f2c63676d Lower go test time 2021-06-18 14:57:18 +02:00
Meng 4ed933a2e7 fix: set content-length properly when StreanRequestBody was enabled (#1049)
* fix: set content-length properly when StreanRequestBody was enabled

* fix: add test cases for validating content length of streaming request
2021-06-18 13:43:29 +02:00
Erik Dubbelboer cec99537fe Add IdleTimeout to Shutdown documentation 2021-06-18 13:38:17 +02:00
Ertuğrul Emre Ertekin c12a06108b TCPDialer :: DNSCacheDuration option (#1046)
* DefaultDNSCacheDuration :: Changed to `var`

* Revert "DefaultDNSCacheDuration :: Changed to `var`"

This reverts commit d836eace9f.

* TCPDialer :: DNSCacheDuration option

* TCPDialer :: DNSCacheDuration option - comment added

* TCPDialer :: DNSCacheDuration option - comment fixed
2021-06-18 13:37:07 +02:00
Erik Dubbelboer 87fc95849c Run go test on github actions (#1047)
* Run go test on github actions

travis-ci.org has stopped.
See also: https://github.com/curl/curl/issues/7150

Downside: github actions don't support ppc64le

* Run less

* delete .travis.yml

* Remove travis + minor lint fixes
2021-06-18 13:36:54 +02:00
Darío be13b504ab Defined Transport for the client (#1045)
* Defined Transport for the client

* Added Transport test
2021-06-16 12:55:56 +02:00
Erik Dubbelboer b8b065b0d7 Don't unwrap io.LimitedReader
This is not needed anymore to trigger sendfile. The Go wrapper around
sendfile already does this: https://github.com/golang/go/blob/9d46ee5ac4acd6602692f70c5149a3f6db058558/src/net/sendfile_linux.go#L23-L33
2021-06-12 13:16:36 +02:00
Erik Dubbelboer 6233fbc08e Fix header .Add functions (#1036)
These functions should take the headers that are handled differently
into account.
v1.26.0
2021-06-01 10:52:35 +02:00
Erik Dubbelboer 5bb5cfc9ca Remove unused peekRawHeader 2021-05-26 09:09:50 +02:00
Sergio Andrés Virviescas Santana 7d13e18a4f Add Request.TLS and try to avoid a new alloc if Request.Header is already allocated (#1034) 2021-05-26 09:06:37 +02:00
Sergio Andrés Virviescas Santana b433ecfcbd Make sure to reset the userValues always and at the exact time (#1027)
* Ensure reset userValues always that release RequestCtx

* Reset userValues after response write and hijack handler are executed
2021-05-22 17:23:41 +02:00
Erik Dubbelboer a18c6322a2 Fix cookie panic 2021-05-21 12:11:09 +02:00
Erik Dubbelboer f3e4118c5b Don't recommend Go 1.13 2021-05-21 11:59:58 +02:00
Sergio Andrés Virviescas Santana fa3e5d85f2 Run test with go 1.16.X (#1028)
* Run test with go 1.16.X

* Fix min required go version

* Add go tip

* Update .github/workflows/security.yml

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
v1.25.0
2021-05-17 10:45:11 +02:00
MoreFreeze ffa0cabed8 Use proper content-type when it is not present (#1023)
Co-authored-by: liuchenxing <liuchenxing@bytedance.com>
2021-05-17 09:20:18 +02:00
Nícolas Barbosa 04cde74c41 feature: add ConvertRequest func (#1024)
* feature: add ConvertRequest func

To easy method to convert ctx.RequestCtx to http.Request

* chore: minor changes by code review #1024
2021-05-17 09:20:10 +02:00
Sergio Andrés Virviescas Santana 5898006f5b Upgrade dependencies and tidy (#1029) 2021-05-17 09:12:49 +02:00
MoreFreeze 097fa05a69 Fix ignoreBody still set content length (#1022)
* Fix ignore body should not set content-length

* Add TestRequestReadNoBody

Co-authored-by: liuchenxing <liuchenxing@bytedance.com>
2021-05-14 10:08:51 +02:00