Some HTTP client fixes.

This commit is contained in:
C. Guy Yarvin 2014-03-03 11:51:35 -08:00
parent 3400b6bacb
commit dd4a42b345
3 changed files with 26 additions and 19 deletions

View File

@ -71,7 +71,8 @@
u2_bean liv; // keepalive
u2_bean end; // all responses added
u2_hhed* hed_u; // headers
u2_hbod* bod_u; // body parts
u2_hbod* bod_u; // body parts (exit)
u2_hbod* dob_u; // body parts (entry)
struct _u2_hreq* nex_u; // next in request queue
u2_hbod* rub_u; // exit of write queue
u2_hbod* bur_u; // entry of write queue
@ -118,7 +119,8 @@
void* par_u; // struct http_parser *
c3_w sas_w; // status code
u2_hhed* hed_u; // headers
u2_hbod* bod_u; // body parts
u2_hbod* bod_u; // exit of body queue
u2_hbod* dob_u; // entry of body queue
} u2_cres;
/* u2_creq: outgoing http request.

View File

@ -585,18 +585,20 @@ _cttp_headers_complete(http_parser* par_u)
static c3_i
_cttp_body(http_parser* par_u, const c3_c* buf_c, size_t siz_i)
{
{
u2_creq* ceq_u = par_u->data;
u2_cres* res_u = ceq_u->res_u;
u2_hbod* bod_u;
u2_creq* ceq_u = par_u->data;
u2_cres* res_u = ceq_u->res_u;
u2_hbod* bod_u;
bod_u = _cttp_bod(siz_i, (const c3_y*)buf_c);
bod_u = _cttp_bod(siz_i, (const c3_y*)buf_c);
bod_u->nex_u = res_u->bod_u;
res_u->bod_u = bod_u;
return 0;
if ( !(res_u->bod_u) ) {
res_u->bod_u = res_u->dob_u = bod_u;
}
else {
res_u->dob_u->nex_u = bod_u;
res_u->dob_u = bod_u;
}
return 0;
}
/* _cttp_message_complete(): jhttp callback

View File

@ -434,17 +434,20 @@ _http_headers_complete(http_parser* par_u)
static c3_i
_http_body(http_parser* par_u, const c3_c* buf_c, size_t siz_i)
{
{
u2_hreq *req_u = par_u->data;
u2_hbod* bod_u;
u2_hreq *req_u = par_u->data;
u2_hbod* bod_u;
bod_u = _http_bod(siz_i, (const c3_y*)buf_c);
bod_u = _http_bod(siz_i, (const c3_y*)buf_c);
bod_u->nex_u = req_u->bod_u;
req_u->bod_u = bod_u;
return 0;
if ( !(req_u->bod_u) ) {
req_u->bod_u = req_u->dob_u = bod_u;
}
else {
req_u->dob_u->nex_u = bod_u;
req_u->dob_u = bod_u;
}
return 0;
}
/* _http_message_complete(): jhttp callback