Commit Graph

989 Commits

Author SHA1 Message Date
Kirill Danshin 21b8fa5920 ci: temporary disable goimports check
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
2018-08-13 01:53:48 +03:00
Kirill Danshin 78854f3794 ci: try yet another fix for goimports check
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
2018-08-13 01:43:55 +03:00
Kirill Danshin 5edd8e0f2f Merge branch 'master' of github.com:valyala/fasthttp 2018-08-13 01:31:38 +03:00
Kirill Danshin f5f97aa484 ci: try yet another way for goimports check
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
2018-08-13 01:27:46 +03:00
Kirill Danshin fb5347a023 Merge pull request #231 from erikdubbelboer/testport
Use random ports for tests
2018-08-13 00:51:23 +03:00
Kirill Danshin e38135e90d Merge pull request #332 from 4oi/master
Add missing http methods
2018-08-13 00:49:27 +03:00
Kirill Danshin ae73e1bec7 ci: use another way to check if source code formatted
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
2018-08-13 00:12:54 +03:00
Kirill Danshin 110dea26f8 ci, reuseport, writer: update travis config and goimports -w on whole project
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
2018-08-12 23:56:32 +03:00
Kirill Danshin bca56ee107 Update LICENSE 2018-08-12 21:35:55 +03:00
toyblocks a84dc2dc0e Add missing http methods
Add support for 'CONNECT', 'OPTIONS', 'TRACE' and 'PATCH'
2018-03-12 07:00:21 +09:00
Aliaksandr Valialkin e5f51c1191 added missing byte 0xFF into hex2intTable. This fixes panic when decoding specially crafted string like "%\xff" v20180529 2017-12-07 14:09:41 +02:00
Aliaksandr Valialkin 51bb00256c attempt #2 to fix TestTCP6 on travis: run the test only if local tcp6 interface is present 2017-11-08 19:16:02 +02:00
Aliaksandr Valialkin cb0855b7a4 an attempt to fix TestTCP6 on travis. It looks like travis doesnt know about ip6-localhost. Substitute it with [::1] 2017-11-08 14:10:58 +02:00
Aliaksandr Valialkin 56554327e4 Update go version to 1.9.x and 1.8.x for travis builds 2017-11-08 14:06:54 +02:00
Aliaksandr Valialkin e2ac397815 Parse bogus uris with missing slash after hostname like http://foobar.com?baz=123, since such uris occur in real life :( 2017-11-08 13:05:29 +02:00
Aliaksandr Valialkin 70ceaddfae Added RequestCtx.String that returns unique string representation of the request context 2017-10-18 15:53:05 +03:00
Aliaksandr Valialkin 5116aa64e0 Mention that the body returned from Request.Body and Response.Body is valid until the Request/Response modification 2017-09-12 13:15:57 +03:00
Aliaksandr Valialkin bcdf16d04f Removed superflouos slashes from documentation 2017-09-12 13:15:04 +03:00
Aliaksandr Valialkin b43f17d9a9 Added a test that verifies that the client sends all the request headers and body to the server 2017-09-04 13:47:21 +03:00
Aliaksandr Valialkin ae643c872d decodeArgAppend code prettifying 2017-07-21 16:45:47 +03:00
Aliaksandr Valialkin 6ece3d9359 decodeArgAppend* optimization: remove bounds check when decoding percent-encoded string
Benchmark results:

name                           old time/op  new time/op  delta
AppendUnquotedArgSlowPath-4    68.9ns ± 2%  63.5ns ± 2%  -7.88%  (p=0.000 n=10+10)
2017-07-21 16:42:32 +03:00
Aliaksandr Valialkin d257ae60a3 ioptimized decodeArgAppend a bit
Benchmark results on linux/amd64:

