This is an automated email from the ASF dual-hosted git repository. bcall pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 0bba409 MIME: Add string_view based overload for value_get. 0bba409 is described below commit 0bba409e3c88979b3273696fdf9ceb6f6a1e3a51 Author: Alan M. Carroll <a...@apache.org> AuthorDate: Wed Nov 7 12:31:31 2018 -0600 MIME: Add string_view based overload for value_get. --- proxy/hdrs/MIME.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/proxy/hdrs/MIME.h b/proxy/hdrs/MIME.h index d95f147..59431a6 100644 --- a/proxy/hdrs/MIME.h +++ b/proxy/hdrs/MIME.h @@ -24,6 +24,7 @@ #pragma once #include <sys/time.h> +#include <string_view> #include "tscore/ink_assert.h" #include "tscore/ink_apidefs.h" @@ -952,6 +953,7 @@ public: int value_get_index(const char *name, int name_length, const char *value, int value_length) const; const char *value_get(const char *name, int name_length, int *value_length) const; + std::string_view value_get(std::string_view const &name) const; // Convenience overload. int32_t value_get_int(const char *name, int name_length) const; uint32_t value_get_uint(const char *name, int name_length) const; int64_t value_get_int64(const char *name, int name_length) const; @@ -1260,6 +1262,15 @@ MIMEHdr::value_get(const char *name, int name_length, int *value_length_return) return (nullptr); } +inline std::string_view +MIMEHdr::value_get(std::string_view const &name) const +{ + if (MIMEField const *field = field_find(name.data(), name.size()); field) { + return {field->m_ptr_value, field->m_len_value}; + } + return {}; +} + inline int32_t MIMEHdr::value_get_int(const char *name, int name_length) const {