src: Zero clear http_parser_url struct

This commit is contained in:
Tatsuhiro Tsujikawa 2014-02-27 22:11:31 +09:00
parent 227a48cea1
commit a85455ed0b
3 changed files with 6 additions and 0 deletions

View File

@ -259,6 +259,7 @@ void check_rewrite_location_uri(const std::string& new_uri,
uint16_t upstream_port)
{
http_parser_url u;
memset(&u, 0, sizeof(u));
CU_ASSERT(0 == http_parser_parse_url(uri.c_str(), uri.size(), 0, &u));
CU_ASSERT(new_uri ==
http2::rewrite_location_uri(uri, u, req_host,

View File

@ -769,6 +769,7 @@ struct HttpClient {
int level = 0)
{
http_parser_url u;
memset(&u, 0, sizeof(u));
if(http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) {
return false;
}
@ -917,6 +918,7 @@ void update_html_parser(HttpClient *client, Request *req,
for(auto& p : req->html_parser->get_links()) {
auto uri = strip_fragment(p.first.c_str());
http_parser_url u;
memset(&u, 0, sizeof(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) &&
@ -1183,6 +1185,7 @@ int on_frame_recv_callback2
uri += authority;
uri += path;
http_parser_url u;
memset(&u, 0, sizeof(u));
if(http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) {
nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE,
frame->push_promise.promised_stream_id,
@ -1582,6 +1585,7 @@ int run(char **uris, int n)
requests;
for(int i = 0; i < n; ++i) {
http_parser_url u;
memset(&u, 0, sizeof(u));
auto uri = strip_fragment(uris[i]);
if(http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) == 0 &&
util::has_uri_field(u, UF_SCHEMA)) {

View File

@ -497,6 +497,7 @@ void Downstream::rewrite_norm_location_response_header
return;
}
http_parser_url u;
memset(&u, 0, sizeof(u));
int rv = http_parser_parse_url((*hd).second.c_str(), (*hd).second.size(),
0, &u);
if(rv != 0) {