WIP: find, and harden against User null issue

This commit is contained in:
Michael Vesely 2020-05-13 20:01:04 +02:00
parent 861f23d29c
commit 04107c8cb6
2 changed files with 25 additions and 23 deletions

View File

@ -241,6 +241,8 @@ namespace WebDAVSharp.Server
IHttpListenerContext context = (IHttpListenerContext)state;
_log.Debug(" WebDAVSharp => " + context?.AdaptedInstance?.User?.Identity?.ToString());
// For authentication
Thread.SetData(Thread.GetNamedDataSlot(HttpUser), context.AdaptedInstance.User.Identity);

View File

@ -232,10 +232,10 @@ namespace WebDAVSharp.Server {
//TODO: (Charly): enable authentication
// For authentication
Thread.SetData(Thread.GetNamedDataSlot(HttpUser), context.User.Identity);
Thread.SetData(Thread.GetNamedDataSlot(HttpUser), context.User?.Identity);
_log.Info(context.Request.HttpMethod + " " + fileName);
Trace.WriteLine($"\nWebDAV - {context.Request.HttpMethod} - {fileName} - {context.User.Identity.AuthenticationType}: {context.User.Identity.Name}", "Info"); //
_log.Debug($"WebDAV - {context.Request.HttpMethod} - {fileName} - {context.User?.Identity?.AuthenticationType}: {context.User?.Identity?.Name}");
try {
try {
string method = context.Request.HttpMethod;