Commit Graph

1253 Commits

Author SHA1 Message Date
arespr 96fead6282 better GetKnownMethodIndex, unit tests, benchmark repair 2017-03-02 20:58:18 +01:00
David Fowler ca31627a5e Parser clean up (#1419)
- Remove stackalloc
- Remove extra Move in ParseRequestLine
2017-03-01 22:33:37 -08:00
Pavel Krymets f2a00da811 Loop over bytes inside states of parser state machine (#1417) 2017-03-01 18:18:34 -08:00
arespr b89415d9b2 knownmethods optimizations 2017-03-02 03:10:00 +01:00
David Fowler cb6059c143 Make the IHttpParser per frame and add a reset (#1415)
* Make the IHttpParser per frame and add a reset
- Made the IHttpParser a per frame object so state can be stored
across method calls and parses.
- Added HttpParserFactory to ServiceContext
2017-03-01 13:12:03 -08:00
Pavel Krymets d3694f085a Add IHttpParser interface (#1414) 2017-03-01 11:55:36 -08:00
Krzysztof Cwalina c56de066d3 Optimized parsing GET verb and version (#1399)
* Optimized parsing GET verb
* optimized http version parsing
* Added microbenchmarks for GetKnownMethod and GetKnownVersion
2017-02-28 17:02:52 -08:00
John Luo 6ad9f3e8b0 Reacting to HeaderUtitilities renames 2017-02-28 14:50:02 -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
Stephen Halter fde0f6b2fc Add an option to Kestrel to disable threadpool dispatching 2017-02-28 10:14:58 -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 39b536b402 Don't treat canceled reads as end of input 2017-02-23 10:05:53 -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
David Fowler ba549502e1 Use the IThreadPool as the ReaderScheduler (#1372)
- This is what socket input did, also using
ThreadPool.QueueUserWorkItem is better than Task.Run for this
scenario and avoids a bunch of overhead.
2017-02-21 21:09:23 -08:00
Pavel Krymets 824ef2c937 Input Pipeline migration (#1277) 2017-02-17 15:38:13 -08:00
Nate McMaster 932b6ed53a
Cleanup MSBuild conversion
Remove runtimeconfig.template.json
Remove ToolsVersion attribute
Use repo.targets instead of makefile.shade
Rename code gen app to shorter name
Use GetOSPlatform task
Upgrade tests to .NET Framework 4.5.2
Cleanup solution configurations. Set the class libraries to AnyCPU even when on the x86 or x64 solution config.
2017-02-16 09:44:58 -08:00
Nate McMaster 708630fd23 Downgrade to stable packages 2017-02-15 14:22:38 -08:00
Stephen Halter e9e0cf7325 Prevent ODE when ReadStart/Stop() is queued after disposal 2017-02-07 00:26:05 -08:00
Stephen Halter 5124adf450 Better report Kestrel crashing errors 2017-02-07 00:26:00 -08:00
Cesar Blum Silveira 1a2c438899 Upgrade to RC.3 2017-01-31 16:23:23 -08:00
Ben Adams ecca980c91 Implement IHeaderDictionary.ContentLength 2017-01-24 14:55:48 -08:00
Ben Adams cac6ade7c9 Implement Stream Flush+FlushAsync fully
Streams should pass through the flush and not assume the underlying
Stream's Flush behaviour
2017-01-23 13:51:57 +00:00
Stephen Halter f32058c5c3 Warn instead of throw when ignoring IServerAddressesFeature
- Throwing could be too much when IServerAddressesFeature URLs come from VS
- Listen on 127.0.0.1:5000 by default

https://github.com/aspnet/Hosting/issues/917
2017-01-19 11:36:19 -08:00
Stephen Halter c4762cdfd5 Better handle OnHeartbeat in 32-bit environments
- Prevent potential overflow when casting a long to an IntPtr
2017-01-17 16:57:52 -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
Cesar Blum Silveira 6d7ddc45ef Fix deadlock in SocketOutput (#1278). 2017-01-06 20:33:35 -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 b46e48fe01 Merge branch 'yves57/stringvalues-for' into dev 2016-12-28 14:44:46 -08:00
Pranav K 5b8f7c2b2b Updating to 4.4 CoreFx packages 2016-12-21 22:22:13 -08:00
Cesar Blum Silveira b41c4078bd Abort connections not closed during shutdown (#1112). 2016-12-20 14:44:34 -08:00
Pavel Krymets 8b44e8e382 Prevent closure allocations in OnHeartbeat (#1261) 2016-12-16 14:42:30 -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
John Luo 859816bb53 Update ParseContentLength to remove unnecessary casting and unsafe 2016-12-09 11:39:25 -08:00
John Luo 4da06e8acd Move Int64 parsing logic to HttpAbstractions 2016-12-08 17:22:21 -08:00
Cesar Blum Silveira e53a87be9c Add MaxRequestBodySize limit (#478). 2016-12-05 17:06:57 -08:00
Yves57 dbaa01830b Replace 'foreach' by 'for' in StringValues (faster) 2016-11-29 22:33:18 +01:00
Cesar Blum Silveira f918279873 Merge branch 'khellang/proxy-authenticate-typo' into dev 2016-11-29 10:32:16 -08:00
Chris R 53e5c3d56c #1001 don't log stack traces for localhost bind failures. 2016-11-28 16:35:14 -08:00
Kristian Hellang e316898c9f Added missing copyright header 2016-11-23 09:17:03 +01: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
Kristian Hellang a0f5585d3f Fixed typo; Proxy-Authenticate #1223 2016-11-22 13:08:17 +01:00
Ben Adams 2eba4017c1 MemoryPoolIterator feedback 2016-11-21 22:48:58 +00:00
Ben Adams ef5ad3deea defaullt(MemoryPoolIterator) test coverage 2016-11-21 22:48:58 +00:00
Ben Adams 2011a27bde Use ternary op rather than lazy and 2016-11-21 22:48:57 +00:00
Ben Adams 8ce47fb8b6 Move perf, share code 2016-11-21 22:48:57 +00:00
Ben Adams 5041d6c291 wasLastBlock adjustments 2016-11-21 22:48:57 +00:00
Ben Adams 7ab4442392 Feedback + Cleanup 2016-11-21 22:48:57 +00:00
Ben Adams 4cdcca212e Don't inline slow paths 2016-11-21 22:48:57 +00:00
Ben Adams 12e2f30577 MemoryPoolIterator byref structs 2016-11-21 22:48:57 +00:00
Ben Adams 53f361160e MemoryPoolIterator fast paths 2016-11-21 22:48:57 +00:00
Ben Adams 8bcbfb9971 Only LocateFirstFoundByte once 2016-11-21 22:48:57 +00:00
Ben Adams 28a21fa7a9 Move vectors closer to use 2016-11-21 22:48:57 +00:00
Ben Adams 00a63537cf And=> xor, powerOfTwoToHighByte to const 2016-11-21 22:48:57 +00:00
Ben Adams 97d4406614 Use Vector<byte>.ctor workaround 2016-11-21 22:48:57 +00:00
Ben Adams 972d978d11 Swap for vector loop unroll detection 2016-11-21 22:48:57 +00:00
Ben Adams 9eb01d1c57 Reduce Vector register pressure by not overlapping 2016-11-21 22:48:57 +00:00
Ben Adams 4f7977d440 Use PowerOfTwoToHighByte for FindFirstEqualByte 2016-11-21 22:48:57 +00:00
Stephen Halter 0c26fc9f41 Merge branch 'rel/1.1.0' into dev 2016-11-11 15:16:48 -08:00
Stephen Halter f1d0fafaa4 Better filter clients connecting to Kestrel's dispatch pipes 2016-11-11 14:57:17 -08:00
Stephen Halter 4a1db74568 Merge branch 'rel/1.1.0' into dev 2016-11-09 14:29:31 -08:00
Stephen Halter e780ad9516 Ensure clients connecting to Kestrel's dispatch pipe are listeners 2016-11-09 14:26:47 -08:00
Pranav K 9d081d17e5 Updating versions to 1.2.0-* 2016-11-09 14:18:16 -08:00
Stephen Halter 757952d4d3 Always flush headers on first response write (#1202). 2016-11-09 14:02:50 -08:00
Stephen Halter c0e75dcbf8 Always flush headers on first response write (#1202). 2016-11-09 13:59:12 -08:00
Stephen Halter 194059a198 Implement Begin/End Read/Write methods in LoggingStream
- This allows the reads and writes from SslStream to be logged on desktop .NET
2016-11-04 21:38:57 -07: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
Cesar Blum Silveira a1c598733b Reject POST and PUT requests with no Content-Length or Transfer-Encoding (#1130). 2016-11-04 18:04:27 -07:00
jacalvar ed98894c93 Created public API baselines 2016-11-04 17:16:22 -07:00
Stephen Halter 6cbbb73ca7 Protect against NullReferenceException in Frame.StopStreams() 2016-11-04 16:01:07 -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
Pranav K 0dcfa2a3fd Updating to Libuv 1.9.1 2016-11-03 10:08:01 -07:00
Ben Adams 2adb6ff955 Interlocked.Read -> Volatile.Read 2016-11-01 18:06:00 -04:00
Cesar Blum Silveira 29408956f9 Handle tokens in Transfer-Encoding header (#1181). 2016-10-31 13:57:34 -07:00
Stephen Halter 5e97c63467 Throw PlatformNotSupportedException on big-endian platforms 2016-10-28 14:51:55 -07:00
Stephen Halter d475d41f71 Fix boundary cases in MemoryPoolIterator.(Try)PeekLong()
- Fix edge case where the iterator is at the very end of a block.
- Fix edge case where one bits where improperly filled in on a right shift.
- Don't use -1 to represent failure. Use bool and an out parameter instead.
2016-10-28 14:51:47 -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
Nathan Anderson 610601cc6e test fixes and whitespace changes to generated code 2016-10-20 15:23:03 -07:00
Nathan Anderson 11ed34f229 add header ordering and short circuits to known headers
refactor known header changes

- create template string from Append switch
- add a check to ClearFast to bail out if too many headers are set
2016-10-19 15:49:01 -07:00
Cesar Blum Silveira fff0adeaaf Faster response Content-Length parsing. 2016-10-18 15:57:40 -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 bf94f8526a Remove TCP Loopback Fast Path code (#1147). 2016-10-12 11:41:57 -07:00
Cesar Blum Silveira ffc3eb3afd HEAD response can include Content-Length header. 2016-10-12 11:38:18 -07:00
Stephen Halter ce6e65b1d7 Don't take SocketOutput's _contextLock to return written blocks 2016-10-11 16:39:13 -07:00
Cesar Blum Silveira a15b1e2805 Update cached Content-Length when setting raw header. 2016-10-11 13:55:05 -07:00
Cesar Blum Silveira f8813a600d Handle response content length mismatches (#175). 2016-10-11 13:25:22 -07:00
Cesar Blum Silveira 6c2532682a Merge branch 'benaadams/callstack' into dev 2016-10-10 14:42: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
Ben Adams adc3e63ecc Improve callstack for LoggingThreadPool 2016-10-08 05:14:00 +01:00
Kristian Hellang 03f8a7a217 Use HeaderUtilities.FormatDate in DateHeaderValueManager (#1132) 2016-10-06 11:56:49 -07:00
Cesar Blum Silveira 2c94884da9 Include address in error message when address already in use (#1086). 2016-10-05 14:23:09 -07:00
Pranav K 91497621c9 Updating partner package versions 2016-10-03 19:59:39 -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
Cesar Blum Silveira e8fa40235b Remove unused variable in MemoryPoolIterator.Seek() (#1137). 2016-10-03 14:22:10 -07:00
Mikael Mengistu 12adc7de9d Refactored to use the fields from the HttpMethods class
* Reacting to PR comments
2016-09-29 12:19:26 -07:00
Ben Adams 310411075f Slimmer locks 2016-09-28 15:33:34 -07:00
Cesar Blum Silveira 09fda749b0 Don't reset frame state when connection is aborted (#1103). 2016-09-28 15:06:22 -07:00
Cesar Blum Silveira 73656f6503 Assume zero length on non-keepalive requests without Content-Length or Transfer-Encoding (#1104). 2016-09-28 12:30:53 -07:00
Cesar Blum Silveira 0312da7df3 Add request headers timeout (#1110). 2016-09-27 17:08:02 -07:00
Stephen Halter 7b2f7b94ab Return last block from SocketOutput when data is fully written
- This reduces Kestrel's memory usage for idle connections.
2016-09-27 15:57:45 -07:00
Stephen Halter 0edf36bd21 Return last block from SocketInput when data is fully consumed
- This reduces Kestrel's memory usage for idle connections.
2016-09-27 15:57:45 -07:00
Cesar Blum Silveira 375e8b7022 Change context relationships from inheritance to composition. 2016-09-27 11:53:06 -07:00
David Fowler 78c859d7ea Turn on warnings as errors 2016-09-25 12:25:12 -07:00
David Fowler 67930753df Merge pull request #1123 from svick/sockaddr-sequential
Specify sequential layout to avoid warning
2016-09-25 10:49:10 -07:00
Petr Onderka 782f96572d Specify sequential layout to avoid warning 2016-09-25 18:13:42 +02: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
Stephen Halter 63509b9e10 Make FrameRequestStream.CopyToAsync(...) copyless
- Add tests for when the CopyToAsync destinationStream throws.
- Add test to verify the destination stream sees the same array written to by
  the producer.
2016-09-20 11:54:58 -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
Stephen Halter 2fbf0c6281 Merge branch 'DamirAinullin/single-initialize' into dev 2016-09-12 10:34:35 -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
DamirAinullin 0491b49268 Remove double initializing of variable _field3 2016-09-07 14:23:06 +03:00
Cesar Blum Silveira f2085b1968 Add keep-alive timeout (#464). 2016-09-06 12:48:47 -07:00
Cesar Blum Silveira 19f8958fa8 Move TestServer to shared directory. 2016-09-06 12:47:24 -07:00
David Fowler 6795ca2f78 Make the char array for utf8 decoding smaller 2016-08-31 18:54:15 -07:00
Stephen Halter 1ecef8094a Make Kestrel's response buffer limit configurable 2016-08-30 16:01:42 -07:00
Stephen Halter acfcafb6e1 Ensure MockLibuv.OnPostTask doesn't complete too early 2016-08-29 20:53:00 -07:00
Stephen Halter 0742d113be Make all calls to ThreadPool.QueueUserWorkItem through IThreadPool
- This allows SocketOutputTests to cause QUWI to exec synchronously
- To avoid allocations, the logger can't be captured making it "unsafe"
2016-08-29 20:52:47 -07:00
Stephen Halter 08d7f66108 Merge branch 'benaadams/less-unsafe' into dev 2016-08-26 14:44:18 -07:00
Ben Adams be51e5aecb Remove unneeded unsafe modifiers 2016-08-25 08:07:15 +01:00
Ben Adams 7dc0a8c7bd Return count from trywrite 2016-08-25 07:58:36 +01:00
Ben Adams af73e519c1 Comment inlinability changes 2016-08-25 07:53:01 +01:00
Ben Adams 40636998d7 Improve inlinability of libuv success checking 2016-08-21 13:48:35 +01:00
Stephen Halter 7bd30ea693 Log all startup errors in KestrelServer 2016-08-18 14:52:26 -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
Cesar Blum Silveira 140dc6fcf5 Add obsoletion reason for KestrelServerOptions.MaxRequestBufferSize. 2016-08-04 10:46:42 -07:00
Stephen Halter 9727a4db86 Improve the performance of connection filters
- Buffer connection filter input less by using ProducingStart/Complete
- Simplify FilteredStreamAdapter
2016-08-03 16:45:39 -07:00
Stephen Halter 5aee524768 Ensure Begin/End Read/Write methods are correctly implemented
- Add Begin/End Write methods to FrameResponseStream
- Fix state check of Begin/End Read methods in FrameRequestStream
2016-08-03 16:45:39 -07:00
Stephen Halter 4337d2a4a7 Implement Begin/End Read/Write methods in LibuvStream 2016-08-03 16:45:39 -07:00
Cesar Blum Silveira 8836eec7d8 Limit request line length (#784). 2016-08-03 15:39:16 -07:00
Stephen Halter dfe12223b8 Ensure HTTPS handshake errors aren't logged on socket close 2016-08-03 15:21:57 -07:00
Stephen Halter 1020d69171 Better logging for connection errors during HTTPS handshake 2016-08-03 11:15:15 -07:00
Mike Harder 4ece3f4b68 Change "String." to "string." to match coding convention 2016-08-01 11:09:31 -07:00
Stephen Halter 00a540dcb8 Merge branch 'benaadams/more-block-collect-info' into dev 2016-07-28 16:51:35 -07:00
Cesar Blum Silveira 2244f190e1 Merge branch 'benaadams/exceptions' into dev 2016-07-25 10:31:32 -07:00
Stephen Halter 3a67cb9df5 Merge branch 'benaadams/enum-rather-than-string' into dev 2016-07-25 10:30:33 -07:00
Stephen Halter b5c117695e Stop KestrelThreads in parallel 2016-07-25 10:29:01 -07:00
Stephen Halter dc12f3150e Wait for graceful shutdown now that it usually works
- Unreference the async handle to allow the loop to stop without walking first
- Wait before walking open handles to allow earlier uv_close calls to complete
2016-07-25 10:29:01 -07:00
Ben Adams 51288e13f8 Enum to singular 2016-07-22 22:25:03 +01:00
Ben Adams 0a1ea124ee Use HttpVersionType enum rather than string compare 2016-07-22 21:34:49 +01:00
Ben Adams 0620ce5a2f Consolidate BadHttpRequestException messages 2016-07-22 21:19:44 +01:00
Ben Adams 7c811ff568 Only allocate key string when unknown 2016-07-22 20:50:43 +01:00
Stephen Halter 27f8c8dca2 Ensure libuv handles get disposed properly after binding errors 2016-07-22 12:26:27 -07:00
David Fowler 0e7967a7fc Allocate things per KestrelThread instead of per listener
- Moved things that have loop affinity to KestrelThread like
WriteReqPool, MemoryPool and the ConnectionManager
- Changed on the listeners to only kill the ListenSocket, not the
connections on dispose
- Moved connection disposal to KestrelThread.Stop
- Simplify the connection manager logic so it's possible to walk and
wait in a single call
2016-07-21 22:17:18 -07:00
Stephen Halter 24fa5c0264 Merge pull request #938 from NVentimiglia/dev
As an American, I had to correct the spelling of 'independent'
2016-07-21 17:17:47 -07:00
Cesar Blum Silveira 3c0e0f8d88 Always throw same exception type on read after connection error (#975). 2016-07-21 16:33:56 -07:00
Pavel Krymets 6bcf7643df Do not allocate large write task queues (#1005) 2016-07-21 16:05:50 -07:00
Pavel Krymets 7b7e2889ce Allocate less in GetIPEndPoint (#1004) 2016-07-21 12:17:55 -07:00
Ben Adams f42316af7f Remove Environment.StackTrace as crashing tests 2016-07-21 01:44:23 +01:00
Ben Adams aa385a1317 Use Environment.NewLine and Environment.StackTrace 2016-07-21 01:13:27 +01:00
Ben Adams 7b8abf5a3e Improved Memoryblock tracking
Also fixed 3 tests that weren't handling block properly
2016-07-21 01:13:27 +01:00
David Fowler 3078f4914c Removed unneeded things from Connection 2016-07-18 22:19:45 -07:00
David Fowler 8399910a6e PR feedback 2016-07-15 15:16:03 -07:00
David Fowler 14717f2a3f Always allocate the socket closed tcs 2016-07-15 15:16:03 -07:00
David Fowler 142685c0fb Remove state lock from Connection
- Remove the state lock by creating the frame earlier
- Set properties on the frame that need to be set before calling start.
- Don't rely on the copy ctor of the *Context hierarchy to set
*everything*
2016-07-15 15:16:03 -07:00
Cesar Blum Silveira 3bb7f4e2c4 Treat ECONNRESET as a connection error (#934). 2016-07-15 14:53:21 -07:00
Doug Bunting 82a0a99107 One build to rule them all
- well, at least VS and command-line builds will share output
- part of aspnet/Coherence-Signed#277
2016-07-07 12:07:14 -07:00
Cesar Blum Silveira edd247b8e2 Merge branch 'khellang/status-451' into dev 2016-07-07 11:42:15 -07:00
Cesar Blum Silveira 176b599854 Merge branch 'khellang/status-308' into dev 2016-07-07 11:35:24 -07:00
Cesar Blum Silveira 9f720eda90 Reset frame streams on each request (#940). 2016-07-06 14:57:43 -07:00
Nicholas Ventimiglia 6a8a4e8669 Update MemoryPoolBlock.cs 2016-06-21 17:00:59 -07:00
Nicholas Ventimiglia 3db95ddcde As an American, I had to correct the spelling of 'independent' 2016-06-21 11:08:40 -07:00
Pranav K de668c2ebd Updating to dev versions
# Conflicts:
#	test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/project.json
2016-06-16 10:40:58 -07:00
Kristian Hellang eb74a19f9a
Added "451 Unavailable For Legal Reasons" to ReasonPhrases
From RFC7725 - https://tools.ietf.org/html/rfc7725
2016-06-16 13:49:26 +02:00
Kristian Hellang 6414ccc2fd
Added "308 Permanent Redirect" to ReasonPhrases
From RFC7538 - https://tools.ietf.org/html/rfc7538
2016-06-16 13:48:52 +02:00
Stephen Halter 01e9101543 Add more doc comments to KestrelServerOptions 2016-06-13 19:52:38 -07:00
Mike Harder 5ecb1f59a4 Limit size of memory buffer when reading request (#304)
- Added property `KestrelServerOptions.MaxRequestBufferSize`
 - Default is 1,048,576 bytes (1MB)
 - If value is null, the size of the request buffer is unlimited.
- Fixed bug in `IConnectionControl.Resume()` where `_socket.ReadStart()` can throw if the socket is already disconnected.
- Made `UvStreamHandle.ReadStop()` idempotent, to match `uv_read_stop()`.
2016-06-13 18:52:20 -07:00
Stephen Halter b4632c273e Handle exceptions thrown from Connection.Start in ListenerSecondary
- This is already done for primary listeners
2016-06-08 17:17:49 -07:00
jacalvar 8dbdc0294f Remove unncessary imports 2016-06-08 15:07:48 -07:00
Mukul Sabharwal badbc7c8f7 Downtarget Kestrel to NETStandard 1.3 2016-06-06 21:37:44 -07:00
moozzyk 69bd0dc4be Reject requests that have null characters in path 2016-06-06 09:59:42 -07:00
Pranav K 17a41597a6 Reacting to Hosting changes 2016-06-03 18:24:35 -07:00
Andrew Stanton-Nurse 09f5be1434 fix #909 by moving most classes to Internal ns 2016-06-03 14:14:21 -07:00
Stephen Halter d14f18012a Avoid Null ReferenceException in Frame.RequestAbortedSource
- Avoid unneeded resetting of _abortedCts and _manuallySetRequestAbortToken
2016-06-02 16:55:19 -07:00
Stephen Halter 6bff2ecb34 Small cleanup to SocketOutput's shutdown logic 2016-06-02 16:54:00 -07:00
Stephen Halter 07744e75d9 Gracefully handle connection close in SocketOutput.ProducingComplete 2016-06-02 16:54:00 -07:00
Stephen Halter 2d229e8980 Allow a maximum of 3 concurrent uv_write operations per connection
- Keep logic to prevent unnecessary calls to KestrelThread.Post
- This partially reverts commit 480996433e.
2016-06-02 16:52:06 -07:00
moozzyk 0342754c57 Using the optimized method for converting header name to ASCII 2016-06-02 16:36:22 -07:00
Cesar Blum Silveira de022b6051 Improved handling of whitespace in headers. 2016-06-02 16:18:43 -07:00
moozzyk 6e46d9757d Improve perf of TryGetAsciiString 2016-06-02 12:52:12 -07:00
Stephen Halter f609f41a7c Reject non-ASCII chars in headers in addition to control chars 2016-06-01 16:01:15 -07:00
Pavel Krymets bb92cc1c29 Fix NRE when aborting connection or client disconects 2016-06-01 15:52:05 -07:00
Chris R 6224f5b6e8 Perf: Remove unnecessary path checks 2016-06-01 14:56:49 -07:00
moozzyk 0753f06c28 Aborting request if a string can't be converted to ASCII 2016-05-31 17:11:31 -07:00
moozzyk 5d77ad24c2 Refactoring out GetAsciiString from MemoryPoolIteratorExtensions 2016-05-31 16:27:01 -07:00
Cesar Blum Silveira 50208a3a79 Implement IHttpRequestFeature.RawTarget (aspnet/HttpAbstractions#596). 2016-05-31 15:30:12 -07:00
Andrew Stanton-Nurse 290e1e3f3f improve validation of HTTP methods 2016-05-31 14:13:13 -07:00
Mike Harder 306084356e ServerAddress.FromUrl() should throw if Host is missing (#860) 2016-05-31 11:54:38 -07:00
BrennanConroy 6b25ee7343 Replace PlatformAbstractions with RuntimeInformation 2016-05-31 08:17:02 -07:00
Cesar Blum Silveira 0a181b1f3f Reset Frame's IHttpRequestFeature.Headers and IHttpResponseFeature.Headers between requests (#879). 2016-05-27 16:02:55 -07:00
Stephen Halter 1a6ec294bc Merge branch 'stephentoub/remove_valuetask_casts' into dev 2016-05-27 15:47:13 -07:00
Cesar Blum Silveira 80a2bc124d Remove Frame.RequestUri. 2016-05-27 12:40:14 -07:00
Mike Harder 2453047fe2 ServerAddress.FromUrl() should throw for invalid url (#875) 2016-05-27 12:02:30 -07:00
Stephen Toub 69d8b17095 Remove uses of ValueTask<T>'s implicit casts
These are being removed.
2016-05-27 10:28:24 -04:00
Stephen Halter b9b67f6bf4 Merge branch 'khellang/set-headers-on-response-start' into dev 2016-05-26 15:35:01 -07:00
Kristian Hellang 72cc0ffbd5 Set Date and Server headers at response start
Closes #223
2016-05-26 17:38:16 +02:00
Cesar Blum Silveira a3d0bd0ec4 Bind to both IPv4 and IPv6 when localhost is specified (#231). 2016-05-25 21:23:29 -07:00
Cesar Blum Silveira 3f4e2323f4 Throw when setting Frame.StatusCode or Frame.ReasonPhrase after response has already started (#805). 2016-05-24 16:32:54 -07:00
Stephen Halter cb284b9d58 Fix race that would allow GetDateHeaderValues to return null 2016-05-24 16:28:46 -07:00
Stephen Halter d164f350b4 Add comment explaining why ForChunkedEncoding._vectorCRs is not static 2016-05-24 16:05:20 -07:00
Mike Harder 5ca6592677 Don't bind if only port is specified (#814) (#861)
- Also renamed ServerAddressFacts to ServerAddressTests to match existing test classes
2016-05-23 14:06:46 -07:00
Ben Adams 6098880132 Reset connection info not using interface 2016-05-21 00:41:55 +01:00
Cesar Blum Silveira 925d8e0200 Always cache headers and streams across frames (#754). 2016-05-20 16:16:19 -07:00
Stephen Halter 5495610e5c Merge branch 'benaadams/fastpath-connectioncheck' into dev 2016-05-20 16:02:46 -07:00
Stephen Halter a38a437efb Merge branch 'khellang/server-header-option' into dev 2016-05-20 15:56:29 -07:00
Stephen Halter c39546352a Merge branch 'shanewalters/remote-cert' into dev 2016-05-20 15:53:51 -07:00
Kristian Hellang 2ab01c09fd Add option to remove the Server header 2016-05-20 13:18:18 +02:00
Ben Adams 5eb1466487 Fast-path response header connection check 2016-05-20 03:37:32 +01:00
shanewalters b17c070e1c Updated to not use handle, centralize conversion logic. 2016-05-19 14:40:29 -06:00
Cesar Blum Silveira 59aef9a443 Merge branch 'benaadams/remove-framecontext' into dev 2016-05-19 12:25:04 -07:00
Cesar Blum Silveira 1f494b168b Remove Frame._requestProcessingStarted field. 2016-05-19 11:48:50 -07:00
Cesar Blum Silveira 9960cb8c23 Remove unused Frame static fields. 2016-05-19 11:47:58 -07:00
Cesar Blum Silveira 8e9df409c4 Remove dead code in ReasonPhrases. 2016-05-19 11:46:48 -07:00
Ben Adams e8647c0cb4 Remove extra FrameContext class
Resolves #837
2016-05-19 19:22:39 +01:00
shanewalters 9232029950 Use SslStream.RemoteCertificate to recreate disposed certificate. 2016-05-19 12:17:23 -06:00
Cesar Blum Silveira 9a06bf39ab Move ECONNRESET value check to server initialization. 2016-05-18 22:11:10 -07:00
Stephen Halter 7e7f21ec49 Merge branch 'benaadams/dateheader' into dev 2016-05-18 17:11:01 -07:00
Stephen Halter 369512369f Merge branch 'benaadams/return-blocks-out-of-lock' into dev 2016-05-18 17:03:24 -07:00
Nathan Anderson e1c64d2119 reuse typeof results in generated Frame code 2016-05-18 16:52:34 -07:00
Stephen Halter 185ad000bb Prevent NullReferenceException in KestrelThread.OnStopRude
- UvMemory.FromIntPtr looks up a weak reference so we need to null check.
2016-05-18 16:21:55 -07:00
Cesar Blum Silveira 8c8ee150f7 Send 'Connection: close' in all 400 responses to HTTP/1.1 requests (#840). 2016-05-18 15:03:31 -07:00
Cesar Blum Silveira 3e841ccba1 Always send HTTP/1.1 responses (#792). 2016-05-16 16:11:37 -07:00
Cesar Blum Silveira 3186e1bd72 Make TakeStartLine more robust (#683). 2016-05-12 12:07:08 -07:00
Ben Adams a3b0f809de Only call PrepareDateValues if not already called for tick 2016-05-10 20:38:27 +01:00
Ben Adams 0e8cbe5df6 Return SocketInput blocks out of lock 2016-05-10 01:18:24 +01:00
Stephen Halter 388841c1d8 Merge branch 'release' into dev 2016-05-09 16:37:40 -07:00
Stephen Halter 12a3816c12 Make some MemoryPoolBlock operations volatile
- Making MemoryPoolBlock.End volatile and using Volatile.Write for
  MemoryPoolBlock.Next prevents a race that could cause threads consuming
  blocks to skip produced bytes.
2016-05-05 15:13:28 -07:00
Stephen Halter 4c39374dc0 Always check if block is last in linked list before consuming it
- This prevents a race where we could read into the "Next" Block without
  completely consuming the previous one.
2016-05-05 15:13:17 -07:00
Nathan Anderson 132263e767 narrow lock scope when connections end 2016-05-04 16:50:08 -07:00
Stephen Halter fed7c44829 Merge branch 'halter73/validate-header' into dev 2016-05-04 12:35:26 -07:00
Stephen Halter c1e5640a65 Don't allow response headers to contain control characters
- For the purposes of this commit, control characters are everything < 0x20.
- Immediately throw an InvalidOperationException when the header is added to
  the IHttpResponseFeature.Headers dictionary.
2016-05-04 12:24:31 -07:00
Mike Harder 14bbba0641 Update addresses in IServerAddressesFeature with assigned dynamic ports (#758)
- Change most tests to use dynamic ports, rather than a fixed port obtained from GetNextPort().
- Add several new cases to `AddressRegistrationTests` and `ServerAddressFacts`.
- Remove project `test\Microsoft.AspNetCore.Server.Kestrel.TestCommon`.  It's not longer needed, since only `AddressRegistrationTests` uses `GetNextPort()`.
2016-05-04 11:27:23 -07:00
Stephen Halter f8c2c2470f Merge branch 'benaadams/memorypool' into dev 2016-05-02 21:58:53 -07:00
Pranav K ff510875f2 Merge branch 'release' into dev 2016-05-02 14:56:30 -07:00
Pranav K f0358182e4 Fix build warnings 2016-05-02 11:27:18 -07:00
Ben Adams 3a424f6aba Remove unnecessary fixed blocks 2016-04-30 11:17:06 +01:00
Ben Adams 2aa10a64a2 Remove noop pin+unpin w/ memory blocks
+ Only use pooled blocks in tests
2016-04-30 11:17:06 +01:00
Kristian Hellang 8a9840216c Use type's namespace instead of assembly FullName 2016-04-29 12:02:56 -07:00
moozzyk 75adbc18a2 Use IOCP on secondary listener threads on Windows
Addresses #679
2016-04-29 08:45:12 -07:00
Cesar Blum Silveira ebca8db7dc Merge branch 'justinvp/taskutilities' into dev 2016-04-28 11:28:42 -07:00
Justin Van Patten 68f14c06cb Use Task.FromCanceled<TResult>() on NETSTANDARD1_3
Task.FromCanceled<int>(cancellationToken) can be used on
NETSTANDARD1_3 in TaskUtilities.GetCancelledZeroTask().
2016-04-27 22:26:31 -07:00
Cesar Blum Silveira 5a8cba878d Merge branch 'benaadams/async-write' into dev 2016-04-27 11:25:45 -07:00
Justin Van Patten 8f7c0ff041 Minor Stream improvements
- Unsupported members should throw NotSupportedException instead of
NotImplementedException per MSDN docs for CanRead/CanSeek/CanWrite.
- Position should throw NotSupportedException when CanSeek is false.
- FrameRequestStream.Flush/FlushAsync should not throw
NotImplementedException.
- Use expression-bodied members for CanRead/CanSeek/CanWrite on
FrameRequestStream to match FrameResponseStream.
- Provide no-op override of LibuvStream.FlushAsync to match Flush.
2016-04-25 22:19:30 -07:00
Ben Adams 216aa9343e Remove redundent null coalesce 2016-04-25 11:49:48 +01:00
Ben Adams 4626833e51 StreamSocketOutput WriteAsync as async 2016-04-25 09:52:33 +01:00
Cesar Blum Silveira 0a21b94609 Make ECONNRESET value platform-specific (#649). 2016-04-22 16:06:08 -07:00
Cesar Blum Silveira 179b57b01f Remove SocketInputStream (#753). 2016-04-21 15:10:12 -07:00
Cesar Blum Silveira 7ca0fbeb3d Merge branch 'release' into dev 2016-04-19 22:22:48 -07:00
Cesar Blum Silveira f29dd60999 Fix connection termination issues when using connection filters (#737, #747).
- If we're done before the client sends a FIN, force a FIN into the raw
  SocketInput so the task in FileteredStreamAdapter finishes gracefully
  and we dispose everything in proper order.
- If there's an error while writing to a stream (like ObjectDisposedException),
  log it once and prevent further write attempts. This means the client closed
  the connection while we were still writing output.
- This also fixes a bug related to the point above, where memory blocks were
  being leaked instead of returned to the pool (because we weren't catching
  the exception from Write()).
2016-04-19 22:04:33 -07:00
Mike Harder 8b83f1ee6b Merge branch 'release' into dev 2016-04-18 16:59:08 -07:00
Mike Harder 0453e4af70 Add KestrelServerOptionsSetup before KestrelServerOptions (#755) (#757)
- Required to ensure that options.ApplicationServices is available after during UseKestrel(options)
2016-04-18 16:57:59 -07:00
Mike Harder 0d9dc1a205 Merge branch 'release' into dev 2016-04-18 15:33:21 -07:00
Mike Harder bbf2c83a7d Add KestrelServerOptionsSetup to IServiceCollection in UseKestrel() (#755)
- Previously, KestrelServerOptionsSetup was only added to IServiceCollection in UseKestrel(options)
- Required to ensure that options.ApplicationServices is available after calling UseKestrel()
2016-04-18 15:32:09 -07:00
Chris R 20a1f4a548 Merge branch 'release' into dev 2016-04-15 16:06:15 -07:00
Chris R c48353f4ef Hosting#698 Remove IServerFactory 2016-04-15 16:05:01 -07:00
Mike Harder 38c70a6fec Merge branch 'release' into dev 2016-04-13 15:12:37 -07:00
Mike Harder 6047a62c07 Add IWebHostBuilder.UseKestrel(options) overload to configure Kestrel (#720)
- Replace KestrelServerInformation with KestrelServerOptions.
- Move properties from KestrelServerPoolingParameters to KestrelServerOptions.
- Stop reading default options from "kestrel.*" config settings.
- Move extension method IApplicatonBuilder.UseKestrelConnectionLogging() to KestrelServerOptions.UseConnectionLogging()
2016-04-13 14:57:54 -07:00
Stephen Halter c9a1d4000f Merge branch 'release' into dev 2016-04-13 12:51:56 -07:00
David Fowler 5354005a1a Remove support for DNX on osx on mono
- Remove mono osx specific PInvokes
- Use PlatformAbstractions to detect darwin instead of direct pinvoke

#742
2016-04-12 23:47:36 -07:00
Eilon Lipton 795fc36cde Fix package metadata 2016-04-12 18:47:35 -07:00
Cesar Blum Silveira 7b63846357 Prevent crash when aborting connection before Frame is created (#738). 2016-04-12 14:18:41 -07:00
Stephen Halter 7d4fcfeb23 Depend on separate libuv package 2016-04-10 21:15:43 -07:00
Pranav K 29a8d5b7c5 Removing imports from src projects 2016-04-08 06:49:01 -07:00
Stephen Halter 056b4ac41d Never call Thread.Abort
- This API isn't available on .NET Core so we should rely entirely on
  our other methods of terminating the libuv threads.
2016-04-06 14:48:01 -07:00
Stephen Halter 50f187aa3e Ensure entire request body is consumed before handling fin
This completes the fix for #704
2016-04-05 11:16:09 -07:00
David Fowler 21de2aee13 Remove unused dependency on TraceSource
- TraceSource is RID specific (see https://github.com/dotnet/corefx/issues/7480) and it
causes 2 dlls to end up in the output of every ASP.NET application. We don't even
use it anymore.
2016-04-04 20:04:17 -07:00
BrennanConroy 109c56713a React to logging changes 2016-04-01 11:53:47 -07:00
Mike Harder 228c34b500 Remove duplicate calls to FrameRequestHeaders and FrameResponseHeaders ctors (#695) 2016-03-31 17:34:59 -07:00
Doug Bunting c828fafe1b React to HttpAbstractions namespace changes
- aspnet/HttpAbstractions#549 and aspnet/HttpAbstractions#592
- clean up `using`s
2016-03-30 16:04:43 -07:00
Mike Harder 088b7e5779 Add UseKestrel() extension method to IWebHostBuilder (#713) 2016-03-30 12:08:32 -07:00
Stephen Halter aa17125f9e Fix spelling of "timeout" in kestrel.shutdownTimeout 2016-03-30 11:14:35 -07:00
Stephen Halter f0e438f65f Remove IKestrelTrace.ApplicationError overload without connection id
Add test verifying that exceptions thrown from application tcs continuations
run by the LoggingThreadPool don't get logged as general exceptions.
2016-03-30 11:13:13 -07:00
Stephen Halter a8e5c0ce30 Log connection id in KestrelTrace.ApplicationError 2016-03-30 10:16:01 -07:00
Cesar Blum Silveira 3f0e65495e Merge branch 'shalter/last-request' into dev 2016-03-22 17:57:26 -07:00
Cesar Blum Silveira fd70fb732d Add explanatory comments for previous commit. 2016-03-22 17:55:21 -07:00
Doug Bunting f13c418a65 React to HttpAbstractions change: No features in `.Internal` namespace
- see issue aspnet/HttpAbstractions#561 and pull aspnet/HttpAbstractions#589
2016-03-18 19:01:53 -07:00
Stephen Halter 792f3ad089 Fix race preventing handling of the last request sent over a connection
We need to attempt to consume start lines and headers even after
SocketInput.RemoteIntakeFin is set to true to ensure we don't close a
connection without giving the application a chance to respond to a request
sent immediately before the a FIN from the client.
2016-03-17 23:08:30 -07:00
Stephen Halter 84a68208d0 Remove race condition from socket input that could stall reads
- Without the _sync lock, if new data was produced as ConsumingComplete
  was called, the next "await SocketInput" might never complete despite not
  all data being examined.
- If more data is produced afterward, the stall would be prevented, but this
  isn't always the case such as during the end of the request.
2016-03-17 07:44:32 -07:00
Cesar Blum Silveira 8e24c3a708 Fix deadlock when connection is simultaneously aborted and ended (#684). 2016-03-12 21:35:21 -08:00
Pranav K 7c67366e84 Fix CI build failure 2016-03-11 21:41:09 -08:00
Brice Lambson fb8cf86f71 Don't reference facades in NuSpec
These can be removed entirely after dotnet/cli#164
2016-03-11 08:45:06 -08:00
Cesar Blum Silveira 88367ccf2d Wait for more input while request hasn't finished (#672). 2016-03-09 15:20:02 -08:00
Cesar Blum Silveira 37b0917ac1 Use TLS 1.1 or 1.2 only (#637). 2016-03-09 12:09:31 -08:00
moozzyk 5f6293110c Adding libuv.so to the package 2016-03-07 13:21:35 -08:00
Cesar Blum Silveira cd8e8f0a11 Prevent DebugAssertException from blocks not returned by non-graceful shutdowns (#667). 2016-03-03 23:57:22 -08:00
Ajay Bhargav Baaskaran 65f83015e3 Added Company, Copyright and Product attributes to AssemblyInfo 2016-03-03 17:32:50 -08:00
Stephen Halter f15471bcf2 Remove 2 from MemoryPool2 and related types
- This was merely an artifact from when this was the second of 2 pools
2016-03-03 12:11:25 -08:00
Doug Bunting bb2e76c7f1 Remove project name from output path
- aspnet/Coherence-Signed#187
- remove `<RootNamespace>` settings but maintain other unique aspects e.g. `<DnxInvisibleContent ... />`
- in a few cases, standardize on VS version `14.0` and not something more specific
2016-03-02 18:57:23 -08:00
Cesar Blum Silveira 41f77ee3fd Handle uploads larger than 2GB. 2016-03-02 16:09:52 -08:00
Stephen Halter 4e5920fd09 KestrelThread.Stop should wait for StartAsync to complete
- Previously KestrelThread.Stop might assume start failed prematurely
- This could cause a background thread to run indefinitely in the background
2016-03-02 15:04:29 -08:00
N. Taylor Mullen c33b422d7a Transition to netstandard.
- dotnet5.X => netstandard1.y (where y = x-1).
- DNXCore50 => netstandardapp1.5.
- Applied the same changes to ifdefs.
2016-03-01 13:36:06 -08:00
Ben Adams dab1a1fa8d bug dodge: Invalid Program Excep on Clr 2016-02-27 13:23:54 +00:00
Ben Adams 766803c573 Return 400 for bad requests and close conn 2016-02-27 12:35:12 +00:00
Ben Adams 4bfcd7ba1f Drain chunked extensions + refactor 2016-02-26 23:48:51 +00:00
Ben Adams e0f7bb06dd Parse chunked trailing headers 2016-02-26 23:48:50 +00:00
Ben Adams 8d8176f14a Consume chunked request fully 2016-02-26 23:48:49 +00:00
Cesar Blum Silveira f21cb128e8 Handle 0-byte reads correctly (#520). 2016-02-26 15:21:11 -08:00
Ben Adams c2e5124d5a Fix XML Comment 2016-02-22 22:43:30 -08:00
Ben Adams 58e07a8b2b Put threads into background before starting 2016-02-20 06:15:11 +00:00
Ajay Bhargav Baaskaran e14b86ebe0 Enabled xml doc generation 2016-02-18 16:27:55 -08:00
N. Taylor Mullen 795bbfce69 Update System.Linq 4.0.2-* => 4.1.0-*. 2016-02-18 15:36:17 -08:00
Chris R aef612bdac Add IHttpConnectionFeature.ConnectionId. 2016-02-18 11:10:55 -08:00
Cesar Blum Silveira aa48ad2933 Merge branch 'benaadams/loopback-fastpath' into dev 2016-02-18 10:52:42 -08:00
Stephen Halter bc56d11d8c Set IsBackground property to true on libuv Threads for non-debug builds
- If libuv doesn't shutdown as expected, the process will still stop. Thanks @benaadams!
- Address other minor PR feedback.
2016-02-17 16:40:05 -08:00
Stephen Halter 53ecef0f98 Use libuv to track connections instead of ConcurrentDictionaries
- This means connections become untracked sooner than before and not all blocks will
  necessarily be returned.
- The assertion in the MemoryPoolBlock2 finalizer was weakened because FilteredStreamAdapter
  will continue to use blocks after libuv stops tracking the associated connection.
- Make 100% sure we don't accept new connections after we dispose the listen socket by using a flag.
- Add a (currently unused) AllowStop method to KestrelThread. This is meant to be called from
  listeners when we stop accepting new connections, but needs investigation to prevent flakiness.
2016-02-17 16:05:35 -08:00
Stephen Halter f4bb8d5eff Verify that memory pool blocks aren't leaked in tests 2016-02-17 16:05:34 -08:00
Stephen Halter 304016fc3b Close UvAsyncHandle properly to avoid zombie threads
- Even when safe handles are disposed explicitly, ReleaseHandle is sometimes
  called on another thread which breaks uv_close.
- Ensure we close the UvAsyncHandle the uv loop so that the second call
  to uv_run always completes without a timeout/Thread.Abort.
- Re-enable some tests. Add skip conditions for those that aren't passing.
2016-02-17 16:05:32 -08:00
Stephen Halter 54caf3071c Close connections as quickly and gracefully as possible on shutdown
- Make the time given for requests to complete gracefully configurable.
- Complete all async reads so calling code can re-check whether to stop
  request processing and exit if in between requests.
- Don't wait for a FIN from the client since some browsers (e.g. IE & Chrome)
  will take a long time to send one.
- Ensure all ConnectionFilters complete before the memory pool is disposed.
- Ensure blocks get returned even when a ConnectionFilter produces a failed read
2016-02-17 16:05:23 -08:00
Stephen Halter 9c31907bac Don't rely on the finalizer to return blocks referenced by SocketInput 2016-02-17 16:01:35 -08:00
Stephen Halter 87bd60746b Merge branch 'benaadams/pool-headers' into dev 2016-02-17 16:00:20 -08:00
Ben Adams 020e0b9dc5 Enable TCP Loopback Fast Path (Windows)
Enable TCP Loopback Fast Path; where the IP layer is skipped, for lower
latency for localhost comms, like HttpPlatformHandler+IIS reverse proxy

http://blogs.technet.com/b/wincat/archive/2012/12/05/fast-tcp-loopback-performance-and-low-latency-with-windows-server-2012-tcp-loopback-fast-path.aspx

Have to do it this way due to open issue in libuv

Loopback fast path: libuv/libuv#489

Related: "Confirm HttpPlatformHandler uses Fast TCP Loopback"
aspnet/IISIntegration#29
2016-02-14 04:44:20 +00:00
Ben Adams b473402cb1 Fast header clear 2016-02-13 11:49:00 +00:00
Ben Adams f8aa1a676a Pass ServerInformation as property of ServiceContext 2016-02-13 05:51:54 +00:00
Ben Adams 460dbb15c2 RO Headers & rationalise exceptions 2016-02-13 03:35:26 +00:00
Ben Adams e533d5da89 Fast path Consume when already complete 2016-02-13 01:52:16 +00:00
Ben Adams c293bbbd1a Reuse headers to prevent values moving to higher GC gens 2016-02-13 01:16:17 +00:00
Stephen Halter f89c959f4f Merge branch 'benaadams/no-spin' into dev 2016-02-12 10:54:48 -08:00
moozzyk fe75aa47db Enabling Kestrel on OSx Mono when not running with dnx
Before moving to dotnet dnx on OSx on Mono would load libuv.dll into the process and Kestrel would use DllImport with __Internal to import functions from the native libraries loaded into the Mono process. With the move to dotnet nothing is preloading libuv to the process so Kestrel must no longer use DllImports with __Internal but the regular ones. Mono seems to load native libraries from the app folder so, the user won't have to install libuv on their own since libuv.dylib is published with the app.
2016-02-11 16:05:32 -08:00
Pranav K c5a8792ece Reacting to CoreCLR package version changes 2016-02-08 09:33:46 -08:00
Cesar Blum Silveira 6757a31fd2 Build with dotnet (#571). 2016-02-01 14:37:47 -08:00
Cesar Blum Silveira 1209eca3fa Normalize request path to NFC and resolve dot segments (#273). 2016-01-28 15:29:29 -08:00
Brennan 15ed03eb26 React to Logging API changes 2016-01-27 14:25:52 -08:00
Stephen Halter a2fe59fb2c Speed up unit tests
- Remove unnecessary uses of Task.Delay
- Change all usages to CancellationToken.None to default(CancellationToken)
  for consistency
2016-01-27 13:01:44 -08:00
Ben Adams 00b8a13b55 Merge+rename+rename resolve 2016-01-26 11:33:14 +00:00
Ben Adams 9f2d685cbf Merge remote-tracking branch 'refs/remotes/aspnet/shalter/always-immediate' into combined-fixes 2016-01-26 02:15:56 +00:00
Stephen Halter a4b8b01c99 Remove immediate parameter from Frame.ProduceStart
- Simply call SocketOutput.WriteAsync(_emptyData) to force headers to be flushed
2016-01-25 11:09:15 -08:00
Stephen Halter 7570da9daa Flush chunked writes before the entire response completes
Ensure chunked writes force an "immediate" write by removing the now
unused immediate parameter from ISocketOutput.Write
2016-01-25 10:34:15 -08:00
Ben Adams 3f414782b9 Remove spinning for blocked socket ops
As per https://github.com/dotnet/corefx/pull/5655
2016-01-24 14:49:25 +00:00
Ben Adams de34d14abb WriteChunked immediate for large responses 2016-01-23 10:48:24 +00:00
Ben Adams 0ca8ca0328 Update FrameResponseStream Cancellation 2016-01-23 10:17:09 +00:00
Stephen Halter 735c0fbbef Added new test to verify failed writes complete all pending write tasks
- Changed MockLibuv to never fall back to real libuv methods.
- Fixed EngineTests.ConnectionCanReadAndWrite
2016-01-23 10:17:07 +00:00
Ben Adams e5238ff383 Only log connection error once 2016-01-23 10:17:06 +00:00
Ben Adams cd621509d0 Complete all writes after error 2016-01-23 10:17:05 +00:00
Ben Adams a97cb81f92 MockConnection Abort 2016-01-23 10:17:03 +00:00
Ben Adams 73bb0ab5b8 SocketOutput Cancellation handling 2016-01-23 10:17:02 +00:00
N. Taylor Mullen b062f851dc Rename AspNet 5 file contents.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:23:51 -08:00
N. Taylor Mullen 3cfe2f3070 Rename AspNet 5 folders and files.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:23:44 -08:00
Pranav K 40824999c6 Reacting to CoreCLR package version change 2016-01-20 20:58:22 -08:00
Stephen Halter 8ea24f05f4 Merge branch 'benaadams/reduce-sync-over-async' into dev 2016-01-19 16:35:51 -08:00
Ben Adams fa8fe3d085 Complete sync-blocked calls directly 2016-01-19 22:38:08 +00:00
Brennan 63cd6149d1 Removed IsLocal from ConnectionInfo 2016-01-19 08:37:47 -08:00
Ben Adams d3d9c8d546 Write async chunks async 2016-01-18 13:39:13 +00:00
Stephen Halter 129a5ad474 Bypass LibuvStream if no ConnectionFilter wraps it 2016-01-14 15:28:54 -08:00
Stephen Halter e5ad019575 Revert "Merge branch 'benaadams/copyfrom-perf' into dev"
This reverts commit ce61282320, reversing
changes made to 7ef70bc145.
2016-01-14 11:47:23 -08:00
Stephen Halter ce61282320 Merge branch 'benaadams/copyfrom-perf' into dev 2016-01-12 14:24:35 -08:00
Ben Adams caaf9d473b Faster CopyFrom 2016-01-12 21:43:37 +00:00
Stephen Halter 7ef70bc145 Merge branch 'anderman/FindFirstByteFast' into dev 2016-01-12 12:51:50 -08:00
Stephen Halter d9f6ac70a0 Merge branch 'benaadams/using-reorder' into dev 2016-01-12 12:15:54 -08:00
Stephen Halter f32f1c4440 Merge branch 'henkollema/projectjson' into dev 2016-01-12 12:14:35 -08:00
Stephen Halter ab5ef547e1 Make chunked writes atomic 2016-01-11 16:53:46 -08:00
Stephen Halter daa2b7e383 Remove _tasksCompleted from SocketOutput
- _tasksCompleted no longer helps avoid locking longer
2016-01-11 12:40:01 -08:00
Stephen Halter df695accb0 Use TryEnter to acquire SocketOutput._contextLock on the libuv event loop 2016-01-11 12:39:59 -08:00
Stephen Halter e90b61e6c5 Move call to CopyFrom in SocketOutput.WriteAsync inside lock to make writes atomic 2016-01-11 12:39:57 -08:00
Ben Adams 8ac119df76 using reorder (nit) 2016-01-11 19:02:51 +00:00
Thom Kiesewetter 1b09a76ebb Find First Byte Fast 2016-01-11 08:31:52 +01:00
clrjunkie 63e39a257e One-time-use allocated blocks keep reference to source pool / Assert that a block is returned to it's source pool / Managed block are only returned to active Slabs 2016-01-09 19:41:35 +02:00
clrjunkie 8260e5d93f Remove null-conditional operators and asserts (Blocks must return to pools) 2016-01-09 19:36:26 +02:00
Stephen Halter 849ff2016c Use object.ReferenceEquals when comparing Actions in SocketInput 2016-01-08 15:40:07 -08:00
Stephen Halter b63dd40efb Protect SocketInput against concurrent consumption 2016-01-08 11:14:15 -08:00
Stephen Halter f3a39d98da Merge branch 'benaadams/socket-input' into dev 2016-01-08 11:12:43 -08:00
Henk Mollema b4b5f07a08 Detect mono using PlatformAbstractions 2016-01-07 00:48:36 +01:00
Henk Mollema db11368d26 Remove StandardsPoliceCompileModule usage
Just a test - this seems to fix the build
2016-01-07 00:35:51 +01:00
Henk Mollema e81c5adce2 Change #ifdefs 2016-01-07 00:35:50 +01:00
Henk Mollema 97a5149dd9 Remove dnx451 and dnxcore50 TFM's 2016-01-07 00:35:49 +01:00
Stephen Halter ffd950966e Merge branch 'benaadams/string-construct' into dev 2016-01-06 12:14:15 -08:00
Stephen Halter c4605bea20 Merge branch 'benaadams/pendingwrites' into dev 2016-01-05 12:57:23 -08:00
Stephen Halter b1a4e8cd1e Merge branch 'anderman/faster-unsafe' into dev 2016-01-05 12:33:14 -08:00
Stephen Halter 48233cd081 Merge branch 'benaadams/memorypool-seek' into dev 2016-01-05 12:09:04 -08:00
Ben Adams bc19a07291 ifdef comments on own line 2016-01-05 12:08:39 -08:00
sergey-tom 406d785b5e Fix typo
Looks like value from wrong variable is passed to Marshal.FreeHGlobal method. So IntPtr.Zero is passed to the method and actual pointer is lost.
2016-01-05 15:14:49 +01:00
Ben Adams e6bc0bc335 Only scheduleWrites on the threadpool 2016-01-05 11:42:41 +00:00
Ben Adams 480996433e Only queue write when not queued 2016-01-05 11:33:29 +00:00
Ben Adams 4c39800ea4 Seek perf extra
See https://github.com/aspnet/KestrelHttpServer/issues/541
2016-01-05 09:37:50 +00:00
Ben Adams 1eda5178de Seek perf + faster non vector path 2016-01-05 09:37:49 +00:00
Cesar Blum Silveira 7cc51959d9 Merge branch 'Anderman/TakeStartLine' into dev 2016-01-04 13:54:51 -08:00
Cesar Blum Silveira a53949c33e Add CORS headers to known headers (#389). 2016-01-04 12:26:21 -08:00
Stephen Halter 11e046e017 Merge branch 'benaadams/name-thread' into dev 2016-01-04 11:55:53 -08:00
Ben Adams cf77efc2ff Fast path pre-completed Input reads 2016-01-02 03:57:02 +00:00
Ben Adams afe944c053 Simplify SocketInput, remove locks, only use pooled blocks 2016-01-02 03:50:55 +00:00
David Fowler 4f8ec86b54 React to HttpAbstractions changes 2015-12-31 14:04:47 -08:00
Stephen Halter 5296d89337 Merge branch 'benaadams/messagebody.for' into dev 2015-12-30 17:38:48 -08:00
Stephen Halter 072f2b1a20 Merge branch 'benaadams/valuetask' into dev 2015-12-30 16:51:48 -08:00
Thom Kiesewetter 36e9e8759a Optimize TakeFirst Line with Known method and Version 2015-12-31 01:24:59 +01:00
Ben Adams ea3e64ab87 Loop unrolled direct string inject 2015-12-30 23:09:59 +00:00
Cesar Blum Silveira 6fbb9a0cfe Cleanup: private embedded types and readonly where appropriate (#187). 2015-12-30 12:47:13 -08:00
Ben Adams f7ac457b40 Use ValueTask 2015-12-30 19:41:55 +00:00
Ben Adams 5c58d48272 Name KestrelThreads
Helps with debugging, profiling
2015-12-30 13:06:27 +00:00
Cesar Blum Silveira acc80bcbc5 Merge branch 'benaadams/take' into dev 2015-12-29 11:46:24 -08:00
Thom Kiesewetter 8fdfef460a Faster unsafe pointers 2015-12-29 15:03:52 +01:00
Ben Adams 80dc284407 Checked length 2015-12-29 08:52:05 +00:00
Ben Adams 9019ac39ae Faster Take 2015-12-29 00:46:45 +00:00
Cesar Blum Silveira 0f389f01cb Merge branch 'benaadams/peek' into dev 2015-12-28 16:14:27 -08:00
Cesar Blum Silveira 1eeb0e380c Merge branch 'benaadams/generic-boxing' into dev 2015-12-28 15:46:30 -08:00
Ben Adams 982ab99b45 Make callback adapters readonly 2015-12-28 23:02:41 +00:00
Cesar Blum Silveira 67ed24896a Dispose socket on Accept() error. 2015-12-28 12:19:35 -08:00
Ben Adams eb8f860bd6 Avoid generic boxing in Post 2015-12-26 15:07:00 +00:00
Ben Adams f220a9f200 Faster Peek 2015-12-26 07:38:08 +00:00
Ben Adams 11b360b667 Faster MessageBody.For 2015-12-26 07:11:54 +00:00
Cesar Blum Silveira ada61f8181 Merge branch 'benaadams/readonly-static' into dev 2015-12-22 11:12:00 -08:00
moozzyk aaf84afaff Don't try calling `uname` on Windows 2015-12-21 10:25:48 -08:00
Ben Adams 02fa0c306d Jit readonly static optimization 2015-12-20 00:34:42 +00:00
John Luo bd10d507f8 Reacting to new Hosting API 2015-12-17 15:08:17 -08:00
Cesar Blum Silveira 717b355bfd Merge branch 'benaadams/horizontal-initalize' into dev 2015-12-17 14:37:48 -08:00
Ben Adams 7625f65e6c Faster MemoryPoolIterator2.CopyFrom 2015-12-17 11:32:01 +00:00
Ben Adams 186f6d0a05 Horizontal initialize repeat vectors once 2015-12-17 10:18:20 +00:00
Stephen Halter 5d6fdc5eb5 Merge branch 'benaadams/vector.dot' into dev 2015-12-16 17:39:40 -08:00
Stephen Halter 67a0165aec Merge branch 'benaadams/headers.clearfast' into dev 2015-12-16 15:48:01 -08:00
Ben Adams 559cd51255 Faster Headers.ClearFast 2015-12-16 22:23:33 +00:00
Ben Adams 9fa9c45eda ReuseStreams config and tests 2015-12-16 21:27:07 +00:00
Ben Adams 841ec73497 Prevent OnComplete modifying Streams 2015-12-16 20:51:45 +00:00
Ben Adams f5e45accac Amortize Stream Costs 2015-12-16 20:51:44 +00:00
Cesar Blum Silveira 349af50977 Pre-allocate standard method and version strings. 2015-12-16 10:47:59 -08:00
Ben Adams 4460cd3470 Don't use Vector<byte>.Dot 2015-12-16 16:24:45 +00:00
moozzyk 83cff16715 Changing the folder of ARM version of libuv to win7-arm
Depends on: https://github.com/aspnet/libuv-build/pull/4
Fixes: https://github.com/aspnet/Home/issues/1111
2015-12-15 10:37:29 -08:00
Ben Adams dc9f5c433b Update reason phrases to current
Update HTTP reason phrases to current values; are currently original
phrases.
2015-12-13 23:17:03 +00:00
Ben Adams 5665eba646 Pool WriteContexts additionally 2015-12-10 20:31:30 +00:00
Stephen Halter 3e42904096 Pool UvWriteReqs instead of SocketOutput.WriteContexts
- This allows all connections accepted by the same thread to share a pool
2015-12-10 20:31:30 +00:00
Ben Adams 992664e0dc Process cascaded work immediately
Without waiting for next libuv pass

Fix for potential regression in #363 due to bug fix.
2015-12-10 20:31:29 +00:00
Ben Adams 97d3340624 Resuse writes, initalize queues 2015-12-10 20:31:28 +00:00
Stephen Halter f9d70e601c Set error before changing state in SocketInput.AbortAwaiting
- This fixes a tight race where awaiting code might continue but not see
  the ODE that moved SocketInput into the completed state.
2015-12-10 12:21:20 -08:00
Stephen Halter f42bb02f24 Merge branch 'benaadams/server-crash' into dev 2015-12-10 12:18:13 -08:00
Ben Adams 9e8b07ecf8 Error concurrent reads gracefully 2015-12-10 16:25:06 +00:00
John Luo fd33475c05 Ignore null valued headers #429 2015-12-09 17:23:34 -08:00
Stephen Halter ebf642457d Merge branch 'khellang/kestrel-server-tests' into dev 2015-12-09 15:27:51 -08:00
Stephen Halter dd02a1c442 Fix compiler warnings 2015-12-08 17:31:57 -08:00
Kristian Hellang 6fbc3b8832 Added null check in KestrelServerInformation 2015-12-08 10:58:42 +01:00
Stephen Halter 90ece575f7 Merge branch 'khellang/configurable-thread-count' into dev 2015-12-08 00:13:56 -08:00
Stephen Halter de5dd4ca57 Merge branch 'benaadams/trim-streams' into dev 2015-12-08 00:11:29 -08:00
Stephen Halter d0dca75241 Remove count parameter from ISocketOutput.ProducingComplete
- This makes the calling code cleaner with a (hopefully) minimal pref impact
2015-12-08 00:09:24 -08:00
John Luo dff3a4f231 Reacting to verbose rename 2015-12-07 17:42:13 -08:00
Kristian Hellang 4c68807a05 Split out ProcessorThreadCount, added InvariantCulture to TryParse 2015-12-07 22:14:05 +01:00
Kristian Hellang 8d6a999bc3 Made NoDelay configurable 2015-12-07 22:09:04 +01:00
Kristian Hellang 12ee74c09c server.threadCount -> kestre.threadCount 2015-12-07 22:00:03 +01:00
Ben Adams 59bfb9ba10 Trim req/resp streams by a field each 2015-12-07 15:31:14 +00:00