From de39e1c66c2d350effdd5bab4fa9d106597aae7a Mon Sep 17 00:00:00 2001 From: MCJack123 Date: Thu, 20 Jun 2024 22:17:10 -0400 Subject: [PATCH] Fixed artifact build --- .github/workflows/main.yml | 2 +- src/sanjuuni.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d9b78c..a41db59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: - name: Restore vcpkg cache uses: lukka/run-vcpkg@v10 with: - vcpkgGitCommitId: a26fc81350ab139c72dfeae07822ce3db3ca7ebb + vcpkgGitCommitId: 7977f0a771e64e9811d32aa30d9a247e09c39b2e - name: Prepare environment run: | mkdir x64\Release diff --git a/src/sanjuuni.cpp b/src/sanjuuni.cpp index 87d8f13..18d9887 100644 --- a/src/sanjuuni.cpp +++ b/src/sanjuuni.cpp @@ -188,11 +188,13 @@ class HTTPListener: public HTTPRequestHandler { std::string file = "local a='" + request.getHost() + playLua; response.setStatusAndReason(HTTPResponse::HTTP_OK); response.setContentType("text/x-lua"); + response.setContentLength(file.size()); response.send().write(file.c_str(), file.size()); } else if (path == "/info") { std::string file = "{\n \"length\": " + std::to_string(frameStorage.size()) + ",\n \"fps\": " + std::to_string(*fps) + "\n}"; response.setStatusAndReason(HTTPResponse::HTTP_OK); response.setContentType("application/json"); + response.setContentLength(file.size()); response.send().write(file.c_str(), file.size()); } else if (path.substr(0, 7) == "/video/") { int frame; @@ -212,6 +214,7 @@ class HTTPListener: public HTTPRequestHandler { } response.setStatusAndReason(HTTPResponse::HTTP_OK); response.setContentType("text/x-lua"); + response.setContentLength(frameStorage[frame].size()); response.send().write(frameStorage[frame].c_str(), frameStorage[frame].size()); } else if (path.substr(0, 7) == "/audio/") { int frame; @@ -233,7 +236,9 @@ class HTTPListener: public HTTPRequestHandler { } response.setStatusAndReason(HTTPResponse::HTTP_OK); response.setContentType("application/octet-stream"); - response.send().write((char*)(audioStorage + frame * size), frame == audioStorageSize / size ? audioStorageSize % size : size); + size_t sz = frame == audioStorageSize / size ? audioStorageSize % size : size; + response.setContentLength(sz); + response.send().write((char*)(audioStorage + frame * size), sz); } else { response.setStatusAndReason(HTTPResponse::HTTP_NOT_FOUND); response.setContentType("text/plain");