src/server/daemon/httprequest.c

changeset 557
e35829a3a6d8
parent 544
27684460629f
child 558
0e79e17c70e2
equal deleted inserted replaced
556:b036ccad4b49 557:e35829a3a6d8
144 } 144 }
145 return ret; 145 return ret;
146 } 146 }
147 147
148 int nsapi_start_request(HTTPRequest *request, threadpool_t *thrpool, EventHandler *ev, pool_handle_t *pool) { 148 int nsapi_start_request(HTTPRequest *request, threadpool_t *thrpool, EventHandler *ev, pool_handle_t *pool) {
149 log_ereport(LOG_DEBUG, "trace reqid: %016llx nsapi_start_request", (unsigned long long int)request->connection->id);
150
149 // create nsapi data structures 151 // create nsapi data structures
150 NSAPISession *sn = nsapisession_create(pool); 152 NSAPISession *sn = nsapisession_create(pool);
151 if(sn == NULL) { 153 if(sn == NULL) {
152 /* TODO: error */ 154 /* TODO: error */
153 return 1; 155 return 1;
512 /* 514 /*
513 * NSAPI Processing 515 * NSAPI Processing
514 */ 516 */
515 517
516 int nsapi_handle_request(NSAPISession *sn, NSAPIRequest *rq) { 518 int nsapi_handle_request(NSAPISession *sn, NSAPIRequest *rq) {
519 log_ereport(LOG_DEBUG, "trace reqid: %016llx nsapi_handle_request", (unsigned long long int)sn->connection->id);
520
517 int r = REQ_NOACTION; 521 int r = REQ_NOACTION;
518 do { 522 do {
519 switch(rq->phase) { 523 switch(rq->phase) {
520 case NSAPIAuthTrans: { 524 case NSAPIAuthTrans: {
521 r = nsapi_authtrans(sn, rq); 525 r = nsapi_authtrans(sn, rq);
615 619
616 int nsapi_finish_request(NSAPISession *sn, NSAPIRequest *rq) { 620 int nsapi_finish_request(NSAPISession *sn, NSAPIRequest *rq) {
617 rq->finished = TRUE; 621 rq->finished = TRUE;
618 request_free_resources(sn, rq); 622 request_free_resources(sn, rq);
619 623
624 log_ereport(LOG_DEBUG, "trace reqid: %016llx nsapi_finish_request", (unsigned long long int)sn->connection->id);
625
620 WSBool read_stream_eof = httpstream_eof(sn->sn.csd); 626 WSBool read_stream_eof = httpstream_eof(sn->sn.csd);
621 if(!read_stream_eof) { 627 if(!read_stream_eof) {
622 log_ereport(LOG_WARN, "request input stream not closed"); 628 log_ereport(LOG_WARN, "request input stream not closed");
623 // TODO: clean stream 629 // TODO: clean stream
624 rq->rq.rq_attr.keep_alive = 0; // workaround 630 rq->rq.rq_attr.keep_alive = 0; // workaround
659 * keep the connection object 665 * keep the connection object
660 * the sn->config is referenced by the connection, so we don't 666 * the sn->config is referenced by the connection, so we don't
661 * unref it 667 * unref it
662 */ 668 */
663 } else { 669 } else {
670 log_ereport(LOG_DEBUG, "trace reqid: %016llx connection destroyed | keep_alive failed", (unsigned long long int)sn->connection->id);
664 connection_destroy(sn->connection); 671 connection_destroy(sn->connection);
665 } 672 }
666 673
667 // free all memory 674 // free all memory
668 free(sn->netbuf->inbuf); 675 free(sn->netbuf->inbuf);

mercurial