mirror of https://github.com/kiwix/libkiwix.git
Refactoring: extracted Response::create_mhd_response()
This commit is contained in:
parent
6c7ab6ff54
commit
a8e78f27e1
|
@ -139,8 +139,8 @@ void Response::inject_externallinks_blocker()
|
|||
script_tag);
|
||||
}
|
||||
|
||||
|
||||
int Response::send(const RequestContext& request, MHD_Connection* connection)
|
||||
MHD_Response*
|
||||
Response::create_mhd_response(const RequestContext& request)
|
||||
{
|
||||
MHD_Response* response = nullptr;
|
||||
switch (m_mode) {
|
||||
|
@ -218,6 +218,12 @@ int Response::send(const RequestContext& request, MHD_Connection* connection)
|
|||
break;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
int Response::send(const RequestContext& request, MHD_Connection* connection)
|
||||
{
|
||||
MHD_Response* response = create_mhd_response(request);
|
||||
|
||||
MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
|
||||
MHD_add_response_header(response, MHD_HTTP_HEADER_CACHE_CONTROL,
|
||||
|
|
|
@ -66,7 +66,10 @@ class Response {
|
|||
void introduce_taskbar();
|
||||
void inject_externallinks_blocker();
|
||||
|
||||
private:
|
||||
private: // functions
|
||||
MHD_Response* create_mhd_response(const RequestContext& request);
|
||||
|
||||
private: // data
|
||||
bool m_verbose;
|
||||
ResponseMode m_mode;
|
||||
std::string m_root;
|
||||
|
|
Loading…
Reference in New Issue