mirror of https://github.com/kiwix/libkiwix.git
Remove `ResponseMode`.
This commit is contained in:
parent
8d6567d067
commit
9078f0ac6e
|
@ -56,7 +56,6 @@ bool is_compressible_mime_type(const std::string& mimeType)
|
||||||
|
|
||||||
Response::Response(bool verbose)
|
Response::Response(bool verbose)
|
||||||
: m_verbose(verbose),
|
: m_verbose(verbose),
|
||||||
m_mode(ResponseMode::OK_RESPONSE),
|
|
||||||
m_returnCode(MHD_HTTP_OK)
|
m_returnCode(MHD_HTTP_OK)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -281,14 +280,12 @@ MHD_Result Response::send(const RequestContext& request, MHD_Connection* connect
|
||||||
{
|
{
|
||||||
MHD_Response* response = create_mhd_response(request);
|
MHD_Response* response = create_mhd_response(request);
|
||||||
|
|
||||||
if ( m_mode != ResponseMode::ERROR_RESPONSE ) {
|
MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
|
||||||
MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
|
MHD_add_response_header(response, MHD_HTTP_HEADER_CACHE_CONTROL,
|
||||||
MHD_add_response_header(response, MHD_HTTP_HEADER_CACHE_CONTROL,
|
m_etag.get_option(ETag::CACHEABLE_ENTITY) ? "max-age=2723040, public" : "no-cache, no-store, must-revalidate");
|
||||||
m_etag.get_option(ETag::CACHEABLE_ENTITY) ? "max-age=2723040, public" : "no-cache, no-store, must-revalidate");
|
const std::string etag = m_etag.get_etag();
|
||||||
const std::string etag = m_etag.get_etag();
|
if ( ! etag.empty() )
|
||||||
if ( ! etag.empty() )
|
MHD_add_response_header(response, MHD_HTTP_HEADER_ETAG, etag.c_str());
|
||||||
MHD_add_response_header(response, MHD_HTTP_HEADER_ETAG, etag.c_str());
|
|
||||||
}
|
|
||||||
for(auto& p: m_customHeaders) {
|
for(auto& p: m_customHeaders) {
|
||||||
MHD_add_response_header(response, p.first.c_str(), p.second.c_str());
|
MHD_add_response_header(response, p.first.c_str(), p.second.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,6 @@ extern "C" {
|
||||||
|
|
||||||
namespace kiwix {
|
namespace kiwix {
|
||||||
|
|
||||||
enum class ResponseMode {
|
|
||||||
OK_RESPONSE,
|
|
||||||
ERROR_RESPONSE,
|
|
||||||
};
|
|
||||||
|
|
||||||
class InternalServer;
|
class InternalServer;
|
||||||
class RequestContext;
|
class RequestContext;
|
||||||
|
|
||||||
|
@ -71,7 +66,6 @@ class Response {
|
||||||
|
|
||||||
protected: // data
|
protected: // data
|
||||||
bool m_verbose;
|
bool m_verbose;
|
||||||
ResponseMode m_mode;
|
|
||||||
int m_returnCode;
|
int m_returnCode;
|
||||||
ByteRange m_byteRange;
|
ByteRange m_byteRange;
|
||||||
ETag m_etag;
|
ETag m_etag;
|
||||||
|
|
Loading…
Reference in New Issue