aboutsummaryrefslogtreecommitdiff
path: root/web/apache/request.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-12-25 08:37:54 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-12-28 14:42:17 +0300
commitbfec6fffb4acd9673ecf066a0e4f1b4baf2dd831 (patch)
treeca85d9db6ddeeaf1b89c488b9ed629511003566a /web/apache/request.cxx
parent21d9f67600a53af44d0f7365074de5312a829193 (diff)
Make use of butl url encode() and decode() functions
Diffstat (limited to 'web/apache/request.cxx')
-rw-r--r--web/apache/request.cxx27
1 files changed, 16 insertions, 11 deletions
diff --git a/web/apache/request.cxx b/web/apache/request.cxx
index 3393555..51590e3 100644
--- a/web/apache/request.cxx
+++ b/web/apache/request.cxx
@@ -18,7 +18,6 @@
#include <memory> // unique_ptr
#include <string>
#include <cassert>
-#include <sstream>
#include <ostream>
#include <istream>
#include <cstring> // str*(), memcpy(), size_t
@@ -353,7 +352,7 @@ namespace web
{
if (path_.empty ())
{
- path_ = path_type (rec_->uri);
+ path_ = path_type (rec_->uri); // Is already URL-decoded.
// Module request handler can not be called if URI is empty.
//
@@ -514,10 +513,9 @@ namespace web
{
assert (!buffer); // Cookie buffering is not implemented yet.
- ostringstream s;
- mime_url_encode (name, s);
- s << "=";
- mime_url_encode (value, s);
+ string s (mime_url_encode (name));
+ s += "=";
+ s += mime_url_encode (value);
if (max_age)
{
@@ -528,20 +526,27 @@ namespace web
//
char b[100];
strftime (b, sizeof (b), "%a, %d-%b-%Y %H:%M:%S GMT", gmtime (&t));
- s << "; Expires=" << b;
+ s += "; Expires=";
+ s += b;
}
if (path)
- s << ";Path=" << path;
+ {
+ s += ";Path=";
+ s += path;
+ }
if (domain)
- s << ";Domain=" << domain;
+ {
+ s += ";Domain=";
+ s += domain;
+ }
if (secure)
- s << ";Secure";
+ s += ";Secure";
state (request_state::headers);
- apr_table_add (rec_->err_headers_out, "Set-Cookie", s.str ().c_str ());
+ apr_table_add (rec_->err_headers_out, "Set-Cookie", s.c_str ());
}
void request::