Enable SSL support in HttpServer

This commit is contained in:
Alex Hultman
2018-09-30 23:13:05 +02:00
parent ecfeffed7b
commit b89699607a
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -24,7 +24,8 @@ struct AsyncFileStreamer {
}
}
void streamFile(uWS::HttpResponse<false> *res, std::string_view url) {
template <bool SSL>
void streamFile(uWS::HttpResponse<SSL> *res, std::string_view url) {
auto it = asyncFileReaders.find(url);
if (it == asyncFileReaders.end()) {
std::cout << "Did not find file: " << url << std::endl;
@@ -33,7 +34,8 @@ struct AsyncFileStreamer {
}
}
static void streamFile(uWS::HttpResponse<false> *res, AsyncFileReader *asyncFileReader) {
template <bool SSL>
static void streamFile(uWS::HttpResponse<SSL> *res, AsyncFileReader *asyncFileReader) {
/* Peek from cache */
std::string_view chunk = asyncFileReader->peek(res->getWriteOffset());
if (!chunk.length() || res->tryEnd(chunk, asyncFileReader->getFileSize())) {