summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-04-21 12:01:39 +0200
committerMattes D <github@xoft.cz>2015-04-21 12:01:39 +0200
commit50323b3760abf2fc62774a11dde406ef38d5935a (patch)
tree0c4cf152371dbe6b2a905a755d8ffdcd683c5d75 /src
parentWebAdmin: Removed server name, shortened memory report. (diff)
parentAdded URL member to the HTTPRequest API class. (diff)
downloadcuberite-50323b3760abf2fc62774a11dde406ef38d5935a.tar
cuberite-50323b3760abf2fc62774a11dde406ef38d5935a.tar.gz
cuberite-50323b3760abf2fc62774a11dde406ef38d5935a.tar.bz2
cuberite-50323b3760abf2fc62774a11dde406ef38d5935a.tar.lz
cuberite-50323b3760abf2fc62774a11dde406ef38d5935a.tar.xz
cuberite-50323b3760abf2fc62774a11dde406ef38d5935a.tar.zst
cuberite-50323b3760abf2fc62774a11dde406ef38d5935a.zip
Diffstat (limited to 'src')
-rw-r--r--src/WebAdmin.cpp3
-rw-r--r--src/WebAdmin.h9
2 files changed, 11 insertions, 1 deletions
diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp
index aff3b4710..484626de3 100644
--- a/src/WebAdmin.cpp
+++ b/src/WebAdmin.cpp
@@ -234,7 +234,7 @@ void cWebAdmin::HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPReque
bool ShouldWrapInTemplate = ((BareURL.length() > 1) && (BareURL[1] != '~'));
// Retrieve the request data:
- cWebadminRequestData * Data = (cWebadminRequestData *)(a_Request.GetUserData());
+ cWebadminRequestData * Data = reinterpret_cast<cWebadminRequestData *>(a_Request.GetUserData());
if (Data == nullptr)
{
a_Connection.SendStatusAndReason(500, "Bad UserData");
@@ -244,6 +244,7 @@ void cWebAdmin::HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPReque
// Wrap it all up for the Lua call:
AString Template;
HTTPTemplateRequest TemplateRequest;
+ TemplateRequest.Request.URL = a_Request.GetURL();
TemplateRequest.Request.Username = a_Request.GetAuthUsername();
TemplateRequest.Request.Method = a_Request.GetMethod();
TemplateRequest.Request.Path = BareURL.substr(1);
diff --git a/src/WebAdmin.h b/src/WebAdmin.h
index 1e1a9bfa9..4dbcc57a6 100644
--- a/src/WebAdmin.h
+++ b/src/WebAdmin.h
@@ -50,9 +50,18 @@ struct HTTPRequest
typedef std::map< std::string, std::string > StringStringMap;
typedef std::map< std::string, HTTPFormData > FormDataMap;
+ /** The entire URL presented to the HTTP server. */
+ AString URL;
+
+ /** HTTP method used for the request ("GET", "POST" etc.) */
AString Method;
+
+ /** The Path part of the request's URL (excluding GET params). */
AString Path;
+
+ /** Name of the logged-in user. Empty if not logged in. */
AString Username;
+
// tolua_end
/** Parameters given in the URL, after the questionmark */