Commit Graph

110 Commits

Author SHA1 Message Date
Aliaksandr Valialkin 86115595ab Allow setting body length for Response.BodyStream via ResponseHeader.ContentLength 2015-11-12 13:30:27 +02:00
Aliaksandr Valialkin d30241c539 Added Get() to http client 2015-11-11 20:00:08 +02:00
Aliaksandr Valialkin 07e319a14f Move request validation and preparation down the stack to HostClient 2015-11-11 19:34:42 +02:00
Aliaksandr Valialkin 6bb8d1108f Initial implementation of http client 2015-11-11 19:17:51 +02:00
Aliaksandr Valialkin 5460e53c17 Subsitute empty RequestURI with slash 2015-11-11 19:15:54 +02:00
Aliaksandr Valialkin f4223fbb70 Added missing unlock when stopping worker pool 2015-11-11 18:08:15 +02:00
Aliaksandr Valialkin 2ae796311b Cleanup: removed dubious and hard-to-use-properly ReadTimeout from Request and Response. Use SetReadDeadline on the underlying conn instead 2015-11-11 16:52:32 +02:00
Aliaksandr Valialkin 429d60e13a ErrReadTimeout -> ErrTimeout 2015-11-11 16:44:53 +02:00
Aliaksandr Valialkin a4e8e226ff Removed dubious loop for obtaining free worker - just increase the number of workers if 'no free workers' error occur 2015-11-11 16:39:59 +02:00
Aliaksandr Valialkin 69758b81d6 Accept net.Conn instead of io.ReadWriteCloser in Serve*() methods, since in reality we use net.Conn methods such as RemoteAddr, SetReadDeadline and SetWriteDeadline 2015-11-11 16:17:12 +02:00
Aliaksandr Valialkin ae6a7cc17c Extracted workerPool from server.go into workerpool.go 2015-11-11 15:27:27 +02:00
Aliaksandr Valialkin 02d312eb54 Added BodyStream to Response, so RequestHandler may set BodyStream instead of Body when it needs response body streaming 2015-11-11 12:54:49 +02:00
Aliaksandr Valialkin 89e1feae77 Reference TimeoutHandler in RequestHandler docs 2015-11-11 11:42:17 +02:00
Aliaksandr Valialkin 0d0e179d7b Added RequestCtx.SetResponseBody helper function 2015-11-11 11:09:31 +02:00
Aliaksandr Valialkin 04ec7b22d0 Added a test for AppendHTTPDate 2015-11-11 11:04:54 +02:00
Aliaksandr Valialkin 9735e0127b Exported ParseUint, ParseUfloat and AppendHTTPDate, which may be frequently used in http apps 2015-11-11 11:00:22 +02:00
Aliaksandr Valialkin ad3452a2e5 Removed dubious Cache from RequestCtx - use sync.Pool instead 2015-11-11 10:47:16 +02:00
Aliaksandr Valialkin b6adf1cd39 Clean least recently used workers in a separate goroutine. This cleans stale workers even on idle server 2015-11-10 17:59:19 +02:00
Aliaksandr Valialkin da671de3ad Fixed a typo 2015-11-10 17:42:35 +02:00
Aliaksandr Valialkin 8c92324ef2 Copy cookies in headers' CopyTo() method 2015-11-10 17:39:28 +02:00
Aliaksandr Valialkin d4e9c2ea22 Allow setting cookies via headers' Set*() methods 2015-11-10 17:09:12 +02:00
Aliaksandr Valialkin a658557d83 Re-use VisitAll in Len implementation of ResponseHeader/RequestHeader 2015-11-10 16:52:32 +02:00
Aliaksandr Valialkin 980beca55b Added Len() to RequestHeader and ResponseHeader 2015-11-10 16:50:36 +02:00
Aliaksandr Valialkin 6bfe7306fa Do not skip cookies when calling VisitAll() on RequestHeader/ResponseHeader 2015-11-10 16:31:17 +02:00
Aliaksandr Valialkin fa05bcd728 Server worker pool optimization - now incoming connections are served by workers in 'most recently used worker' order. This should keep CPU caches hot 2015-11-10 15:24:36 +02:00
Aliaksandr Valialkin 8081e14ca0 Use perIPConn pool 2015-11-10 15:20:13 +02:00
Aliaksandr Valialkin 84b9f9e30a Increase server concurrency in timing tests 2015-11-10 15:19:08 +02:00
Aliaksandr Valialkin e7b70f2c8a Fixed doc typos 2015-11-10 12:46:36 +02:00
Aliaksandr Valialkin a0ee798bbe Added RequestCtx.Init() helper for custom Server implementations 2015-11-09 18:41:27 +02:00
Aliaksandr Valialkin 04b68cd1f5 Export DefaultConcurrency 2015-11-09 17:10:27 +02:00
Aliaksandr Valialkin 827b8b1e82 Added TimeoutErrMsg() function to RequestCtx for determining the last error message set via TimeoutError call 2015-11-09 17:06:50 +02:00
Aliaksandr Valialkin 0f67cb2ee4 Added CopyTo() to Request and Response 2015-11-09 16:46:41 +02:00
Aliaksandr Valialkin 3aa2987131 Substituted RequestCtx.shadow with more clear timeoutErrMsg 2015-11-09 11:03:50 +02:00
Aliaksandr Valialkin e8bd4f1d82 Do not allocate memory for msg in RequestCtx.Error 2015-11-09 10:45:33 +02:00
Aliaksandr Valialkin 964f640cd1 gofmt 2015-11-09 10:43:17 +02:00
Aliaksandr Valialkin 9200e02eb5 Consistency fix: readersPool->readerPool, writersPool->writerPool 2015-11-09 10:42:09 +02:00
Aliaksandr Valialkin 4c2a55ed12 Set default user-agent in http request 2015-11-08 21:58:46 +02:00
Aliaksandr Valialkin e8ffadf2df Moved currentTime variable ouside request processing loop 2015-11-07 11:09:41 +02:00
Aliaksandr Valialkin 03f8f2408e Increment request id and initialize request time before request reading, so log messages contain correct id and duration for request read errors 2015-11-06 16:34:16 +02:00
Aliaksandr Valialkin 5a6e973ab3 Log request duration in RequextCtx.Logger() 2015-11-06 16:21:49 +02:00
Aliaksandr Valialkin f1ff68f9f1 Optimized args, cookies and headers parsing 2015-11-05 14:28:07 +02:00
Aliaksandr Valialkin 9fc0d48181 Added benchmarks for header reading 2015-11-05 14:26:16 +02:00
Aliaksandr Valialkin 227b0a4bd3 Trim input buffer inside decodeArg 2015-11-05 13:10:56 +02:00
Aliaksandr Valialkin 44826d0838 Improved Args parsing speed 2015-11-05 13:03:47 +02:00
Aliaksandr Valialkin bb73a5cbfa Trim dst buffer inside decodeCookieArg. This simplifies the code 2015-11-05 12:55:43 +02:00
Aliaksandr Valialkin 236d4bd461 Added Cookie.ParseBytes to be consistent with Args 2015-11-05 12:54:10 +02:00
Aliaksandr Valialkin 6fb8b96152 Increased cookies' parsing performance 2015-11-05 12:47:30 +02:00
Aliaksandr Valialkin dfec0d9d36 Eliminated redundant memory allocation during cookie expiration time parsing 2015-11-05 12:12:15 +02:00
Aliaksandr Valialkin 87105b99cb Added response cookies support 2015-11-05 12:07:54 +02:00
Aliaksandr Valialkin a7fdc68be0 Enforce MaxConnsPerIP limit to connections served via Server.ServeConn() 2015-11-05 10:56:04 +02:00