Commit Graph

1287 Commits

Author SHA1 Message Date
Erik Dubbelboer 607743cb8e Ignore gosec warning in example v1.15.0 2020-07-12 18:25:46 +02:00
Erik Dubbelboer f97a382d80 Add letsencrypt example 2020-07-11 20:40:19 +02:00
Serge Romanov e6ed19fd0c update link to router package (#842)
Co-authored-by: Bob Cohn <robert.cohn@taotesting.com>
2020-06-25 10:34:24 +02:00
Erik Dubbelboer ef51a7e590 Fix fasthttpadaptor Content-Type detection
Make this in line with how net/http handles Content-Type.
2020-06-21 11:09:08 +02:00
Erik Dubbelboer ac4cc171a5 Completely remove fuzzit
They have been acquired by GitLab and are going to remove all data for
previous projects. See https://github.com/valyala/fasthttp/issues/838
2020-06-21 10:55:27 +02:00
Nagy Salem 38affcb146 Added Gearbox (#823) 2020-06-18 22:44:33 +02:00
Erik Dubbelboer 9dd7979b2e Restart PipelineClient worker on error (#834) 2020-06-16 11:58:07 +02:00
Erik Dubbelboer 380f00bfdb Fixed bug which prevents cached FS files from being updated
Bug was introduced in previous "Fixed recompressing of stale files"
commit.
2020-06-12 21:47:32 +02:00
Erik Dubbelboer 2f28edba01 Fixed recompressing of stale files 2020-06-07 11:54:40 +02:00
Erik Dubbelboer 1671faf0bd Prefork does work on windows
Just need to use Reuseport.
2020-06-07 11:19:31 +02:00
Erik Dubbelboer cc9db3ab20 Try TravisCI Windows (#828)
* Try TravisCI Windows

* prefork is supported on windows with Reuseport=true

* Bit longer timeouts for tests
2020-06-06 15:57:38 +02:00
sky ac51d598dc Make the ErrNothingRead to be exposed. (#827)
* Make the ErrNothingRead to be exposed.

* Update header.go

update annotation.

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2020-06-05 14:12:33 +02:00
RW 853abb31af 🐞 panic in fs.go #824 (#825)
Co-authored-by: wernerr <rene.werner@verivox.com>
2020-06-04 16:53:47 +02:00
Andy Pan 33b3cb259e Support Windows SO_REUSEADDR (#822)
* Support Windows SO_REUSEADDR

* Update the comment

* Renew comment of the Listen method on Windows
2020-06-04 16:51:39 +02:00
Andy Pan 29e6d094c8 Update TechEmpower benchmark from 18 to 19 round (#821) 2020-06-02 11:56:48 +02:00
Erik Dubbelboer b98999e8e0 Merge pull request #820 from valyala/uri-errors
URI.Parse now returns an error
v1.14.0
2020-06-01 11:46:14 +02:00
Erik Dubbelboer 439185eb57 Run cross compilation and race detector on the latest release only 2020-05-31 17:05:49 +02:00
Erik Dubbelboer bcaa594b41 Remove unused raw header code 2020-05-31 15:49:37 +02:00
Erik Dubbelboer 9468c66e25 URI.Parse now returns an error 2020-05-31 15:16:54 +02:00
Erik Dubbelboer 1391312294 Merge pull request #817 from vural/custom-retry-decider
Add custom retry decider for fail http requests
2020-05-30 16:50:17 +02:00
Vural Kap 77dcda39ae Add custom retry decider for fail http requests 2020-05-27 20:40:04 +03:00
Erik Dubbelboer 2f92c68a07 Add timeouts to tls Handshake
Fixes #813 which suggested the code.
v1.13.0 v1.13.1
2020-05-25 20:44:04 +02:00
Erik Dubbelboer 123f6a8cee Fix memory reusage bug with auth
Fixes #814
2020-05-25 20:27:15 +02:00
Erik Dubbelboer 24410e58c0 Merge pull request #810 from valyala/brotli
Add Brotli support
2020-05-18 18:30:48 +02:00
Erik Dubbelboer d22782d3f7 HostClient can't switch between protocols (#800) 2020-05-18 18:30:29 +02:00
Moritz Marquardt 5bd1b0cf2c Make FS return a redirect for directories without trailing slash (#802)
* Make FS return a redirect for directories without trailing slash

Fixes #792

* Add a test for the directory redirect

* Fix directory redirects for ServeFile

* Fix error message

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2020-05-18 18:30:13 +02:00
Erik Dubbelboer 05d4602a68 Fix race condition in test 2020-05-16 11:54:57 +02:00
Erik Dubbelboer 339ad36634 Add Brotli support
New Functions:

    CompressHandlerBrotliLevel(h RequestHandler, brotliLevel, otherLevel int) RequestHandler
    Request.BodyUnbrotli() ([]byte, error)
    Response.BodyUnbrotli() ([]byte, error)
    AppendBrotliBytesLevel(dst, src []byte, level int) []byte
    WriteBrotliLevel(w io.Writer, p []byte, level int) (int, error)
    WriteBrotli(w io.Writer, p []byte) (int, error)
    AppendBrotliBytes(dst, src []byte) []byte
    WriteUnbrotli(w io.Writer, p []byte) (int, error)
    AppendUnbrotliBytes(dst, src []byte) ([]byte, error)

New Constants:

    CompressBrotliNoCompression
    CompressBrotliBestSpeed
    CompressBrotliBestCompression
    CompressBrotliDefaultCompression

Brotli compression levels are different from gzip/flate. Because of this we have separate level constants and CompressHandlerBrotliLevel takes 2 levels.

I didn't add Brotli support to CompressHandler as this could cause a spike in CPU usage when users upgrade fasthttp.

fasthttp.CompressBrotliDefaultCompression is not the same as
brotli.DefaultCompression. brotli.DefaultCompression is more than twice
as slow as fasthttp.CompressBrotliDefaultCompression which I thought was
unreasonable as default.
2020-05-15 15:36:26 +02:00
Erik Dubbelboer 9507d7c7d7 Don't wrap conn with a TLS Client if it's already a TLS Conn 2020-05-12 12:32:53 +02:00
Erik Dubbelboer dacd0353f9 HostClient can't switch between protocols 2020-05-02 21:01:52 +02:00
Julian Junxiang Zhou dc6b9db734 Copy to the req.Header.userAgent from the defaultUserAgent (#796)
This avoids the req.Header.userAgent sharing an underlying array with the
global defaultUserAgent

This should fix the #795
2020-04-30 13:06:48 +02:00
Mike MacDermaid 32940977fb allow the expect 100 continue workflow to deny requests (#787)
* allow the expect 100 continue workflow to deny requests

* suggested changes

* update booleans to reflect handler name change
2020-04-27 20:29:02 +02:00
Erik Dubbelboer 446e1a638d Fix .travis.yml 2020-04-26 14:58:14 +02:00
Erik Dubbelboer 079f39bddc Don't allow ASCII control character in URLs (#790)
* Don't allow ASCII control character in URLs

* Add tests
2020-04-25 20:54:59 +02:00
Ivan Mironov 3e27d8ebad Fix integer overflow handling in parseUintBuf() (#789)
* Add more tests for parseUintBuf()

* Fix integer overflow handling in parseUintBuf()
2020-04-23 15:08:07 +02:00
Erik Dubbelboer 571315f30a Only base64 the proxy auth once 2020-04-23 15:05:56 +02:00
Erik Dubbelboer 503e363eb4 Remove unnecessary check
Fixes #785
2020-04-21 09:17:34 +02:00
Erik Dubbelboer 54df169029 Add fasthttpproxy.FasthttpHTTPDialer v1.12.0 2020-04-20 18:32:19 +02:00
Erik Dubbelboer 96a8ad6e00 Upgrade dependencies 2020-04-20 18:21:58 +02:00
Kirill Danshin 5ce12a8e78 oss-security got new email
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
2020-04-19 03:12:28 +03:00
Kirill Danshin f9ef8fc47b update the docs
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
v1.11.0
2020-04-19 00:44:47 +03:00
Kirill Danshin cc407796cd fix: s.concurrency stays 0 when you don't use s.ServeConn
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
2020-04-19 00:44:47 +03:00
Markmerc db18810c87 Add configuration to not pre-parse multipart form data (#778)
Co-authored-by: Mercurio <mmmercur@amazon.com>
v1.10.0
2020-04-14 18:17:57 +02:00
Darío 402e095d4d Fixed case when no hijacker is added but no-response is true (#772) 2020-04-07 09:35:05 +02:00
Vic Shóstak ea20759cf1 Add third-party framework to README (#774) 2020-04-07 09:33:46 +02:00
Darío a1cfe58ca8 Added fastws (alphabetically) to related projects (#770) 2020-04-03 17:30:28 +02:00
Daniel Qian 70b1d3bce7 feat: make client to wait when no free connections (#764)
* feat: make client to wait when no free connections

* feat: make client to wait when no free connections

use AcquireTimer to do timeout instead of using context

* feat: make client to wait when no free connections

Add BenchmarkClientGetEndToEndWaitConn* to test heap allocation
in waiting for free connection situation

* feat: make client to wait when no free connections

Add BenchmarkHTTPClientGetEndToEndWaitConn* to test heap allocation
in waiting for free connection situation

* feat: make client to wait when no free connections

fix bug in BenchmarkHTTPClientGetEndToEndWaitConn*

* feat: make client to wait when no free connections

fix bug in TestHostClientMaxConnWaitTimeoutSuccess make it wait
longer to avoid ErrNoFreeConns on travis-ci

* feat: make client to wait when no free connections

fix do not compile benchmark(NetHTTP?)ClientGetEndToEndWaitConn
if go version < 1.11.x

* feat: make client to wait when no free connections

fix the bug that if deadline is earlier than MaxConnWaitTimeout,
still wait MaxConnWaitTimeout which later than deadline.

* feat: make client to wait when no free connections

fix race condition in TestHostClientMaxConnWaitTimeoutError

* feat: make client to wait when no free connections

fix bug in TestHostClientMaxConnWaitTimeoutWithEarlierDeadline
2020-04-03 17:12:50 +02:00
Erik Dubbelboer 0ba26f7b42 Don't retry requests with a BodyStream
We won't be able to re-read the body stream. So instead return an error.

Fixes #766
2020-03-30 22:33:31 +02:00
Tomás Senart 75c6008129 client: Implement DoRedirects (#765)
This commit adds a `DoRedirects` method to both `HostClient` and
`Client` as well as top level convenience function of the same name that
is called with the package level `defaultClient`.

Re-implementing this redirect logic in user code is harder than
necessary.
2020-03-25 17:55:13 +01:00
Andy Pan 38aa88ab52 Make the prefork mode more robust (#755)
* Make the prefork mode more robust

The main process will exit if one of the prefork child processes doesn't complete successfully under the current prefork mode, so it ought to make sure that all child processes run independently and the main process will only exit after all child processes are finished.

* Start over those failed child processes automatically

* Kill all child processes before main process exits

* Remove redundant code

* Add configurable threshold of starting over child processes

* Return a error of RecoverThreshold

* Resolved requested changes

* Add logs

* Resolve requested changes
2020-03-13 11:25:52 +01:00