mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-18 09:45:28 +00:00
feat(web): upload routes write large bodies to a file
A route registered as an upload route has its headers run through the middleware first, so a request that isn't allowed is answered before any of its body is taken. The body then goes to a file as it arrives, with a size limit, instead of into memory. MultipartFile splits a multipart/form-data body that is in a file into its parts without loading it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,10 @@ struct HTTPContext {
|
||||
std::string originalPath{}; // as sent, for parameters whose case matters (file names)
|
||||
std::string queryString{};
|
||||
std::string body{};
|
||||
// An upload route's body (Web::RegisterUploadRoute): the file it was written to as it arrived, and its size.
|
||||
// `body` is empty then. The handler owns the file from the moment it is called.
|
||||
std::string bodyFile{};
|
||||
uint64_t bodyBytes = 0;
|
||||
|
||||
// Request headers (header name -> value)
|
||||
// Header names are lowercase for case-insensitive lookup
|
||||
|
||||
Reference in New Issue
Block a user