Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Throw if UseUrls specifies HTTPS or path base (#1519) #1533

Merged
merged 1 commit into from
Mar 30, 2017
Merged

Conversation

cesarblum
Copy link
Contributor

{
throw new InvalidOperationException($"HTTPS addresses are not supported. Use {nameof(KestrelServerOptions)}.{nameof(KestrelServerOptions.Listen)}() to configure an HTTPS endpoint.");
}

if (!string.IsNullOrEmpty(parsedAddress.PathBase))
Copy link
Member

Choose a reason for hiding this comment

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

What happens if it's just '/'?
Where does it throw? This just logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a ServerAddress test that checks that just '/' is not set as path base:

[InlineData("http://www.example.com/", "http", "www.example.com", 80, "", "http://www.example.com:80")]

@@ -164,9 +164,14 @@ public void Start<TContext>(IHttpApplication<TContext> application)
{
var parsedAddress = ServerAddress.FromUrl(address);

if (parsedAddress.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase))
{
throw new InvalidOperationException($"HTTPS addresses are not supported. Use {nameof(KestrelServerOptions)}.{nameof(KestrelServerOptions.Listen)}() to configure an HTTPS endpoint.");
Copy link
Member

Choose a reason for hiding this comment

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

I don't like the phrasing of "HTTPS addresses are not supported..."

I would change this to "HTTPS endpoints may only be configured using {nameof(KestrelServerOptions)}.{nameof(KestrelServerOptions.Listen)}()".

Copy link
Member

Choose a reason for hiding this comment

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

may?

Copy link
Member

Choose a reason for hiding this comment

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

can, must, whatever.

@cesarblum
Copy link
Contributor Author

@halter73 I've changed the path base message too, for consistency.

@natemcmaster
Copy link
Contributor

Does this incidentally fix #1296 too?

@cesarblum
Copy link
Contributor Author

@natemcmaster No. See my updated comment there.

@cesarblum
Copy link
Contributor Author

Updated.

Copy link
Member

@davidfowl davidfowl left a comment

Choose a reason for hiding this comment

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

LGTM

@cesarblum cesarblum merged commit 1be31ae into dev Mar 30, 2017
@cesarblum cesarblum deleted the cesarbs/1519 branch March 30, 2017 03:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants