Commit Graph

64 Commits

Author SHA1 Message Date
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 4ee6517626 Issue #193: properly handle nil body when calling WriteGzip* and WriteDeflate* on Response struct 2016-10-31 13:41:50 +02:00
Aliaksandr Valialkin 3e1cb31dcd Added SwapBody to Request and Response for zero-copy body pass between Request and Response objects 2016-09-12 13:42:59 +03:00
Aliaksandr Valialkin 834fb48f10 Immediately write compressed response data to the connection after the user flushes the data from StreamWriter 2016-08-18 13:03:57 +03:00
Aliaksandr Valialkin d055141f64 Propagate 'https' scheme to request URI for TLS connections 2016-08-17 14:01:35 +03:00
Aliaksandr Valialkin 83a24c301b Issue #114: added SetHost and Host helper methods to Request 2016-06-15 20:32:54 +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 fa50251b46 Issue #100: accept POST query args with arbitrary charset set via Content-Type 2016-05-20 18:14:06 +03:00
Aliaksandr Valialkin bfa17b7ae9 do not copy Request and Cookie objects in tests 2016-03-28 17:17:05 +03:00
Aliaksandr Valialkin 877a47395f Issue #61: use proper content-length in multipart/form-data tests 2016-03-01 18:12:00 +02:00
Aliaksandr Valialkin 31a9d3461e Issue #61: test request with multipart/form-data body containing file value 2016-03-01 17:13:49 +02:00
Aliaksandr Valialkin b98beaa40f Added RequestURI helper to Request 2016-02-21 13:22:13 +02:00
Aliaksandr Valialkin be49d3027a Allow updating request's RequestURI and Host header via Request.URI() 2016-02-19 18:53:13 +02:00
Aliaksandr Valialkin e7e436064f Keep response and request body after calling Body() if SetBodyStream is called 2016-02-13 11:42:22 +02:00
Aliaksandr Valialkin 77a12cbf68 Added SetBodyStream* to Request. This allows streaming multi-GB data in request bodies 2016-02-12 20:52:29 +02:00
Aliaksandr Valialkin bfce0fa31c substituted bytes.Buffer by ByteBuffer in tests where appropriate 2016-02-12 14:15:28 +02:00
Aliaksandr Valialkin 6cd79f25f2 Added BodyWriteTo to Request and Response 2016-02-09 20:04:46 +02:00
Aliaksandr Valialkin 0458fee5cd Issue #15: make sure that io.EOF isn't returned on incomplete request/response 2016-02-05 13:22:03 +02:00
Aliaksandr Valialkin 52d4b7ca38 Issue #15: document that io.EOF is returned from Read* calls on (Request|Response)(Header)? only if the reader is closed before the first byte read 2016-02-05 13:14:36 +02:00
Aliaksandr Valialkin f8c0d95e57 Issue #40: added io.WriterTo implementation to Request and Response 2016-01-21 12:24:51 +02:00
Aliaksandr Valialkin a208149ac4 FS optimization: do not read file contents on HEAD requests 2016-01-18 20:40:43 +02:00
Aliaksandr Valialkin 7d7c17c8d7 Do not send response body (and content-length) for 1xx, 204 and 304 responses 2016-01-06 15:22:52 +02:00
Aliaksandr Valialkin c5d9023043 Issue #30: properly handle content-length for HEAD responses 2016-01-05 18:02:50 +02:00
Aliaksandr Valialkin dbe26b3541 Do not set Content-Length in GET and HEAD requests according to pull request #31 (thanks to @buaazp ) 2016-01-05 15:47:30 +02:00
Aliaksandr Valialkin f704d819f6 Always return multipart form body on Request.Body() call 2015-12-31 15:38:34 +02:00
Aliaksandr Valialkin 51460d7747 Fixed a typo 2015-12-31 12:10:48 +02:00
Aliaksandr Valialkin 5700ef75d0 Added a test for reading gzipped request body according to @celer's email 2015-12-31 12:10:12 +02:00
Aliaksandr Valialkin 85ae42bdba Do not read request body if both 'Content-Length' and 'Transfer-Encoding' headers are missing. Based on @celer's patch at https://github.com/celer/fasthttp/commit/667a8905cc6a95f223b5bd41056b1ea2861118df 2015-12-31 11:12:41 +02:00
Aliaksandr Valialkin 3284c3e671 Pull request #24: added support for '100 Continue' responses and 'Expect: 100-continue' requests. Kudos to @celer 2015-12-25 16:11:20 +02:00
Aliaksandr Valialkin edcfdbcec9 Issue #14: added support for response body compression 2015-12-25 12:26:34 +02:00
Aliaksandr Valialkin e4c3007338 Improved RequestCtx.WriteString() test 2015-12-24 20:54:17 +02:00
Aliaksandr Valialkin 80105c1a85 Added RequestCtx.WriteString 2015-12-24 20:48:05 +02:00
Aliaksandr Valialkin 6a340b7334 Added request PUT method support 2015-11-29 11:32:44 +02:00
Aliaksandr Valialkin 01031f43e2 Added support form multipart/form-data POST requests 2015-11-27 16:23:02 +02:00
Aliaksandr Valialkin df6fda8c33 Added ability to limit request body size on the server and response body size on the client 2015-11-27 13:22:15 +02:00
Aliaksandr Valialkin aa3b9144de Fixed user-agent string in TestRequestString 2015-11-25 14:30:09 +02:00
Aliaksandr Valialkin c9abc7ac4c Added String method to Request and Response 2015-11-22 16:47:27 +02:00
Aliaksandr Valialkin 46ac549ae1 Access URI members via accessors 2015-11-22 13:05:24 +02:00
Aliaksandr Valialkin 22c2789727 Added WriteTo, AppendBytes and String methods to RequestHeander and ResponseHeader 2015-11-22 02:14:09 +02:00
Aliaksandr Valialkin 2b1eca3a70 Optimize request uri parsing - defer Host header reading 2015-11-19 15:05:27 +02:00
Aliaksandr Valialkin a2601c68af API consistency change - make Response.StatusCode accessor 2015-11-19 11:39:20 +02:00
Aliaksandr Valialkin 835bf87605 API consistency: Clear -> Reset to be consistent with standard go packages 2015-11-18 17:55:28 +02:00
Aliaksandr Valialkin 72347ec910 Added BodyWrite() to Request and Response for writing request and response bodies 2015-11-18 14:17:42 +02:00
Aliaksandr Valialkin 86fe38c7a2 Hide Respone and Request body behind Body accessors 2015-11-18 14:00:24 +02:00
Aliaksandr Valialkin 6d16259215 Added SetBody and SetBodyStream methods to Response and RequestCtx 2015-11-18 13:49:23 +02:00
Aliaksandr Valialkin c728643d4a Access Content-Length via ContentLength accessor 2015-11-16 18:09:05 +02:00
Aliaksandr Valialkin f1f78f0828 Hide Request.URI and Request.PostArgs behind accessors, which automatically call parse URI and PostArgs on first access 2015-11-15 23:47:22 +02:00
Aliaksandr Valialkin 88e41d9b08 Removed accessors converting []byte to string, i.e. allocating memory. This should reduce memory usage for apps using fasthttp, since now they shoud either use []byte or do string() conversion on their own :) 2015-11-14 18:25:00 +02:00
Aliaksandr Valialkin 2e78d83bf7 Hide Request.RequestURI behind accessors in order to prevent users shooting in the foot when assigning to Request.RequestURI directly 2015-11-14 17:58:58 +02:00