Commit ad8be7d4 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

src: parse_link_header takes StringRef

parent 07926cff
......@@ -1171,12 +1171,10 @@ almost_done:
}
} // namespace
std::vector<LinkHeader> parse_link_header(const char *src, size_t len) {
auto first = src;
auto last = src + len;
std::vector<LinkHeader> parse_link_header(const StringRef &src) {
std::vector<LinkHeader> res;
for (; first != last;) {
auto rv = parse_next_link_header_once(first, last);
for (auto first = std::begin(src); first != std::end(src);) {
auto rv = parse_next_link_header_once(first, std::end(src));
first = rv.second;
auto &link = rv.first;
if (!link.uri.empty()) {
......
......@@ -322,11 +322,11 @@ struct LinkHeader {
StringRef uri;
};
// Returns next URI-reference in Link header field value |src| of
// length |len|. If no URI-reference found after searching all input,
// returned uri field is empty. This imply that empty URI-reference
// is ignored during parsing.
std::vector<LinkHeader> parse_link_header(const char *src, size_t len);
// Returns next URI-reference in Link header field value |src|. If no
// URI-reference found after searching all input, returned uri field
// is empty. This imply that empty URI-reference is ignored during
// parsing.
std::vector<LinkHeader> parse_link_header(const StringRef &src);
// Constructs path by combining base path |base_path| with another
// path |rel_path|. The base path and another path can have optional
......
This diff is collapsed.
......@@ -1782,9 +1782,7 @@ int Http2Upstream::prepare_push_promise(Downstream *downstream) {
if (kv.token != http2::HD_LINK) {
continue;
}
for (auto &link :
http2::parse_link_header(kv.value.c_str(), kv.value.size())) {
for (auto &link : http2::parse_link_header(kv.value)) {
StringRef scheme, authority, path;
rv = http2::construct_push_component(balloc, scheme, authority, path,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment