aboutsummaryrefslogtreecommitdiff
path: root/web/mime-url-encoding.hxx
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/mime-url-encoding.hxx
parent21d9f67600a53af44d0f7365074de5312a829193 (diff)
Make use of butl url encode() and decode() functions
Diffstat (limited to 'web/mime-url-encoding.hxx')
-rw-r--r--web/mime-url-encoding.hxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/web/mime-url-encoding.hxx b/web/mime-url-encoding.hxx
index d45f4ca..f748738 100644
--- a/web/mime-url-encoding.hxx
+++ b/web/mime-url-encoding.hxx
@@ -6,25 +6,28 @@
#define WEB_MIME_URL_ENCODING_HXX
#include <string>
-#include <iosfwd>
namespace web
{
- // @@ Add the query flag (true by default). If true, then the encoding is
- // applied to the URL query part, and so the plus character is used to
- // encode the space character. Audit use cases afterwards.
+ // URL-encode characters other than unreserved (see RFC3986). If the query
+ // flag is true, then the encoding is applied to the URL query part, and so
+ // convert space characters to plus characters rather than percent-encode
+ // them.
//
- void
- mime_url_encode (const char* v, std::ostream& o);
-
std::string
- mime_url_encode (const char* v);
+ mime_url_encode (const char*, bool query = true);
std::string
- mime_url_encode (const std::string& v);
+ mime_url_encode (const std::string&, bool query = true);
+ // If the query flag is true, then convert plus characters to space
+ // characters (see above). Throw std::invalid_argument if an invalid encoding
+ // sequence is encountered.
+ //
std::string
- mime_url_decode (const char* b, const char* e, bool trim = false);
+ mime_url_decode (const char* b, const char* e,
+ bool trim = false,
+ bool query = true);
}
#endif // WEB_MIME_URL_ENCODING_HXX