diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-03-18 22:17:49 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-03-27 17:28:44 +0300 |
commit | 35359f038f571dc46de3d14af72a2bc911fb0a24 (patch) | |
tree | de3e89d678e78b9efc4d395274fd7ccc68f4a213 /web/mime-url-encoding.cxx | |
parent | 8ad672cc7211952716ffe1fbf76c179b4f1149e3 (diff) |
Implement brep-monitor
Diffstat (limited to 'web/mime-url-encoding.cxx')
-rw-r--r-- | web/mime-url-encoding.cxx | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/web/mime-url-encoding.cxx b/web/mime-url-encoding.cxx deleted file mode 100644 index e202f08..0000000 --- a/web/mime-url-encoding.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// file : web/mime-url-encoding.cxx -*- C++ -*- -// license : MIT; see accompanying LICENSE file - -#include <web/mime-url-encoding.hxx> - -#include <string> -#include <iterator> // back_inserter - -#include <libbutl/url.mxx> - -using namespace std; -using namespace butl; - -namespace web -{ - inline static bool - encode_query (char& c) - { - if (c == ' ') - { - c = '+'; - return false; - } - - return !url::unreserved (c); - } - - string - mime_url_encode (const char* v, bool query) - { - return query ? url::encode (v, encode_query) : url::encode (v); - } - - string - mime_url_encode (const string& v, bool query) - { - return query ? url::encode (v, encode_query) : url::encode (v); - } - - string - mime_url_decode (const char* b, const char* e, bool trim, bool query) - { - if (trim) - { - for (; b != e && *b == ' '; ++b) ; - - if (b == e) - return string (); - - while (*--e == ' '); - ++e; - } - - string r; - if (!query) - url::decode (b, e, back_inserter (r)); - else - url::decode (b, e, back_inserter (r), - [] (char& c) - { - if (c == '+') - c = ' '; - }); - return r; - } -} |