From 968f41ba511f8f74377b1a1c7b61ff759ebe3078 Mon Sep 17 00:00:00 2001 From: faketruth Date: Tue, 31 Jan 2012 20:56:42 +0000 Subject: Changed how Lua handles the (Post)Params in the HTTPRequest of a WebPlugin It should now be theoretically possible to upload files through WebAdmin git-svn-id: http://mc-server.googlecode.com/svn/trunk@203 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cWebAdmin.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'source/cWebAdmin.cpp') diff --git a/source/cWebAdmin.cpp b/source/cWebAdmin.cpp index 002505c1f..b99b8e779 100644 --- a/source/cWebAdmin.cpp +++ b/source/cWebAdmin.cpp @@ -136,10 +136,22 @@ void cWebAdmin::Request_Handler(webserver::http_request* r) HTTPRequest Request; Request.Username = r->username_; Request.Method = r->method_; - Request.Params = new cStringMap(r->params_); - Request.PostParams = new cStringMap(r->params_post_); + Request.Params = r->params_; + Request.PostParams = r->params_post_; Request.Path = r->path_; + for( unsigned int i = 0; i < r->multipart_formdata_.size(); ++i ) + { + webserver::formdata& fd = r->multipart_formdata_[i]; + + HTTPFormData HTTPfd;//( fd.value_ ); + HTTPfd.Value = fd.value_; + HTTPfd.Type = fd.content_type_; + HTTPfd.Name = fd.name_; + LOGINFO("Form data name: %s", fd.name_.c_str() ); + Request.FormData[ fd.name_ ] = HTTPfd; + } + if( Split.size() > 1 ) { for( PluginList::iterator itr = WebAdmin->m_Plugins.begin(); itr != WebAdmin->m_Plugins.end(); ++itr ) @@ -159,9 +171,6 @@ void cWebAdmin::Request_Handler(webserver::http_request* r) } } - delete Request.Params; - delete Request.PostParams; - if( FoundPlugin.empty() ) // Default page { Content.clear(); -- cgit v1.2.3