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/apache/request.ixx | 46 +--------------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) (limited to 'web/apache/request.ixx') diff --git a/web/apache/request.ixx b/web/apache/request.ixx index 6dde6ce..4218756 100644 --- a/web/apache/request.ixx +++ b/web/apache/request.ixx @@ -2,14 +2,9 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include // strncasecmp() - -#include // apr_table_* - #include // ap_*() -#include -#include // move() +#include // stringbuf namespace web { @@ -47,44 +42,5 @@ namespace web ? OK : rec_->status; } - - inline const std::string& request:: - form_data () - { - if (!form_data_) - { - form_data_.reset (new std::string ()); - - if (rec_->method_number == M_POST) - { - const char* ct (apr_table_get (rec_->headers_in, "Content-Type")); - - if (ct != nullptr && - strncasecmp ("application/x-www-form-urlencoded", ct, 33) == 0) - { - std::istream& istr (content ()); - - // Do not throw when eofbit is set (end of stream reached), and - // when failbit is set (getline() failed to extract any - // character). - // - istr.exceptions (std::istream::badbit); - std::getline (istr, *form_data_); - - // Make this data the content of the input stream, so it's - // available for the application as well. - // - std::unique_ptr in_buf ( - new std::stringbuf (*form_data_)); - - in_.reset (new std::istream (in_buf.get ())); - in_buf_ = std::move (in_buf); - in_->exceptions (std::istream::failbit | std::istream::badbit); - } - } - } - - return *form_data_; - } } } -- cgit v1.1