-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Source server variables from IIS when running ANCM in-proc #10022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source server variables from IIS when running ANCM in-proc #10022
Conversation
This is the first version to get something out there before asking too many questions.
Let me know if we'd like to support that or if you see anything else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK to me. Minor suggestion around using a real type instead of a mock. Also not sure about adding the dependency. Now that it's one big happy <FrameworkReference>
, it's probably not a big deal, but having to depend on Servers.IIS
from Rewrite
feels a little off.
src/Middleware/Rewrite/test/IISUrlRewrite/ServerVariableTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK to me. Minor suggestion around using a real type instead of a mock. Also not sure about adding the dependency. Now that it's one big happy <FrameworkReference>
, it's probably not a big deal, but having to depend on Servers.IIS
from Rewrite
feels a little off.
src/Middleware/Rewrite/src/Internal/PatternSegments/IISServerVariableSegment.cs
Outdated
Show resolved
Hide resolved
src/Middleware/Rewrite/src/Internal/IISUrlRewrite/ServerVariables.cs
Outdated
Show resolved
Hide resolved
4b997b1
to
2e90d8f
Compare
9fedfd5
to
0333d78
Compare
I think we should move this feature to the features assembly in Http/* |
Hey @davidfowl thanks for jumping in. What feature are you referring to exactly? |
@mderriey he's talking about moving IServerVariablesFeature so we can avoid the IIS server dependency. We'd also need to move GetIISServerVariable, or not use it in this code path. |
That would be a breaking change, but I think I'm OK with it. It seems reasonable. Server Variables aren't actually an IIS-specific concept anyway. They date back to CGI so it seems reasonable that other servers may want to provide them. If we do this, I'd consider renaming the extension method to |
Exactly!
Right! I think that's what we want to do for 3.0. Lets not hold up this PR as a result tho. File an issue and refactor this since most of these changes are related to the rewrite middleware. |
Thanks for the explanation/context. I'd be happy to try and implement the final solution to expand my knowledge of the codebase. Could you please tag me in the resulting issue when it's created? |
Filing a bug now :) |
Feel free to move discussion on the subject of moving/renaming the feature to that issue. |
Great, thanks. I'll wait until this PR is merged to start the move. Thanks again. |
Code Check failed but I can't get AzDO to load. Usually this means you've got reference assemblies that are out of date. See https://github.com/aspnet/AspNetCore/blob/master/docs/ReferenceAssemblies.md for instructions on updating. |
Got it to load, yep, just need to update the refasms.
|
0333d78
to
3845ca8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits at this point 😄
Looks good, we can handle moving the feature to Http in a second PR.
I also want to do some E2E verification that this works when running inprocess.
@@ -19,7 +19,8 @@ public static class IISUrlRewriteOptionsExtensions | |||
/// <param name="options">The <see cref="RewriteOptions"/></param> | |||
/// <param name="fileProvider">The <see cref="IFileProvider"/> </param> | |||
/// <param name="filePath">The path to the file containing UrlRewrite rules.</param> | |||
public static RewriteOptions AddIISUrlRewrite(this RewriteOptions options, IFileProvider fileProvider, string filePath) | |||
/// <param name="useNativeIISServerVariables">Server variables are sourced natively from IIS if the application uses the in-process hosting model; use <c>false</c> to disable that behavior</param> | |||
public static RewriteOptions AddIISUrlRewrite(this RewriteOptions options, IFileProvider fileProvider, string filePath, bool useNativeIISServerVariables = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static RewriteOptions AddIISUrlRewrite(this RewriteOptions options, IFileProvider fileProvider, string filePath, bool useNativeIISServerVariables = true) | |
public static RewriteOptions AddIISUrlRewrite(this RewriteOptions options, IFileProvider fileProvider, string filePath, bool alwaysUseManagedServerVariables = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally we prefer bool defaults to be false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, thanks for pointing that out. I pushed extra commits to address that.
@@ -0,0 +1,21 @@ | |||
using System.Collections.Generic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit copyright.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 😇
There are still test failures and I believe you need to re update references. That's the reason we are working on making things internal. |
We inverted the meaning of the new boolean parameter
Hey @jkotalik, sorry about that. I forgot to invert the boolean values after we changed the meaning of the parameter. I also regenerated reference assemblies. Sorry that this one drags out so much, I keep forgetting about the ref assemblies. Thanks for your time, I'll keep an eye on the outcomes of the builds. |
Thanks @mderriey |
Addresses #6013