Skip to content

Commit

Permalink
reinit the stale headers_in list
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoweibin committed Jul 20, 2011
1 parent 3e2f185 commit fc45338
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion ngx_http_ajp_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,24 @@ ngx_http_ajp_reinit_request(ngx_http_request_t *r)
}


static ngx_list_t *
ngx_list_reinit(ngx_list_t *list)
{
ngx_list_part_t *head;

head = &list->part;

if (head->nelts > 0) {
list->last = head;

head->nelts = 0;
head->next = NULL;
}

return list;
}


static ngx_int_t
ngx_http_ajp_process_header(ngx_http_request_t *r)
{
Expand Down Expand Up @@ -359,11 +377,15 @@ ngx_http_ajp_process_header(ngx_http_request_t *r)
return NGX_OK;
}
else if (rc == AJP_EOVERFLOW) {
a->state = ngx_http_ajp_st_response_recv_headers;

/* reinit the headers_int list, the memory may be stale */
ngx_list_reinit(&u->headers_in.headers);

/*
* It's an uncomplete AJP packet, move back to the header of packet,
* and parse the header again in next call
* */
a->state = ngx_http_ajp_st_response_recv_headers;
return ngx_http_ajp_move_buffer(r, buf, pos, last);
}
else {
Expand Down

0 comments on commit fc45338

Please sign in to comment.