Commit Graph

1253 Commits

Author SHA1 Message Date
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
Kristian Hellang b6b8ea3c38 Made ThreadCount configurable 2015-12-07 15:38:06 +01:00
Kristian Hellang 75cfe2c3bb Moved GetThreadCount into KestrelServerInformation 2015-12-07 15:38:05 +01:00
Stephen Halter 706ff04160 Merge branch 'benaadams/statemachines' into dev 2015-12-07 00:07:14 -08:00
Stephen Halter c451ce1863 Merge branch 'khellang/thread-count-init' into dev 2015-12-06 23:32:57 -08:00
Kristian Hellang 5eaa7e51c8 Initialize ThreadCount as early as possible
This will allow you to inspect the property
in the Configure method.

Closes #404
2015-12-04 20:55:37 +01:00
Ben Adams 35a06369d7 Pooled block always has pool 2015-12-04 08:23:12 +00:00
Stephen Halter 1c320d7a74 Merge branch 'benaadams/dont-use-default-buffer-size' into dev 2015-12-03 18:28:24 -08:00
Stephen Halter 737aac4cfc Merge branch 'benaadams/over-the-edge' into dev 2015-12-03 18:28:05 -08:00
Ben Adams 858e5ab3a2 Moar stopping power, Timeout is total timout 2015-12-03 23:37:54 +00:00
Ben Adams 1ca67695ed Use pooled memory for filtered stream 2015-12-03 19:17:40 +00:00
Ben Adams 9af9dea72c Smaller default buffer 2015-12-03 18:46:43 +00:00
Ben Adams c41b449681 Lighter & less async sMachines
Selected excerpts from "Value tasks + Less Async" #432
2015-12-03 11:10:20 +00:00
Ben Adams b1e8f0cdea Add IThreadPool interface 2015-12-03 10:37:52 +00:00
Ben Adams 850d2b0c7e Construct ThreadPoolActions in KestrelServer 2015-12-03 09:56:21 +00:00
Ben Adams 5ae9b3c383 Log user code threadpool continuation execptions 2015-12-03 09:56:21 +00:00
Stephen Halter 10490888d3 Merge branch 'tenor/speed-up-date' into dev 2015-12-02 19:52:48 -08:00
Stephen Halter b84d8dbd07 Minor style changes to tenor/speed-up-date
- Removed some code required to support sub-second timer intervals
2015-12-02 19:50:55 -08:00
Stephen Halter 7cbbf68e9d Merge branch 'benaadams/connectionfilter' into dev 2015-12-02 19:21:05 -08:00
Stephen Halter bb2c17a779 Merge branch 'benaadams/req-delegate' into dev 2015-12-02 19:17:16 -08:00
Ben Adams a55be21469 Empty buffer when null buffer 2015-12-03 02:10:36 +00:00
Ben Adams b7c60de98a Don't allocate request processing delegate 2015-12-02 15:23:09 +00:00
John Luo 168f4770f4 Reacting to new IServer and IHttpApplication design 2015-12-01 13:03:46 -08:00
Stephen Halter 0c33cad343 Merge branch 'benaadams/kestrel-thread-api' into dev 2015-12-01 12:20:41 -08:00
Sunny Ahuwanya 6251b8f3e6 Changed timer interval to 1 second. 2015-12-01 09:29:54 -05:00
Cesar Blum Silveira 921c338a40 Support PathBase (#214). 2015-11-30 16:42:02 -08:00
Ben Adams 9102c1bb92 Remove unused IMemoryPool 2015-11-29 10:13:14 +00:00
Ben Adams 2937fc3c98 OnConnection->OnConnectionAsync
Resolves  #433
2015-11-29 03:57:47 +00:00
Sunny Ahuwanya 67a0f2d420 Reverted ISystemClock to use DateTimeOffset 2015-11-28 21:27:51 -05:00
Sunny Ahuwanya 7f025a6bd4 Speed up DateHeaderValueManager
Replaced PumpTimer() method with StartTimer(), introduced StopTimer()
method which pauses timer when idle instead of disposing it,
ISystemClock returns DateTime instead of DateTimeOffset.
2015-11-28 20:15:17 -05:00
David Fowler ea7f40c592 Merge pull request #408 from benaadams/CancellationTokenSource
Remove CreateLinkedTokenSource
2015-11-25 01:32:04 -08:00
Stephen Halter 07c0b414f0 Merge branch 'benaadams/faster-headers' into dev 2015-11-23 15:10:24 -08:00
Ben Adams 81dba3961d less work in locks 2015-11-21 14:13:23 +00:00
stephentoub c7d7f0e575 Lazily allocate the RequestAborted CTS
Avoid allocating the CancellationTokenSource unless it's actually requested.  This makes it pay-for-play with regards to code that actually asks for the RequestAborted token and requests that are aborted.
2015-11-21 08:38:48 -05:00
Cesar Blum Silveira e4fd91bb68 Fix hang on Connection: close requests. (#406) 2015-11-20 20:43:52 -08:00
Ben Adams feb40402de merge preamble-output, socket-output 2015-11-21 04:18:06 +00:00
Ben Adams a3173c487a Precomputed header bytes 2015-11-21 00:22:44 +00:00
Stephen Halter 0dbf108353 Smarter unpinning of MemoryPoolBlock2 in SocketOutput 2015-11-20 12:59:53 -08:00
Stephen Halter 2572256d3f Use MemoryPool2 for SocketOutput Buffers
Add ProducingStart and ProducingComplete methods to ISocketOutput.
These new methods can help prevent double buffering when encoding.
2015-11-20 04:41:33 -08:00
Ben Adams 9d852632c0 Remove _nullBuffer
Was meant to be removed as part of #335

/cc @rynowak
2015-11-20 05:51:25 +00:00
Ben Adams 174ec739bb Don't log ODEs thrown from _abortedCts.Cancel 2015-11-20 00:30:08 +00:00
Chris R 1c40548928 Add LoggingConnectionFilter. 2015-11-19 16:28:45 -08:00
Ben Adams 3c7431aa35 Change disconnect to abort cts 2015-11-19 23:25:31 +00:00
Ben Adams 58d8c851c5 Remove CreateLinkedTokenSource
Resolves  #407
2015-11-19 21:50:10 +00:00
Cesar Blum Silveira 307e020703 Don't crash the server if a connection filter throws synchronously. 2015-11-19 13:27:43 -08:00
Master T efec0feda2 Fix merge 2015-11-18 08:29:30 +01:00
Master T 2cdd659e67 Fix indentation 2015-11-18 05:11:57 +01:00
Master T 592d802fde Add test for https scheme, code cleanup 2015-11-18 05:06:30 +01:00
Master T 85eb6ab600 Code cleanup 2015-11-18 05:06:29 +01:00
Master T ba63c894be Remove Console.WriteLine 2015-11-18 05:06:28 +01:00
Master T 8e910baf04 Improve based on pull request feedback 2015-11-18 05:06:27 +01:00
Master T bed8c67181 Add SslProtocols option to HttpsConnectionFilter 2015-11-18 05:05:50 +01:00
Master T bd30f28dfd Implement client certificate authentication 2015-11-18 05:05:50 +01:00
David Fowler b8f01cf674 Merge pull request #378 from benaadams/thread-count
Network thread count defaults
2015-11-17 07:34:29 -08:00
Stephen Halter 5d59a20178 Merge branch 'benaadams/no-delay' into dev 2015-11-16 20:56:26 -08:00
David Fowler b1a772f19c Merge pull request #393 from benaadams/patch-1
Disconnect is Debug not Error
2015-11-16 20:29:50 -08:00
David Fowler 9c47796ec0 Merge pull request #312 from benaadams/MemoryPoolIterator2-GetString
Reduce GetString allocs and conversions
2015-11-16 20:13:38 -08:00
Ben Adams 4dc4346fca Reduce GetString allocs and conversions 2015-11-17 03:46:09 +00:00
Stephen Halter f7a5c38f65 Follow common pattern for implementing IHttpRequestLifetimeFeature 2015-11-16 16:03:55 -08:00
Stephen Halter b73e42b617 Abort request on any write failure 2015-11-16 16:03:53 -08:00
Stephen Halter 874bd29ce1 Throw IOExceptions instead of ODEs after a request is aborted 2015-11-16 16:03:51 -08:00
Stephen Halter 062caf16be Support for IHttpRequestLifetimeFeature 2015-11-16 16:03:50 -08:00
Ben Adams 1cbb273b0d Corrected Exception messages 2015-11-16 16:03:48 -08:00
Ben Adams 5e883827e0 Explain why dispose can't be used 2015-11-16 16:03:46 -08:00
Ben Adams f60f6c92ca Stop streams on finish
Can't use dispose (or close) as can be disposed too early by user code

Resolves #263
2015-11-16 16:03:44 -08:00
David Fowler 5774cf9f1e Merge pull request #390 from benaadams/stack2queue
ConcurrentStack -> ConcurrentQueue
2015-11-16 15:36:29 -08:00
David Fowler 7ba0f7da19 Merge pull request #377 from benaadams/legacy
Result -> GetAwaiter().GetResult() for legacy
2015-11-16 12:13:45 -08:00
David Fowler e3a62ff09f Merge pull request #335 from benaadams/used-pool-array
Consume body without allocating or reading
2015-11-16 11:47:18 -08:00
Ben Adams 8941d4b620 Disconnect is Debug not Error
Resolves #392
2015-11-16 17:44:24 +00:00
Ben Adams 7691a7cc23 Improved Send100 Check 2015-11-16 06:43:49 +00:00
Ben Adams ecc439555e Reuse ReadAsync for Consume 2015-11-15 22:27:39 +00:00
Ben Adams 1589b54018 Early bail, completed tasks+Interlocked 2015-11-15 21:56:20 +00:00
Ben Adams f089abd337 Consume in single call 2015-11-15 21:39:36 +00:00
Ben Adams f48e6ba51a Add Async in method name 2015-11-15 21:28:36 +00:00
Ben Adams f7bdc5a4e9 Skip non-consumed rather than reading 2015-11-15 21:28:33 +00:00
Ben Adams bd6e181d93 ConcurrentStack -> ConcurrentQueue 2015-11-15 21:17:14 +00:00
Troy Dai 2e2dfd87c1 Fix byte[] array allocation in IsDarwin 2015-11-14 22:55:25 -08:00
Cesar Blum Silveira a3a49d21b8 Reset Frame.Scheme on each request (#366). 2015-11-13 16:05:10 -08:00
Ben Adams 96c1668c54 Result -> GetAwaiter().GetResult() for legacy 2015-11-13 20:08:59 +00:00
Ben Adams 558b0ae643 statics to instance 2015-11-13 20:08:11 +00:00
Ben Adams d82c571831 Trim exposed KestrelThread api 2015-11-13 20:08:11 +00:00
Ben Adams a95318c616 Network thread count defaults 2015-11-13 20:00:32 +00:00
Ben Adams 59a95f43a3 Set NoDelay as default
Resolves  #374
2015-11-13 19:33:24 +00:00
Murat Girgin 52fe469688 Update project.json 2015-11-12 22:59:34 -08:00
Stephen Halter fc346f7768 Avoid some closure allocations in SocketOutput 2015-11-12 17:08:44 -08:00
Stephen Halter 59cdd60af6 Don't pre-complete too many writes 2015-11-12 17:08:43 -08:00
Stephen Halter 6b995362f1 Merge branch 'benaadams/odd-sync' into dev 2015-11-12 16:47:27 -08:00
Stephen Halter 983997ab9c Merge branch 'nickcraver/cancellation' into dev 2015-11-12 16:15:59 -08:00
Stephen Halter 9958427db7 Merge branch 'benaadams/result-getawaiter' into dev 2015-11-12 16:05:50 -08:00
Stephen Halter 0ead24680d Merge branch 'benaadams/reduce-log-boxing' into dev 2015-11-12 16:01:06 -08:00
Stephen Halter fdfd7dcf36 Merge branch 'benaadams/Task.Run-QueueUserWorkItem' into dev 2015-11-12 15:51:42 -08:00
N. Taylor Mullen 86e1924cad Remove System beta tag in project.json for coreclr packages. 2015-11-12 12:23:45 -08:00
Nick Craver a45a671b22 Make ReadAsync state overload 451 only and private. 2015-11-11 18:55:56 -05:00
Stephen Halter e5ff33eda2 Remove UvAsyncHandle.DangerousClose
- This should stop the AVs we've been seeing in some of our test runs
2015-11-11 15:24:09 -08:00
Ben Adams 0500043cc9 .Result -> .GetAwaiter().GetResult() 2015-11-11 09:46:56 +00:00
Nick Craver d1221e82c1 Pass cancellation tokens down consistently
I'm assuming these are oversights since the usage is inconsistent.
Otherwise this served only as a mild waste of time :)
2015-11-10 22:58:19 -05:00
Stephen Halter 55f6f21d5a Build Microsoft.AspNet.Server.Kestrel.Https for dotnet5.4 2015-11-10 17:15:35 -08:00
Stephen Halter bdbd9ae7a6 Merge branch 'benaadams/socketoutput-tasks' into dev 2015-11-10 15:55:10 -08:00
Ben Adams d32937eafe Add tests for non-immediate byte counting 2015-11-10 23:17:40 +00:00
Ben Adams 34cec3448d SocketOutput to Tasks 2015-11-10 19:53:43 +00:00
Troy Dai d0bdede709 Update the reference link in comments of SockAddr 2015-11-10 11:11:32 -08:00
Troy Dai d9c15e0180 Add references to socket in comments 2015-11-10 10:37:12 -08:00
Ben Adams 344c821f83 Remove sync block->task
await rather than synchronously blocking and then returning a
Task.FromResult
2015-11-10 18:23:44 +00:00
Troy Dai d08b83a1c7 Fix get IPAddress for Darwin 2015-11-10 10:04:10 -08:00
Ben Adams c0f82765aa Move logging to new style 2015-11-10 10:43:51 +00:00
Ben Adams a2c4e3a654 Task.Run -> ThreadPool.QueueUserWorkItem
Task.Run eventually ends up being QueueUserWorkItem.
The returned task is ignored, so no added goodness.
Short running item.

Cut out the middleman
2015-11-10 07:28:17 +00:00
Ben Adams 278bd9c962 Completed Task opt 2015-11-09 04:32:08 +00:00
Stephen Halter 9d19eed88f Merge branch 'benaadams/memorypool2-allocate' into dev 2015-11-05 12:16:43 -08:00
Stephen Halter bb9f83186b Remove unused parameter from ListenerSecondary.ReadStartCallback 2015-11-05 12:09:50 -08:00
Stephen Halter fff28990fe Ensure ListenerSecondary buffer isn't double freed or freed too early
- Call buf_init in StartAsync so we have access to a KestrelThread
2015-11-04 16:21:29 -08:00
Stephen Halter 74f08c16df Merge branch 'benaadams/listenersecondary-allocs' into dev 2015-11-04 15:34:42 -08:00
Ben Adams 3e7969cefe Move handle creation to constructor 2015-11-04 22:44:30 +00:00
Stephen Halter 272ce27c79 Merge branch 'benaadams/delegates' into dev 2015-11-04 14:21:13 -08:00
Ben Adams 5cef608e52 Dispose _ptr 2015-11-04 22:20:51 +00:00
Ben Adams 22dfd31261 More readable loop condition 2015-11-04 22:04:19 +00:00
Stephen Halter 35bbddf9b5 Merge branch 'benaadams/listener-primary-alloc' into dev 2015-11-04 10:14:52 -08:00
Stephen Halter 04b2885f10 Merge branch 'benaadams/listener-allocation' into dev 2015-11-04 10:12:33 -08:00
Stephen Halter f4be290d4a Merge branch 'benaadams/connection-allocs' into dev 2015-11-04 10:08:36 -08:00
Ben Adams cc84097016 Listener - remove closure allocation 2015-11-04 12:36:32 +00:00
Ben Adams 1d4b9d6633 ListenerPrimary - reduce closure allocation
Still captures string pipeName
2015-11-04 12:33:51 +00:00
Ben Adams d104e8a08d Reduce delegate allocation 2015-11-04 12:31:44 +00:00
Ben Adams 34c1a671f0 ListenerSecondary - reduce closure allocation 2015-11-04 12:20:00 +00:00
Ben Adams 5ae1c4ecb2 MemoryPool2 Allocate returns newest
Rather than a while loop on Allocate; return last memory block created
rather than returning it to the pool and checking if one can be removed.
2015-11-04 08:37:12 +00:00
Ben Adams c113c0d3a2 Don't alloc array per header
i.e `new StringValues(string)` rather than `new StringValues(new [] {
string } )`
2015-11-04 07:11:55 +00:00
Cesar Blum Silveira 889a24278d Merge branch 'release' into dev 2015-11-02 17:36:41 -08:00
Cesar Blum Silveira eaee76dfeb Strong name everything. 2015-11-02 16:16:55 -08:00
Ben Adams ea6f6b10dc Don't capture connection on closure 2015-11-01 13:27:17 +00:00
John Luo b466c3b7d7 Reacting to Hosting changes 2015-10-30 14:19:55 -07:00
Stephen Halter fe654598f6 Merge branch 'release' into dev 2015-10-29 14:30:02 -07:00
Stephen Halter 85202b0174 Merge branch 'benaadams/read-to-null-buffer' into release 2015-10-29 12:24:40 -07:00
Stephen Halter 1722150ee9 Do nothing in KestrelThread.Stop if libuv fails to load
This prevents DllNotFoundExceptions from being masked by NullReferenceExceptions
2015-10-29 12:21:25 -07:00
Troy Dai e9a6061023 Make Frame implements IHttpConnectionFeature
Provide RemoteIPAddress as well as RemotePort
2015-10-29 10:08:35 -07:00
Ben Adams bdadc8a3da Move comment into loop, remove noop 2015-10-28 22:44:35 +00:00
Ben Adams 4bba074d77 Read to null buffer
Read to null buffer rather than Stream.Null as the CopyToAsync will
create a `new byte[]` on each call
bc14660885/src/mscorlib/src/System/IO/Stream.cs (L218)
of size 81920 bytes!
bc14660885/src/mscorlib/src/System/IO/Stream.cs (L48)
2015-10-28 08:53:11 +00:00
moozzyk c1b21b89d5 Removing dependency on Microsoft.Extensions.PlatformAbstractions 2015-10-27 01:40:28 -07:00
moozzyk d4853f9b7c Switching to using the built-in loading of native libs 2015-10-27 01:13:21 -07:00
Stephen Halter fb01ea3918 Consume the full request body when the app does not 2015-10-26 11:13:07 -07:00
Stephen Halter 094b8efbf8 Properly handle headers with empty values 2015-10-25 01:40:22 -07:00
Troy Dai 52f4fa91e3 Unescape string in memory
1. In place unescape;
1. UTF-8 verification;
2. MemoryPoolIterator2.Put
3. Tests
2015-10-23 15:26:59 -07:00
Ryan Nowak f88631efb3 React to breaking changes in StringValues 2015-10-23 15:05:09 -07:00
Pavel Krymets eb2c3a1ce8 Rename Microsoft.Runtime.Abstractions to Microsoft.Extensions.PlatformAbstractions 2015-10-22 18:22:05 -07:00
Pranav K dea782163d Updating packages to use generations 2015-10-22 15:18:49 -07:00
Troy Dai a1e4e022b9 Clean up 2015-10-21 22:08:03 -07:00
Pavel Krymets f8fd2f9ac9 React to hosting changes 2015-10-21 10:23:53 -07:00
Stephen Halter 8f0d1179ab Allow Nagle’s algorithm to be disabled via IKestrelServerInformation.NoDelay 2015-10-19 12:44:21 -07:00
Stephen Halter c809beec18 Don't allocate Exceptions unnecessarily
- Allocate Exceptions in the ReadStart callbacks if necessary instead
  of in UvStreamHandle.
- This also fixes a bug in ListenerSecondary where it should have
  previously been looking at the error code instead of the read count.

#237
2015-10-16 15:25:37 -07:00
Stephen Halter 8e818e3549 Address PR feedback 2015-10-15 16:52:37 -07:00
Stephen Halter 7b315d2470 Close connection gracefully in Frame.ProduceEnd
- Try sending a FIN before closing the socket
- Don't attempt to send a FIN twice for the same connection
2015-10-15 15:35:40 -07:00
Stephen Halter 513abb4561 Log errors in OnStarting and OnCompleted 2015-10-15 15:35:38 -07:00
Stephen Halter b98425d3b1 Log unhandled exceptions thrown from the AppFunc 2015-10-15 15:35:36 -07:00
Stephen Halter 7c27c5c0e7 Better handle blocks not taken taken from slabs
- If the block needs to be larger than 4032 bytes it won't be backed by a slab
2015-10-14 16:05:35 -07:00
David Fowler 6aaa3cbe06 Use IApplicationLifetime.StopApplication instead of
IApplicationShutdown.

React to hosting changes 374526b270
2015-10-14 01:09:11 -07:00
David Fowler ef38f5589d React to hosting changes to IApplicationLifetime 2015-10-14 00:46:18 -07:00
Chris R cfe6e22a29 React to IHeaderDictionary changes. 2015-10-12 09:29:34 -07:00
Stephen Halter 3eec43a0c3 Move static BitCount method to base class
- Updated comment to point to a specific commit in corefx
- This is more consistent with AppendValue since BitCount doesn't need
  to be generated
2015-10-09 17:27:33 -07:00
Stephen Halter a33a5d0f1b Merge branch 'benaadams/bitcount-fast' into dev 2015-10-09 17:17:03 -07:00
Louis DeJardin 78177e7082 Fixing rebase errors 2015-10-09 13:26:34 -07:00
Louis DeJardin 6ae0f5d505 PR feedback - code formatting 2015-10-09 13:19:10 -07:00
Louis DeJardin 29b0b124ee Moving non-changing methods into .cs partial 2015-10-09 13:19:09 -07:00
Ben Adams ccfeef6353 All features to have backing object 2015-10-09 13:18:32 -07:00
Ben Adams 8f41e47eca Remove bitfield for locally implemented interface items
Only generate type statics for cached features
2015-10-09 13:18:09 -07:00
Ben Adams 3c20053d9a Don used cached typeof for tests 2015-10-09 13:15:39 -07:00
Ben Adams 56893df7f9 Don't iterate overriden features twice 2015-10-09 13:11:48 -07:00
Louis DeJardin cbc3b4e6f5 PR Feedback
* Sorting namespaces
* Removing `as` casting for Frame's implemented interfaces
2015-10-09 13:10:27 -07:00
Louis DeJardin dc0eb679ae Updating unit tests for Frame IFeatureCollection update 2015-10-09 13:09:37 -07:00
Louis DeJardin 71fc2bf2e5 Rough implementation of feature collection optimization 2015-10-09 13:09:35 -07:00
Ben Adams 6b0fa776ca More comment clarity 2015-10-09 12:16:54 -07:00
Ben Adams 47973541b5 Remove redundant cast 2015-10-09 12:16:53 -07:00
Ben Adams e107c47913 Add comment explanation 2015-10-09 12:16:52 -07:00
Ben Adams 05702e81e6 more typeof caching 2015-10-09 12:16:50 -07:00
Ben Adams d48a27dd59 Use bitflag for override and cache typeof in statics 2015-10-09 12:16:49 -07:00
Louis DeJardin dcf591c832 Rough implementation of feature collection optimization 2015-10-09 12:16:48 -07:00
Stephen Halter 0c1b05ce2d Merge branch 'release' into dev 2015-10-08 16:40:13 -07:00
Ben Adams 6f506ba988 subsequent block has data - IsEnd is false
Resolves #249
2015-10-08 16:18:47 -07:00
Stephen Halter 24c0a8e142 Fix MemoryPoolIterator2.CopyTo's block traversal
- This fix prevents large request streams from being corrupted

#234
2015-10-08 16:16:41 -07:00
Ben Adams 9d251cdb54 subsequent block has data - IsEnd is false
Resolves #249
2015-10-08 18:13:22 -04:00
Chris R 0b36382448 Merge pull request #236 from benaadams/sanitize-loops
Sanitize loops
2015-10-08 10:05:17 -07:00
Ben Adams 0a297688b4 Use Jit recongised, standard loop construct
For bounds check elimination.
Convey intent more clearly; eliminate bounds checks
2015-10-08 12:31:21 -04:00
Ben Adams 4250d35347 PR feeback 2015-10-08 01:11:41 -04:00
Ben Adams 05418dd18a Use corefx implementation 2015-10-07 16:51:10 -04:00
Ben Adams 8bf2c814d6 Add BitCount LongExtensions 2015-10-07 12:23:20 -04:00
Chris R 1f50f4c2a8 #231 bind to IPv6Any, add functional tests. 2015-10-05 16:13:11 -07:00
Ryan Nowak f545f99dab Add attributes to fix the build 2015-10-05 11:22:30 -07:00
Stephen Halter 2f3a00625a Initial work to support HTTPS using SslStream
- Add extension method "UseKestrelHttps" to IApplicationBuilder
2015-10-05 03:15:18 -07:00
Pranav K 49451fb11e Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:45 -07:00
Stephen Halter 6d3e5d3bf2 Merge branch 'benaadams/fastpath-header-enumerator' into dev 2015-09-28 12:21:58 -07:00
moozzyk d2f282f54f Consuming Libuv from NuGet package
Fixes #50
2015-09-26 18:00:50 -07:00
Chris R e3f141fcde #227 Fix OverflowException in MemoryPool 2015-09-26 06:56:54 -07:00
Stephen Halter f0137b7b9e Bind to specific IP addresses if provided with any
This still only applies to IPv4.

#98
2015-09-25 16:26:01 -07:00
Ben Adams 1718b69f22 Fast path header enumerator
Use strongly typed enumerable as interface's allocates.
2015-09-26 00:16:42 +01:00
damianedwards a7b65efa75 CR feedback 2015-09-25 14:59:47 -07:00
damianedwards 3c2408db68 Fix tests after rebase 2015-09-25 14:59:47 -07:00
damianedwards 7c46b2bd3b Use a timer to generate the value for the Date header in responses:
- Doing it on each request is expensive
- The Timer is started when the first request comes in and fires every second
- Every request flips a bool so the Timer knows requests are coming in
- The Timer stops itself after a period of no requests coming in (10 seconds)
- #163
2015-09-25 14:59:47 -07:00
Louis DeJardin 5070b8073e Temporarily commenting out the Debug.Assert of block freeing
Unit tests using ad-hoc contexts aren't guaranteed to dispose pools.
That's kinda making unit tests fail, more or less, because Debug...
2015-09-25 14:17:09 -07:00
Louis DeJardin 318f3b7145 Changing Trace.Assert to Debug.Assert
* Also Debug.Assert for unreturned memory blocks
2015-09-25 13:01:54 -07:00
Louis DeJardin f740616573 disposedValue changed to _disposedValue
Boilerplate code didn't have _
2015-09-25 12:49:30 -07:00
Louis DeJardin c42dace9e6 consts looked like local vars 2015-09-25 12:49:30 -07:00
Louis DeJardin 0adbbd0217 Using the well-known-header field without checking set bit 2015-09-25 12:49:29 -07:00
Stephen Halter dc902f5fc4 Update SocketOutput to not call QueueUserWorkItem unnecessarily 2015-09-25 12:49:28 -07:00
Louis DeJardin 789d5b3595 Writes which are not immediate always return completed tasks
They must always be followed with Writes which are immediate, and
returning an incomplete task put them in a state where the callback
might not have been initiated.
2015-09-25 12:49:27 -07:00
Louis DeJardin 5e678fdbaa Adding volatile keyword to stopping boolean 2015-09-25 12:49:27 -07:00
Louis DeJardin 99fc7e4e50 Moving the Start/Stop logic into Frame.
Also formalizes the relationship between the function's Task and
how it relates to graceful shutdown. Specifically how it relates
to finishing the requests currently in progress.
2015-09-25 12:49:26 -07:00
Louis DeJardin f89a586b75 Removing boilerplate-generated #region 2015-09-25 12:49:25 -07:00
Louis DeJardin 37f7dfd01f Typo in comments 2015-09-25 12:49:25 -07:00
Louis DeJardin c424b8437c Renaming based on PR feedback 2015-09-25 12:49:24 -07:00
Louis DeJardin 844c791b16 Processing function should return Task 2015-09-25 12:49:23 -07:00
Louis DeJardin 091084cfe2 Refactoring MemoryPool class locations
Moving Iterator out into its own file rather than being a nested class
Moving pool classes into Infrastructure namespace instead of Http
2015-09-25 12:49:23 -07:00
Louis DeJardin 13defc5a32 Initialize Memory2 in ListenerContext
Better than initializing from multiple other classes
2015-09-25 12:49:22 -07:00
Louis DeJardin 5ba1b9fb3c Secondary listeners need to allocate their own memory pool 2015-09-25 12:49:21 -07:00
Louis DeJardin 6db3d9e645 Using specific exception types 2015-09-25 12:49:21 -07:00
Louis DeJardin 76b528e1d2 Adding comments to MemoryPool classes 2015-09-25 12:49:20 -07:00
Louis DeJardin ff0affe34d Removing _frameTask and fixing Task.Run argument 2015-09-25 12:49:19 -07:00
Louis DeJardin 30ec2cb0b1 Harden framing epilog
* Connection no longer needes Frame's processing Task
* Any exceptions from unusual processing is logged
2015-09-25 12:49:19 -07:00
Louis DeJardin 28250d9981 Providing Path to application 2015-09-25 12:49:18 -07:00
Louis DeJardin 04f6446a50 Updates for PR feedback 2015-09-25 12:49:18 -07:00
Louis DeJardin d3a87c4c14 Removing MessageBodyExchanger base class 2015-09-25 12:49:17 -07:00
Louis DeJardin 52dc37eae7 Fixing a header parsing bug
When request header data arrives with \r\n split across packets
2015-09-25 12:49:16 -07:00
Louis DeJardin e5a3bda3a2 Progress on flow control
* Dealing with race conditions
* Reworking iterator methods
* Shutdown and Close need to be passed throught the write-behind mechanism
2015-09-25 12:49:15 -07:00
Louis DeJardin 4193c92ba7 Fixing merge conflicts 2015-09-25 12:49:15 -07:00
Louis DeJardin 1f6aaebeda Changing flow control for incoming data
SocketInput is now awaitable
Input buffers are slab-allocated and pinned from large object heap
Request frame parsing is offloaded from libuv thread
2015-09-25 12:49:14 -07:00
Louis DeJardin 557f6d6993 Refactoring response control flow
- Bring through both sync and async execution paths
- Remove callback pattern from from and socketoutput write calls
2015-09-25 12:47:51 -07:00
Stephen Halter 1e39473047 uv_pipe_connect returns void
This fix prevents Libuv.pipe_connect from throwing when the stack
memory that was previously incorrectly interpreted as the int return
value happens to be negative.

When pipe_connect threw, an assertion failure would follow since the
pipe handle would be closed prematurely.

http://docs.libuv.org/en/v1.x/pipe.html#c.uv_pipe_connect

#205
2015-09-25 11:40:40 -07:00
Eilon Lipton c4bf10d6e9 Add third party notices for libuv
Fixes #218
2015-09-23 15:42:58 -07:00
Chris R 355bc01a15 Hosting#358 Move the default address into Hosting. 2015-09-22 11:56:46 -07:00
David Fowler 891b991a34 Use new packInclude feature to include native assets
- Now Kestrel won't break when people overwrite the build.cmd
2015-09-19 03:59:58 -07:00
Stephen Halter 47323a88e1 Surface errors from Listener.StartAsync better
If CreateListenSocket fails, surface the original error instead of throwing a
NullReferenceException from Listener.Dispose().

#185
2015-09-16 18:19:01 -07:00
Stephen Halter 2d01f2752b Catch and log uv_accept errors
- This is also what is done by node.js
- "tcp, pipe: don't assert on uv_accept() errors (Ben Noordhuis)"

0685707bc6
2015-09-16 18:18:58 -07:00
Stephen Halter f14af1f409 Don't swallow too many exceptions
- Swallowing too many exceptions can end up hiding issues in
  Kestrel itself. It's better to let the process die.
- If we want to handle certain exceptions we should be as
  specific as possible with our try/catch blocks.
2015-09-16 18:18:55 -07:00
Chris R 2e225b0db6 Hosting#331 Add IServerAddressesFeature. 2015-09-15 12:47:18 -07:00
Pranav K 78de14d248 Adding NeutralResourcesLanguageAttribute 2015-09-10 18:15:27 -07:00
Stephen Halter 958cc3eca3 Add missing arguments to LogDebug arguments in KestrelTrace 2015-09-10 12:40:16 -07:00
Stephen Halter 813127e7f6 Merge branch 'benaadams/negative-threads' into dev 2015-09-10 11:58:09 -07:00
Stephen Halter ec88e57f67 Remove commented code in KestrelTrace 2015-09-10 11:41:27 -07:00
Stephen Halter 1ebf98d40d Log message style changes
- Disabled some log messages for possibly being too verbose.
- Don't log ConnectionReadFin when there is an error.
2015-09-10 11:41:25 -07:00
Stephen Halter 0ef096b41c Increment connection id for logging 2015-09-10 11:41:22 -07:00
Ben Adams dda5774a8b Throw exception if ThreadCount negative 2015-09-10 08:03:42 +01:00
Ben Adams 887cf2c7be Negative thread count fix 2015-09-10 02:57:49 +01:00
Stephen Halter dc08062545 Merge branch 'drussilla/add-logging' into dev
Conflicts:
	src/Microsoft.AspNet.Server.Kestrel/Http/Connection.cs
	src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs
2015-09-09 11:28:09 -07:00
Ivan Derevyanko ac77c11211 Make ConnectionCallback static again. 2015-09-09 02:13:49 +02:00
Ivan Derevyanko 2b2943d5b0 Restore static delegates 2015-09-09 01:27:44 +02:00
Stephen Halter 2041e4d08b Prevent pipes from being closed prematurely on OS X and Linux
This change fixes the in-process marshalling of TCP handles on Mac and Linux
that is used to support having multiple threads accepting connections from
multiple loops.

On these two platforms, the ReadStart callback somtimes gets called with a
status and pipe_pending_count equal to zero. Now when the status is zero
just exit the callback without closing the pipe.

This change more closely follows the example at
https://nikhilm.github.io/uvbook/processes.html#sending-file-descriptors-over-pipes
2015-09-08 16:21:45 -07:00
Ivan Derevyanko a93a66fe7c Replace Trace.WriteLine with ITraceLogger 2015-09-09 00:26:26 +02:00
Ivan Derevyanko 6d47227975 KestrelTrace refactored and added to the ServiceContext. Close aspnet/KestrelHttpServer#141 2015-09-05 18:17:17 +02:00
Kai Ruhnau 5ee80e0155 Fix bug #191 introduced by b25d2d9 2015-09-05 12:29:00 +02:00
Stephen Halter f10c989d90 Add ServiceContext to make it easier to flow new services through ctors 2015-09-04 15:04:25 -07:00
Stephen Halter 1584d70e1f Clean up if an exception is thrown in the middle of ServerFactory.Start 2015-09-03 15:26:30 -07:00
Louis DeJardin c50aec1729 Adding comments to meaningless field names 2015-09-02 21:14:18 -07:00
Louis DeJardin dffd977c3f Fixing field names 2015-09-02 20:50:21 -07:00
Louis DeJardin 5c7007a4e9 Fixing member field name 2015-09-02 20:37:11 -07:00
Louis DeJardin 0859d82d6b Adding private keyword to private enums 2015-09-02 20:33:51 -07:00
Louis DeJardin 3bbb77f9d0 Alphabetizing using statements 2015-09-02 20:31:11 -07:00
Louis DeJardin b25d2d9772 Continued updates for #184
* Reordering members
- Fields
- Constructors
- Properties
- EverythingElse
- NestedTypes

* Removing commented code
2015-09-02 20:08:54 -07:00
Louis DeJardin 2467cf2ade Nested types must be last 2015-09-02 00:07:58 -07:00
Louis DeJardin 46604d68b3 Initial commit for style cleanup #184
* adding private keyword to fields
* one type per file
2015-09-01 22:25:51 -07:00
Chris R c2192d7bd1 Change IServerInformation to IFeatureCollection. 2015-09-01 15:27:57 -07:00
Stephen Halter d0bd2b3dd0 Configure unix pipes via the hostname instead of the scheme. 2015-08-31 10:46:48 -07:00
Stephen Halter a919ea8d0a Remove unnecessary listener interfaces 2015-08-31 10:46:46 -07:00
Stephen Halter a9b8cfa582 Remove unnecessary use of generics in listeners 2015-08-31 10:46:40 -07:00
Chris R 803ec38073 React to string[] -> StringValues changes. 2015-08-28 12:59:00 -07:00
Stephen Halter 40ca61b640 Merge branch 'release' into dev 2015-08-26 16:32:19 -07:00
Stephen Halter 2642c84bf9 Don't automatically set Content-Length: 0 in some circumstances
- When in response to a HEAD Request
- For 101, 204, 205 and 304 responses
- For non keep-alive connections
2015-08-26 16:16:35 -07:00
Stephen Halter 69759231ff Set Content-Length: 0 when an AppFunc completes without a write
- Previously an incomplete chunked response would be written instead.
- Add test to verify Content-Length: 0 is set automatically.
- Add test to verify HTTP/1.0 keep-alive isn't used if no Content-Length
  is set for the response.
- Add tests to verify errors are handled properly after chunked writes.

#173
2015-08-25 23:17:41 -07:00
Stephen Halter ca0a42a01e Merge branch 'Daniel15/unix-sockets' into dev 2015-08-24 12:53:31 -07:00
Pranav K 7cdfdddaa0 Unpinnng Dnx.Runtime.Abstractions package version 2015-08-18 21:34:43 -07:00
Daniel Lo Nigro 9ade227abb Implement support for UNIX sockets.
The common use-case for Kestrel in production will be behind a reverse proxy such as Nginx. In cases where the reverse proxy is located on the same machine as the application, connecting via a UNIX socket is more efficient than a TCP socket, as it avoids going through the network layer. Accessing 127.0.0.1 through TCP still needs to initiate a TCP connection and perform handshaking, checksumming, etc, all of which is avoided by using UNIX sockets.

 - Moved TCP-specific stuff from Listener into new TcpListener class (same with ListenerPrimary and ListenerSecondary)
 - Made Listener abstract
 - Created new PipeListener. Note that while the use case is for UNIX sockets, this is called "Pipe" in uv, so I've called this "PipeListener" so the terminology is consistant
 - Uses "unix" URL scheme to determine whether to use socket. "http://127.0.0.1:5000" is for listening via TCP while "unix:///var/run/kestrel-test.sock" is for listening via UNIX socket

#156
2015-08-15 15:50:34 -07:00
Stephen Halter 753d64660d Ignore zero length writes when automatically chunking responses
- Zero length writes would previously be interpreted as the end of response
- Optimize writing the chunked response suffix
- Add tests for automatic response chunking
2015-08-14 15:59:47 -07:00
Stephen Halter 3fb33119ee Initial non-optimized support for automatically chunking responses 2015-08-14 15:59:39 -07:00
Stephen Halter 32c4f314b6 Lock around Connection.End to make it thread-safe 2015-08-14 12:17:06 -07:00
Stephen Halter 4f0480a4d0 Gracefully handle exceptions thrown from OnStarting callbacks
- If OnStarting is being called after the app func has completed, return a 500.
- If Onstarting is being called due to a call to write, throw from write.
2015-08-14 12:05:43 -07:00
Stephen Halter 6a01043e1a Fix ListenerSecondary so it reliably accepts new connections on Windows
Calling uv_read_start on a named pipe with a larger than necessary buffer
would cause pieces of the next uv_ipc_frame_uv_stream struct to be read into
the uv_read_start buffer when a lot of tcp handles were passed quickly over
the pipe.

This prevented the struct from properly being queued for the next call to
uv_accept to consume. The empty queue caused the call to uv_accept in
ListenerSecondary to fail and return WSAEWOULDBLOCK leaving the connection
in a zombie state.
2015-08-14 11:57:21 -07:00
Stephen Halter c0cc511b5b Prevent access to closed socket in in Connection.End 2015-08-14 11:49:45 -07:00
Stephen Halter b162202519 Properly close keep alive connections 2015-08-14 11:49:43 -07:00
Chris R 43ebf710ab Fix regression in reading config 2015-08-14 09:33:02 -07:00
Kirthi Krishnamraju c7535f127c fix build break due to aspnet\configuration #246 2015-08-13 22:42:48 -07:00
Stephen Halter 097fb35ddf Fix startup when you reference the assembly directly instead of Hosting
- I missed this change in Program.cs when doing the initial package merging
2015-08-12 15:14:01 -07:00
Stephen Halter d97b02696f Merge Kestrel into Microsoft.AspNet.Server.Kestrel 2015-08-11 14:56:20 -07:00
Stephen Halter 0ac3c3dad6 More ConfigureAwait(false) 2015-08-11 12:46:08 -07:00
Stephen Halter 688ad9bee7 Merge branch 'benaadams/configure-awaits' into dev 2015-08-11 12:34:53 -07:00
Stephen Halter 5dfca955b3 Move GeneratedCode project so no NuGet package gets created 2015-08-05 12:22:59 -07:00
Stephen Halter 7dd256f26e Add a "dnu restore" prepare step before generating code
- This ensures the generated code project's project.lock.json is created
2015-08-05 11:54:17 -07:00
Stephen Halter 51693304c1 Update dependencies after rename to Microsoft.Dnx.Compilation.CSharp 2015-08-05 11:07:13 -07:00
Troy Dai b8f930bb4c Update CoreCLR versions 2015-08-04 10:15:28 -07:00
Stephen Halter e5144e3139 Include Server and Date in the initial response header dictionary 2015-08-03 16:20:34 -07:00
Stephen Halter 978dd39924 Update the prepare script used to generate code
- The syntax to run dnx with a modified appbase has recently changed
2015-08-03 16:20:32 -07:00
Stephen Halter 7446fe4cc7 Update SocketOutputTests to account for the "immediate" Write param 2015-08-03 16:20:30 -07:00
Louis DeJardin 6ff894bb19 Using masked byte sequences to recognize well-known header names 2015-08-03 16:20:28 -07:00
Louis DeJardin b999b47218 String concatination showed up in profiler 2015-08-03 16:20:26 -07:00
Louis DeJardin f6dc72544c Response headers don't need to be queued before subsequent write 2015-08-03 16:20:24 -07:00
Louis DeJardin c0728edda7 Linq .Any() was causing enumeration 2015-08-03 16:20:22 -07:00
Louis DeJardin f9cf9f1936 Improvements to appending request header 2015-08-03 16:20:20 -07:00
Louis DeJardin 96b03ee212 Perf - enumerate with struct
Conflicts:
	src/Microsoft.AspNet.Server.Kestrel/project.json
2015-08-03 16:20:18 -07:00
Louis DeJardin ad089be477 Removing "I like pie" diagnostics 2015-08-03 16:20:16 -07:00
Louis DeJardin 963f086eb0 Prototypeing a fast header dictionary
Conflicts:
	src/Microsoft.AspNet.Server.Kestrel/project.json
2015-08-03 16:20:14 -07:00
Chris R 83b2c95385 React to IFeatureCollection changes. 2015-08-03 15:13:58 -07:00
anurse 07304640ed react to DNX renames 2015-07-31 11:54:52 -07:00
Stephen Halter 4a9515d2e0 Gracefully handle uncaught exceptions in user code when possible 2015-07-30 16:01:33 -07:00
Troy Dai 07de3cafd1 Clean build warnings 2015-07-30 12:14:13 -07:00
Victor Hurdugaci 343d698286 React to DNX renames 2015-07-29 01:04:59 -07:00
Stephen Halter 47d7f73bdc Fix SocketOutput so that it can now complete large writes
- Complete in this context means that the callback gets invoked.
- Previously, calls to write would never complete if the buffer contained
  more than 64 KB (_maxBytesPreCompleted).
- This is tested by SocketOutputTests.CanWrite1MB.
2015-07-28 16:57:24 -07:00
Stephen Halter cce9d8f09c Make SocketOutput more testable
- Added a MockLibUv class
- Create a SocketOutputTests class
2015-07-28 16:57:22 -07:00
Stephen Halter c345849707 Don't use QueueUserWorkItem to trigger write callbacks immediately
- In this case we are off the event loop, so we can invoke the callback directly.
- Increase _maxBytesBufferedBeforeThrottling
2015-07-28 16:57:21 -07:00
Stephen Halter 74fa82bca7 Complete WriteAsync Tasks early when there are less than 64KB buffered 2015-07-28 16:57:19 -07:00
Stephen Halter d723f9da21 Reduce calls to uv_write by calling it with multiple buffers when possible 2015-07-28 16:57:16 -07:00
Louis DeJardin 5e6e5fec01 Adding an IKestralServerInformation.ThreadCount property
Will default to 1 until multi-loop stability is ensured
2015-07-27 11:40:39 -07:00
Louis DeJardin e39fe60da0 Removing commented code 2015-07-24 16:19:15 -07:00
Louis DeJardin baeb3e7962 Fixing write2.Dispose() to avoid creating closure 2015-07-24 15:47:31 -07:00
Louis DeJardin 17a846ad8e Method not used by descendants 2015-07-24 15:44:27 -07:00
Louis DeJardin 62ec11be7e Adding internal Constants class 2015-07-24 15:43:43 -07:00
Louis DeJardin f935567cfd Read callback status is always 0 for any error and EOF 2015-07-24 15:36:45 -07:00
Louis DeJardin b93845be19 Removing debug code 2015-07-24 15:25:44 -07:00
Louis DeJardin 3d45602513 Catch Accept because of EAGAIN 2015-07-24 14:02:42 -07:00
Louis DeJardin 42246fd51b Using named pipes to dispatch connections to multiple threads 2015-07-24 13:50:13 -07:00
Louis DeJardin ceeb4edabd Adding UvPipeHandle 2015-07-24 13:50:10 -07:00
Stephen Halter a457f6da25 Merge branch 'release' into dev 2015-07-21 14:18:37 -07:00
Stephen Halter 4a284e5f81 Revert "React to FeatureModel package change."
This should not have been in the release branch yet!

This reverts commit 3cc0dd7a25.
2015-07-21 14:17:11 -07:00
Stephen Halter c199e5eee1 Wait on user-defined OnStarting and OnCompleted callbacks 2015-07-21 12:44:57 -07:00
Chris R 3cc0dd7a25 React to FeatureModel package change. 2015-07-21 12:44:56 -07:00
Stephen Halter 88689ccdb8 Merge branch 'release' into dev 2015-07-21 12:14:46 -07:00
Stephen Halter b9901c3bfe Surface fatal exceptions that stop the event loop
- Request an app Shutdown so KestrelEngine gets disposed
- Ensure Listener.Dispose doesn't deadlock before the engine
  can be disposed
- Rely on the existing logic to rethrow in the fatal error when
  the engine gets disposed
2015-07-21 11:58:26 -07:00
Ben Adams 23ffc3fea9 ConfigureAwait(false) 2015-07-19 15:50:42 +01:00
Ben Adams e69f63e494 ConfigureAwait(false) 2015-07-19 15:47:39 +01:00
Chris R 93477efb41 React to FeatureModel package change. 2015-07-17 09:58:55 -07:00
Pranav K 853ee00ff5 Merge remote-tracking branch 'origin/release' into dev 2015-07-16 08:43:59 -07:00
Peter Hsu 3aaae6964f Fix NPE issue where UvShutdownReq being garbage collected before the shutdown callback executed 2015-07-14 10:36:34 -07:00
Steve Smith 94dba8ff0e Moved address parsing to ServerAddress 2015-07-13 11:10:25 -07:00
markrendle 98995132de Pre-create Continue bytes in Frame 2015-07-13 10:43:05 -07:00
Stephen Halter 0670b7ae61 Ensure all the C# files have copyright notices 2015-07-06 17:49:00 -07:00
Stephen Halter 4b66edc4fe Move non-nested classes and interfaces to their own files 2015-07-06 17:48:58 -07:00
Victor Hurdugaci fd038b7b91 Add repository information to project files 2015-07-01 20:13:32 -07:00
Hao Kung f724fefbda React to HttpChanges 2015-06-25 17:28:07 -07:00
Stephen Halter 29098d6383 Fix UvLoopHandle.ReleaseHandle on linux
Libuv.loop_close can clear the GCHandle pointer on linux
2015-06-17 17:53:56 -07:00
Stephen Halter 1592459a0b Dispose Listeners if they fail to start 2015-06-15 10:08:03 -07:00
Stephen Halter a992c78548 Dispatch user defined callback so it can't block the event loop 2015-06-15 10:07:58 -07:00
Stephen Halter adc0310491 Ensure all handles still get released after graceful shutdown 2015-06-15 09:43:01 -07:00
Stephen Halter 31057f65bc Gracefully shutdown even when there are open connections 2015-06-15 09:41:33 -07:00
Stephen Halter 5c6a53c491 Dispose Listeners if they fail to start 2015-06-12 17:02:31 -07:00
Stephen Halter 7e125faa73 Dispatch user defined callback so it can't block the event loop 2015-06-12 17:02:27 -07:00
Chris R 08c0bbbd60 React to OnSendingHeaders rename. 2015-06-12 15:05:45 -07:00
Stephen Halter 106edf8c86 Ensure all handles still get released after graceful shutdown 2015-06-12 12:49:52 -07:00
Stephen Halter b43e5940e5 Gracefully shutdown even when there are open connections 2015-06-11 17:06:25 -07:00
Kirthi Krishnamraju 7e78374053 React to aspnet/Configuration #195,#198 2015-05-20 17:26:00 -07:00
Chris R bff13b2e9b React to Http namespace changes. 2015-05-07 13:43:34 -07:00
N. Taylor Mullen 063fb64c8b Update LICENSE.txt and license header on files. 2015-05-01 13:53:45 -07:00
Brennan cb4361b253 React to DNX package renames 2015-05-01 11:07:18 -07:00
N. Taylor Mullen 01a13bfa1d Add serviceable attribute to projects.
aspnet/DNX#1600
2015-04-14 15:00:26 -07:00
Chris Ross a23b665e8d Update IServerInformation namespace. 2015-04-10 10:47:31 -07:00
Matt Ellis ea636140c7 Allow Kestrel to boot when on CoreCLR and *NIX
With cross platform .NET Core support coming online, we need to update
our IsWindows check to not assume running on .NET Core means running on
Windows.  Since CoreFX doesn't yet expose a method for doing this (they
are working on adding it back), we'll just call Uname and if that
returns an empty string assume that we are on Windows.
2015-04-09 23:58:03 -07:00
Doug Bunting 5ad7aea8b4 Update .xproj files for Microsoft.Web.AspNet.* -> Microsoft.DNX.* rename 2015-04-02 13:49:26 -07:00
Ajay Bhargav Baaskaran c1e298b010 React to aspnet/HttpAbstractions#160 - Implementing OnResponseCompleted 2015-03-16 15:10:53 -07:00
N. Taylor Mullen 8d8c6ea823 Update .kproj => .xproj. 2015-03-11 14:09:00 -07:00
N. Taylor Mullen f796e1a5fc Remove BOM from project.json, *.cmd, *.sh and *.shade files. 2015-03-09 12:55:39 -07:00
N. Taylor Mullen 06a82669f5 Update aspnet50/aspnetcore50 => dnx451/dnxcore50. 2015-03-08 12:51:12 -07:00
Praburaj 620e83b590 Rename Microsoft.AspNet.Http.Interfaces => Microsoft.AspNet.Http 2015-03-05 16:23:18 -08:00
Praburaj cb3def5668 Changing signature of AppFunc to pass on IFeatureCollection
Reaction to this fix: https://github.com/aspnet/Hosting/issues/162
2015-02-25 17:40:17 -08:00
David Fowler e8d9414d92 Removed build time dependency 2015-02-10 10:08:16 -08:00
Stephen Halter cc720bd3fe Handle HttpFeature rename 2015-01-18 21:04:13 -08:00
David Fowler e421b3f01c Throw better error when libuv can't be loaded
- Throw more specific exception for *nix machines
2014-12-26 21:24:35 -08:00
Pranav K 2e943eb3ab Reacting to System.Diagnostics.Tracing version change 2014-12-15 16:20:40 -08:00
Pranav K 10a32fda26 Reacting to System.Threading version changes
* Sorting project.json references alphabetically
2014-12-15 14:44:33 -08:00
Victor Hurdugaci 4a2dd8f279 Add schema version to kproj files 2014-11-25 10:54:18 -08:00
Victor Hurdugaci 1b8f25f7d4 Update KProj to the latest format 2014-11-12 15:15:40 -08:00
Chris Ross 045a6eb4ba Add new HeadersSent API. 2014-11-06 12:10:15 -08:00
David Fowler 0174d213d1 Added package descriptions 2014-10-31 01:48:15 -07:00
Louis DeJardin e550d1f1ec Updating Darwin OS detection 2014-10-20 16:11:48 -07:00
Louis DeJardin dcf55abc9f Changing shared library name on Unix OS type 2014-10-13 22:48:47 -07:00
Pranav K ba0e3321bf Reacting to CLR package versioning changes 2014-10-10 10:33:06 -07:00
David Fowler 72c32367a4 Fixup references and the sample 2014-10-05 11:26:15 -07:00
Pranav K 1b1e02e9dd Reacting to System.Text.Encoding package version change 2014-09-11 10:06:52 -07:00
David Fowler 418f745292 Updated to use the new target framework in project.json 2014-09-04 01:52:19 -07:00
David Fowler 77d6318cfc Updated to use the new target framework in project.json 2014-08-28 23:39:13 -07:00
Pranav K 226e6f3291 Reacting to System.IO package version change 2014-08-20 06:56:34 -07:00
David Fowler 26084c7f13 Removed source files from the project 2014-08-15 08:17:40 -07:00
Pranav K 4fc0be86b6 Reacting to System.Collections version change 2014-07-14 15:11:48 -07:00
David Fowler 33cd0d89aa Renamed configurations to frameworks in project.json 2014-07-13 22:12:48 -07:00
Louis DeJardin de6c32dc4b Guarding against leaking GCHandles in read/write operations
See #19
2014-07-08 18:11:09 -07:00
Louis DeJardin 2da561cb7a Garbage collecting safe handles need to queue the uv_close
All of the uv_* calls must be called on the original thread
the finalizer thread cleaning up safehandle classes needs
special handling

see #16
2014-07-08 16:02:09 -07:00
Louis DeJardin 836be5565a Using weak gchandles from native to managed
See #15
2014-07-08 14:51:13 -07:00
Louis DeJardin 21778f631a Guarding against more read_cb cases 2014-07-07 14:01:02 -07:00
Louis DeJardin 8624b82b2b Improving callback exception support
Also renaming KestralTests to KestrelTests
2014-07-07 13:08:25 -07:00
Chris Ross 6edd238f38 Rename IHttpOpaqueUpgradeFeature to IHttpUpgradeFeature. 2014-07-03 14:14:07 -07:00
Louis DeJardin 747777ab54 Adding dylib binary to source control 2014-07-03 11:30:01 -07:00
Pranav K be88722cb5 Moving SampleApp from src to samples 2014-07-01 09:24:32 -07:00
David Fowler 9118d037fe Updated the kproj 2014-06-27 23:02:52 -07:00
Louis DeJardin 7c626431a1 Adding Upgrade support, using WebSocket middleware from sample app 2014-06-27 22:25:38 -07:00
Louis DeJardin 5e51783087 Recompiling windows binaries because uv_loop_size was added 2014-06-27 21:00:06 -07:00
Louis DeJardin 0f1a72e7e0 Tiny CLR won't tell you what the OS is. Assume tiny CLR is running on Windows. 2014-06-27 20:59:39 -07:00
Louis DeJardin e4b9bd265c Adjusting Kestrel to run cross platform 2014-06-27 20:01:44 -07:00
Louis DeJardin 9c29ccdd32 Cross-platform LoadLibrary, adjusting libuv apis 2014-06-27 19:45:31 -07:00
Louis DeJardin 08a3685f53 Moving native resources, updating loading code 2014-06-27 19:33:48 -07:00
Louis DeJardin 63637be073 Listener.Dispose should block until operation is complete 2014-06-25 20:57:12 -07:00
Louis DeJardin 9e4bc60205 Adding amd64 support
Moves Libuv.dll into nupkg
Uses ILibraryManager to locate location for native libraries
Updates version numbers to 1.0.0-*
Throws exceptions with error text provided by libuv.dll
Bind to ip4 or ip6 endpoints
Getting server defaults from ini
Enabling "Kestrel" to be used as a Main entrypoint
2014-06-20 21:09:44 -07:00
Louis DeJardin 17e566c5d1 Adding "server.urls" configuration support to kestrel 2014-06-17 22:45:53 -07:00
Louis DeJardin 6ac6419f4f Adding support for 'k web --server kestrel' 2014-06-13 13:10:46 -07:00
Louis DeJardin 9c7cb6a958 Adding some tests for Http11
Requires updating to test utilities
Adding initial EventSource to try to see some order of events
2014-06-11 17:09:25 -07:00
Louis DeJardin 660babcd7f Adding core clr configurations 2014-06-10 00:29:16 -07:00
David Fowler ad738561af Fixed project.json casing 2014-06-08 23:39:09 -07:00
David Fowler 75d0b29954 Renamed Project.json to Project.json2 2014-06-08 23:39:08 -07:00
Louis DeJardin ebd6af0fd6 Trying to get 100 Continue working again 2014-06-08 01:03:56 -07:00
Louis DeJardin 044bbb83e6 Getting request body variations to work 2014-06-07 02:49:25 -07:00
Louis DeJardin 313db3f0cf Removing unnecessary using statements 2014-06-06 22:16:08 -07:00
Louis DeJardin e517e39aac Not working, but worth taking a snapshot of the source 2014-06-06 22:13:31 -07:00