diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-10-20 22:01:05 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-10-21 23:15:29 +0200 |
| commit | 4dddfd622977f84f0cf41847aec9e728d02bec65 (patch) | |
| tree | 27bc4ceca8cd18bd3583107b2213368134b931f5 /src/uri.hh | |
| parent | e8dc8edad7cdf194091f0479b70b154e872f57ef (diff) | |
uri: New module
Decode URI encoded string, validating both hex and that encoded
data is valid UTF-8.
Diffstat (limited to 'src/uri.hh')
| -rw-r--r-- | src/uri.hh | 17 |
1 files changed, 17 insertions, 0 deletions
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 <optional> +#include <string> +#include <string_view> + +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<std::string_view> decode(std::string_view input, + std::string& dst); + +} // namespace uri + +#endif // URI_HH |
