MCPcopy Create free account
hub / github.com/apache/trafficserver / value_get_index

Method value_get_index

src/proxy/hdrs/MIME.cc:1799–1827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1797}
1798
1799int
1800MIMEField::value_get_index(const char *value, int length) const
1801{
1802 int retval = -1;
1803
1804 // if field doesn't support commas and there is just one instance, just compare the value
1805 if (!this->supports_commas() && !this->has_dups()) {
1806 if (this->m_len_value == static_cast<uint32_t>(length) && strncasecmp(value, this->m_ptr_value, length) == 0) {
1807 retval = 0;
1808 }
1809 } else {
1810 HdrCsvIter iter;
1811 int tok_len;
1812 int index = 0;
1813 const char *tok = iter.get_first(this, &tok_len);
1814
1815 while (tok) {
1816 if (tok_len == length && strncasecmp(tok, value, length) == 0) {
1817 retval = index;
1818 break;
1819 } else {
1820 index++;
1821 }
1822 tok = iter.get_next(&tok_len);
1823 }
1824 }
1825
1826 return retval;
1827}
1828
1829std::string_view
1830MIMEField::value_get() const

Callers 1

test_Hdrs.ccFile · 0.45

Calls 4

supports_commasMethod · 0.95
has_dupsMethod · 0.95
get_firstMethod · 0.80
get_nextMethod · 0.80

Tested by

no test coverage detected