From 4dddfd622977f84f0cf41847aec9e728d02bec65 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 20 Oct 2025 22:01:05 +0200 Subject: uri: New module Decode URI encoded string, validating both hex and that encoded data is valid UTF-8. --- src/uri.hh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/uri.hh (limited to 'src/uri.hh') diff --git a/src/uri.hh b/src/uri.hh new file mode 100644 index 0000000..6b92694 --- /dev/null +++ b/src/uri.hh @@ -0,0 +1,17 @@ +#ifndef URI_HH +#define URI_HH + +#include +#include +#include + +namespace uri { + +// If input needs no decoding, input is returned. Otherwise dst +// is modified and returned. If invalid encoding is found, nullopt is returned. +std::optional decode(std::string_view input, + std::string& dst); + +} // namespace uri + +#endif // URI_HH -- cgit v1.2.3-70-g09d2