Changeset 1885
- Timestamp:
- 08/20/08 18:55:59 (3 months ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/admin/PageEntry.py (modified) (1 diff)
- cherokee/trunk/cherokee/util.c (modified) (1 diff)
- cherokee/trunk/cherokee/util.h (modified) (1 diff)
- cherokee/trunk/cherokee/virtual_server.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r1884 r1885 1 1 2008-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. 2 7 3 8 * admin/static/js/common.js: Fixes a weird problem with Firedfox. cherokee/trunk/admin/PageEntry.py
r1880 r1885 17 17 NOTE_VALIDATOR = 'Which, if any, will be the authentication method.' 18 18 NOTE_EXPIRATION = 'Points how long the files should be cached' 19 NOTE_EXPIRATION_TIME = 'How long from the object can be cached' 19 NOTE_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." 20 21 21 22 DATA_VALIDATION = [ cherokee/trunk/cherokee/util.c
r1877 r1885 642 642 643 643 644 long 645 cherokee_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 644 678 645 679 /* gethostbyname_r () emulation cherokee/trunk/cherokee/util.h
r1877 r1885 91 91 size_t cherokee_strlcat (char *dst, const char *src, size_t siz); 92 92 int cherokee_estimate_va_length (char *format, va_list ap); 93 long cherokee_eval_formated_time (cherokee_buffer_t *buf); 93 94 ret_t cherokee_fix_dirpath (cherokee_buffer_t *buf); 94 95 cherokee/trunk/cherokee/virtual_server.c
r1880 r1885 469 469 } else if (equal_buf_str (&conf->val, "time")) { 470 470 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); 472 472 if (ret != ret_ok) { 473 473 PRINT_ERROR_S ("Expiration 'time' without a time property\n"); 474 474 return ret_error; 475 475 } 476 477 entry->expiration_time = cherokee_eval_formated_time (tmp); 476 478 } 477 479