refactoring
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@523 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -59,17 +59,9 @@ void Request::Clear()
|
||||
env_http_accept_encoding = &char_empty;
|
||||
|
||||
session = 0;
|
||||
|
||||
result = err404; // !! tutaj moze cos lepszego, cos w stylu 'not implemented'
|
||||
|
||||
// dir = -1;
|
||||
// cur_dir_table.clear();
|
||||
item_table.clear();
|
||||
// dir_table2.clear();
|
||||
|
||||
item.Clear();
|
||||
str.clear();
|
||||
|
||||
dir_table.clear();
|
||||
is_item = false;
|
||||
pfunction = 0;
|
||||
@@ -79,35 +71,16 @@ void Request::Clear()
|
||||
|
||||
is_thread = false;
|
||||
thread.Clear();
|
||||
|
||||
thread_tab.clear();
|
||||
|
||||
notify_code = 0;
|
||||
|
||||
browser_msie = false;
|
||||
|
||||
// should be always empty
|
||||
// this is only for safety
|
||||
//string_empty.clear();
|
||||
redirect_to.clear();
|
||||
|
||||
|
||||
plugin.Call(CMSLU_REQUEST_CLEAR);
|
||||
}
|
||||
|
||||
|
||||
void Request::CopyFirstItem()
|
||||
{
|
||||
if( !request.item_table.empty() )
|
||||
request.item = request.item_table[0];
|
||||
else
|
||||
{
|
||||
request.item.Clear();
|
||||
|
||||
log << log1 << "Request::CopyFirstItem: item_table is empty" << logend;
|
||||
request.result = err_internal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// value can be null
|
||||
@@ -148,27 +121,21 @@ return true;
|
||||
|
||||
|
||||
|
||||
std::string & Request::PostVar(const char * var)
|
||||
std::string * Request::PostVar(const char * var)
|
||||
{
|
||||
PostTable::iterator p;
|
||||
|
||||
p = post_table.find(var);
|
||||
PostTable::iterator p = post_table.find(var);
|
||||
|
||||
if( p == post_table.end() )
|
||||
{
|
||||
throw Error(Error::no_postvar);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return p->second;
|
||||
return &(p->second);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
bool Request::PostVar(const char * var, std::string & result)
|
||||
{
|
||||
PostTable::iterator p;
|
||||
|
||||
p = post_table.find(var);
|
||||
PostTable::iterator p = post_table.find(var);
|
||||
|
||||
if( p == post_table.end() )
|
||||
{
|
||||
@@ -180,7 +147,7 @@ bool Request::PostVar(const char * var, std::string & result)
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -333,12 +300,12 @@ void Request::Read()
|
||||
|
||||
void Request::SendAll()
|
||||
{
|
||||
if( result == redirect )
|
||||
if( !redirect_to.empty() )
|
||||
{
|
||||
FCGX_PutS("Status: 301 Moved Permanently\r\n", out);
|
||||
FCGX_FPrintF(out, "Location: %s\r\n", str.c_str());
|
||||
FCGX_FPrintF(out, "Location: %s\r\n", redirect_to.c_str());
|
||||
|
||||
log << log2 << "Redirect to: " << str << logend;
|
||||
log << log2 << "Redirect to: " << redirect_to << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -355,7 +322,7 @@ void Request::SendAll()
|
||||
FCGX_PutS("\r\n", out);
|
||||
|
||||
|
||||
if( result == redirect )
|
||||
if( !redirect_to.empty() )
|
||||
// if there is a redirect we do not send a content
|
||||
return;
|
||||
//
|
||||
|
Reference in New Issue
Block a user