From 6be5bc707876ece1cd09d7c304ba559512ef5257 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 19 Apr 2017 20:48:09 +0300 Subject: Implement request body caching --- web/module | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'web/module') diff --git a/web/module b/web/module index b770d67..1e588a4 100644 --- a/web/module +++ b/web/module @@ -11,6 +11,7 @@ #include #include #include // uint16_t +#include // size_t #include // move() #include // runtime_error @@ -111,13 +112,21 @@ namespace web virtual const name_values& cookies () = 0; - // Get the stream to read the request content from. If the buffer argument - // is false, then reading content after any unbuffered content has been - // written or after a retry is undefined behavior. The implementation may - // detect this and throw sequence_error but is not required to do so. + // Get the stream to read the request content from. If the limit argument + // is zero, then the content limit is left unchanged (unlimited initially). + // Otherwise the requested limit is set, and the invalid_request exception + // with the code 413 (payload too large) will be thrown when the specified + // limit is reached while reading from the stream. If the buffer argument + // is zero, then the buffer size is left unchanged (zero initially). If it + // is impossible to increase the buffer size (because, for example, some + // content is already read unbuffered), then the sequence_error is thrown. + // + // Note that unread input content is discarded when any unbuffered content + // is written, and any attempt to read it will result in the + // sequence_error exception being thrown. // virtual std::istream& - content (bool buffer = false) = 0; + content (size_t limit = 0, size_t buffer = 0) = 0; }; class response -- cgit v1.1