fix(Request): allow to prepare integer headers

This commit is contained in:
Tomasz Sowa 2022-08-31 21:25:14 +02:00
parent a19158cb62
commit a7a338f28e
1 changed files with 20 additions and 8 deletions

View File

@ -46,7 +46,6 @@
#include "jobtask.h"
namespace Winix
{
@ -1832,11 +1831,31 @@ void Request::SendHeaders()
for(i=headers.value.value_object.begin() ; i != headers.value.value_object.end() ; ++i)
{
bool header_prepared = false;
if( i->second->is_wstr() )
{
pt::wide_to_utf8(i->first, aheader_name);
pt::wide_to_utf8(*i->second->get_wstr(), aheader_value);
header_prepared = true;
}
else
if( i->second->is_long_long() )
{
pt::wide_to_utf8(i->first, aheader_name);
pt::Toa(*i->second->get_long_long(), aheader_value);
header_prepared = true;
}
else
{
if( plog )
{
(*plog) << log2 << "Skipping HTTP Header: " << i->first << " - it's neither a wstr nor a long long" << logend;
}
}
if( header_prepared )
{
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
FCGX_PutS(": ", fcgi_request.out);
FCGX_PutS(aheader_value.c_str(), fcgi_request.out);
@ -1845,13 +1864,6 @@ void Request::SendHeaders()
if( config->log_http_answer_headers && plog )
(*plog) << log1 << "HTTP Header: " << aheader_name << ": " << aheader_value << logend;
}
else
{
if( plog )
{
(*plog) << log2 << "Skipping HTTP Header: " << i->first << " - it's not a wstr" << logend;
}
}
}
}
}