Commit Graph

132 Commits

Author SHA1 Message Date
Aliaksandr Valialkin b00a213a93 Moved ctx.UserValue from standard map to custom userData. This should improve its' performance for common case when ctx contains up to 10 user values 2015-12-11 16:40:55 +02:00
Aliaksandr Valialkin 400114e9fe Added RequestCtx.NotFound() helper 2015-12-10 13:22:23 +02:00
Aliaksandr Valialkin 1f36aa1f8f clarify on why 'Connection: close' response header is set only for non-http/1.1 requests 2015-12-10 11:56:23 +02:00
Aliaksandr Valialkin 71e8c28a95 Issue #16: properly set 'Connection' response header 2015-12-10 11:47:25 +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 1a06baebe3 Refer to SetBodyStreamWriter from SetBodyStream docs 2015-12-09 16:34:50 +02:00
Aliaksandr Valialkin 52999aff94 Added SetBodyStreamWriter for streaming response body 2015-12-09 16:33:07 +02:00
Aliaksandr Valialkin 5f157c097e Added UserAgent helper to RequestCtx 2015-12-09 13:48:33 +02:00
Aliaksandr Valialkin 6ad39dad61 Added SendFile to Response 2015-12-09 13:47:11 +02:00
Aliaksandr Valialkin bc50b11813 Added AppendBody and SetBodyString helper methods to Request and Response 2015-12-09 13:43:06 +02:00
Aliaksandr Valialkin 42802cc79f Spelling fix 2015-12-08 15:21:09 +02:00
Aliaksandr Valialkin 9bac0d4123 Added RequestCtx.SendFile() 2015-12-08 15:18:21 +02:00
Aliaksandr Valialkin ff63733774 Removed LimitedReader wrapper in writeBodyFixedSize, since it prevents sendfile triggering for FSHandler 2015-12-08 11:50:04 +02:00
Aliaksandr Valialkin 019996b9ea Added ListenAndServeUNIX 2015-12-07 16:30:14 +02:00
Aliaksandr Valialkin fab86ba9b4 Mention TimeoutError exception, which may be called when other goroutines access RequestCtx 2015-12-03 13:42:08 +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 0b6cc4cbad Issue #13: add a (k,v) storage inside RequestCtx for user values, which may pass between middlewares 2015-12-02 20:32:49 +02:00
Aliaksandr Valialkin 1ddca5dc04 Added ResetBody 2015-12-02 08:36:31 +02:00
Aliaksandr Valialkin 07a8bf90b4 Properly remove hijack hander from RequestCtx 2015-11-29 22:36:49 +02:00
Aliaksandr Valialkin 4cf82252e3 Added ability to filter out non-GET requests 2015-11-29 12:49:01 +02:00
Aliaksandr Valialkin fb07cbbd31 Signify that Request and Response from RequestCtx and Header from Request and Response mustn't be copied by value 2015-11-29 12:18:33 +02:00
Aliaksandr Valialkin 1364e4c206 Added IsPut to RequestCtx to be consistent with IsGet and IsPost 2015-11-29 11:37:05 +02:00
Aliaksandr Valialkin d8c882d360 scalability improvement: initialize RequestCtx.id only when creating new RequestCtx obect. This should reduce globalCtxID contention 2015-11-28 17:23:53 +02:00
Aliaksandr Valialkin a5a2571194 scalability improvement: make firstByteReader's pool per-server 2015-11-28 17:14:32 +02:00
Aliaksandr Valialkin 78f1cc863a hijack scalability improvement: make hijacked conn per-server 2015-11-28 17:12:01 +02:00
Aliaksandr Valialkin 8563a2e762 Follow redirects in client Get* and Post* methods. Added Redirect method to RequestCtx. 2015-11-28 14:47:19 +02:00
Aliaksandr Valialkin d7ecf59c5d Added Request.RemoveMultipartFormFiles for removing temporary files created during reading multipart/form-data request 2015-11-28 10:32:55 +02:00
Aliaksandr Valialkin cc79b27b51 Imporoved multipart/form-data support.
* The server automatically deletes temporary uploaded files after returning
  from RequestHandler.
* Multipart data is automatically streamed into temporary files on request
  reading. This limits memory usage for big file uploads.
2015-11-28 10:18:03 +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 c695c83986 Added RequestCtx.IsTLS, which may be used for determining whether the connection is encrypted 2015-11-26 18:55:26 +02:00
Aliaksandr Valialkin 8b00288e0a Skip br.Buffered() verification, since it is guaranteed it is higher than 0 if br != nil 2015-11-26 12:22:24 +02:00
Aliaksandr Valialkin 9e35210a5a Fixed possible data race on RequestCtx.TimeoutError if connection's buffered reader is attached to ctx.fbr 2015-11-24 16:56:29 +02:00
Aliaksandr Valialkin 6a90e62dd3 Fixed data race when hijacked conn is backed by firstByteReader, which is attached to RequestCtx 2015-11-24 15:42:52 +02:00
Aliaksandr Valialkin 45ed911251 Improved RequestCtx.Hijack() - now HijackHandler works with the real net.Conn instead of fake io.ReadWriter. Also reduced memory usage by releasing empty read buffers on hijacked connections 2015-11-24 13:55:00 +02:00
Aliaksandr Valialkin 146145240d Added RequestCtx.Hijack() for connections' hijacking 2015-11-23 19:41:43 +02:00
Aliaksandr Valialkin 1fb0888104 Moved ErrKeepaliveTimeout to ServeConn errors section 2015-11-23 14:21:31 +02:00
Aliaksandr Valialkin a81d93c2ae Added ability to limit keep-alive connection lifetime 2015-11-23 14:17:49 +02:00
Aliaksandr Valialkin 70269b237a Clarified that ReduceMemoryUsage may be used when serving more than 1M concurrent mostly idle keep-alive connections 2015-11-23 13:14:57 +02:00
Aliaksandr Valialkin 49a2103c07 Clear ctx in Server.serveConn while waiting for the next request in acquireByteReader(). This should help GC collecting ctx objects 2015-11-23 12:18:53 +02:00
Aliaksandr Valialkin 351cfa1153 Added ReduceMemoryUsage option to Server 2015-11-22 14:39:41 +02:00
Aliaksandr Valialkin 46ac549ae1 Access URI members via accessors 2015-11-22 13:05:24 +02:00
Aliaksandr Valialkin a862d8592a Documentation update 2015-11-22 06:33:58 +02:00
Aliaksandr Valialkin 14fcfcd65b Properly track connection start time and per-connection request num 2015-11-22 04:34:26 +02:00
Aliaksandr Valialkin 6be8800950 Properly keep request start time in acquireByteReader 2015-11-22 04:11:37 +02:00
Aliaksandr Valialkin a8bfab03d8 API prettifying: ServeConnTime -> ConnTime, ServeConnRequestNum -> ConnRequestNum 2015-11-22 01:29:42 +02:00
Aliaksandr Valialkin 0109f3a8d6 Defer allocating RequestCtx if requests' frequency on keep-alive connection is less than 1 HZ (1 req/s). This reduces memory usage for servers with a million of concurrent connections with infrequent requests 2015-11-22 01:22:31 +02:00
Aliaksandr Valialkin 5af424687b Removed obsolete comment 2015-11-22 00:41:34 +02:00
Aliaksandr Valialkin 2b1eca3a70 Optimize request uri parsing - defer Host header reading 2015-11-19 15:05:27 +02:00