epee: don't send the body of the response to a HEAD HTTP request

According to the HTTP spec: "The HEAD method is identical to GET
except that the server MUST NOT return a message-body in the
response".
This commit is contained in:
Guillaume LE VAILLANT 2017-07-05 15:27:13 +02:00
parent 605ad09a3e
commit 13a8d64fe6

View file

@ -547,7 +547,7 @@ namespace net_utils
LOG_PRINT_L3("HTTP_RESPONSE_HEAD: << \r\n" << response_data); LOG_PRINT_L3("HTTP_RESPONSE_HEAD: << \r\n" << response_data);
m_psnd_hndlr->do_send((void*)response_data.data(), response_data.size()); m_psnd_hndlr->do_send((void*)response_data.data(), response_data.size());
if(response.m_body.size()) if(response.m_body.size() && (query_info.m_http_method != http::http_method_head))
m_psnd_hndlr->do_send((void*)response.m_body.data(), response.m_body.size()); m_psnd_hndlr->do_send((void*)response.m_body.data(), response.m_body.size());
return res; return res;
} }