Commit Graph

33 Commits

Author SHA1 Message Date
Ryan Nowak 54e5370e8f Add CORS support to HttpMethodMatcherPolicy
Also removes HttpMethodEndpointConstraint, since it's been fully
replaced.
2018-07-26 23:01:11 -07:00
Ryan Nowak 147c9527f3
Implement EndpointSelector and MatcherPolicy (#646)
Implement EndpointSelector and MatcherPolicy

This change makes the EndpointSelector API more concrete, and is the
beggining of removing EndpointConstraint by making it obsolete.

To that end, I'm introducing MatcherPolicy, which is a
feature-collection API for registering policies that interact with the
DfaMatcher. The two policies that we'll need to start are:
- ability to order endpoints
- ability to append 'policy' nodes to the graph

These two concepts together replace EndpointConstraint. Extending our
graph representation is a really efficient way to processing most common
scenarios.

---

In general this helps with common cases where 4 or so endpoints match
the URL, but with different HTTP methods supported on each. Today we
have to process route values and call into some 'policy' to make a
decision about which one is the winner. This change pushes this
knowledge down into the graph so that it's roughly as cheap as a
dictionary lookup, and can be done allocation-free.

The big savings here is ability to remove more candidates *before*
collecting route data.

---

Along with this change, I also built 'rejection' into the DFA node
model, you can see an example with the HTTP Method handling that I
implemented. I implemented a policy that can treat failure to resolve an
HTTP method as a 405 response by returning a failure endpoint. This is
at the heart of much of the feedback we've gotten in this area around
versioning and http method handling. We also have a version of this
feature in MVC for [Consumes].
2018-07-24 17:31:51 -07:00
Ryan Nowak b9df95831d Change Branding
For preview one the branding is:

new thing = UseGlobalRouting/UseEndpoint
old thing = UseRouter

We're going to drop the name Dispatcher everywhere and make sure that we
position our new work as 'new and improved routing' instead of
introducing a new product/concept name.

We're not totally sure of the term Global yet, but it's what we're doing
for preview 1. Suggestions welcome for dicussion after we do the first
preview :)
2018-07-22 16:41:59 -07:00
Ryan Nowak f1c060bf3d RoutePattern everywhere 2018-07-20 13:04:34 -07:00
Ryan Nowak 477296a3cc Make DFA matcher the default 2018-07-18 07:50:27 -07:00
Ryan Nowak 400d243f42
Fix remaining feature gaps in DfaMatcher (#621)
* Fix remaining feature gaps in DfaMatcher

* addressed minor feedback

* missed one
2018-07-17 19:22:46 -07:00
Ryan Nowak b2e4743c7d
Change benchmarks (#612)
Add benchmarks that include some HTTP method matching.

Clean up names and name like-kinded benchmarks alphabetically.

Matcher*Benchmark -> E2E including HTTP method selection
MatcherSelectCandidates*Benchmark -> Focused on just URL path processing
2018-07-14 17:21:05 -07:00
Ryan Nowak ef6f326188 Add experimental JumpTables
Also reduced the count of entries of the max iteration to 25. The main
issue that we're trying to solve right now is which approach is the best
with a small number of entries. Going up to 100 takes a loooong time,
and all of the dictionary-based approaches scale well above 10 or so
entries.
2018-07-13 20:42:58 -07:00
Kiran Challa 42708bec91 Added support for route constraints in Dispatcher world 2018-07-13 14:18:54 -07:00
Ryan Nowak 7209cab5e9
Productize JumpTable (#594)
* Productize JumpTable
2018-07-12 23:28:51 -07:00
Kiran Challa 3a022107dc Revert "Added support for route constraints in Dispatcher world"
This reverts commit 85e92ab3cc.
2018-07-12 06:24:37 -07:00
Nate McMaster 85e92ab3cc Added support for route constraints in Dispatcher world 2018-07-12 05:06:22 -07:00
Ryan Nowak 576c14a1b5 Remove InstructionMatcher 2018-07-11 23:47:57 -07:00
Ryan Nowak 7aba48ca27 Add support for httpmethods in swaggatherer 2018-07-11 21:44:55 -07:00
Kiran Challa 1009705283 Added a RouteValuesBasedEndpointFinder 2018-06-28 10:53:10 -07:00
Ryan Nowak bc5f02444b
Benchmarks and improvements to route value dictionary (#577)
* Add benchmarks for RVD

There are the scenarios that are critical for URL matching performance.

* Reimplement RouteValueDictionary

Improves the scenarios with benchmarks by about 30%

* Fix benchmark

* PR feedback

* More feedback and tests
2018-06-26 13:41:49 -07:00
Ryan Nowak 30fcfb65ea Productionize Path tokenization 2018-06-21 17:13:03 -07:00
Ryan Nowak 5b8db03a57 Fixing up a few small issues
The instruction matcher was missing a few details, which made it faster
than it should have been. Right now I'm trying to keep the design of
these in sync. Once I fixed that it exposed a legitimate bug that was
blocking the github benchmark.
2018-06-15 18:04:43 -07:00
Ryan Nowak 00e99dbbb2 Flesh out experimental matchers
This change improves this area a bit by consolidating the matcher
implementations between the benchmarks project and the conformance
tests.

Additionally I split the minimal matcher into a really trivial
implementation for the simple tests and a more complex one for the
larger tests. This allows us to keep the plaintext/techempower scenario
in sight while also having a good baseline for the more sophisticated
tests.

Also starting to add tests that verify that matchers behave as expected.

The matchers now successfully execute all of these benchmarks, which
means that they support literals and parameters.

Missing features:
- complex segments
- catchall
- default values
- optional parameters
- constraints
- complex segments with file extensions

This is a good place to iterate a bit more of perf and try to make a
decision about what we want to implement.
2018-06-15 15:43:50 -07:00
Kiran Challa d3ddc1709a Added initial support for link generation when using Dispatcher 2018-06-14 15:31:30 -07:00
Ryan Nowak 08f12f2bfd Add sample matcher tests 2018-06-09 13:29:06 -07:00
Ryan Nowak edf26be1bf move feature around 2018-06-06 21:50:07 -07:00
Ryan Nowak 72941a8f35 Remove old cruft
Our new benchmarks are already much better than this one.
2018-06-06 21:50:07 -07:00
Ryan Nowak 49f839a286 Add benchmarks for matcher implementations 2018-06-06 21:50:07 -07:00
Ryan Nowak 72a7c31973 Upgrade benchmarks project
Upgrades our benchmarks project to use the shared benchmarking
infrastructure.
2018-05-31 17:30:10 -07:00
Kiran Challa 4184b2406d Updated to make routing always use UrlEncoder.Default and not depend on DI to get it.
[Fixes #513] RedirectToAction with Non-English Characters in Parameters and Authentication Causes Error
2018-04-12 05:15:45 -07:00
Jass Bagga 93d20ec78c
Revert Dispatcher changes (#508)
Addresses aspnet/Home#2741
2018-01-10 12:53:17 -08:00
Nate McMaster f4fb178f55 Pin tool and package versions to make builds more repeatable
Part of aspnet/Universe#575
2017-11-01 16:32:09 -07:00
Ryan Nowak 736b49294d Add Template abstraction
This change adds the Template as a top level abstraction. URL templating
is now a two-stage process.

First you use a 'key' to look up a Template, then you use the Template
to create the URL.

This change also has some cleanup of the way RoutePatternBinder gets
instantiated. I added a factory service so that most of the complex
things can be made internal to Dispatcher. Now it's much easier to
constuct and use. These impacts some pubternal APIs that we already
broke, but makes them actually nice :)

Also cleaned up some tests and fixed one that was broken and not
running.
2017-10-25 22:15:24 -07:00
Ryan Nowak 2d661396df Port TemplateBinder to dispatcher 2017-10-25 14:28:20 -07:00
Jass Bagga ebd0baa458 Add dispatcher packages 2017-08-31 11:54:27 -07:00
Nate McMaster e67d85d30c Use PackageLineup to manage PackageReference versions 2017-08-29 11:31:54 -07:00
Nate McMaster 44f9a7083b Use Directory.Build.props/targets 2017-08-29 11:30:03 -07:00