Skip to content
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

Add IServerAddressesFeature support #4685

Merged
merged 15 commits into from
Dec 20, 2018
Merged

Add IServerAddressesFeature support #4685

merged 15 commits into from
Dec 20, 2018

Conversation

pakrym
Copy link
Contributor

@pakrym pakrym commented Dec 13, 2018

Fixes: #3843

This feature requires both new shim and new handler to work but is gracefully disabled otherwise.

@Tratcher
Copy link
Member

Multiple IIS test failures?

@pakrym
Copy link
Contributor Author

pakrym commented Dec 13, 2018

Yep, I missed something. But in general PR ready for review.

@pakrym
Copy link
Contributor Author

pakrym commented Dec 14, 2018

Failures are AuthSamples tests

@@ -84,6 +83,9 @@ public Task StartAsync<TContext>(IHttpApplication<TContext> application, Cancell

_iisContextFactory = new IISContextFactory<TContext>(_memoryPool, application, _options, this, _logger);
_nativeApplication.RegisterCallbacks(_requestHandler, _shutdownHandler, _onDisconnect, _onAsyncCompletion, (IntPtr)_httpServerHandle, (IntPtr)_httpServerHandle);

Features.Set<IServerAddressesFeature>(new ServerAddressesFeature(_options.ServerAddresses));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification: The IServerAddressesFeature should be created and set in the IServer constructor, but the addresses should not be added until Start.
https://github.com/aspnet/KestrelHttpServer/blob/5c1fcd664d39db8fe5c8e38052a3cc29f90322f6/src/Kestrel.Core/KestrelServer.cs#L50-L51

Yes this is a bit of an arbitrary limitation, but we don't want people to get different behavior in IIS vs selfhost.


for (auto binding : bindings)
{
result += binding.QueryProtocol() + L"://" + binding.QueryHost() + L":" + binding.QueryPort() + basePath + L";";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is pathBase encoded or decoded here? e.g. if I have a space in my base path do I get ' ' or %20? The escaped form should be preferred in this url form.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The host is likely in unicode, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test

else if (selectedPort != bindingPort)
{
// If there are multiple endpoints configured return empty port
return L"";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

environmentvariablehelpers is checking for null, not empty string. Or is there a difference here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants