src/server/daemon/httprequest.c

changeset 22
adb0bda54e6b
parent 21
627b09ee74e4
child 23
a2c8fc23c90e
equal deleted inserted replaced
21:627b09ee74e4 22:adb0bda54e6b
281 int r = REQ_NOACTION; 281 int r = REQ_NOACTION;
282 282
283 do { 283 do {
284 switch(rq->phase) { 284 switch(rq->phase) {
285 case NSAPIAuthTrans: { 285 case NSAPIAuthTrans: {
286 r = nsapi_authtrans(sn, rq);
287 if(r != REQ_PROCEED) {
288 break;
289 }
286 rq->phase++; 290 rq->phase++;
287 nsapi_context_next_stage(&rq->context); 291 nsapi_context_next_stage(&rq->context);
288 } 292 }
289 case NSAPINameTrans: { 293 case NSAPINameTrans: {
290 //printf(">>> NameTrans\n"); 294 //printf(">>> NameTrans\n");
337 int nsapi_finish_request(NSAPISession *sn, NSAPIRequest *rq) { 341 int nsapi_finish_request(NSAPISession *sn, NSAPIRequest *rq) {
338 // TODO: free memory 342 // TODO: free memory
339 close(sn->sys_fd); 343 close(sn->sys_fd);
340 344
341 return 0; 345 return 0;
346 }
347
348 int nsapi_authtrans(NSAPISession *sn, NSAPIRequest *rq) {
349 HTTPObjectConfig *objconf = rq->vs->objects;
350 httpd_object *obj = objconf->objects[0];
351 dtable *dt = object_get_dtable(obj, NSAPIAuthTrans);
352
353 int ret = rq->context.last_req_code;
354 for(int i=NCX_DI(rq);i<dt->ndir;i++) {
355 directive *d = dt->dirs[i];
356
357 ret = d->func->func(d->param, (Session*)sn, (Request*)rq);
358 if(ret != REQ_NOACTION) {
359 /*
360 * if a saf is still processing, we need to save the context, to
361 * process this object at a later time
362 */
363 if(ret == REQ_PROCESSING) {
364 /* save nsapi context */
365 /* add +1 to start next round with next function */
366 rq->context.dtable_index = i + 1;
367 }
368
369 return ret;
370 }
371 }
372
373
374 return REQ_PROCEED;
342 } 375 }
343 376
344 int nsapi_nametrans(NSAPISession *sn, NSAPIRequest *rq) { 377 int nsapi_nametrans(NSAPISession *sn, NSAPIRequest *rq) {
345 HTTPObjectConfig *objconf = rq->vs->objects; 378 HTTPObjectConfig *objconf = rq->vs->objects;
346 //printf("nsapi_nametrans\n"); 379 //printf("nsapi_nametrans\n");

mercurial