Skip to content

Commit

Permalink
Fixed a bug in qhttp response handler
Browse files Browse the repository at this point in the history
The older version of the code was throwing an exception when creating
HTTP headers for file sizes exceeding signed 32-bit representation (~2 GB).
  • Loading branch information
iagaponenko committed Jul 19, 2023
1 parent 5e5c5d1 commit 8c799cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/qhttp/Response.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 8c799cb

Please sign in to comment.