Created
February 3, 2016 20:49
-
-
Save yannick/1e6ae7d977c773b94fbe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Mylog | |
| this(string timeid, ref HTTPServerRequest req) | |
| { | |
| this.timeid = timeid; | |
| this.unixtime = Clock.currTime.toUnixTime(); | |
| this.domain = req.host; | |
| this.ip = req.headers.get("X-Real-IP", req.headers.get("X-Forwarded-For", req.peer)); | |
| this.userAgent = req.headers.get("User-Agent", ""); | |
| foreach (key, val; req.headers) | |
| { | |
| import std.string : toLower; | |
| if (!(key.toLower == "date")) //date is somewhat kaputt | |
| this.headers[key] = val; | |
| } | |
| foreach (key, val; req.query) | |
| { | |
| this.query[key] = sanitize(val); | |
| } | |
| foreach (key, val; req.cookies) | |
| { | |
| this.cookies[key] = sanitize(val); | |
| } | |
| foreach (key, val; req.params) | |
| { | |
| this.parameters[key] = val; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment