Skip to content

Commit

Permalink
added comments for getFileContent method moved to pathtool api
Browse files Browse the repository at this point in the history
  • Loading branch information
MananJethwani authored and kelson42 committed Sep 26, 2021
1 parent 6c5d9e5 commit 6bbf4f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions include/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ std::vector<std::string> split(const std::string& str, const std::string& delims
*/
std::string converta2toa3(const std::string& a2code);

/** Extracts content from given file.
*
* This function provides content of a file provided it's path.
*
* @param path The absolute path provided in string format.
* @return Content of corresponding file in string format.
*/
std::string getFileContent(const std::string& path);
}
#endif // KIWIX_TOOLS_H
7 changes: 4 additions & 3 deletions src/server/internalServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ InternalServer::InternalServer(Library* library,
m_withTaskbar(withTaskbar),
m_withLibraryButton(withLibraryButton),
m_blockExternalLinks(blockExternalLinks),
m_indexTemplateString(indexTemplateString),
mp_daemon(nullptr),
mp_library(library),
mp_nameMapper(nameMapper ? nameMapper : &defaultNameMapper)
{}
{
m_indexTemplateString = !indexTemplateString.empty() ? indexTemplateString : RESOURCE::templates::index_html;
}

bool InternalServer::start() {
#ifdef _WIN32
Expand Down Expand Up @@ -338,7 +339,7 @@ InternalServer::get_matching_if_none_match_etag(const RequestContext& r) const

std::unique_ptr<Response> InternalServer::build_homepage(const RequestContext& request)
{
return ContentResponse::build(*this, !m_indexTemplateString.empty() ? m_indexTemplateString : RESOURCE::templates::index_html, get_default_data(), "text/html; charset=utf-8", true);
return ContentResponse::build(*this, m_indexTemplateString, get_default_data(), "text/html; charset=utf-8", true);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/server/internalServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class InternalServer {
bool withTaskbar,
bool withLibraryButton,
bool blockExternalLinks,
std::string indexTemplateString = "");
std::string indexTemplateString);
virtual ~InternalServer() = default;

MHD_Result handlerCallback(struct MHD_Connection* connection,
Expand Down

0 comments on commit 6bbf4f9

Please sign in to comment.