Commit Graph

1253 Commits

Author SHA1 Message Date
Vladimir Sadov f0ade24cf7 Updating to new toolset compiler. (#2043)
* Updating to new toolset compiler.
Now includes ref escaping rules.

* newer version.
2017-09-06 15:52:47 -07:00
Stephen Halter 284367db9f Improve ConnectionLimitMiddleware and connection pipeline building (#2010)
* Improve ConnectionLimitMiddleware and connection pipeline building
* Add IDecrementConcurrentConnectionCountFeature
* Flow connection features from connection middleware
2017-08-30 11:30:20 -07:00
Ben Adams e7743cbb78 Shorter LibuvThread locks (#2034) 2017-08-29 12:21:45 -07:00
David Fowler 9d8556e7c4 Added FrameConnection.OnConnectionClosed back (#2028) 2017-08-26 21:20:06 -07:00
David Fowler 7854c0604a Remove the events on ConnectionContext (#2023)
- Use the pipe events and removed the Tasks from ConnectionContext
- Remove OnConnectionClosed from FrameConnection. Since the `FrameConnetion` is a single middleware, not the entire pipeline, we shouldn't need to wait on the connection close there.
- It seems like the callbacks are rooted on the pipe even after they fire. This needs to be investigated in pipelines.
2017-08-26 20:19:55 -07:00
Ben Adams 09be7c416a Use preparsed version, rather than reparsing (#2021)
Current path is:

 Parser -> HttpVersion Enum -> Get Version String -> Set `HttpVersion` with string -> Convert back to Enum

Can just set the enum directly since its already parsed.

Also using the const rather than strings; where the strings are in code
2017-08-26 17:18:16 -07:00
Ben Adams 088f7e32ae Reset StatusCode & ReasonPhrase directly (#2025) 2017-08-26 17:14:45 -07:00
David Fowler dc9ed60465 Create the connection logging scope in ConnectionHandler (#2013)
- Instead of doing it on the FrameConnection only. This will
make sure all middleware logs get the connection id as part of their scope.
2017-08-22 14:32:58 -07:00
Ben Adams 11a9b6498d Don't alloc IEnumerable in Reset for ITlsConnectionFeature (#2009)
* Don't alloc IEnumerable for ITlsConnectionFeature
* Delegate to ConnectionFeatures and determine scheme once
2017-08-21 17:01:05 -07:00
David Fowler 2e6687031d Added initial connection middleware pipeline (#2003)
* Added initial connection middleware pipeline
- Implemented IConnectionBuilder on ListenOptions. Kept IConnectionAdapter for now.
- Delay the configure callback for ListenOptions until the server has started.
- Added ConnectionLimitMiddleware and HttpConnectionMiddleware
- Expose ConnectionAborted and ConnectionClosed on ConnectionContext and
IConnectionTransportFeature
- Updated the tests
- Removed IConnectionApplicationFeature
- Moved Application to IConnectionTransportFeature
2017-08-21 12:11:27 -07:00
Stephen Halter 14f122fb9f Measure Writing in FrameWritingBenchmark 2017-08-17 16:59:24 -07:00
Ben Adams 442ee80039 Less awaits for Reponse Write(Async) 2017-08-17 15:51:22 -07:00
Nate McMaster 87db7cceb6 Stop producing Microsoft.AspNetCore.Server.Kestrel.Tls as a package 2017-08-16 14:56:01 -07:00
Nate McMaster 26f1d4baa3 Use PackageLineup
PackageLineup is a way to manage PackageReference versions across large projects. It removes the version information from the repository and instead pulls the information from an external "lineup" file.
2017-08-16 14:10:43 -07:00
Cesar Blum Silveira 0fafd19ec9 Initial HTTP/2 support.
What works:

- HTTP/2 over TLS1.2 with ALPN
- Request and response flow
  - Headers are compressed and decompressed with HPACK
  - Request body can be read by streams (if present)
  - MVC template app with individual auth works fine
- PRIORITY frames are validated
- RST_STREAM frames are validated and abort streams
- SETTINGS frames are validated and ACKed
- PING frames are validated and ACKed
- GOAWAY frames stop connections
- WINDOW_UPDATE frames are validated
- CONTINUATION frames are sent for large header blocks

What doesn't work yet:

- Flow control in either direction
- It's not possible to encode a single header across more than one frame
  - Affects only a very large header (name and value combined ~16KB long)
- Request trailers
- Response trailers
- Limits and timeouts in `KestrelServerLimits` are not enforced on HTTP/2
- HPACK use is very limited on the send side
  - Literals are not Huffman-encoded
  - Common headers (e.g. "server: Kestrel") are never indexed
- Honoring client settings
- Some error checking is still missing (e.g. validating incoming frame size)
2017-08-16 10:04:44 -07:00
David Fowler 5c775073a4 Initial bedrock refactoring (#1995)
- Added Protocols.Abstractions
 - IConnectionHandler.OnConnection takes an IFeatureCollection instead of
 IConnectionInfo
 - Removed IConnectionContext and IConnectionInformation replaced with
 IConnectionTransportFeature
 - Updated FrameConnectionContext and FrameContext to have the relevant
 state instead of flowing the ConnectionInformation.
 - Updated tests
2017-08-16 00:02:48 -07:00
Pavel Krymets 659fa967a1 Consume corefxlab packages and private build of C# compiler (#1976) 2017-08-07 13:58:19 -07:00
Nate McMaster 6584a8b5fd Shorten folder names
Remove the Microsoft.AspNetCore.Server prefix from csproj and their folders. This is required to help us avoid max path issues on Windows.
2017-07-28 11:11:55 -07:00
Pavel Krymets fd6617d101 React to pipeline changes (#1969) 2017-07-26 15:51:06 -07:00
Stephen Halter 09c92d61d0 Merge branch 'rel/2.0.0' into dev 2017-07-17 14:58:16 -07:00
Stephen Halter f0e572075b Fix FlushAsync when a ConnectionAdapter is configured (#1957)
* Also remove async void everywhere
2017-07-17 14:57:26 -07:00
David Fowler 7ebbdad974 Add support for connection scopes if logging is enabled (#1953)
* Add support for connection scopes if logging is enabled
- Don't create a scope if logging isn't on
- Copied the pattern we use in Hosting
2017-07-12 11:45:08 -07:00
Cesar Blum Silveira fd1758fdfc Make StopAsync multi-thread safe (#1666). 2017-07-11 14:29:50 -07:00
Cesar Blum Silveira eca4bfe6c3 Add response minimum data rate feature. 2017-07-07 22:37:25 -07:00
Nate McMaster 5185ebe45f Fix typo in type name (#1948) 2017-07-07 16:27:20 -07:00
Nate McMaster ec72c255f6 Make HttpsConnectionAdapter pubternal 2017-07-07 14:23:34 -07:00
Nate McMaster a3c157cb61 Validate certificate EKU when it is provided 2017-07-07 11:31:06 -07:00
Nate McMaster bd8a2c8a62 Add XML docs for the public HTTPs APIs shipping in 2.0 (#1942) 2017-07-07 10:40:39 -07:00
Aristarkh Zagorodnikov 00d17dea79 Domain socket handles (#1922)
* UvPipeHandle.Open(IntPtr) and underlying interop
* LibuvConstants.ENOTSUP
* IEndpointInformation.HandleType along with ListenOptions extra ctor and handle type re-specification
* Exception-based auto-detection of socket type in Listener, accept socket creation support for detected handle types in ListenerContext
* Added systemd Unix socket activation tests
2017-07-03 11:11:23 -07:00
Stephen Halter e9ffcdb414 Add feature to optionally disallow synchronous IO (#1919)
* Allow synchronous IO by default
2017-07-03 11:07:17 -07:00
Cesar Blum Silveira 81c2b57dda Increase default request min rate to 240 bytes/second (#1929). 2017-06-30 14:58:44 -07:00
Cesar Blum Silveira 68ba9a9445 Avoid torn reads from _frame.MinReadBodyDataRate in FrameConnection.Tick(). 2017-06-30 12:22:31 -07:00
Cesar Blum Silveira f2061ed716 Rename request body min rate APIs (#1901). 2017-06-29 17:16:34 -07:00
Nate McMaster 9b4be69e9d Do not enforce timeouts when the debugger is attached 2017-06-27 16:56:27 -07:00
Stephen Halter ea2f1033d3 Make Transport.Abstractions pubternal (#1911)
* Remove Sockets transport dependency from primary package
* Use deprecated travis images to keep systemd tests running

https://blog.travis-ci.com/2017-06-21-trusty-updates-2017-Q2-launch
2017-06-21 14:58:57 -07:00
Stephen Halter e1e7c9b810 Wait until the writer is complete to reset RequestBodyPipe (#1902) 2017-06-20 10:56:23 -07:00
Cesar Blum Silveira 892de7d4b8 Merge branch 'rel/2.0.0-preview2' into dev 2017-06-19 16:39:00 -07:00
Cesar Blum Silveira 7afd279a6d Don't pause and resume read timing on upgrade requests (#1904). 2017-06-19 16:37:47 -07:00
Stephen Halter a97c08843c Complete IPipeWriter in OutputProducer.Abort() (#1894)
- This prevents MemoryPoolBlocks from leaking when writes fail
2017-06-12 11:12:01 -07:00
Stephen Halter d879518a18 Always complete RequestBodyPipe.Reader (#1893)
* Disable test that leaks blocks in debug builds
* Move some test helpers
2017-06-12 11:11:40 -07:00
Stephen Halter 31e5dfdcf0 Merge branch 'rel/2.0.0-preview2' into dev 2017-06-08 15:09:55 -07:00
Stephen Halter f67a105ff4 Update defaults in KestrelServerLimits doc comments (#1891) 2017-06-08 15:08:49 -07:00
Cesar Blum Silveira 48638cb1cd Merge branch 'rel/2.0.0-preview2' into dev 2017-06-08 15:01:34 -07:00
Cesar Blum Silveira fcc04f8c3d Add request body minimum data rate feature (#1874). 2017-06-08 14:36:03 -07:00
Pranav K 3f771ef0bc Remove usage of TaskCache (#1889)
* Remove usage of TaskCache
2017-06-08 13:47:01 -07:00
Stephen Halter f96c48c08d Add a request body size limit (#1877)
- Implement IHttpMaxRequestBodySizeFeature
2017-06-07 11:48:56 -07:00
Hao Kung 0390779084 Revert " #1875 Add Configuration support and tests."
This reverts commit c6e228d176.
2017-06-05 13:48:38 -07:00
Chris R c6e228d176 #1875 Add Configuration support and tests. 2017-06-02 12:30:12 -07:00
Cesar Blum Silveira 402b337178 Temporary workaround for GenerateResource task error on VS. 2017-05-30 12:47:36 -07:00
Nate McMaster c343628926 Implement max connection limits
- Added new options to allow configuring the maximum number of concurrent connections and upgraded connections.
- `KestrelServerLimits.MaxConcurrentConnections` defaults unlimited.
- `KestrelServerLimits.MaxConcurrentUpgradedConnections` defaults to unlimited.
- Calls to IHttpUpgradeFeature.UpgradeAsync() will throw when the MaxConcurrentUpgradedConnections limit has been reached.
- Kestrel will close new connections without response when MaxConcurrentConnections is reached.
2017-05-26 12:27:48 -07:00
Cesar Blum Silveira 197eb43d8a Read request body concurrent to app execution. 2017-05-22 12:23:02 -07:00
Nate McMaster 390582dcf1 Target .NET Standard 2.0 (#1849) 2017-05-20 10:37:35 -07:00
Pavel Krymets 34ab089e7b React to scheduler changes (#1846) 2017-05-18 14:49:48 -07:00
Nate McMaster 7f0319f5dd Throw InvalidOperationException from IHttpUpgradeFeature.UpgradeAsync when request is not upgradable 2017-05-17 11:38:42 -07:00
Pavel Krymets d22f689fd2 Add support to use System.Memory as a package instead of internilized source (#1821) 2017-05-16 16:54:03 -07:00
David Fowler cf16d601d6 Remove synchronous Write APIs (#1838) 2017-05-15 19:04:04 -07:00
Stephen Halter 9ab09dbe48 Change Exception to UvException where possible (#1833) 2017-05-15 11:03:04 -07:00
Stephen Halter 41f1922502 Simplify LibuvConnection.OnRead() (#1828)
* Simplify LibuvConnection.OnRead()

- Fix a null reference that sometimes occurs given an EOF status
2017-05-15 11:02:16 -07:00
David Fowler 1a706113d9 Remove rogue ConfigureAwait (#1830)
- We don't do it anywhere else, I assume this is left over
from older legacy
2017-05-12 18:26:52 -07:00
Cesar Blum Silveira cb1d0f3956 Prevent infinite loop in PipelineExtensions.PeekAsyncAwaited() (#1827). 2017-05-12 16:04:38 -07:00
Cesar Blum Silveira 37f15bdd85 Create Frame in FrameConnection. 2017-05-10 16:48:37 -07:00
David Fowler b9518e3684 Invert the dependency between connection adapters and Frame (#1822)
* Invert the dependency between connection adapters and Frame
- Removed PrepareRequest from IAdaptedConnection and instead added
a feature collection to the ConnectionAdapterContext. This allows features to be set
once by the adapter instead of per request. It's the Frame's job to copy features
from the connection level feature collection into the per request feature collection.
- Set the scheme to "https" based on the presence of ITlsConnectionFeature.
- Always set ITlsConnection feature if the HttpsAdaptedConnection doesn't throw during
the handshake
2017-05-10 15:29:43 -07:00
David Fowler c8b6a2be56 More FrameConnection refactoring (#1820)
* More FrameConnection refactoring
- This change reverts the change to complete the writer with an
exception on abort because of the number of first chance exceptions
that get thrown.
- This change also moves connection logging into FrameConnection instead
of being split between the ConnectionHandler and FrameConnection.
- Fixed issues with LibuvOutputConsumerTests that leak WriteReq since
cancelled writes no longer end the connection.
2017-05-09 17:40:25 -07:00
David Fowler c48113ad80 Refactoring and of FrameConnection and Frame (#1816)
* Refactoring and of FrameConnection and Frame
- Building on top of the last refactoring of FrameConnection, this change aims to clean up
the communication between the Frame and FrameConnection by removing some concepts and
being consistent about the communication between Frame and FrameConnection with or without
connection adapters. Changes include:
- Removing ConnectionLifetimeControl, ISocketOutput, StreamSocketOutput
- Moving more initialization of the frame to FrameConnection after the pipes
are setup
- OutputProducer communicates cancellation via the IPipeWriter instead of the output's IPipeReader.
- Frame always communicates via the pipes and that communications flows through the layers to the transport.
This means that each 1/2 of the adapted pipeline handles closing the right side of the transport at the
right time, propagating exceptions as necessary.
- This is how the flow looks now:
            ->                        ->
[transport]     [connection adapters]     [frame]
            <-                        <-
- Transports need to handle a ConnectionAbortedException on the output as a signal to stop
writing and end the connection. This will no longer try to drain the output but will just stop
writing and end the response immediately.
- Remove frame.Abort when cancellation on Write fails.
- Unify the connection shutdown logic
- Dispose 1/2 initialized connection adapters

#1815
2017-05-08 20:44:13 -07:00
Stephen Halter 6e2fdda162 Simplify connection lifetime control flow (#1776)
* Also make IAdaptedConnection disposable
2017-05-05 16:11:01 -07:00
Pavel Krymets 28b479c99a Merge branch 'rel/2.0.0-preview1' into dev 2017-05-05 14:35:41 -07:00
Pavel Krymets a9c165e666 netcoreapp2.0 (#1810) 2017-05-05 14:31:34 -07:00
David Fowler cd1568d7f4 Remove uv_shutdown because FIN is already sent during uv_close (#1811)
* Remove uv_shutdown because FIN is already sent during uv_close

#1808
2017-05-05 12:52:10 -07:00
Stephen Halter 557cf29e4a arespr/knownmethods-optimizations cleanup 2017-05-04 12:27:22 -07:00
Stephen Halter f464760bf8 Merge branch 'arespr/knownmethods-optimizations' into dev 2017-05-04 11:44:54 -07:00
David Fowler 9072e0ba26 Added a ConnectionAbortedException to Transport.Abstractions (#1806)
* Added a ConnectionAbortedException to Transport.Abstractions
- To avoid hard coding TaskCanceledException in each transport
- This PR tries to keep compatibility by converting the ConnectionAbortedException
to a TaskCanceledException on exceptions in FrameRequestStream. The downside is that
this conversion causes an async state machine to be created per call to ReadAsync.
CopyToAsync isn't that bad because it's a single long running task.
2017-05-03 19:38:34 -07:00
David Fowler 35b5d92652 Fix EBUSY errors on uv_loop_close (#1798)
* Fix race where ListenerPrimary is disposed before secondary listeners spin up
- Since we only add listeners to dispatch pipes after receiving the "ack" message
it's possible to have pipes that were created but not acked yet. We might miss
disposal of those pipes if they were never added to the list of _dispatchPipes.

#1761
2017-05-01 14:55:32 -07:00
Nate McMaster 4dc7946cd8 Implement new request trace identifier format
The format:
The trace identifier begins with connection ID and ends with a number that increments with each request per connection.

Example:
Connection ID = xyz
Request 1 = "xyz:00000001"
Request 2 = "xyz:00000002"
...
Request 15 = "xyz:0000000F"
Request 16 = "xyz:00000010"
2017-05-01 09:50:47 -07:00
David Fowler 9a5d6c8879 More shutdown tweaks (#1760)
* More shutdown tweaks
- Added assert if loop has ended before starting the shutdown
sequence.
2017-04-29 01:15:10 -07:00
Stephen Halter 7122b6c4aa Fix flaky heartbeat test (#1794) 2017-04-29 00:42:27 -07:00
David Fowler 749e282102 Prepare for OnReader/WriterCallbacks changes (#1791)
- This change does a few things:

1. It adds the events we will replace with
pipe events to IConnectionContext and IConnectionInformation to get out of
band notifications about pipe completions.

2. It also implements those callbacks
and exposing slight changes we'll need to make once we have them. The idea is
that we can delete/replace these methods once we have the new pipe API and things
will keep working.
2017-04-29 00:41:48 -07:00
David Fowler cfad8051d5 Merge branch 'rel/2.0.0-preview1' into dev 2017-04-27 21:00:46 -07:00
David Fowler 0e372edb2c Removed UseTransportThread (#1781) 2017-04-27 20:59:50 -07:00
David Fowler 5b62024fc8 * Properly handle FINs and resets in the SocketConnection (#1782)
- FIN from the client shouldn't throw
- Forced close from the server should throw
- Properly wrap connection reset exceptions and other exceptions
in IO exceptions
- This gives kestrel control over when the output closes
- Fixed one test that assumed libuv
- Dispose the connection to yield the reader

Fixes #1774
2017-04-27 17:55:35 -07:00
Stephen Halter 79ea2bb9b3 Quick fix for SslStream ODEs in HttpsAdaptedConnection.PrepareRequest (#1786) 2017-04-27 16:56:07 -07:00
David Fowler 0755495ce5 Remove Logging dependency from the http parser (#1780)
* Remove Logging dependency from the http parser
2017-04-27 08:46:08 -07:00
Nate McMaster c2f15fcac3 Move user-facing strings into resource files 2017-04-26 17:22:55 -07:00
Nate McMaster 9464003bda Add wait in ListenerPrimaryTests to avoid race condition with List.Add 2017-04-26 11:03:28 -07:00
David Fowler 566a587126 Added ApplicationSchedulingMode to KestrelServerOptions (#1759)
* Added ApplicationSchedulingMode to KestrelServerOptions
- Made default mode Default instead of ThreadPool
2017-04-25 00:37:09 -07:00
David Fowler 9e80fb65bd Removed the wrote after disconnect log (#1747)
- It's not very useful
2017-04-24 17:34:56 -07:00
Stephen Halter f26c31c116 Fix scope id test failures on mac and linux (#1754) 2017-04-24 17:15:41 -07:00
Nate McMaster 39047638cc Add debug logging in address binding when IPv6Any fails 2017-04-24 17:14:43 -07:00
Stephen Halter c22f8f5c59 Fix potential race in LibuvThread.StopAsync (#1756) 2017-04-24 16:47:48 -07:00
David Fowler a98581670e Schedule connection adapter reads on configured thread pool (#1741)
* Schedule connection adapter reads on configured thread pool
- This should speed up connection adapters as we don't block
new reads. It *might* also help some of the test flakiness
2017-04-24 12:19:22 -07:00
David Fowler 7e5604b2f5 Remove async from OnRead (#1746)
- Remove async from fast path.
- Added ApplyBackpressureAsync that pauses and resumes reading
2017-04-24 11:58:52 -07:00
Pavel Krymets df9e48b1f0 Add cancellation support for write async (#1736) 2017-04-24 11:58:08 -07:00
David Fowler 71d2abed06 More clean up of LibuvConnection (#1743)
* More clean up of LibuvConnection
- Use C# 7
- Use Buffer<T>.Pin to get access to the underlying
pointer instead of using TryGetPointer.
2017-04-23 20:45:03 -07:00
David Fowler db44f5b672 Clean up LibuvOutputConsumer (#1744)
* Clean up LibuvOutputConsumer
- Added UvShutdownReq.ShutdownAsync
- Added Debug.Assert in LibuvAwaitable since it should never race.
2017-04-23 20:22:49 -07:00
David Fowler 650a3ccc26 Pass exception to Complete (#1739) 2017-04-21 23:31:59 -07:00
David Fowler a749939be4 Clean up libuv connection (#1726)
* Clean up libuv connection
- Cancel all pending flushes on the input writer before
disposing the stream handle.
- Complete the pipe before disposing the socket
- Added logging for connection pause/resume.
- Added test
2017-04-21 13:13:05 -07:00
David Fowler feb9d1281e Tweak libuv shutdown sequence (#1735)
* Tweak libuv shutdown sequence
- Increase timeouts for thread and listener shutdowns
- Remove post.Unreference call from AllowStopRude
2017-04-21 13:12:37 -07:00
Nate McMaster ee9feedc27 Improve implementation of IHttpUpgradeFeature
After upgrade has been accepted by the server:
 - Reads to HttpRequest.Body always return 0
 - Writes to HttpResponse.Body always throw
 - The only valid way to communicate is to use the stream returned by IHttpUpgradeFeature.UpgradeAsync()

Also, Kestrel returns HTTP 400 if requests attempt to send a request body along with Connection: Upgrade
2017-04-20 12:42:58 -07:00
David Fowler d1494224f4 Make the tests that use the Heartbeat more deterministic. (#1724)
- Added Start to Heartbeat and made OnHeartbeat internal
- Explicitly call start in tests
2017-04-20 01:41:37 -07:00
Stephen Halter a053ca4758 Move shutdown logic from transport to core (#1707)
* Move shutdown logic from transport to core
* Use weak references to track FrameConnections
2017-04-19 18:08:36 -07:00
Nate McMaster 7a3a731686 Refactor address binding and handle EAFNOSUPPORT
- Simplify KestrelServer by refactoring address binding into a separate class
 - Use strategy pattern to implement address binding for different sceanrios
 - Add fallback from binding 0.0.0.0 if binding to [::] fails (can happen if UvException with EAFNOSUPPORT is thrown)
2017-04-19 15:58:12 -07:00
David Fowler 42d82a507d Make all UvRequest objects normal GC handles (#1698)
* Make all UvRequest objects normal GC handles
- This avoids the cost of using GCHandle.Alloc per operation.
- It *does* mean that we need to explicitly dispose UvRequest objects
after using them (which we did before anyways). This change does
add a few try catch statements to make sure we always dispose the UvRequest
if there are synchronous exceptions.
- This is ~1.5% of the overhead in the benchmarks today
- Keep track of all allocated UvRequest objects with a WeakReference in DEBUG
and assert none are kept around after cleaning up.
- Fixed a leak where we don't clean up UvWriteReq objects when writing
to the named pipe.
2017-04-19 15:16:11 -07:00
Pavel Krymets 88890595d1 Define a constant to workaround corefxlab classes asses modifier issue 2017-04-18 09:01:35 -07:00
Cesar Blum Silveira 801a7c7652 Add copyright header to TransportSocketOptions.cs. 2017-04-17 20:47:29 -07:00
David Fowler e4af3f7e35 Expose a UseTransportThread property on KestrelServerOptions (#1695)
- This property will force Kestrel to use whatever scheduler the transport
used when write and read callbacks are fired. The default value is false so
all calls to user code including connection adapters, and the application function,
and cancellation token callbacks.
- Transports may expose configuration that changes what the transport thread is.
- Removed InternalKestrelServerOptions.cs
- Added a configurable UseSockets overload (even though there are no options yet)
- Remove RequiresDispatch from the IConnectionInformation
2017-04-17 12:58:28 -07:00
David Fowler 85d883456b Remove Reset from IHttpParser (#1700)
* Remove Reset from IHttpParser
- The parser isn't stateful and doesn't need it
2017-04-17 00:37:40 -07:00
David Fowler 31cc1e5018 Fix extra space 2017-04-16 09:25:28 -07:00
David Fowler 6a403d231e Clean up IThreadPool interface (#1696)
- Remove tcs completion methods
2017-04-15 19:04:44 -07:00
Stephen Halter 8cd58b042c Fix tests using Heartbeat 2017-04-14 16:26:27 -07:00
Stephen Halter 7aa7b3e0a9 Track connections until request processing completes
- Paves the way to allow request processing to continue during server shutdown
  even after a client disconnects.
2017-04-14 16:26:27 -07:00
Nate McMaster c08c57f764 Reject HTTP/1.1 requests that do not have a correct Host header
Improves Kestrel to reject requests that don't conform to HTTP spec.

RFC 7230 section 5.4: "A server MUST respond with a 400 (Bad Request)
status code to any HTTP/1.1 request message that lacks a Host header
 field and to any request message that contains more than one Host
 header field or a Host header field with an invalid field-value."

See https://tools.ietf.org/html/rfc7230#section-5.4.

Other changes:

 - update VS code settings to work better with CLI 2.0
 - update tests that were subject to infinite hangs
2017-04-14 15:48:21 -07:00
David Fowler 9e37272f06 Clean up the logic in DoReceive 2017-04-14 01:39:56 -07:00
David Fowler aedd061865 Tweaks to socket transport (#1687)
- Style changes: Sort usings, use more var and C#7
- Added ConfigureAwait to stop dead locks with xunit
- Remove duplicate handling of aborts in the receiver
- Handle the case where output ends before input
2017-04-14 01:14:21 -07:00
Geoff Kizer efa0a48fb1 Add initial Socket transport for Kestrel (#1659)
- This change adds the initial socket transport for Kestrel, all of the tests pass but there are still
a couple of things that aren't done yet.
- The functional tests support running both on both transports but tests aren't running for sockets right now. We need to parameterize these. 
- TimeoutServerTests hard code the libuv transport, this needs to support any transport.
- There is no handling of connection stopping on application shutdown. This is being implemented in kestrel core so transports don't need to handle it. Sockets won't be the default transport until that is the case.
- Performance needs to be looked at, today the SocketTransport doesn't dispatch by default and we're not buffering in kestrel.core, this can hurt as the number of kernel calls map 1:1 with application writes.
2017-04-13 23:10:06 -07:00
John Luo 0723d46ec4 Honor PreferHostingUrls #1575 2017-04-13 18:12:53 -07:00
Pavel Krymets 3045cff3c5 Fix adapted output pipe options (#1682) 2017-04-13 15:54:48 -07:00
Stephen Halter 6036f27f52 Fix deadlocks in startup and shutdown 2017-04-13 12:47:34 -07:00
Nate McMaster ed4a27a827 Remove ListenOptions.Scheme and move IConnectionFilter to .Internal namespace
Add an internal API to ListenOptions to determine if an endpoint is configured to use HTTPS. This is a temporary as the design of connection adapters and configuration will churn before release.
2017-04-13 09:45:26 -07:00
David Fowler 8258d300e2 Small tweaks to timer logic (#1668)
- Avoid null refs in tests by ignoring null IKestrelTrace
- Use a static callback for the timer callback

Fixes #1667
2017-04-13 09:29:43 -07:00
Chris R 8b6d933711 Add ConfigureAwaits to prevent test deadlocks 2017-04-13 07:26:51 -07:00
Chris R e043fa871e Make IServer Start and Stop async 2017-04-12 22:23:05 -07:00
Stephen Halter 11ab602b2f Make timeout logic transport agnostic (#1649)
* Make timeout logic transport agnostic

* PR feedback

* More PR feedback
2017-04-12 16:15:46 -07:00
Ben Adams d29e4d4cf0 Specialized struct generics rather than interface (#1640)
Changed the IHttpParser interface to be generic. This lets use a struct to 
get better code generation and also should allow us to inline calls back into
the handler from the parser.
2017-04-10 19:30:18 -07:00
Ben Adams 2863cca8ca FrameFeatureCollection benchmark (#1643) 2017-04-09 16:02:18 -07:00
Ben Adams fb22629da6 Use Span.IndexOf rather than Contains (#1638)
- Remove Contains method and use IndexOf (which is already vectorized) to look for CR in header values.
2017-04-08 23:45:26 -07:00
Stephen Halter 58284bde5c Don't dispose WriteReqPool and PipeFactory too soon (#1633) 2017-04-08 01:35:02 -07:00
David Fowler 0fd885e5eb Signal the reader after aborting the connection (#1636)
- This will give it a chance to unwind gracefully before failing
with an invalid request.

Fixes #1632
2017-04-08 01:22:06 -07:00
Pavel Krymets 53b0eea2ec Use writable buffer writer (#1564) 2017-04-07 14:40:10 -07:00
David Fowler 239b691ff5 A few HttpParser changes (#1624)
- Renamed KestrelHttpParser to HttpParser
- Removed the generic virtual dispatch as it turns out to be an
order of magnitude slower than regular virtual dispatch. This change
means we also lose the inlining of Frame.OnStartLine and Frame.OnHeader.
2017-04-07 08:35:53 -07:00
Cesar Blum Silveira f253dbc0c0 Split transport-specific tests and general tests into distinct test projects (#1588).
* Rename EngineTests to LibuvTransportTests.
* Move libuv-specific tests into their own test project.
* Move LibuvOutputConsumerTests.AllocCommitCanBeCalledAfterConnectionClose to new OutputProducerTests class and rename it to WritesNoopAfterConnectionCloses.
* Remove TransportContext from TestServiceContext.
* Make KestrelTests depend on Kestrel.Core only.
* Rename Microsoft.AspNetCore.Server.Kestrel.KestrelTests to Microsoft.AspNetCore.Server.Kestrel.Core.Tests.
* Add Microsoft.AspNetCore.Server.Kestrel.Tests test project for WebHostBuilderKestrelExtensionsTests.
* Increase socket receive timeout in MaxRequestBufferSizeTests to mitigate flakiness.
* Anything using TestServer should be a functional test.
* Move out of LibuvTransportTests tests that are not specific to LibuvTransport.
  - Move to RequestTests:
    - Http11 (rename to Http11KeptAliveByDefault)
    - Http10ContentLength (rename to Http10NotKeptAliveByDefault)
    - Http10KeepAlive
    - Http10KeepAliveNotUsedIfResponseContentLengthNotSet (rename to Http10KeepAliveNotHonoredIfResponseContentLengthNotSet)
    - Http10ContentLengthKeepAlive (rename to Http10KeepAliveHonoredIfResponseContentLengthSet)
    - Expect100ContinueForBody (rename to Expect100ContinueHonored)
    - ZeroContentLengthAssumedOnNonKeepAliveRequestsWithoutContentLengthOrTransferEncodingHeader
    - ConnectionClosesWhenFinReceivedBeforeRequestCompletes (test was actually not marked as Theory, and was incorrect)
    - RequestsCanBeAbortedMidRead
    - RequestHeadersAreResetOnEachRequest
    - UpgradeRequestIsNotKeptAliveOrChunked
    - HeadersAndStreamsAreReused (rename to HeadersAndStreamsAreReusedAcrossRequests)
  - Move to ResponseTests:
    - Http10RequestReceivesHttp11Response (rename to Http11ResponseSentToHttp10Request)
    - ZeroContentLengthSetAutomaticallyAfterNoWrites
    - ZeroContentLengthSetAutomaticallyForNonKeepAliveRequests
    - ZeroContentLengthNotSetAutomaticallyForHeadRequests
    - ZeroContentLengthNotSetAutomaticallyForCertainStatusCodes
    - ConnectionClosedAfter101Response
    - ThrowingResultsIn500Response
    - ThrowingAfterWritingKillsConnection
    - ThrowingAfterPartialWriteKillsConnection
    - ThrowingInOnStartingResultsInFailedWritesAnd500Response
    - ThrowingInOnCompletedIsLoggedAndClosesConnection
    - FailedWritesResultInAbortedRequest
    - NoErrorsLoggedWhenServerEndsConnectionBeforeClient
    - NoResponseSentWhenConnectionIsClosedByServerBeforeClientFinishesSendingRequest
    - ResponseHeadersAreResetOnEachRequest
    - OnStartingCallbacksAreCalledInLastInFirstOutOrder
    - OnCompletedCallbacksAreCalledInLastInFirstOutOrder
  - Remove:
    - RePathEscapeTests (theory data to HttpParsingData)
    - ReDisconnectingClient (what was that testing?)
2017-04-06 19:09:40 -07:00
Pranav K 3b016e6832 Use 4.3.0 version of System.Threading.Tasks.Extensions 2017-04-05 18:03:24 -07:00
Pavel Krymets dd02ba577f Use corefxlab and corefx by source (#1612) 2017-04-05 15:37:45 -07:00
Stephen Halter b40d8b4248 Fix naming of IConnectionInformation.OutputReaderScheduler (#1608) 2017-04-04 21:30:33 -07:00
Cesar Blum Silveira 7ceea5323a Rename namespaces/directories/classes in Kestrel.Core and Transport.Libuv (#1582).
- Put everything in the libuv transport package under `Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.*` namespaces.
- Move stuff in Transport.Libuv/Internal/Http and Transport.Libuv/Internal/Infrastructure to Transport.Libuv/Internal (keep the Networking directory for the libuv wrappers).
- Add `Libuv` prefix to most libuv internal classes.
- Rename `KestrelEngine` to `LibuvTransport`.
- Rename `SocketOutputConsumer` to `LibuvOutputConsumer`.
- Rename `SocketOutputProducer` to `OutputProducer`.
- Fix namespaces in `Microsoft.AspNetCore.Server.Kestrel.Core.`
2017-04-04 13:45:02 -07:00
Cesar Blum Silveira 6a66323a99 Remove Kestrel.Core dependency from Transport.Libuv (#1584). 2017-04-03 20:54:01 -07:00
Cesar Blum Silveira 6bd0344880 Add Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions project (#1582).
- Changes the design to have one ConnectionHandler per endpoint.
2017-04-03 15:09:03 -07:00
Stephen Halter f285b18f08 Ensure no data is written to a connection after uv_shutdown (#1600) 2017-04-03 14:58:43 -07:00
Pavel Krymets c7113e1c60 Revert "Fetch corefx lab sources and compile them into kestrel (#1581)"
This reverts commit 13ee32b7ab.
2017-04-03 14:08:27 -07:00
Pavel Krymets 13ee32b7ab Fetch corefx lab sources and compile them into kestrel (#1581) 2017-04-03 13:21:17 -07:00
David Fowler f787c5277c Remove unused span (#1599) 2017-04-02 23:53:49 -07:00
David Fowler 547ad80a27 Don't update consumed if we didn't see a new line (#1592)
* Don't update consumed if we didn't see a new line
- The start line parser incorrectly updated the consumed cursor
when it attempted to find new lines across buffers. This change fixes
that and also removes passing the span by reference (which will be illegal).
- Added a unit test
2017-04-02 00:03:06 -07:00
Nate McMaster 83958886cc
Implement IHttpRequestIdentifierFeature on Frame
This feature generates a unique ID per request. This unique ID can be
used in event source and logging.

Also, this change improves KestrelEventSource by moving it back into the
Kestrel.Core assembly and de-coupling from the Libuv transport. This
adds two new events, RequestStart and RequestStop, which can be used to
identify the correlation between connection ID and request trace
identifier.
2017-03-31 16:54:35 -07:00
Cesar Blum Silveira 6b9d54265f Call ProduceEnd() before consuming request body if response has already started (#1530). 2017-03-31 11:08:55 -07:00
David Fowler b0bd5475cd More decoupling (#1572)
- Remove Libuv and Hosting dependency from Kestrel.Core
- Kestrel.Https and Kestrel.Core depend on Hosting.Abstractions

* wip

* Added separate ServerAddressesFeature

* Review feedback
- Added TlsConnectionFeature to Https
2017-03-30 20:14:50 -07:00
David Fowler c3ad007b0d Fixed regression caused by transport refactoring (#1573)
* Fixed regression caused by transport refactoring
- Libuv should not close the socket until it has started it. Before this was enforced
by calling ReadStart before starting the frame but the flow has changed. Now that closing the connection
is communicated via the pipe, we need to start consuming writes after calling ReadStart.
- Renamed OnSocketClosed to Close and moved dispose and logging into that method.

Fixes #1571
2017-03-30 09:33:28 -07:00
Cesar Blum Silveira 1be31ae2ce Throw if UseUrls specifies HTTPS or path base (#1519). 2017-03-29 20:23:51 -07:00
Cesar Blum Silveira e64bffd25c Remove deprecated property KestrelServerOptions.MaxRequestBufferSize (#1027). 2017-03-29 20:15:08 -07:00
Nate McMaster 6b6a8347cc
Add Connection as a primary request header 2017-03-29 16:40:50 -07:00
Nate McMaster 686829d226
Add tests for WritableBuffer extensions and rename WriteAscii => WriteAsciiNoValidation 2017-03-29 16:10:31 -07:00
Stephen Halter 7f785588ef Transport agnostic kestrel refactoring (#1551)
- Add transport interfaces
- Create separate Core and Libuv projects

#828
2017-03-29 16:06:05 -07:00
Pranav K d6d13a0986 Remove net451 as a cross-compile target 2017-03-24 07:44:11 -07:00
David Fowler f090b7a9c6 React to corefxlab changes (#1539)
- Removed use of TryRead and follow the pin and use pattern in the other APIs

https://github.com/dotnet/corefxlab/pull/1348
2017-03-23 06:52:24 -07:00
David Fowler c65734667a Optimize calls into StreamSocketOuput to WriteFast further (#1538)
* Optimize calls into StreamSocketOuput to WriteFast further
- Added overloads to array, offset, length to avoid implicit conversions to
ReadOnlySpan.
- Use similar optimizations for multi buffer writes for strings and ints
- Use ref locals in multi write instead of pointers and pinning
2017-03-22 02:16:28 -07:00
Cesar Blum Silveira 72587baac3 Check that MaxRequestBufferSize is greater than or equal to MaxRequestHeadersTotalSize (#1491). 2017-03-21 19:25:56 -07:00
David Fowler 5fad3c7a3e Remove async from WriteAsync in SocketOutput (#1531)
- SocketOutput.WriteAsync will be synchronous for a majority of cases
(until you reach the limit) so no need to pay the async state machine
cost until then.
2017-03-21 09:52:24 -07:00
Ben Adams 32d6b42964 Respond to corefxlab rename (build break) (#1529) 2017-03-21 08:43:49 -07:00
Ben Adams 24ed93288e Use for rather than foreach on List (#1523)
List enumerator is full fat
2017-03-21 03:26:58 -07:00
David Fowler f546f16356 Forgot to WriteFast in SocketOutput (#1527) 2017-03-21 03:21:31 -07:00
David Fowler cf576559b6 Fix write after close (#1526)
- Change Alloc to be a Write with a callback that exposes the WritableBuffer.
This allows the ISocketOutput to implementation to not call the callback if
the underlying socket is dead.
- Added a new functional test
2017-03-20 23:58:26 -07:00
Cesar Blum Silveira 3b40ba52ca Check if request is aborted before verifying response bytes written (#1498). 2017-03-20 16:02:25 -07:00
Stephen Halter 8923b0da70 Use correct config for response buffer limit (#1516) 2017-03-20 15:43:55 -07:00
David Fowler 39819d6708 Added fast path for single memory ReadableBuffer (#1512)
* Special case single buffer
* Added fast path for single span buffers in UvWriteReq
2017-03-20 00:11:41 -07:00
David Fowler 2ed456fd68 Faster Write implementation using cpblk (#1511)
* Faster Write implementation
- Use Unsafe.CopyBlockUnaligned to copy bytes to the
WritableBuffer. This is temporary until we get newer
corefx bits with a better span.CopyTo implementation.
- Remove WritableBufferExtensions from Performance project
- Split method into WriteFast and WriteMultiBuffer
- Cache the span for the common case where
the buffer is non empty.
- Use ref locals instead of pinning pointers in fast path
2017-03-19 12:44:01 -07:00
David Fowler f1e0143d51 React to corefxlab changes (#1510)
* React to latest CoreFxLab changes
2017-03-19 01:31:11 -07:00
David Fowler f6e5e74d95 Update packages (#1509)
* Update packages
* React to API changes in corefxlab
2017-03-18 15:42:01 -07:00
Justin Van Patten 6d2001c67a Remove explicit static constructors (#1483)
Explicit static cctors cause the C# compiler to not mark types as
beforefieldinit, which means the JIT will add checks to each static
method and instance constructor of the type to make sure that the static
constructor was previously called.
2017-03-18 12:42:31 -07:00
Ben Adams 5b814a55ac Speed up WritableBuffer.WriteXxx (#1504)
* Speed up WritableBuffer.WriteAscii
* Add Benchmarks
* Non-standard header vals are still ascii
* Speedup WriteNumeric
* Don't advance for write
* Remove cruft
2017-03-18 12:25:10 -07:00
David Fowler f4c6e0b151 Feedback from SocketOutput port (#1502)
- Fix naming convention in LibuvAwaitable
- Remove case statement in SocketOutput
2017-03-18 01:21:31 -07:00
Pavel Krymets 07cbf7faa9 Use pipelines for SocketOutput
- Changed socket output to be based on pipelines
- Changed connection filter glue to be based on pipelines
- Codegen that used `MemoryPoolIterator` for output now uses `WritableBuffer`
- Made `UvWriteReq` async/await friendly with `LibuvAwaitable<T>`
- Deleted MemoryPool and friends
2017-03-18 00:26:00 -07:00
Cesar Blum Silveira 2ef3804578 Span-based RemoveDotSegments (#1448) 2017-03-17 14:42:13 -07:00
Cesar Blum Silveira 632780dd16 Remove splitting of path and path base (#1050). 2017-03-15 09:57:33 -07:00
Nate McMaster d4c0d4b81e Adds an EventSource named 'Microsoft-AspNetCore-Server-Kestrel' with the following event and properties:
ConnectionStart:
 - connectionId
 - scheme
 - localEndPoint
 - remoteEndPoint

ConnectionStop:
 - connectionId
2017-03-14 16:59:11 -07:00
Nate McMaster 64f84811bd Fix incorrect debug asserts 2017-03-14 11:45:04 -07:00
Nate McMaster 5073d4fdaf Re-add .NET Framework to tests and other cleanup (#1494) 2017-03-14 11:02:49 -07:00
Ben Adams b94912bcb1 InitializeHeaders only at start of parsing/Fix remaining (#1488)
* Don't reinitialize header collection each loop
* Correct remaining tracking value
* Add tests
2017-03-13 15:32:28 -07:00
Cesar Blum Silveira 49f09d5a25 Log rejected request targets. 2017-03-12 18:37:08 -07:00
Justin Van Patten b612da4e6c Avoid an unnecessary closure allocation in ListenerSecondary (#1485)
The tcs is being passed as the state, so use it from the state instead
of closing over it.
2017-03-12 12:20:41 -07:00
Justin Van Patten a26f96237b Specify StringComparison when calling string.StartsWith (#1484)
StartsWith does a culture-sensitive comparison by default. An ordinal
comparison makes more sense here.
2017-03-11 22:31:42 -08:00
arespr d755f6183a Merge branch 'dev' into knownmethods-optimizations 2017-03-11 22:50:58 +01:00
Nate McMaster 49b328d4c2 Handle absolute, asterisk, and authority-form request targets
Improves compliance with RFC 7230 on the expected handling of requests
that have URI or asterisk in the request target.

This means rejecting asterisk requests that are not OPTIONS and rejecting
authority-form requests taht are not CONNECT.

This also means the server will handle the path and query on targets
with absolute URIs as request-targets.
2017-03-09 16:54:12 -08:00
Ben Adams 941d396942 Speed up ParseRequestLine (#1463) 2017-03-08 19:27:56 -08:00
Cesar Blum Silveira bb973decb8 Unify header rejection messages.
- Log bad headers with escaped non-vchar characters
2017-03-08 15:27:44 -08:00
arespr e9250323e0 update GeneratedCodeTests 2017-03-08 22:20:43 +01:00
David Fowler dbcf34388e Remove dependency on Utf8String (#1466)
- Also remove System.IO.Pipelines.Text.Primitives
2017-03-08 12:38:55 -08:00
arespr 0bca84a268 Add HttpUtilities to CodeGenerator 2017-03-08 19:17:12 +01:00
arespr 0a45cbbb95 Merge branch 'dev' into knownmethods-optimizations 2017-03-08 19:09:00 +01:00
Cesar Blum Silveira e25eb418bb Change non-printable char representation in log messages from <0xXX> to \xXX. 2017-03-08 10:05:53 -08:00
David Fowler 1f0bb14546 Clean up left over code from port to pipelines (#1465)
- Remove unused methods in PipelineExtensions
- Remove AwaitableThreadPool since we dispatch reads
2017-03-08 08:43:11 -08:00
Cesar Blum Silveira 5743d740b4 Convert HTTP parsing FrameTests to IHttpParser tests (#1416).
- Also fix an issue in KestrelHttpParser where "Header: \r\n" is
  parsed with a value of " " instead of "".
2017-03-07 15:51:11 -08:00
Ben Adams e2f8c226ef Simplify TakeSingleHeader and Vectorize (#1457)
* Sanitize unsafe code
* Vectorize
* Extract Contains and add more tests
2017-03-07 13:30:57 -08:00
Pavel Krymets 1294c00618 Cleanup unused code (#1458) 2017-03-07 11:52:45 -08:00
David Fowler 02a4342908 Made changes to TakeSingleHeader (#1453)
* Made changes to TakeSingleHeader
- Remove state machine and just parse in place
- Inline OnHeader into TakeSingleHeader
- Use IndexOfVectorized instead of custom indexof
- Normalize header whitespace error
- Combine IndexOf and IndexOfAny into a single IndexOfNameEnd call
2017-03-07 08:58:55 -08:00
John Luo 06134bc6e0 Add IPv6 loopback address by default #1434 2017-03-06 18:02:28 -08:00
David Fowler 537b06f025 Interleave multispan and single span code path (#1442)
- Attempt at making the reader better for multispan parsing
- Try tighter inner loop
- Fix boundary case and clean code up
- Update the cursor once instead of after every header
- Fix errors with not updating consumed state on incomplete header payload
- Filled a test hole, removed a condition that should never happen
- Avoid struct copies every iteration when parsing headers
2017-03-06 09:06:28 -08:00
David Fowler da763b4873 Use ascii decoding routine that disallows null chars (#1445)
* Use ascii decoding routine that disallows null chars
- GetAsciiString() in newer corefxlab builds allows 0 (which is a valid
ascii char). To avoid future regressions, GetAsciiStringNonNullCharacters()
was added and used in place of GetAsciiString() when interpreting the
request line and headers
- Make GetAsciiStringNonNullCharacters return empty instead of null
2017-03-04 11:26:32 -08:00
David Fowler 20f75605ca Workaround rogue System.IO.Pipelines on nuget.org 2017-03-03 22:35:41 -08:00
Stephen Halter ac60f13312 Modify RequestProcessingAsync to call single parse method (#1427)
* Modify RequestProcessingAsync to call single parse method
* Fix bad request logging
2017-03-03 14:43:32 -08:00
David Fowler 1d685e195e Parser cleanup and remove line continuation header error (#1431)
- Cleaned up some parsing logic (removed locals etc)
- Removing line continuation errors cleaned up code duplication
a little bit
2017-03-03 10:04:44 -08:00
arespr ac5fd3f29f PR feetback 2017-03-02 22:45:36 +01:00
arespr bb74a6ce34 address PR feetback, fix unit tests for invalid known methods 2017-03-02 22:04:43 +01:00
David Fowler 8929b40527 Single span optimizations (#1421)
- Added a fast path for single span in the start line parsing
- Added a fast path for single span header parsing
- Changed the out header loop to be pointer based (instead of slicing)
2017-03-02 12:17:39 -08:00
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