- Timestamp:
- Aug 1, 2022, 12:54:31 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/MapRendering/Web/Handlers/ApiHandler.cs
r367 r382 4 4 using System.Reflection; 5 5 using AllocsFixes.NetConnections.Servers.Web.API; 6 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest; 7 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse; 6 8 7 9 namespace AllocsFixes.NetConnections.Servers.Web.Handlers { 8 public class ApiHandler : PathHandler {10 public class ApiHandler : AbsHandler { 9 11 private readonly Dictionary<string, WebAPI> apis = new CaseInsensitiveStringDictionary<WebAPI> (); 10 12 … … 35 37 #endif 36 38 37 public override void HandleRequest ( HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,39 public override void HandleRequest (string _requestPath, HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _con, 38 40 int _permissionLevel) { 39 string apiName = _req .Url.AbsolutePath.Remove (0, urlBasePath.Length);41 string apiName = _requestPath.Remove (0, urlBasePath.Length); 40 42 41 43 if (!apis.TryGetValue (apiName, out WebAPI api)) { … … 47 49 if (!AuthorizeForApi (apiName, _permissionLevel)) { 48 50 _resp.StatusCode = (int) HttpStatusCode.Forbidden; 49 if (_ user!= null) {51 if (_con != null) { 50 52 //Log.Out ($"{nameof(ApiHandler)}: user '{user.SteamID}' not allowed to execute '{apiName}'"); 51 53 } … … 58 60 apiHandlerSampler.Begin (); 59 61 #endif 60 api.HandleRequest (_req, _resp, _ user, _permissionLevel);62 api.HandleRequest (_req, _resp, _con, _permissionLevel); 61 63 #if ENABLE_PROFILER 62 64 apiHandlerSampler.End ();
Note:
See TracChangeset
for help on using the changeset viewer.