src/server/httprequest.c

changeset 12
34aa8001ea53
parent 10
e3ae779232a9
--- a/src/server/httprequest.c	Fri Dec 30 15:19:16 2011 +0100
+++ b/src/server/httprequest.c	Fri Dec 30 17:50:05 2011 +0100
@@ -325,7 +325,6 @@
     for(int i=NCX_DI(rq);i<dt->ndir;i++) {
         directive *d = dt->dirs[i];
 
-        printf("execute [%s]\n", d->func->name);
         ret = d->func->func(d->param, (Session*)sn, (Request*)rq);
 
         /* check for name or ppath */
@@ -458,14 +457,30 @@
     }
 
     int ret = rq->context.last_req_code;
+    char *content_type = NULL;
     for(int i=NCX_OI(rq);i>=0;i--) {
-        httpd_object *obj = objset->obj[i];
+        httpd_object *obj = objset->obj[i];   
         dtable *dt = object_get_dtable(obj, NSAPIService);
 
         // execute directives
         for(int j=0;j<dt->ndir;j++) {
             directive *d = dt->dirs[j];
 
+            /* check type parameter */           
+            char *dtp = pblock_findkeyval(pb_key_type, d->param);
+            if(dtp) {
+                /* type parameter for directive */
+                if(!content_type) {
+                    content_type = pblock_findkeyval(
+                            pb_key_content_type,
+                            rq->rq.srvhdrs);
+                }
+                /* compare types */
+                if(strcmp(dtp, content_type) != 0) {
+                    continue;
+                }
+            }
+
             ret = d->func->func(d->param, (Session*)sn, (Request*)rq);
             if(ret != REQ_NOACTION) {
                 if(ret == REQ_PROCESSING) {

mercurial