name                           old time/op  new time/op  delta
ArgsParse-4                    72.8ns ± 2%  68.0ns ± 2%  -6.59%  (p=0.000 n=10+9)
AppendUnquotedArgFastPath-4    20.4ns ± 2%  21.1ns ± 9%    ~     (p=0.614 n=8+10)
AppendUnquotedArgSlowPath-4    68.9ns ± 3%  70.4ns ± 6%    ~     (p=0.148 n=9+10)
URIParsePath-4                 80.9ns ± 2%  78.7ns ± 2%  -2.80%  (p=0.000 n=10+10)
URIParsePathQueryString-4      88.9ns ± 1%  86.3ns ± 1%  -2.90%  (p=0.000 n=10+8)
URIParsePathQueryStringHash-4  95.7ns ± 8%  91.0ns ± 1%  -4.88%  (p=0.000 n=9+10)
URIParseHostname-4             98.6ns ± 1%  95.4ns ± 1%  -3.24%  (p=0.000 n=10+10)
2017-07-21 16:08:21 +03:00
Aliaksandr Valialkin 52a0993b96 Issue #278: more optimizations for normalizeHeaderKey 2017-07-11 10:17:57 +03:00
Kirill Danshin 179aa635ec add gramework (#280)
Signed-off-by: Kirill Danshin <k@guava.by>
2017-07-10 14:36:13 +03:00
Aliaksandr Valialkin 952171f61b Issue #278: optimize normalizeHeaderKey a bit
Performance results on amd64:

name                            old time/op  new time/op  delta
NormalizeHeaderKeyCommonCase-4  43.3ns ± 0%  32.6ns ± 1%  -24.80%  (p=0.000 n=9+10)
NormalizeHeaderKeyLowercase-4   42.6ns ± 3%  32.6ns ± 1%  -23.41%  (p=0.000 n=10+10)
NormalizeHeaderKeyUppercase-4   43.5ns ± 1%  32.6ns ± 2%  -25.03%  (p=0.000 n=9+8)

Based on top of https://github.com/valyala/fasthttp/pull/279 .
2017-07-10 14:28:06 +03:00
Aliaksandr Valialkin 498431ce67 Added missing bufio.Writer.Flush() in testResponseBodyStream* 2017-06-28 18:18:09 +03:00
Aliaksandr Valialkin 8948e047bf Issue #176: reset Content-Length when compression is enabled for streamed response body 2017-06-27 20:50:04 +03:00
Aliaksandr Valialkin 0f5182f9ce added a fast path to AppendHTMLEscape when the string doesnt contain special chars 2017-06-23 19:04:29 +03:00
Aliaksandr Valialkin 6ac0fd1a91 use more clear decodeArgAppend instead of misleading decodeArg 2017-06-20 18:19:36 +03:00
Aliaksandr Valialkin 2db9429ff7 added a fast path to decodeArgAppend when the arg doesnt contain encoded chars 2017-06-20 13:40:15 +03:00
Aliaksandr Valialkin c0de95e84b Added AppendUnquotedArg - the complementary function to AppendQuotedArg 2017-06-19 18:35:07 +03:00
Aliaksandr Valialkin b154429ca9 Compress responses only if their content-type starts with text/ or application/ 2017-05-17 17:10:29 +03:00
Aliaksandr Valialkin 103adc311e Do not compress responses with sizes smaller than 200 bytes
Compressing small bodies has little sense, since the compressed result size
may exceed the original body size.

This should save CPU time when the server responds with small responses.
2017-05-17 16:17:53 +03:00
Aliaksandr Valialkin 30e92af08f Limit heap memory usage when compressing high number of concurrent responses
Previously each concurrent compression could allocate huge compression state
with the size up to 1Mb each. So 10K concurrent connections could result in
10Gb of compression state in the heap.

This CL limits the number of compression states among concurrent requests
when {Append,Write}{Gzip,Deflate}* functions are called to O(GOMAXPROCS).
These functions are used by CompressHandler* for non-streaming responses,
i.e. it should cover the majority of use cases.

Memory usage for 10K concurrent connections that compress responses drops
from 10Gb to 200Mb after this CL.
2017-05-17 14:45:31 +03:00
Aliaksandr Valialkin 9ffce8c687 client: properly extract tls ServerName from address without port 2017-04-26 17:57:12 +03:00
Aliaksandr Valialkin 8b2cc86299 fasthttputil: added TLS benchmarks for ECDSA certificates
Handshakes with ECDSA certificates are optimized much better
comparing to RSA certificates - see https://github.com/golang/go/issues/20058 .
2017-04-24 14:16:32 +03:00
Aliaksandr Valialkin 8d2055d00a fasthttputil: added TLS benchmarks for handshakes with elliptic curves 2017-04-20 19:05:57 +03:00
Aliaksandr Valialkin 2c5a87147a fasthttputil: added BenchmarkTLSHandshakeWithoutClientSessionCache 2017-04-20 12:31:46 +03:00
Aliaksandr Valialkin fc109d6887 Added a benchmark for RequestCtx.Redirect 2017-02-22 18:45:09 +02:00
Perelandric 3580c93d02 Make SetMethod slice to zero before appending (#234)
SetMethod appended directly to the `h.method` slice without setting its
length to zero, so multiple calls would create an unexpected value.
2017-02-22 09:48:29 +02:00
Aliaksandr Valialkin de05aa4747 travis: test with go1.8 2017-02-20 18:59:34 +02:00
Aliaksandr Valialkin f06438ae94 doc: mention that RequestCtx.ConnRequestNum() returns connection request numbers starting from 1 2017-02-20 16:00:55 +02:00
Erik Dubbelboer 5afdf7cdfd Use random ports for tests
This should stop travis-ci from constantly failing with
"bind: address already in use"
2017-02-14 14:47:15 +08:00
Aliaksandr Valialkin 32c72cde80 Export CoarseTimeNow and clarify that RequestCtx.Time() and RequestCtx.ConnTime() return time truncated to a second 2017-02-10 15:45:14 +02:00
Aliaksandr Valialkin 6309f42188 optimization: substitute time.Now() calls with coarse-grained time in hot paths 2017-02-09 23:59:06 +02:00
Aliaksandr Valialkin e113a6dfce stackless: use dedicated worker pool per each stackless func.
This reduces tail latencies in our prod when multiple stackless funcs
are used concurrently.
2017-02-06 14:23:39 +02:00
Aliaksandr Valialkin 07559fc63b stackless: send "func done" notification over a buffered channel, so the funcWorker could process multiple work items without switching to other goroutines 2017-02-06 01:10:21 +02:00
Aliaksandr Valialkin 5abb44878e stackless: added NewFunc() for wrapping stack-hungry CPU-bound functions 2017-02-05 23:35:23 +02:00
Aliaksandr Valialkin b69eba7101 Added Args.GetBool helper 2017-01-30 19:47:15 +02:00
Aliaksandr Valialkin 2ada93a6df Document that the cookie passed to ResponseHeader.SetCookie may be re-used after the function returns 2017-01-18 19:20:47 +02:00