void nxd_http_client_proto_start_request(nxd_http_client_proto* hcp, nxweb_http_request* req) { //nxweb_http_request* resp=&hcp->resp; hcp->nxb=nxp_alloc(hcp->nxb_pool); nxb_init(hcp->nxb, NXWEB_CONN_NXB_SIZE); hcp->req=req; if (!req->nxb) req->nxb=hcp->nxb; if (!req->host) req->host=hcp->host; nxe_loop* loop=hcp->data_in.super.loop; hcp->req_headers_ptr=_nxweb_prepare_client_request_headers(req); //nxweb_log_error("REQ: %s", hcp->req_headers_ptr); if (!hcp->req_body_in.pair && req->content && req->content_length>0) { nxd_obuffer_init(&hcp->ob, req->content, req->content_length); nxe_connect_streams(loop, &hcp->ob.data_out, &hcp->req_body_in); } if (hcp->state==HCP_IDLE) hcp->state=HCP_SENDING_HEADERS; nxe_unset_timer(loop, NXWEB_TIMER_KEEP_ALIVE, &hcp->timer_keep_alive); hcp->req_body_sending_started=0; hcp->receiving_100_continue=0; hcp->request_complete=0; hcp->response_body_complete=0; hcp->queued_error_message.l=0; nxe_istream_set_ready(loop, &hcp->data_out); }
void ssi_buffer_init(ssi_buffer* ssib, nxweb_http_server_connection* conn, nxweb_http_request* req) { memset(ssib, 0, sizeof(ssi_buffer)); ssib->req=req; ssib->nxb=nxp_alloc(conn->hsp.nxb_pool); // allocate separate nxb to not interfere with other filters nxb_init(ssib->nxb, NXWEB_CONN_NXB_SIZE); ssib->data_in.super.cls.os_cls=&ssi_buffer_data_in_class; ssib->data_in.ready=1; }