src: Don't process rel=preload again once we found it

This commit is contained in:
Tatsuhiro Tsujikawa 2016-03-04 23:00:33 +09:00
parent 2d6211c455
commit 10ec00126c
1 changed files with 43 additions and 41 deletions

View File

@ -924,6 +924,7 @@ parse_next_link_header_once(const char *first, const char *last) {
// we expect link-param // we expect link-param
if (!ign) { if (!ign) {
if (!ok) {
// rel can take several relations using quoted form. // rel can take several relations using quoted form.
static constexpr char PLP[] = "rel=\""; static constexpr char PLP[] = "rel=\"";
static constexpr size_t PLPLEN = str_size(PLP); static constexpr size_t PLPLEN = str_size(PLP);
@ -958,7 +959,7 @@ parse_next_link_header_once(const char *first, const char *last) {
start = first; start = first;
} }
if (first == last) { if (first == last) {
return {{StringRef{}}, first}; return {{StringRef{}}, last};
} }
assert(*first == '"'); assert(*first == '"');
++first; ++first;
@ -972,6 +973,7 @@ parse_next_link_header_once(const char *first, const char *last) {
} }
return {{StringRef{}}, last}; return {{StringRef{}}, last};
} }
}
// we are only interested in rel=preload parameter. Others are // we are only interested in rel=preload parameter. Others are
// simply skipped. // simply skipped.
static constexpr char PL[] = "rel=preload"; static constexpr char PL[] = "rel=preload";