src/server/daemon/httprequest.c

changeset 141
ff311b63c3af
parent 138
06619bbd14ef
child 142
55298bc9ed28
equal deleted inserted replaced
140:93247a579184 141:ff311b63c3af
96 // create nsapi data structures 96 // create nsapi data structures
97 NSAPISession *sn = pool_malloc(pool, sizeof(NSAPISession)); 97 NSAPISession *sn = pool_malloc(pool, sizeof(NSAPISession));
98 if(sn == NULL) { 98 if(sn == NULL) {
99 /* TODO: error */ 99 /* TODO: error */
100 } 100 }
101 ZERO(sn, sizeof(NSAPISession));
101 NSAPIRequest *rq = pool_malloc(pool, sizeof(NSAPIRequest)); 102 NSAPIRequest *rq = pool_malloc(pool, sizeof(NSAPIRequest));
102 if(rq == NULL) { 103 if(rq == NULL) {
103 /* TODO: error */ 104 /* TODO: error */
104 } 105 }
106 ZERO(rq, sizeof(NSAPIRequest));
105 rq->rq.req_start = request->req_start; 107 rq->rq.req_start = request->req_start;
106 rq->phase = NSAPIAuthTrans; 108 rq->phase = NSAPIAuthTrans;
107 109
108 // fill session structure 110 // fill session structure
109 sn->connection = request->connection; 111 sn->connection = request->connection;
112 //sn->sn.csd = stream_new_from_fd(pool, request->connection->fd); 114 //sn->sn.csd = stream_new_from_fd(pool, request->connection->fd);
113 //sn->sn.csd = net_stream_from_fd(pool, request->connection->fd); 115 //sn->sn.csd = net_stream_from_fd(pool, request->connection->fd);
114 IOStream *io; 116 IOStream *io;
115 if(request->connection->ssl) { 117 if(request->connection->ssl) {
116 io = sslstream_new(pool, request->connection->ssl); 118 io = sslstream_new(pool, request->connection->ssl);
119 sn->sn.ssl = 1;
117 } else { 120 } else {
118 io = sysstream_new(pool, request->connection->fd); 121 io = sysstream_new(pool, request->connection->fd);
119 } 122 }
120 sn->sn.csd = httpstream_new(pool, io); 123 sn->sn.csd = httpstream_new(pool, io);
121 124
675 httpd_object *obj = objset->obj[i]; 678 httpd_object *obj = objset->obj[i];
676 dtable *dt = object_get_dtable(obj, NSAPIPathCheck); 679 dtable *dt = object_get_dtable(obj, NSAPIPathCheck);
677 680
678 // execute directives 681 // execute directives
679 for(int j=NCX_DI(rq);j<dt->ndir;j++) { 682 for(int j=NCX_DI(rq);j<dt->ndir;j++) {
680 if(ret == REQ_NOACTION || REQ_PROCEED) { 683 if(ret == REQ_NOACTION || ret == REQ_PROCEED) {
681 directive *d = dt->dirs[j]; 684 directive *d = dt->dirs[j];
682 ret = nsapi_exec(d, sn, rq); 685 ret = nsapi_exec(d, sn, rq);
683 } else { 686 } else {
684 if(ret == REQ_PROCESSING) { 687 if(ret == REQ_PROCESSING) {
685 // save nsapi context 688 // save nsapi context

mercurial