diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-09-01 12:36:11 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-09-01 12:36:11 -0400 |
| commit | 37dfbbe4776ef8cb005907cbc2ae96e64d641295 (patch) | |
| tree | c59c899786b3f088c3f4c454327f42f17f125ecf /MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs | |
| parent | 699bdacebc94635f129d3e68cfaaa49ebc0ff6f6 (diff) | |
update tabs
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs index 28b7824c8..8e46f8f03 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -102,14 +102,14 @@ namespace MediaBrowser.Server.Implementations.HttpServer // new SessionAuthProvider(_containerAdapter.Resolve<ISessionContext>()), //})); - PreRequestFilters.Add((httpReq, httpRes) => - { - //Handles Request and closes Responses after emitting global HTTP Headers - if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase)) - { - httpRes.EndRequest(); //add a 'using ServiceStack;' - } - }); + //PreRequestFilters.Add((httpReq, httpRes) => + //{ + // //Handles Request and closes Responses after emitting global HTTP Headers + // if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase)) + // { + // httpRes.EndRequest(); //add a 'using ServiceStack;' + // } + //}); HostContext.GlobalResponseFilters.Add(new ResponseFilter(_logger).FilterResponse); } @@ -403,6 +403,17 @@ namespace MediaBrowser.Server.Implementations.HttpServer return; } + if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase)) + { + httpRes.StatusCode = 200; + httpRes.AddHeader("Access-Control-Allow-Origin", "*"); + httpRes.AddHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS"); + httpRes.AddHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, Range, X-MediaBrowser-Token, X-Emby-Authorization"); + httpRes.ContentType = "text/html"; + + httpRes.Close(); + } + var operationName = httpReq.OperationName; var localPath = url.LocalPath; |
