- Timestamp:
- Jan 19, 2019, 6:12:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/Handlers/SessionHandler.cs
r325 r351 10 10 private readonly string staticPart; 11 11 12 public SessionHandler (string _staticPart, string _dataFolder, Web _parent, string moduleName = null) :13 base ( moduleName) {12 public SessionHandler (string _staticPart, string _dataFolder, Web _parent, string _moduleName = null) : 13 base (_moduleName) { 14 14 staticPart = _staticPart; 15 15 parent = _parent; … … 24 24 } 25 25 26 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnectionuser,27 int permissionLevel) {28 string subpath = req.Url.AbsolutePath.Remove (0, staticPart.Length);26 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user, 27 int _permissionLevel) { 28 string subpath = _req.Url.AbsolutePath.Remove (0, staticPart.Length); 29 29 30 30 StringBuilder result = new StringBuilder (); … … 32 32 33 33 if (subpath.StartsWith ("verify")) { 34 if ( user != null) {35 resp.Redirect ("/static/index.html");34 if (_user != null) { 35 _resp.Redirect ("/static/index.html"); 36 36 return; 37 37 } … … 40 40 "<h1>Login failed, <a href=\"/static/index.html\">click to return to main page</a>.</h1>"); 41 41 } else if (subpath.StartsWith ("logout")) { 42 if ( user != null) {43 parent.connectionHandler.LogOut ( user.SessionID);42 if (_user != null) { 43 parent.connectionHandler.LogOut (_user.SessionID); 44 44 Cookie cookie = new Cookie ("sid", "", "/"); 45 45 cookie.Expired = true; 46 resp.AppendCookie (cookie);47 resp.Redirect ("/static/index.html");46 _resp.AppendCookie (cookie); 47 _resp.Redirect ("/static/index.html"); 48 48 return; 49 49 } … … 52 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 string host = (Web.isSslRedirected ( req) ? "https://" : "http://") +req.UserHostName;54 string host = (Web.isSslRedirected (_req) ? "https://" : "http://") + _req.UserHostName; 55 55 string url = OpenID.GetOpenIdLoginUrl (host, host + "/session/verify"); 56 resp.Redirect (url);56 _resp.Redirect (url); 57 57 return; 58 58 } else { … … 63 63 result.Append (footer); 64 64 65 resp.ContentType = MimeType.GetMimeType (".html");66 resp.ContentEncoding = Encoding.UTF8;65 _resp.ContentType = MimeType.GetMimeType (".html"); 66 _resp.ContentEncoding = Encoding.UTF8; 67 67 byte[] buf = Encoding.UTF8.GetBytes (result.ToString ()); 68 resp.ContentLength64 = buf.Length;69 resp.OutputStream.Write (buf, 0, buf.Length);68 _resp.ContentLength64 = buf.Length; 69 _resp.OutputStream.Write (buf, 0, buf.Length); 70 70 } 71 71 }
Note:
See TracChangeset
for help on using the changeset viewer.