diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-03-14 14:38:45 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2016-03-17 12:59:35 +0300 |
commit | 0b6b57f9acaa2ec648bf582ff67851331f8e6eef (patch) | |
tree | 7ce5da6a1c37f3674762d5514b0a34bf05e38df7 /web/module | |
parent | 637d5650b91cb1da2605e5f7049ccc8bab5591f3 (diff) |
Use serializable transaction isolation level
Diffstat (limited to 'web/module')
-rw-r--r-- | web/module | 46 |
1 files changed, 29 insertions, 17 deletions
@@ -111,13 +111,13 @@ namespace web virtual const name_values& cookies () = 0; - // Get the stream to read the request content from. Note that - // reading content after any unbuffered content has been written - // is undefined behavior. The implementation may detect it and - // throw sequence_error but is not required to do so. + // 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. // virtual std::istream& - content () = 0; + content (bool buffer = false) = 0; }; class response @@ -160,10 +160,11 @@ namespace web virtual void cookie (const char* name, const char* value, - const std::chrono::seconds* max_age = 0, - const char* path = 0, - const char* domain = 0, - bool secure = false) = 0; + const std::chrono::seconds* max_age = nullptr, + const char* path = nullptr, + const char* domain = nullptr, + bool secure = false, + bool buffer = true) = 0; }; // A web server logging backend. The module can use it to log @@ -229,15 +230,26 @@ namespace web // Return false if decline to handle the request. If handling have been // declined after any unbuffered content has been written, then the // implementation shall terminate the response in a suitable but - // unspecified manner. Any exception other than invalid_request described - // above that leaves this function is treated by the web server - // implementation as an internal server error (500). Similar to - // invalid_request, it will try to return the status and description - // (obtained by calling what() on std::exception) to the client, if - // possible. The description is assume to be encoded in UTF-8. The - // implementation may provide a configuration option to omit the - // description from the response, for security/privacy reasons. + // unspecified manner. // + // Throw retry if need to retry handling the request. The retry will + // happen on the same instance of the module and the implementation is + // expected to "rewind" the request and response objects to their initial + // state. This is only guaranteed to be possible if the relevant functions + // in the request and response objects were called in buffered mode (the + // buffer argument was true). + // + // Any exception other than retry and invalid_request described above that + // leaves this function is treated by the web server implementation as an + // internal server error (500). Similar to invalid_request, it will try to + // return the status and description (obtained by calling what() on + // std::exception) to the client, if possible. The description is assume + // to be encoded in UTF-8. The implementation may provide a configuration + // option to omit the description from the response, for security/privacy + // reasons. + // + struct retry {}; + virtual bool handle (request&, response&, log&) = 0; }; |