Changeset 394 for binary-improvements2/WebServer/src/Web.cs
- Timestamp:
- Aug 8, 2022, 8:07:44 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/WebServer/src/Web.cs
r391 r394 63 63 RegisterWebMods (useStaticCache); 64 64 65 RegisterPathHandler ("/session/", new SessionHandler ( webfilesFolder,connectionHandler));65 RegisterPathHandler ("/session/", new SessionHandler (connectionHandler)); 66 66 RegisterPathHandler ("/userstatus", new UserStatusHandler ()); 67 67 RegisterPathHandler ("/sse/", new SseHandler ()); … … 152 152 } 153 153 154 #if ENABLE_PROFILER 154 private readonly UnityEngine.Profiling.CustomSampler getContextSampler = UnityEngine.Profiling.CustomSampler.Create ("GetCtx"); 155 155 private readonly UnityEngine.Profiling.CustomSampler authSampler = UnityEngine.Profiling.CustomSampler.Create ("Auth"); 156 private readonly UnityEngine.Profiling.CustomSampler cookieSampler = UnityEngine.Profiling.CustomSampler.Create ("ConCookie"); 156 157 private readonly UnityEngine.Profiling.CustomSampler handlerSampler = UnityEngine.Profiling.CustomSampler.Create ("Handler"); 157 #endif158 158 159 159 private void HandleRequest (IAsyncResult _result) { … … 165 165 #if ENABLE_PROFILER 166 166 UnityEngine.Profiling.Profiler.BeginThreadProfiling ("AllocsMods", "WebRequest"); 167 getContextSampler.Begin (); 167 168 HttpListenerContext ctx = listenerInstance.EndGetContext (_result); 169 getContextSampler.End (); 168 170 try { 169 171 #else … … 189 191 } 190 192 191 #if ENABLE_PROFILER192 193 authSampler.Begin (); 193 #endif194 194 int permissionLevel = DoAuthentication (request, out WebConnection conn); 195 #if ENABLE_PROFILER196 195 authSampler.End (); 197 #endif198 196 199 197 //Log.Out ("Login status: conn!=null: {0}, permissionlevel: {1}", conn != null, permissionLevel); 200 198 199 cookieSampler.Begin (); 201 200 if (conn != null) { 202 201 Cookie cookie = new Cookie ("sid", conn.SessionID, "/") { … … 208 207 response.AppendCookie (cookie); 209 208 } 209 cookieSampler.End (); 210 210 211 211 string requestPath = request.Url.AbsolutePath; … … 256 256 } 257 257 } else { 258 #if ENABLE_PROFILER259 258 handlerSampler.Begin (); 260 #endif261 259 handler.HandleRequest (_context); 262 #if ENABLE_PROFILER263 260 handlerSampler.End (); 264 #endif265 261 } 266 262 … … 291 287 } 292 288 293 string remoteEndpointString = reqRemoteEndPoint.ToString ();294 295 289 if (_req.QueryString ["adminuser"] == null || _req.QueryString ["admintoken"] == null) { 296 290 return guestPermissionLevel; … … 303 297 } 304 298 305 Log.Warning ("Invalid Admintoken used from " + re moteEndpointString);299 Log.Warning ("Invalid Admintoken used from " + reqRemoteEndPoint); 306 300 307 301 return guestPermissionLevel;
Note:
See TracChangeset
for help on using the changeset viewer.