Changeset 945

Show
Ignore:
Timestamp:
11/02/07 23:32:59 (1 year ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r944 r945  
     12007-11-02  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * qa/149-Common-PathInfo.py, qa/150-Common-No-PathInfo.py: Added 
     4        two new QA tests to ensure that the latest change works. 
     5 
     6        * cherokee/handler_common.c, cherokee/handler_common.h: Added new 
     7        configuration key "allow_pathinfo". 
     8 
    192007-10-29  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
    210 
  • cherokee/trunk/cherokee/handler_common.c

    r869 r945  
    4747 
    4848#define ENTRIES "handler,common" 
    49  
     49#define DEFAULT_ALLOW_PATHINFO true 
    5050 
    5151ret_t 
     
    6969cherokee_handler_common_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props) 
    7070{ 
    71         ret_t ret; 
     71        ret_t                            ret; 
     72        cherokee_config_node_t          *subconf; 
    7273        cherokee_handler_common_props_t *props; 
    7374 
     
    7879                        MODULE_PROPS_FREE(cherokee_handler_common_props_free)); 
    7980 
    80                 n->props_file    = NULL; 
    81                 n->props_dirlist = NULL; 
     81                n->props_file     = NULL; 
     82                n->props_dirlist  = NULL; 
     83                n->allow_pathinfo = DEFAULT_ALLOW_PATHINFO; 
    8284 
    8385                *_props = MODULE_PROPS(n); 
     
    8688        props = PROP_COMMON(*_props); 
    8789 
     90        /* Parse 'common' parameters 
     91         */ 
     92        ret = cherokee_config_node_get (conf, "allow_pathinfo", &subconf); 
     93        if (ret == ret_ok) { 
     94                props->allow_pathinfo = atoi(subconf->val.buf); 
     95        } 
     96 
     97        /* Parse 'file' parameters 
     98         */ 
    8899        ret = cherokee_handler_file_configure (conf, srv, (cherokee_module_props_t **)&props->props_file); 
    89100        if ((ret != ret_ok) && (ret != ret_deny)) return ret; 
    90101 
     102        /* Parse 'dirlist' parameters 
     103         */ 
    91104        return cherokee_handler_dirlist_configure (conf, srv, (cherokee_module_props_t **)&props->props_dirlist); 
    92105} 
     
    183196                int    begin; 
    184197 
     198                /* If PathInfo is not allowed just return 'Not Found' 
     199                 */ 
     200                if (! PROP_COMMON(props)->allow_pathinfo) { 
     201                        conn->error_code = http_not_found;  
     202                        return ret_error; 
     203                } 
     204 
    185205                /* Maybe it could stat() the file because the request contains 
    186206                 * a PathInfo string at the end.. 
  • cherokee/trunk/cherokee/handler_common.h

    r597 r945  
    3434typedef struct { 
    3535        cherokee_module_props_t           base; 
     36        cherokee_boolean_t                allow_pathinfo; 
    3637        cherokee_handler_file_props_t    *props_file; 
    3738        cherokee_handler_dirlist_props_t *props_dirlist; 
  • cherokee/trunk/qa/Makefile.am

    r852 r945  
    153153146-ContentRange4-NoIO.py \ 
    154154147-ContentRange-Double-NoIO.py \ 
    155 148-ContentRange-Double2-NoIO.py 
     155148-ContentRange-Double2-NoIO.py \ 
     156149-Common-PathInfo.py \ 
     157150-Common-No-PathInfo.py 
    156158 
    157159test: