mirror of
https://github.com/Telecominfraproject/wlan-cloud-analytics.git
synced 2026-01-27 10:22:33 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -483,6 +483,7 @@ namespace OpenWifi {
|
||||
Response->set("Content-Transfer-Encoding", "binary");
|
||||
Response->set("Accept-Ranges", "bytes");
|
||||
}
|
||||
Response->set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
Response->set("Content-Disposition", "attachment; filename=" + Name);
|
||||
Response->set("Accept-Ranges", "bytes");
|
||||
Response->set("Cache-Control", "no-store");
|
||||
@@ -491,7 +492,7 @@ namespace OpenWifi {
|
||||
Response->sendFile(TempAvatar.path(), MT.ContentType);
|
||||
}
|
||||
|
||||
inline void SendFileContent(const std::string &Content, const std::string &Type,
|
||||
inline void SendFileContent(const std::string &Content, [[maybe_unused]] const std::string &Type,
|
||||
const std::string &Name) {
|
||||
Response->setStatus(Poco::Net::HTTPResponse::HTTPStatus::HTTP_OK);
|
||||
SetCommonHeaders();
|
||||
@@ -500,12 +501,13 @@ namespace OpenWifi {
|
||||
Response->set("Content-Transfer-Encoding", "binary");
|
||||
Response->set("Accept-Ranges", "bytes");
|
||||
}
|
||||
Response->set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
Response->set("Content-Disposition", "attachment; filename=" + Name);
|
||||
Response->set("Accept-Ranges", "bytes");
|
||||
Response->set("Cache-Control", "no-store");
|
||||
Response->set("Expires", "Mon, 26 Jul 2027 05:00:00 GMT");
|
||||
Response->setContentLength(Content.size());
|
||||
Response->setContentType(Type);
|
||||
Response->setContentType(MT.ContentType);
|
||||
auto &OutputStream = Response->send();
|
||||
OutputStream << Content;
|
||||
}
|
||||
|
||||
@@ -437,6 +437,15 @@ namespace OpenWifi::Utils {
|
||||
return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "text/css"};
|
||||
if (E == "js")
|
||||
return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "application/javascript"};
|
||||
if (E == "pcap")
|
||||
return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/vnd.tcpdump.pcap"};
|
||||
if (E == "txt")
|
||||
return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "text/plain"};
|
||||
if (E == "tgz")
|
||||
return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/tar+gzip"};
|
||||
if (E == "gz" || E=="gzip")
|
||||
return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/gzip"};
|
||||
|
||||
return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/octet-stream"};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user