aspnet / ServerTests

[Archived] Tests for Helios, WebListener and Kestrel. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
21 stars 13 forks source link

[Annoucement] WebListener API updates #39

Closed Tratcher closed 7 years ago

Tratcher commented 8 years ago

The WebListener APIs are being reviewed and updated. Relevant breaking changes will be posted to this thread. Changes so far:

AllowAnonymous is now a separate bool property defaulting to true. It was formerly a member of the AuthenticationSchemes enum.

builder.UseWebListener(options =>
{
  options.Listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.NTLM;
  options.Listener.AuthenticationManager.AllowAnonymous = false;
});

WebSockets have been re-enabled using a new managed implementation from CoreFx. Win8+ is still required due to Http.Sys API dependencies. The Microsoft.Net.WebSockets.Server package has been deleted since the support was added directly to Microsoft.Net.Http.Server.

dmccaffery commented 8 years ago

I assume this is in support of SignalR? Glad to see its moving forward. From a web sockets perspective; will this only ever be supported on Windows (http.sys), or are their plans to expand support cross-plat?

davidfowl commented 8 years ago

@dmccaffery What specifically are you asking about?

Tratcher commented 8 years ago

Yes, SignalR will benefit from this. See https://github.com/aspnet/websockets for cross-plat support (this has been up and running for over a year now).

Tratcher commented 8 years ago

@304NotModified RE: https://github.com/aspnet/Announcements/issues/198#issuecomment-238306532 WebListener hasn't released a 1.0 version yet, we're preparing for that.

dmccaffery commented 8 years ago

Ah; sweet. I knew about the websockets repo, but I thought it was put on hold and never finished / officially supported. I haven't been keeping my eye on it as I've been more concerned (interested in) the Roslyn project system and msbuild reintroduction that is up and coming. Thanks for the quick response!

Tratcher commented 8 years ago

The WebSockets repo was on hold, but it has been revived for the 1.1 milestone.

304NotModified commented 8 years ago

Would be nice if semver was properly used.

Version 1.0.0 defines the public API. The way in which the version number is incremented after this release is dependent on this public API and how it changes. Major version X (X.y.z | X > 0) MUST be incremented if any backwards incompatible changes are introduced to the public API. It MAY include minor and patch level changes. Patch and minor version MUST be reset to 0 when major version is incremented.

http://semver.org/#spec-item-5

davidfowl commented 8 years ago

1.1 milestone, the package will likely be 1.0.0

304NotModified commented 8 years ago

OK thanks, that wasn't clear.

atifaziz commented 8 years ago

AllowAnonymous is now a separate bool property defaulting to true.

The default value for Boolean options should always be false. This way, one doesn't have to look up the docs to see if any property starts life as true or false. Let it always be false because it's an option and you should have to opt into the behaviour by turning it on. Negate the property name so it's obvious what setting to true will do. In other words rename AllowAnonymous to DisallowAnonymous (or ForbidAnonymous).

Tratcher commented 8 years ago

Here's the last planned batch of API changes.

Summary: All of the settings have been moved from WebListener to a new WebListenerSettings object. A few names have also been updated.

Old API New API
WebListenerOptions.Listener [WebListener] ListenerSettings [WebListenerSettings]
new WebListener(ILoggerFactory) new WebListener(WebListenerSettings), WebListenerSettings.Logger [ILogger]
WebListener.Settings [WebListenerSettings]
WebListener.UrlPrefixes WebListenerSettings.UrlPrefixes
WebListener.TimeoutManager WebListenerSettings.Timeouts
WebListener.AuthenticationManager WebListenerSettings.Authentication
WebListener.AuthenticationManager.AuthenticationSchemes WebListenerSettings.Authentication.Schemes
WebListener.SetRequestQueueLimit(long) WebListenerSettings.RequestQueueLimit [long]

Example changes in MusicStore: https://github.com/aspnet/MusicStore/commit/299b44c018b126bd3de681b6e6e8ea06ed9eb85c

Keep in mind that all of the above settings (except Logger) can be modified while the listener is running.