Commit 25503ad7 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Merge branch 'worenga-fix-get-assets'

parents 91af4ed7 8f513fce
......@@ -1596,16 +1596,29 @@ void update_html_parser(HttpClient *client, Request *req, const uint8_t *data,
auto res_type = p.second;
http_parser_url u{};
if (http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) == 0 &&
util::fieldeq(uri.c_str(), u, req->uri.c_str(), req->u, UF_SCHEMA) &&
util::fieldeq(uri.c_str(), u, req->uri.c_str(), req->u, UF_HOST) &&
util::porteq(uri.c_str(), u, req->uri.c_str(), req->u)) {
// No POST data for assets
auto pri_spec = resolve_dep(res_type);
if (http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) == 0) {
if (client->add_request(uri, nullptr, 0, pri_spec, req->level + 1)) {
const char *host_string = nullptr;
auto found =
std::find_if(std::begin(req->req_nva), std::end(req->req_nva),
[](const Header &nv) {
return ":authority" == nv.name || "host" == nv.name;
});
if (found != std::end(config.headers)) {
host_string = (*found).value.c_str();
}
if (util::fieldeq(uri.c_str(), u, req->uri.c_str(), req->u, UF_SCHEMA) &&
(util::fieldeq(uri.c_str(), u, req->uri.c_str(), req->u, UF_HOST) ||
(host_string != nullptr &&
util::fieldeq(uri.c_str(), u, UF_HOST, host_string))) &&
util::porteq(uri.c_str(), u, req->uri.c_str(), req->u)) {
// No POST data for assets
auto pri_spec = resolve_dep(res_type);
submit_request(client, config.headers, client->reqvec.back().get());
if (client->add_request(uri, nullptr, 0, pri_spec, req->level + 1)) {
submit_request(client, config.headers, client->reqvec.back().get());
}
}
}
}
......
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