add support for OPTIONS http method
This commit is contained in:
@@ -828,8 +828,8 @@ void Request::ModifyStatusForRedirect()
|
||||
|
||||
|
||||
|
||||
|
||||
void Request::SendAnswer()
|
||||
// may rename to something like PrepareAndSendAnswer()?
|
||||
void Request::PrepareAndSendAnswer()
|
||||
{
|
||||
output_8bit.clear();
|
||||
compressed_output.clear();
|
||||
@@ -845,9 +845,7 @@ void Request::SendAnswer()
|
||||
}
|
||||
}
|
||||
|
||||
// may use CanSendContent() method?
|
||||
// what about method HEAD?
|
||||
if( !redirect_to.empty() || !x_sendfile.empty() )
|
||||
if( !redirect_to.empty() || !x_sendfile.empty() || method == Request::options )
|
||||
{
|
||||
Send8bitOutput(output_8bit); // send empty content
|
||||
return;
|
||||
@@ -1787,7 +1785,7 @@ void Request::SendHeaders()
|
||||
{
|
||||
if( i->second->is_wstr() )
|
||||
{
|
||||
pt::wide_to_utf8(i->first, aheader_name);
|
||||
pt::wide_to_utf8(i->first, aheader_name);
|
||||
pt::wide_to_utf8(*i->second->get_wstr(), aheader_value);
|
||||
|
||||
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
||||
@@ -1905,7 +1903,7 @@ bool Request::CanSendContent()
|
||||
return false;
|
||||
}
|
||||
|
||||
if( method == Request::head )
|
||||
if( method == Request::head || method == Request::options )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1933,7 +1931,7 @@ void Request::LogRequestTime()
|
||||
void Request::FinishRequest()
|
||||
{
|
||||
modify_status_code_if_needed(); // will be removed
|
||||
SendAnswer();
|
||||
PrepareAndSendAnswer();
|
||||
RequestEnds();
|
||||
LogRequestTime();
|
||||
|
||||
|
Reference in New Issue
Block a user