Changeset 1885

Show
Ignore:
Timestamp:
08/20/08 18:55:59 (3 months ago)
Author:
alo
Message:

--

Files:

Legend:

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

    r1884 r1885  
    112008-08-20  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/virtual_server.c, cherokee/util.c, cherokee/util.h, 
     4        admin/PageEntry.py: Adds support for time extensions in the 
     5        "Expire" sections. For instance, now it allows setting "2h" for 
     6        two hours, or "1w" for one week. 
    27 
    38        * admin/static/js/common.js: Fixes a weird problem with Firedfox. 
  • cherokee/trunk/admin/PageEntry.py

    r1880 r1885  
    1717NOTE_VALIDATOR       = 'Which, if any, will be the authentication method.' 
    1818NOTE_EXPIRATION      = 'Points how long the files should be cached' 
    19 NOTE_EXPIRATION_TIME = 'How long from the object can be cached' 
     19NOTE_EXPIRATION_TIME = "How long from the object can be cached.<br />" + \ 
     20                       "The <b>m</b>, <b>h</b>, <b>d</b> and <b>w</b> suffixes are allowed for minutes, hours, days, and weeks. Eg: 2d." 
    2021 
    2122DATA_VALIDATION = [ 
  • cherokee/trunk/cherokee/util.c

    r1877 r1885  
    642642 
    643643 
     644long 
     645cherokee_eval_formated_time (cherokee_buffer_t *buf) 
     646{ 
     647        char end; 
     648        int  mul = 1; 
     649 
     650        if (unlikely (cherokee_buffer_is_empty (buf))) 
     651                return ret_ok; 
     652         
     653        end = cherokee_buffer_end_char (buf); 
     654        switch (end) { 
     655        case 's': 
     656                mul = 1; 
     657                break; 
     658        case 'm': 
     659                mul = 60; 
     660                break; 
     661        case 'h': 
     662                mul = 60 * 60; 
     663                break; 
     664        case 'd': 
     665                mul = 60 * 60 * 24; 
     666                break; 
     667        case 'w': 
     668                mul = 60 * 60 * 24 * 7; 
     669                break; 
     670        default: 
     671                break; 
     672        } 
     673 
     674        return atol(buf->buf) * mul; 
     675} 
     676 
     677 
    644678 
    645679/* gethostbyname_r () emulation 
  • cherokee/trunk/cherokee/util.h

    r1877 r1885  
    9191size_t  cherokee_strlcat            (char *dst, const char *src, size_t siz); 
    9292int     cherokee_estimate_va_length (char *format, va_list ap); 
     93long    cherokee_eval_formated_time (cherokee_buffer_t *buf);   
    9394ret_t   cherokee_fix_dirpath        (cherokee_buffer_t *buf); 
    9495 
  • cherokee/trunk/cherokee/virtual_server.c

    r1880 r1885  
    469469                } else if (equal_buf_str (&conf->val, "time")) { 
    470470                        entry->expiration = cherokee_expiration_time; 
    471                         ret = cherokee_config_node_read_long (conf, "time", &entry->expiration_time); 
     471                        ret = cherokee_config_node_read (conf, "time", &tmp); 
    472472                        if (ret != ret_ok) { 
    473473                                PRINT_ERROR_S ("Expiration 'time' without a time property\n"); 
    474474                                return ret_error; 
    475475                        } 
     476 
     477                        entry->expiration_time = cherokee_eval_formated_time (tmp); 
    476478                } 
    477479