aboutsummaryrefslogtreecommitdiff
path: root/web/apache/request.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-04-19 20:48:09 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-04-19 20:53:18 +0300
commit6be5bc707876ece1cd09d7c304ba559512ef5257 (patch)
tree2287f09e4cc21f3d4e07bc6faf62543921822b2c /web/apache/request.ixx
parent01adb23a543bc4c83ef9570117692261e88f61cd (diff)
Implement request body caching
Diffstat (limited to 'web/apache/request.ixx')
-rw-r--r--web/apache/request.ixx46
1 files changed, 1 insertions, 45 deletions
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 <strings.h> // strncasecmp()
-
-#include <apr_tables.h> // apr_table_*
-
#include <http_protocol.h> // ap_*()
-#include <sstream>
-#include <utility> // move()
+#include <sstream> // 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<std::streambuf> 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_;
- }
}
}