aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/UriUtil.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/util/UriUtil.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/util/UriUtil.cxx b/src/util/UriUtil.cxx
index fdca47c00..62977e91b 100644
--- a/src/util/UriUtil.cxx
+++ b/src/util/UriUtil.cxx
@@ -54,6 +54,23 @@ uri_get_suffix(const char *uri)
return suffix;
}
+const char *
+uri_get_suffix(const char *uri, UriSuffixBuffer &buffer)
+{
+ const char *suffix = uri_get_suffix(uri);
+ if (suffix == nullptr)
+ return nullptr;
+
+ const char *q = strchr(suffix, '?');
+ if (q != nullptr && size_t(q - suffix) < sizeof(buffer.data)) {
+ memcpy(buffer.data, suffix, q - suffix);
+ buffer.data[q - suffix] = 0;
+ suffix = buffer.data;
+ }
+
+ return suffix;
+}
+
static const char *
verify_uri_segment(const char *p)
{