Commit Graph

210 Commits

Author SHA1 Message Date
Pavel Krymets 440b8bc0ba Migrate tests, tools and samples to portable 2016-04-14 14:34:51 -07:00
Chris R 8196f2ab81 #605 Fix regressions in FormReader / FileBufferingReadStream. 2016-04-01 11:34:45 -07:00
Doug Bunting 6725d68559 Move some implementations (all feature implementations) out of `.Internal` namespaces
- #549, #592
- move feature implementations to `Microsoft.AspNetCore.Http.Features` and `...Authentication.Features`
- move `DefaultHttpContext`, `HttpContextAccessor`, `HttpContextFactory`, `FormCollection` and
  `HeaderDictionary` to `Microsoft.AspNetCore.Http`
- move `FormFile` to `Microsoft.AspNetCore.Http.Internal`
 - that and `Microsoft.AspNetCore.Http.Authentication.Internal` are the remaining `.Internal` namespaces

nits:
- remove a couple of parameterless constructors
- add / fill subfolders to align with new namespaces
- remove all use of (unnecessary) "T:..." `<see cref=""/>` values
2016-03-30 16:01:37 -07:00
Doug Bunting 80813f7c1e Use pooled `StringBuilder` to reduce allocations when adding response cookies
- #561
- new `SetCookieHeaderValue.AppendToStringBuilder()` method; avoids per-call `StringBuilder` allocation
- `ResponseCookies` uses `ObjectPool<StringBuilder>` that `ResponseCookiesFeature` provides
 - `ResponseCookies` works fine if no `ObjectPoolProvider` is available
- `IHttpContextFactory` instance is a singleton instantiated from CI
 - make `HttpContextFactory` `ObjectPoolProvider` and `ResponseCookiesFeature`-aware
 - apply same pattern to sample `PooledHttpContextFactory`
- pool is not currently configurable; defaults are fine for response cookies
 - if we need (policy) configuration, would add an `IOptions<HttpContextFactorySettings>`

