From bfec6fffb4acd9673ecf066a0e4f1b4baf2dd831 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 25 Dec 2017 08:37:54 +0300 Subject: Make use of butl url encode() and decode() functions --- web/apache/request.cxx | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'web/apache') 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 // unique_ptr #include #include -#include #include #include #include // 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:: -- cgit v1.1