feat: add Content-Type and Connection headers for autoindex responses

This commit is contained in:
whaffman 2025-10-30 23:05:11 +01:00
parent a479fa5415
commit e8071a6dd0

View File

@ -72,6 +72,8 @@ void FileHandler::handleDirectory(const std::string &dirpath, ResourceType type)
if (type == DIRECTORY_AUTOINDEX) if (type == DIRECTORY_AUTOINDEX)
{ {
Log::debug("Requested path is a directory: " + dirpath); Log::debug("Requested path is a directory: " + dirpath);
response_.addHeader("Content-Type", "text/html");
response_.addHeader("Connection", "close");
response_.setBody(AutoIndex::generate(dirpath, uri_)); response_.setBody(AutoIndex::generate(dirpath, uri_));
response_.setStatus(Http::StatusCode::OK); response_.setStatus(Http::StatusCode::OK);
return; return;