vere: plugs leak of http response headers
@@ -420,7 +420,6 @@ static void
_http_hgen_send(u3_hgen* gen_u)
{
c3_assert( c3y == gen_u->red );
- c3_assert( 0 == gen_u->nud_u );
u3_hreq* req_u = gen_u->req_u;
h2o_req_t* rec_u = req_u->rec_u;
@@ -434,6 +433,7 @@ _http_hgen_send(u3_hgen* gen_u)
// stash [bod_u] to free later
//
+ _cttp_bods_free(gen_u->nud_u);
gen_u->nud_u = gen_u->bod_u;
gen_u->bod_u = 0;
@@ -483,11 +483,6 @@ _http_hgen_proceed(h2o_generator_t* neg_u, h2o_req_t* rec_u)
gen_u->red = c3y;
- _http_heds_free(gen_u->hed_u);
- gen_u->hed_u = 0;
- _cttp_bods_free(gen_u->nud_u);
- gen_u->nud_u = 0;
-
if ( 0 != gen_u->bod_u || c3y == gen_u->dun ) {
_http_hgen_send(gen_u);
}
@@ -523,6 +518,7 @@ _http_start_respond(u3_hreq* req_u,
"hosed";
u3_hhed* hed_u = _http_heds_from_noun(u3k(headers));
+ u3_hhed* deh_u = hed_u;
c3_i has_len_i = 0;
@@ -530,7 +526,6 @@ _http_start_respond(u3_hreq* req_u,
if ( 0 == strncmp(hed_u->nam_c, "content-length", 14) ) {
has_len_i = 1;
}
-
else {
h2o_add_header_by_str(&rec_u->pool, &rec_u->res.headers,
hed_u->nam_c, hed_u->nam_w, 0, 0,
@@ -548,7 +543,7 @@ _http_start_respond(u3_hreq* req_u,
gen_u->bod_u = ( u3_nul == data ) ?
0 : _cttp_bod_from_octs(u3k(u3t(data)));
gen_u->nud_u = 0;
- gen_u->hed_u = hed_u;
+ gen_u->hed_u = deh_u;
gen_u->req_u = req_u;
// if we don't explicitly set this field, h2o will send with
