Skip to content

Commit

Permalink
support http static css files
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoegel committed Aug 22, 2024
1 parent 8e04eec commit 46110eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions http/fwoop_httpclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ std::error_code HttpClient::makeReqest(const HttpRequest &request, std::shared_p
Log::Error("hostname ", d_host, " not found");
return std::error_code(static_cast<int>(HttpErrc::HostNotFound), HttpClientError);
}
Log::Debug("connecting to IP: ", record->IP());
if (inet_pton(AF_INET, record->IP().c_str(), &serv_addr.sin_addr) <= 0) {
Log::Error("invalid address or address not supported");
reset();
Expand Down
2 changes: 2 additions & 0 deletions http/fwoop_httpresponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ void HttpResponse::streamFile(const std::string &fileName)
auto ext = FileReader::getExtension(d_fileName);
if (ext == "html") {
d_headers.push_back({HttpHeader::ContentType, "text/html"});
} else if (ext == "css") {
d_headers.push_back({HttpHeader::ContentType, "text/css"});
} else {
d_headers.push_back({HttpHeader::ContentType, "text/plain"});
}
Expand Down

0 comments on commit 46110eb

Please sign in to comment.