From 8c799cbd4fb2045a716f1707d4d3fcccb1fabe26 Mon Sep 17 00:00:00 2001 From: Igor Gaponenko Date: Wed, 19 Jul 2023 02:01:57 +0000 Subject: [PATCH] Fixed a bug in qhttp response handler The older version of the code was throwing an exception when creating HTTP headers for file sizes exceeding signed 32-bit representation (~2 GB). --- src/qhttp/Response.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qhttp/Response.cc b/src/qhttp/Response.cc index d8ca71aa5..5a612568a 100644 --- a/src/qhttp/Response.cc +++ b/src/qhttp/Response.cc @@ -175,7 +175,7 @@ std::string Response::_headers() const { headerst << r->first << " " << r->second; auto ilength = headers.find("Content-Length"); - std::size_t length = (ilength == headers.end()) ? 0 : std::stoi(ilength->second); + std::size_t length = (ilength == headers.end()) ? 0 : std::stoull(ilength->second); LOGLS_INFO(_log, logger(_server) << logger(_socket) << headerst.str() << " + " << length << " bytes"); headerst << "\r\n";