nit: Add some doc comments
2016-03-25 09:38:52 -07:00
David Fowler 8efc650e74 Fixed build 2016-03-25 01:54:05 -07:00
Doug Bunting 6f24508a33 Move remaining feature interfaces into `Microsoft.AspNetCore.Http.Features` package and namespace
- #590, also related to #561
- move feature interfaces from `Microsoft.AspNetCore.Http` package
- move required classes from `Microsoft.AspNetCore.Http.Abstractions` package
- move `ISession` and `WebSocketAcceptContext` to `Microsoft.AspNetCore.Http` namespace (#590)

nit: remove transient dependencies listed in `Microsoft.AspNetCore.Http.Abstractions`'s `project.json`
2016-03-21 09:05:09 -07:00
Chris R ce408a999e #578 Do not buffer the request body by default when reading forms. 2016-03-17 15:21:10 -07:00
Chris R 1f754f65d3 Add ISession.Id 2016-03-04 14:28:20 -08:00
David Obando 15649b7e31 Faster SubMatch implementation
Submatch has been sped up by implementing a modified Boyer–Moore–Horspool algorithm with an average-case complexity of O(N) on random text. Worst case, it behaves similarly to the previous implementation O(MN), where M is the length of the boundary and N is the length of the buffer to operate on.

Method SubMatch looks for two things:

  1. Whether the byte array segment fully contains the boundary, or
  2. Whether the byte array ends with the start of the boundary.

Case 1 is now a lot faster than the previous implementation. Case 2 remains using the same code as before. The method will do Case 1 until the matchOffset is equal to N-M. It then switches to Case 2, unless a match is found.

The code can be further sped up with a full Boyer–Moore implementation, or something more sophisticated. This however can be evaluated in the case that this implementation is insufficiently performant for our main scenarios.

This commit resolves issue #575.
2016-03-04 10:54:20 -08:00
Doug Bunting 3105fd1075 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:51:48 -08:00
N. Taylor Mullen 9f499d7962 Transition to netstandard.
- dotnet5.X => netstandard1.y (where y = x-1).
- DNXCore50 => netstandardapp1.5.
- Applied the same changes to ifdefs.
2016-03-01 13:31:53 -08:00
Sebastien Ros c030ef9129 [Fixes #567] Adding port and host parsing in HostString 2016-02-19 16:29:22 -08:00
John Luo dc2aa0ec8f Updating test TFMs for custom test discovery 2016-02-18 15:01:26 -08:00
Ryan Nowak 91751015ea Reset fields on AuthenticateContext
This is needed for cases where IAuthenticationHandler instances delegate
or modify the output of each-other.
2016-02-18 12:14:53 -08:00
Doug Bunting 8c120a0792 Extend `WebEncoders` API to avoid allocations within the methods
- rewrite existing methods in terms of the new ones
- don't allocate multiple 0-length arrays

nits:
- clarify a couple of doc comments e.g. using `<paramref/>`
- move an error message into a resource
 - pass parameter names into new resource
- rename parameters for consistency e.g. `inputLength` -> `count`
- name literal `int` parameters
- more `var`
2016-02-17 23:13:33 -08:00
Doug Bunting 5d8231ee0d `OwinExtensions.UseBuilder()` should not leave `ApplicationServices` or `RequestServices` `null`
Also correct tests to avoid warnings and to ensure scenarios are actually tested
- tests previously went `async` without waiting for completion

nit: add parameter `null` checks
2016-02-17 11:31:02 -08:00
Kiran Challa 4a3e2ad3c5 Enable tests to run using dotnet xunit runner 2016-02-09 22:11:54 -08:00
Chris R 3e6c7171be #515 Make forgiving vs strict header list parsers. 2016-02-08 10:21:28 -08:00
John Luo 8aa7a0993d Relocating dependencies 2016-02-01 18:26:36 -08:00
John Luo 93079ea3a6 Updating to new CLI 2016-02-01 16:37:16 -08:00
Brennan 765a52007a Use EscapeDataString for encoding Cookies 2016-01-29 12:58:36 -08:00
N. Taylor Mullen 02363da94e Rename AspNet 5 file contents.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:20:40 -08:00
N. Taylor Mullen b2c154b576 Rename AspNet 5 folders and files.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:20:30 -08:00
ryanbrandenburg da478b02ed * Move HttpResponseStreamWriter from Mvc 2016-01-21 10:28:07 -08:00
David Fowler ca8136b73c Compile middleware invoke method when extra args are provided
- Improves the performance when accessing scoped services in middleware
2016-01-07 20:39:04 -08:00
Victor Hurdugaci e7bf0e71bb Build with dotnet 2016-01-07 14:22:25 -08:00
Stephen Halter 364a712cb3 Merge branch 'lodejard/featurereferences' into dev 2015-12-30 15:35:08 -08:00
Pranav K 161d6ca5c0 Move Microsoft.Extensions.WebEncoders to HtmlAbstractions
Fixes #512
2015-12-23 09:27:39 -08:00
Louis DeJardin c95d816c1d Updating unit test to probe _features cache field state 2015-12-17 11:18:44 -08:00
Louis DeJardin 35d71068d4 PR feedback 2015-12-16 22:46:20 -08:00
Louis DeJardin 0e3fe7493e Streamlining feature cache and object re-initialiation code paths
Shouldn't increase object size, but does improve maintainability
2015-12-16 20:01:55 -08:00
Ben Adams 67c5ec29b3 Allow feature cache to be updated+invalidated 2015-12-15 16:12:37 -08:00
Kristian Hellang c2e7618d9a Added Name and FileName to IFormFile
This commits also gets rid of the name
closure in FormFileCollection by interating
over the files in the collection instead
of using Find and FindAll.

Closes #352 and #499
2015-12-04 20:28:42 +01:00
David Fowler 5b175beea8 Change SendFileAsync to use a fallback implementation instead of throwing
- If the user wants to use the SendFile API directly then they can access the feature
explicitly.
- Removed SupportsSendFile
- Don't check for existence, let FileStream throw
- Updated Doc comments
- Pass the buffer into StreamCopyOperation
- Using a real using instead of try finally.
2015-12-02 22:37:53 -08:00
Pranav K a0a1c38e44 Moving Microsoft.AspNet.Html.Abstractions to a HtmlAbstractions repo
Fixes #418
2015-12-01 17:35:20 -08:00
John Luo 67aa2546a8 Removing ApplicationServices from HttpContext #466 2015-11-19 09:34:38 -08:00
Pavel Krymets 681533e06c Set IHttpContextAccessor only if DI provides it 2015-11-18 09:15:27 -08:00
John Luo fbec068f5c Adding option to configure services when exposing the ASP.NET 5 pipeline via OWIN #398 2015-11-17 11:02:04 -08:00
Pavel Krymets 690e5a66e5 Set default path=/ when removing cookie 2015-11-16 15:58:18 -08:00
John Luo d4d04d2c96 Adding exception message for paths not starting with / #251 2015-11-16 10:21:02 -08:00
Ryan Nowak 88c356f645 Add HtmlContentBuilder and HtmlTextWriter
Remove BufferedHtmlContent
2015-11-16 08:41:03 -08:00
N. Taylor Mullen bb8141710d Remove System beta tag in project.json for coreclr packages. 2015-11-12 12:23:07 -08:00
Nick Craver 6874b87f13 C#6 Cleanup & Optimizations
The main intent is cleanup using C# 6 operators and normalization of
type aliases. While there are no intended functional changes here, it
does eliminate a few tight race conditions as a bonus (not a real-win
since this isn't thread-safe all over, simply noting).
2015-11-10 09:38:49 -08:00
Ryan Nowak 308dd109a0 Reduce allocations on Conneg hotpath 2015-11-09 09:16:30 -08:00
Chris R f050e09283 Revert use of explicit converters that prevent APIs from returning null. 2015-11-04 16:03:36 -08:00
Ben Adams 3c2e2b9d98 #426 Less alloc/wrapping/boxing for Query, Forms, Cookies 2015-11-02 14:47:46 -08:00
Cesar Blum Silveira af0d2e5888 Merge branch 'release' into dev 2015-11-02 13:38:08 -08:00
Doug Bunting 037196d5c7 Restore `null` and `string.Empty` handling from `EncoderExtensions`
- prior test encoders were never invoked for `null` or empty `string`s e.g.
``` c#
    public static void HtmlEncode(this IHtmlEncoder htmlEncoder, string value, TextWriter output)
    {
...
        if (!String.IsNullOrEmpty(value))
        {
            htmlEncoder.HtmlEncode(value, 0, value.Length, output);
        }
    }
```
- add missing `null` checks and handle `string.Empty` in `TextWriter output, string value, ...` overloads
  - better match for the underlying `TextEncoder` behaviour
  - `EncoderExtensions` provided an API like `TextEncoder.Encode(TextWriter output, string value)`
    - that method calls `Encode(TextWriter output, string value, int startIndex, int characterCount)`
2015-11-02 09:40:42 -08:00
Cesar Blum Silveira e934f5e4ed Strong name everything. 2015-10-30 15:36:55 -07:00
Chris R be4fb46281 #391 Migrate to System.Text.Encoding.Web 2015-10-30 10:13:02 -07:00