Commit Graph

867 Commits

Author SHA1 Message Date
Aliaksandr Valialkin e4db3cb560 Security fix: limit request body size by default
This mitigates possible DoS-attacks based on sending very BIG request bodies
to the server with default settings.
Thanks to @MichaelMonashev for pointing to this attack.
2016-06-28 20:54:42 +03:00
Aliaksandr Valialkin 778f83ed89 Discourage using ReleaseBody, since now bytebufferpool should properly handle the case mentioned in #102 2016-06-27 18:26:56 +03:00
Aliaksandr Valialkin 15c8282c3f typo fix 2016-06-27 17:52:45 +03:00
Aliaksandr Valialkin 80e08dc9ef Cross-reference Set* with Add* methods on RequestHeader and ResponseHeader 2016-06-27 17:48:32 +03:00
Justin Seely 3d3774799e Enable IPv6 for reuseport (#122) 2016-06-24 17:29:10 +03:00
Aliaksandr Valialkin efa9cb909e Issue #121: Added a test to make sure equal and space chars may be used inside cookie values 2016-06-24 17:22:27 +03:00
Aliaksandr Valialkin a35f26a704 Deprecate ByteBuffer in favor of bytebufferpool 2016-06-24 16:48:38 +03:00
Aliaksandr Valialkin 00868f2226 Use separate pools for request and response bodies.
This should reduce potential memory waste related to byte buffers' pool usage.
2016-06-24 15:15:59 +03:00
Aliaksandr Valialkin 775eb9d43f Update according to bytebufferpool new API 2016-06-24 14:59:39 +03:00
Aliaksandr Valialkin 3148999d1e Updated bytebufferpool calls according to the latest modifications 2016-06-23 11:08:30 +03:00
Aliaksandr Valialkin 8ca66d3de8 Use github.com/valyala/bytebufferpool, which should protect against memory fragmentation in the pool of byte buffers like mentioned in the PR #102 2016-06-22 20:32:00 +03:00
kayteh 29a4c4d6c1 Fix small typo in net/http -> fasthttp example (#120) 2016-06-19 00:28:03 +03:00
Aliaksandr Valialkin d42167fd04 Set response Server header to Server.Name if it is empty. This properly handles #118 v20160617 2016-06-17 13:13:04 +03:00
Aliaksandr Valialkin 83a24c301b Issue #114: added SetHost and Host helper methods to Request 2016-06-15 20:32:54 +03:00
Anton Tyurin 33ed259db7 reuseport: set FD_CLOSEEXEC for the sockets (#117)
Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2016-06-13 18:00:33 +03:00
Alexander Shchepetilnikov e2fcfbaea5 Fix typo (#115) 2016-06-13 17:58:03 +03:00
Aliaksandr Valialkin 8db7d05839 Close base response body streams when wrapping them into gzip or deflate stream writers 2016-06-10 20:19:15 +03:00
Aliaksandr Valialkin 80af8b2b97 Simplified PipeConns - now they properly handle the case when reader side is closed 2016-06-10 19:56:11 +03:00
Aliaksandr Valialkin 7c6a3278ad Improved testPipeConnsCloseWhileReadWrite 2016-06-10 18:24:42 +03:00
Aliaksandr Valialkin 312f9e5633 move inmemory_listener_timing_test to *_test package, so it could import fasthttp without cycle 2016-06-10 17:48:06 +03:00
Aliaksandr Valialkin ce9d1d2224 Use fasthttp.PipeConns instead of io.Pipe in StreamReader
This improves StreamReader performance by more than 2x.
2016-06-10 15:31:05 +03:00
Aliaksandr Valialkin 8f05edbec9 typo fix 2016-06-08 16:03:51 +03:00
Aliaksandr Valialkin efbb037c40 Added RequestCtx.Redirect tests, which cover cases mentioned in https://github.com/kataras/iris/issues/173 2016-06-07 13:30:42 +03:00
Aliaksandr Valialkin 033bb40f06 Properly handle hashes and single dots in URI.Update (see https://github.com/kataras/iris/issues/173) 2016-06-07 13:30:03 +03:00
Aliaksandr Valialkin 3c5ba2c98d Limit the number of concurrently running request handlers inside TimeoutHandler 2016-06-06 16:47:02 +03:00
Aliaksandr Valialkin b8b31526d7 Do not compress already compressed response in CompressHandler 2016-06-06 14:15:34 +03:00
Aliaksandr Valialkin 661978870b return StatusOK from an empty ResponseHeader.StatusCode() 2016-06-06 14:08:53 +03:00
Aliaksandr Valialkin 90baa054bc Export IsBodyStream on RequestCtx, Request and Response
These methods may help writing proper request handler wrappers
for request handlers, which may set body either via SetBodyStream*
or via usual body methods.
2016-06-03 17:07:13 +03:00
Aliaksandr Valialkin 1fc1f4cbf5 Reduce memory usage under high load by pooling request/response bodies.
- Use request/response body pools.
- Defer request/response body allocation until it is really required.
- Return request/response bodies to the pool as soon as they become unused.

This minimizes the total amount of memory occupied by active request/response
bodies under high load.
2016-06-03 16:54:22 +03:00
Aliaksandr Valialkin c09347e6de Removed coveralls.io badge, since it requires non-trivial setup to work properly 2016-06-03 14:01:30 +03:00
Hiroaki Nakamura 03bef793b7 Add missing messages to statusMessages (#109) 2016-05-30 19:12:58 +03:00
Aliaksandr Valialkin d029cfc489 Use coveralls.io badge instead of broken gocover.io 2016-05-30 18:36:54 +03:00
Tracer Tong ae8de36df0 Issue #107 (#108) 2016-05-27 18:54:11 +03:00
Aliaksandr Valialkin cefa3b1f52 Issue #105: listen by default only on IPv4, since IPv6 may be misleading / unexpected / buggy 2016-05-27 16:53:10 +03:00
Aliaksandr Valialkin bdd73c3261 small cleanup after 117f109c29 2016-05-27 16:11:29 +03:00
Aliaksandr Valialkin ccf67b7c98 Issue #107: make sure fasthttp supports arbitrary request methods including DELETE 2016-05-27 16:10:21 +03:00
Jason Fesler 117f109c29 Add func (resp *Response) ReleaseBody(size int) (#102) 2016-05-24 15:49:08 +03:00
Aliaksandr Valialkin f68634569e Issue #103: Set 'Server' response header before calling user-provided request handler 2016-05-24 15:41:08 +03:00
Aliaksandr Valialkin 57d56c2d34 Fixed flacky TestServerResponseBodyStream 2016-05-24 15:27:30 +03:00
Aliaksandr Valialkin 6c5368b250 Issue #103: Added FS.CompressedFileSuffix and clarified FSHandlerCacheDuration documentation 2016-05-24 13:22:59 +03:00
Aliaksandr Valialkin fa50251b46 Issue #100: accept POST query args with arbitrary charset set via Content-Type 2016-05-20 18:14:06 +03:00
Aliaksandr Valialkin e40caade41 Updated performance numbers for our production system 2016-05-17 17:16:48 +03:00
Denis Jannot 4959fd04db To make it compatible with the Rumprun unikernel (#98)
* Update reuseport.go

* Update reuseport_bsd.go
2016-05-16 18:54:32 +03:00
Aliaksandr Valialkin f36b47782a removed memory allocations from tryDial. This should improve performance for non-keepalive connections 2016-05-16 17:17:18 +03:00
Aliaksandr Valialkin ecba84a7fe Issue #95: Added 'Related projects' chapter into README 2016-05-12 11:23:01 +03:00
Aliaksandr Valialkin 4e35fde934 Issue #95: added an installation section to README.md 2016-05-11 20:40:03 +03:00
Aliaksandr Valialkin e4ed265221 Fixed a typo 2016-05-10 15:00:34 +03:00
Aliaksandr Valialkin f43cd21abb Issue #93: added an example for reuseport.Listener 2016-05-10 14:58:07 +03:00
Anton Tyurin b7687e4f75 reuseport: close Listener in case of error (#94)
If closing of an underlying File returns error, a Listener will not
be returned to a user and will not be closed as well.

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2016-05-10 14:43:57 +03:00
Aliaksandr Valialkin fcba2aa2f2 travis: switched from gox to GOOS/GOARCH environment variables for build tests on supported platforms 2016-05-06 18:36:29 +03:00