Changeset 4152

Show
Ignore:
Timestamp:
22/01/10 12:28:26 (8 months ago)
Author:
alo
Message:

Adds output language selection to the POST progress report handler.

Location:
cherokee/trunk/cherokee
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • cherokee/trunk/cherokee/dwriter.c

    r4151 r4152  
    446446 
    447447        if (equal_buf_str (buf, "ruby")) { 
    448                 props->lang = dwriter_ruby; 
     448                *lang = dwriter_ruby; 
    449449                return ret_ok; 
    450450        } 
  • cherokee/trunk/cherokee/error_list.py

    r4142 r4152  
    260260 
    261261 
     262# cherokee/handler_post_report.c 
     263# 
     264e('HANDLER_POST_REPORT_LANG', 
     265  title = "Unrecognized language '%s'", 
     266  desc  = "Cherokee's POST status reporter supports a number of output languages and formats, including: JSON, Python, PHP and Ruby.") 
     267 
     268 
    262269# cherokee/handler_dbslayer.c 
    263270# 
  • cherokee/trunk/cherokee/handler_post_report.c

    r4149 r4152  
    5050                                        cherokee_module_props_t **_props) 
    5151{ 
     52        ret_t                                 ret; 
    5253        cherokee_list_t                      *i; 
    5354        cherokee_handler_post_report_props_t *props; 
     
    6061                cherokee_module_props_init_base (MODULE_PROPS(n), 
    6162                                                 MODULE_PROPS_FREE(props_free)); 
    62  
     63                n->lang = dwriter_json; 
    6364                *_props = MODULE_PROPS(n); 
    6465        } 
     
    6869        cherokee_config_node_foreach (i, conf) { 
    6970                cherokee_config_node_t *subconf = CONFIG_NODE(i); 
    70                 UNUSED (subconf); 
     71 
     72                ret = cherokee_dwriter_lang_to_type (&subconf->val, &props->lang); 
     73                if (ret != ret_ok) { 
     74                        LOG_CRITICAL (CHEROKEE_ERROR_HANDLER_POST_REPORT_LANG, subconf->val.buf); 
     75                        return ret_error; 
     76                } 
    7177        } 
    7278 
     
    108114 
    109115        n->writer.pretty = true; 
    110         n->writer.lang   = dwriter_json; 
     116        n->writer.lang   = PROP_POST_REPORT(props)->lang; 
    111117 
    112118        cherokee_dwriter_set_buffer (&n->writer, &n->buffer); 
  • cherokee/trunk/cherokee/handler_post_report.h

    r4147 r4152  
    3838typedef struct { 
    3939        cherokee_module_props_t  base; 
     40        cherokee_dwriter_lang_t  lang; 
    4041} cherokee_handler_post_report_props_t; 
    4142