Commit Graph

100 Commits

Author SHA1 Message Date
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
Aliaksandr Valialkin 954a0615dc Fixed a typo in RequestCtx.SetConnectionClose() 2015-11-19 11:51:04 +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 548333e1c4 Added Write() function to RequestCtx for populating response body 2015-11-18 14:20:39 +02:00
Aliaksandr Valialkin 86fe38c7a2 Hide Respone and Request body behind Body accessors 2015-11-18 14:00:24 +02:00
Aliaksandr Valialkin 3ee3da595e Added Response.SetStatusCode 2015-11-18 13:51:04 +02:00
Aliaksandr Valialkin 6d16259215 Added SetBody and SetBodyStream methods to Response and RequestCtx 2015-11-18 13:49:23 +02:00
Aliaksandr Valialkin 5c3b0287db API simplification: SetResponseBody -> SetBody 2015-11-18 13:33:29 +02:00
Aliaksandr Valialkin c9ec8e85e0 Added MaxrequestsPerConn limit to Server 2015-11-17 16:39:45 +02:00
Aliaksandr Valialkin f3b4ff17b1 Added accessors for determining ServeConn call start time and the sequence number of request served in the connection 2015-11-17 16:29:14 +02:00
Aliaksandr Valialkin 2eff1422af Added referer accessor to RequestHeader 2015-11-17 13:47:00 +02:00
Aliaksandr Valialkin 2499cde277 Added referer accessor to RequestCtx 2015-11-17 13:42:05 +02:00
Aliaksandr Valialkin 800fe1306b Server microoptimization: check response's 'connection: close' first 2015-11-17 11:38:25 +02:00
Aliaksandr Valialkin 0e2c4013f7 Added ID accessor to RequestCtx 2015-11-17 09:47:17 +02:00
Aliaksandr Valialkin 89263fc064 Added Time accessor to RequestCtx 2015-11-17 09:45:41 +02:00
Aliaksandr Valialkin bf4ed1ad76 typo fix 2015-11-16 19:32:21 +02:00
Aliaksandr Valialkin 265b6163f7 Added StatusCode and content-type accessors to RequestCtx 2015-11-16 19:31:50 +02:00
Aliaksandr Valialkin 2dbf142a06 convert connectionClose to accessor 2015-11-16 18:23:08 +02:00
Aliaksandr Valialkin 35bf5aa661 Access ResponseHeader.server via Server accessor 2015-11-16 16:13:57 +02:00
Aliaksandr Valialkin 230a396384 Hide URI.QueryArgs behind accessor, which automatically parses query args 2015-11-15 23:51:13 +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 1c19e5f2c1 do not trim big body buffers - they should be handled by GC 2015-11-14 21:13:04 +02:00
Aliaksandr Valialkin c01be3ee99 Panic if net.Listener returns (nil, nil) 2015-11-14 20:09:15 +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
Aliaksandr Valialkin 1f81c87c38 Substituted direct access to Request.Method by accessors, so package users don't shoot in the foot when assigning directly to Request.Method 2015-11-14 17:34:12 +02:00
Aliaksandr Valialkin 5eb991ed31 Added Concurrency parameter to Server 2015-11-14 14:54:45 +02:00
Aliaksandr Valialkin be5a9ddeaf Added helper functions to RequestCtx 2015-11-13 19:32:33 +02:00
Aliaksandr Valialkin 1bbce02863 Added IsGet(), IsPost() and IsHead() helpers to RequestCtx 2015-11-13 16:10:22 +02:00
Aliaksandr Valialkin fd177d7f63 Added global Serve* helpers 2015-11-13 15:08:22 +02:00
Aliaksandr Valialkin efbdc8fa7f Added ListenAndServe and ListenAndServeTLS helper functions to Server 2015-11-12 23:21:46 +02:00
Aliaksandr Valialkin 3f0794bcd1 Added RequestCtx.LocalAddr() for determining server address for the current connection 2015-11-12 21:50:44 +02:00