Commit Graph

122 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
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 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
Aliaksandr Valialkin ef299a95e2 Fixed TestServerErrSmallBuffer for go 1.6 2016-11-14 23:16:56 +02:00
Aliaksandr Valialkin 3246b4efb5 Issue #173: improve error messages on headers parsing 2016-11-10 20:00:54 +02:00
Aliaksandr Valialkin 02fe9b8533 Issue #173: return valid response instead of silently closing connection on request parsing errors 2016-11-10 18:09:23 +02:00
Clayton Anderson 1909d6a025 Fixed bug with quoted multipart form boundaries (#135) 2016-07-12 09:33:29 +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
Aliaksandr Valialkin 661978870b return StatusOK from an empty ResponseHeader.StatusCode() 2016-06-06 14:08:53 +03:00
Tracer Tong ae8de36df0 Issue #107 (#108) 2016-05-27 18:54:11 +03:00
Aliaksandr Valialkin 3509bd8a7d Issue #83: Added ResponseHeader.DelClientCookie for instructing the client for removing the given cookie. Clarified ResponseHeader.DelCookie documentations 2016-04-29 14:40:55 +03:00
Aliaksandr Valialkin 2a12271406 Issue #83: Added DelCookie* methods to RequestHeader and ResponseHeader 2016-04-24 22:34:33 +03:00
Aliaksandr Valialkin 12ba989984 Issue #69: Added RequestHeader.Add and ResponseHeader.Add for adding multiple headers with the same key 2016-03-29 17:11:43 +03:00
Aliaksandr Valialkin 0c67179812 Added delAllArgsBytes helper 2016-03-29 16:30:07 +03:00
Aliaksandr Valialkin 0d43464f64 Renamed unsafeBytes2Str to b2s 2016-03-29 16:26:21 +03:00
Aliaksandr Valialkin 8b26017325 Renamed setArg to setArgBytes 2016-03-29 16:19:22 +03:00
Aliaksandr Valialkin c469d18819 Issue #72: properly handle 'Connection: keep-alive, Upgrade' header 2016-03-22 19:47:59 +02:00
Aliaksandr Valialkin ca2c5535a3 do not write 'date' response header, since 'date' header is automatically generated 2016-03-11 11:05:32 +02:00
Aliaksandr Valialkin e0eac18652 use 'switch string(key) {}' instead of 'switch { case bytes.Equal(key, ...) ... }'. This may improve switch statement's performance 2016-03-10 17:44:58 +02:00
Aliaksandr Valialkin 38356e216e Issue #64: properly delete header values via Del call 2016-03-10 17:22:59 +02:00
Aliaksandr Valialkin 8280b7a162 Moved empty noCopy struct to the top of container structs. See @stemar94 's comment at https://github.com/golang/go/issues/12884 for details 2016-03-06 00:17:08 +02:00
Aliaksandr Valialkin 9f43aa1601 Do not expose noCopy.Lock 2016-03-04 21:20:52 +02:00
Aliaksandr Valialkin 9fa69c74af Embed noCopy struct into structs, which mustn't be copied
This should help `go vet` detecting invalid structs' copyings.
See https://github.com/golang/go/issues/8005#issuecomment-190753527 for details.
2016-03-04 16:57:24 +02:00
Aliaksandr Valialkin ad8f9d1f6f Issue #57: Exported AppendNormalizedHeaderKey 2016-02-25 21:28:13 +02:00
Aliaksandr Valialkin dd6954f4b2 Issue #57: Server: added ability to disable header names' normalizing 2016-02-25 14:00:04 +02:00
Aliaksandr Valialkin 714b45e4c7 Print only the first 200 and the last 200 bytes of the buffer on error during headers' reading 2016-02-18 15:57:34 +02:00
Aliaksandr Valialkin 320182f734 Return more clear error message when headers don't fit read buffer size 2016-02-18 15:33:30 +02:00
Aliaksandr Valialkin fd2887a5fc Issue #53: Clarify that the following instances mustn't be used from concurrently running goroutines: Args, Cookie, URI, RequestCtx, Request, Response, RequestHeader and ResponseHeader 2016-02-17 11:45:21 +02:00
Aliaksandr Valialkin 445fb8a9ae header: skip trailing CRLFs after request/response bodies 2016-02-16 19:37:51 +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 52ddf98cfd Fixed golint warnings 2016-01-19 12:43:23 +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 81b5321d14 Removed misleading ConnectionCloseReal method from RequestHeader 2016-01-17 00:43:34 +02:00
Sebastian Schepens fa88c5b853 Don't assume Content-Encoding: identity when request is 1xx, 204 or 304 2016-01-12 15:23:14 -03:00
Aliaksandr Valialkin 3bd3552062 Added ResetConnectionClose() to RequestHeader and ResponseHeader 2016-01-08 13:43:44 +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 2ff945b9ea Properly reset scratch buffer for header values 2016-01-05 14:30:05 +02:00
Aliaksandr Valialkin 8a83396595 FS: added support for byte range requests 2016-01-05 14:05:07 +02:00
Aliaksandr Valialkin 69a05ffcaf Issue #28: do not set default Content-Type for empty response 2016-01-04 14:56:49 +02:00
Aliaksandr Valialkin e5d7485342 truncate raw headers buffer before passing to readRawHeaders 2015-12-31 15:37:41 +02:00
Aliaksandr Valialkin da83f137b7 Added SetMultipartFormBoundary* to RequestHeader 2015-12-31 14:20:21 +02:00
Aliaksandr Valialkin 9074415b7a Microoptimization for RequestHeader.IsGet() 2015-12-25 16:09:15 +02:00
Aliaksandr Valialkin 149f0f38b7 Issue #14: added CompressHandler wrapper for transparent response compression support 2015-12-25 13:33:01 +02:00
Aliaksandr Valialkin 5ff6be8fee Substitute AppendBytesStr by append() 2015-12-19 20:38:10 +02:00
Aliaksandr Valialkin ddfa9f5dc0 Clarify Append* return values 2015-12-19 20:29:17 +02:00
Aliaksandr Valialkin 495e130b8f Issue #16: support 'Connection: keep-alive' header for non-http/1.1 requests and/or responses 2015-12-10 11:19:34 +02:00
Aliaksandr Valialkin 9c18f79145 Added support for If-Modified-Since to SendFile and FS 2015-12-09 18:51:51 +02:00
Aliaksandr Valialkin 4ac44f0c6c Mention which structs are safe for use from concurrently running goroutines (Server, Client and HostClient) and which structs are unsafe to use from concurrently running goroutines - all the other 2015-12-03 13:38:59 +02:00
Aliaksandr Valialkin fe212fe380 Issue #6: Add support for PATCH method and other methods which may contain body 2015-12-02 20:17:50 +02:00