- Timestamp:
- Sep 4, 2018, 1:00:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/Handlers/SessionHandler.cs
r311 r325 1 using System;2 using System.Collections.Generic;3 1 using System.IO; 4 2 using System.Net; 5 3 using System.Text; 6 using System.Threading;7 4 8 namespace AllocsFixes.NetConnections.Servers.Web.Handlers 9 { 5 namespace AllocsFixes.NetConnections.Servers.Web.Handlers { 10 6 public class SessionHandler : PathHandler { 11 private string staticPart;12 private Web parent;13 private string header = "";14 private string footer = "";7 private readonly string footer = ""; 8 private readonly string header = ""; 9 private readonly Web parent; 10 private readonly string staticPart; 15 11 16 public SessionHandler (string _staticPart, string _dataFolder, Web _parent, string moduleName = null) : base(moduleName) { 17 this.staticPart = _staticPart; 18 this.parent = _parent; 12 public SessionHandler (string _staticPart, string _dataFolder, Web _parent, string moduleName = null) : 13 base (moduleName) { 14 staticPart = _staticPart; 15 parent = _parent; 19 16 20 17 if (File.Exists (_dataFolder + "/sessionheader.tmpl")) { … … 27 24 } 28 25 29 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) { 26 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, 27 int permissionLevel) { 30 28 string subpath = req.Url.AbsolutePath.Remove (0, staticPart.Length); 31 29 … … 37 35 resp.Redirect ("/static/index.html"); 38 36 return; 39 } else {40 result.Append ("<h1>Login failed, <a href=\"/static/index.html\">click to return to main page</a>.</h1>");41 37 } 38 39 result.Append ( 40 "<h1>Login failed, <a href=\"/static/index.html\">click to return to main page</a>.</h1>"); 42 41 } else if (subpath.StartsWith ("logout")) { 43 42 if (user != null) { … … 48 47 resp.Redirect ("/static/index.html"); 49 48 return; 50 } else {51 result.Append ("<h1>Not logged in, <a href=\"/static/index.html\">click to return to main page</a>.</h1>");52 49 } 50 51 result.Append ( 52 "<h1>Not logged in, <a href=\"/static/index.html\">click to return to main page</a>.</h1>"); 53 53 } else if (subpath.StartsWith ("login")) { 54 54 string host = (Web.isSslRedirected (req) ? "https://" : "http://") + req.UserHostName; … … 57 57 return; 58 58 } else { 59 result.Append ("<h1>Unknown command, <a href=\"/static/index.html\">click to return to main page</a>.</h1>"); 59 result.Append ( 60 "<h1>Unknown command, <a href=\"/static/index.html\">click to return to main page</a>.</h1>"); 60 61 } 61 62 … … 68 69 resp.OutputStream.Write (buf, 0, buf.Length); 69 70 } 70 71 71 } 72 73 72 } 74
Note:
See TracChangeset
for help on using the changeset viewer.