diff -r 49bb6c8ceb2b -r bdec069d2239 src/server/daemon/httprequest.c --- a/src/server/daemon/httprequest.c Tue Jul 09 20:56:01 2013 +0200 +++ b/src/server/daemon/httprequest.c Thu Jul 11 14:21:23 2013 +0200 @@ -58,7 +58,7 @@ int handle_request(HTTPRequest *request, threadpool_t *thrpool) { // handle nsapi request - + // create pool pool_handle_t *pool = pool_create(); @@ -440,8 +440,8 @@ * process this object at a later time */ if(ret == REQ_PROCESSING) { - /* save nsapi context */ - /* add +1 to start next round with next function */ + // save nsapi context + // add +1 to start next round with next function rq->context.dtable_index = i + 1; } @@ -458,13 +458,13 @@ //printf("nsapi_nametrans\n"); httpd_objset *objset = objset_create(sn->sn.pool); rq->rq.os = objset; - /* first object in objconf is the default object TODO: make sure it is */ + // first object in objconf is the default object TODO: make sure it is objset_add_object(sn->sn.pool, objset, objconf->objects[0]); - httpd_object *obj = objset->obj[0]; /* nametrans only in default object */ + httpd_object *obj = objset->obj[0]; // nametrans only in default object dtable *dt = object_get_dtable(obj, NSAPINameTrans); - /* execute directives */ + // execute directives int ret = rq->context.last_req_code; char *name = NULL; char *ppath = NULL; @@ -474,11 +474,11 @@ ret = nsapi_exec(d, sn, rq); } - /* check for name or ppath */ + // check for name or ppath name = pblock_findkeyval(pb_key_name, rq->rq.vars); ppath = pblock_findkeyval(pb_key_ppath, rq->rq.vars); - /* add additional objects to the objset */ + // add additional objects to the objset if(add_objects(objconf, objset, sn, rq, name, ppath) == REQ_ABORTED) { fprintf(stderr, "add_objects failed\n"); return REQ_ABORTED; @@ -490,8 +490,8 @@ * process this object at a later time */ if(ret == REQ_PROCESSING) { - /* save nsapi context */ - /* add +1 to start next round with next function */ + // save nsapi context + // add +1 to start next round with next function rq->context.dtable_index = i + 1; } @@ -499,14 +499,14 @@ } } - /* if no function has set the ppath var, translate it to docroot */ + // if no function has set the ppath var, translate it to docroot if(ret == REQ_NOACTION && ppath == NULL) { sstr_t docroot = rq->vs->document_root; if(docroot.length < 1) { printf("docroot too short\n"); return REQ_ABORTED; /* docroot too short */ } - /* if there is a trailing '/', remove it */ + // if there is a trailing '/', remove it if(docroot.ptr[docroot.length - 1] == '/') { docroot.length--; } @@ -543,17 +543,15 @@ // execute directives for(int j=NCX_DI(rq);jndir;j++) { - if(ret == REQ_NOACTION) { + if(ret == REQ_NOACTION || REQ_PROCEED) { directive *d = dt->dirs[j]; ret = nsapi_exec(d, sn, rq); - } - - if(ret != REQ_NOACTION) { + } else { if(ret == REQ_PROCESSING) { - /* save nsapi context */ + // save nsapi context rq->context.objset_index = i; - /* add +1 to start next round with next function */ + // add +1 to start next round with next function rq->context.dtable_index = j + 1; } @@ -570,7 +568,7 @@ httpd_objset *objset = rq->rq.os; if(NCX_OI(rq) == -1) { - /* object index is undefined -> define correct object index */ + // object index is undefined -> define correct object index NCX_OI(rq) = objset->pos - 1; } @@ -598,10 +596,10 @@ return ret; } case REQ_PROCESSING: { - /* save nsapi context */ + // save nsapi context rq->context.objset_index = i; - /* add +1 to start next round with next function */ + // add +1 to start next round with next function rq->context.dtable_index = j + 1; return ret; } @@ -624,7 +622,7 @@ sstr_t path = sstr(pblock_findkeyval(pb_key_ppath, rq->rq.vars)); sstr_t ct; if(path.ptr[path.length - 1] == '/') { - /* directory */ + // directory ct = sstrn("internal/directory", 18); } else { ct = sstrn("text/plain", 10); @@ -654,22 +652,22 @@ if(ret == REQ_NOACTION) { directive *d = dt->dirs[j]; - /* check type parameter */ + // check type parameter char *dtp = pblock_findkeyval(pb_key_type, d->param); if(dtp) { - /* type parameter for directive */ + // type parameter for directive if(!content_type) { content_type = pblock_findkeyval( pb_key_content_type, rq->rq.srvhdrs); } - /* compare types */ + // compare types if(strcmp(dtp, content_type) != 0) { continue; } } - /* check method parameter */ + // check method parameter char *dmt = pblock_findkeyval(pb_key_method, d->param); if(dmt) { if(!method) { @@ -681,7 +679,7 @@ } } - /* execute the saf */ + // execute the saf ret = nsapi_exec(d, sn, rq); } @@ -693,10 +691,10 @@ */ net_finish(sn->sn.csd); } else if(ret == REQ_PROCESSING) { - /* save nsapi context */ + // save nsapi context rq->context.objset_index = i; - /* add +1 to start next round with next function */ + // add +1 to start next round with next function rq->context.dtable_index = j + 1; } @@ -730,10 +728,10 @@ if(ret != REQ_NOACTION) { if(ret == REQ_PROCESSING) { - /* save nsapi context */ + // save nsapi context rq->context.objset_index = i; - /* add +1 to start next round with next function */ + // add +1 to start next round with next function rq->context.dtable_index = j + 1; }