Ignore:
Timestamp:
Aug 1, 2022, 12:54:31 PM (2 years ago)
Author:
alloc
Message:

Switched to use SpaceWizards.HttpListener

File:
1 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements2/MapRendering/Web/Handlers/ItemIconHandler.cs

    r369 r382  
    44using System.Net;
    55using UnityEngine;
     6using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
     7using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    68using Object = UnityEngine.Object;
    79
    810namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
    9         public class ItemIconHandler : PathHandler {
     11        public class ItemIconHandler : AbsHandler {
    1012                private readonly Dictionary<string, byte[]> icons = new Dictionary<string, byte[]> ();
    1113                private readonly bool logMissingFiles;
     
    2426                public static ItemIconHandler Instance { get; private set; }
    2527
    26                 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
     28                public override void HandleRequest (string _requestPath, HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _con,
    2729                        int _permissionLevel) {
    2830                        if (!loaded) {
     
    3234                        }
    3335
    34                         string requestFileName = _req.Url.AbsolutePath.Remove (0, urlBasePath.Length);
     36                        string requestFileName = _requestPath.Remove (0, urlBasePath.Length);
    3537                        requestFileName = requestFileName.Remove (requestFileName.LastIndexOf ('.'));
    3638
    37                         if (icons.ContainsKey (requestFileName) && _req.Url.AbsolutePath.EndsWith (".png", StringComparison.OrdinalIgnoreCase)) {
     39                        if (icons.ContainsKey (requestFileName) && _requestPath.EndsWith (".png", StringComparison.OrdinalIgnoreCase)) {
    3840                                _resp.ContentType = MimeType.GetMimeType (".png");
    3941
     
    4547                                _resp.StatusCode = (int) HttpStatusCode.NotFound;
    4648                                if (logMissingFiles) {
    47                                         Log.Out ("Web:IconHandler:FileNotFound: \"" + _req.Url.AbsolutePath + "\" ");
     49                                        Log.Out ("Web:IconHandler:FileNotFound: \"" + _requestPath + "\" ");
    4850                                }
    4951                        }
Note: See TracChangeset for help on using the changeset viewer.