Commit Graph

59 Commits

Author SHA1 Message Date
Pavel Krymets d3694f085a Add IHttpParser interface (#1414) 2017-03-01 11:55:36 -08:00
Cesar Blum Silveira 568aaff9c4 Improve HTTP parsing tests (#1393).
- Add several more test cases
- Share data between functional and unit tests
2017-02-28 14:23:27 -08:00
David Fowler c6705d8693 Convert TakeStartLine and TakeMessageHeaders to be state machines (#1401)
- Less passes over the buffer
- Single pass to find all start line delimiters instead
of calling IndexOf multiple times.
- Made TakeStartLine and TakeMessageHeaders a state machine
- Only check length against remaining bytes once
- Change variable names to match TakeStartLine
- Use ReadableBuffer.First.Span instead of ToSpan()
- Added test for missing path with a querystring
2017-02-27 11:55:30 -08:00
David Fowler 5692f51bf7 Revert "Revert "Use Spans to parse the start line and headers (#1394)""
This reverts commit 19c3107deb.
2017-02-24 10:22:05 -08:00
David Fowler 19c3107deb Revert "Use Spans to parse the start line and headers (#1394)"
This reverts commit 8140b8cdfe.
2017-02-24 10:03:32 -08:00
David Fowler 8140b8cdfe Use Spans to parse the start line and headers (#1394)
* Use Spans to parse the start line and headers
- Use `Span<byte>` to parse the start line and headers
2017-02-23 23:02:29 -08:00
Stephen Halter 7d3bcd2bf8 Avoid unobserved exceptions
- Don't throw from AdaptedPipeline.ReadInputAsync
- Watch for unobserved exceptions in SampleApp
2017-02-22 16:12:20 -08:00
Pavel Krymets 824ef2c937 Input Pipeline migration (#1277) 2017-02-17 15:38:13 -08:00
Ben Adams ecca980c91 Implement IHeaderDictionary.ContentLength 2017-01-24 14:55:48 -08:00
Cesar Blum Silveira 89a63d190e Don't close connection when Content-Length set but no bytes written. 2017-01-12 12:38:15 -08:00
Cesar Blum Silveira e26f91a392 Call OnStarting before verifying response length (#1289). 2017-01-10 14:24:44 -08:00
John Luo 57b368566d Use StatusCode instead of three digit numbers for status codes 2017-01-09 10:09:54 -08:00
Stephen Halter 2351c1b558 Create a direct way to configure Kestrel endpoints
- Replace endpoint configuration via .UseUrls() or --server.urls with Listen*
  methods on KestrelSerrverOptions.
- Replace IConnectionFilter with IConnectionAdapter which no longer exposes
  ServerAddress via a context.
- Simplify libuv Listener classes
- Support systemd socket activation
- Add docker-based test for systemd socket activation to be run on Travis
2017-01-06 17:37:58 -08:00
Cesar Blum Silveira cedbe76f52 Abort request on client FIN (#1139). 2016-12-13 12:03:33 -08:00
Cesar Blum Silveira defcbdb907 Revert "Add MaxRequestBodySize limit (#478)."
This reverts commit e53a87be9c.
2016-12-09 16:30:12 -08:00
Cesar Blum Silveira e53a87be9c Add MaxRequestBodySize limit (#478). 2016-12-05 17:06:57 -08:00
Pavel Krymets e55c62444b Refactor FrameTests and rename SocketInput SocketOutput properties (#1229) 2016-11-22 16:36:36 -08:00
Ben Adams 2bf5a966cd Fast path and inline HttpVersion.set 2016-11-22 15:26:38 -08:00
Ben Adams 2eba4017c1 MemoryPoolIterator feedback 2016-11-21 22:48:58 +00:00
Ben Adams 12e2f30577 MemoryPoolIterator byref structs 2016-11-21 22:48:57 +00:00
Ben Adams 97d4406614 Use Vector<byte>.ctor workaround 2016-11-21 22:48:57 +00:00
Stephen Halter c0e75dcbf8 Always flush headers on first response write (#1202). 2016-11-09 13:59:12 -08:00
Stephen Halter 0d559468f1 Make connection reset logs less scary
- Particularly between requests, connection resets aren't that abnormal.
2016-11-04 21:36:51 -07:00
Cesar Blum Silveira a83bbcfba7 Prevent block leak when socket is closed before connection filter is applied. 2016-11-04 20:56:01 -07:00
Stephen Halter b3aca0413c Avoid zero-length writes to flush connection filter stream
- This works around a zero-length write bug in SslStream.
- We already assume connection filter streams auto flush.

#1195
2016-11-04 15:43:35 -07:00
Cesar Blum Silveira 29408956f9 Handle tokens in Transfer-Encoding header (#1181). 2016-10-31 13:57:34 -07:00
Cesar Blum Silveira 1ffad5ca38 Handle multiple tokens in Connection header (#1170). 2016-10-27 12:19:43 -07:00
Cesar Blum Silveira d64b4c7acb Control-flow simplification in Frame.CreateResponseHeader() (#1168). 2016-10-24 11:07:06 -07:00
Cesar Blum Silveira 78584799a4 Separate request rejection from bad request state setting. 2016-10-17 15:16:50 -07:00
Mike Harder f1071dea50 Set StatusCode before disposing HttpContext (#876) 2016-10-17 15:16:43 -07:00
Cesar Blum Silveira ffc3eb3afd HEAD response can include Content-Length header. 2016-10-12 11:38:18 -07:00
Cesar Blum Silveira f8813a600d Handle response content length mismatches (#175). 2016-10-11 13:25:22 -07:00
Cesar Blum Silveira 3177ba0aae Wait for frame loop completion to dispose connection stream (#1156). 2016-10-10 10:16:03 -07:00
Cesar Blum Silveira a2439105ae Refactor request line validation and error reporting (#1116). 2016-10-03 16:54:51 -07:00
Cesar Blum Silveira 4117ad8a1e Refactor non-body response handling.
- Add functional tests
- Remove BadHttpResponse, ResponseRejectionReasons and TestFrameProtectedMembers
- Chunk non-keepalive HTTP/1.1 responses
- Set _canHaveBody to true when StatusCode == 101
- Add test to check that upgraded connections are always closed when the app
  is done
- Log writes on responses to HEAD requests only once.
2016-10-03 16:46:59 -07:00
Ben Adams e7e6b896ba Don't emit TE header or body for non-body responses 2016-10-03 15:54:14 -07:00
Ben Adams 310411075f Slimmer locks 2016-09-28 15:33:34 -07:00
Cesar Blum Silveira 0312da7df3 Add request headers timeout (#1110). 2016-09-27 17:08:02 -07:00
Cesar Blum Silveira 375e8b7022 Change context relationships from inheritance to composition. 2016-09-27 11:53:06 -07:00
Cesar Blum Silveira 49ff98f8cb More specific response status codes for errors (#653).
- 414 when request line exceeds size limit
- 431 when request headers exceed size or count limits
- 505 when request line contains unsupported HTTP version
2016-09-22 12:13:14 -07:00
Cesar Blum Silveira 1a273f5a34 Improve keep-alive timeout.
- Track time more accurately
- Control timeout in Connection instead of Frame
2016-09-14 20:57:16 -07:00
Cesar Blum Silveira 8c513402a3 Always call ConsumingComplete() with furthest examined position (#1095). 2016-09-10 20:05:14 -07:00
Pavel Krymets c777a9efea Use TaskCache class from Microsoft.Extensions.TaskCache.Sources (#1089)
Instead of Task.FromResult(0)
2016-09-09 15:57:33 -07:00
Cesar Blum Silveira f2085b1968 Add keep-alive timeout (#464). 2016-09-06 12:48:47 -07:00
Stephen Halter 972be6e8c1 Disable automatic chunking for all non keep-alive requests
- Fixes a bug where Upgrade requests (e.g. WebSockets) would be chunked
- Allows chunking to be disabled by setting "Connection: close" on the response
2016-08-17 12:39:18 -07:00
Stephen Halter 16fbb94c44 Automatically chunk and set 0 Content-Length for non keep-alive responses 2016-08-15 16:27:54 -07:00
Stephen Halter 5f4e60bf8d Always set "Connection: close" header for non keep-alive responses 2016-08-15 16:27:54 -07:00
Cesar Blum Silveira 08a91f17bf Call OnStarting and OnCompleted callbacks in LIFO order (#1042). 2016-08-10 14:52:05 -07:00
Cesar Blum Silveira 08f98f4790 Add header limit options (#475). 2016-08-09 12:31:39 -07:00
Cesar Blum Silveira a5aacd6307 Throw when setting OnStarting after response has already started (#806). 2016-08-08 11:38:06 -07:00