Ticket #943: lighttpd-mod_expire-weeks.patch

File lighttpd-mod_expire-weeks.patch, 1.4 kB (added by Elan Ruusamäe <glen@…>, 22 months ago)

for 1.4.13

  • lighttpd-1.4.13/src/mod_expire.c

     
    8585        /* 
    8686         * parse 
    8787         * 
    88          * '(access|modification) [plus] {<num> <type>}*' 
     88         * '(access|now|modification) [plus] {<num> <type>}*' 
    8989         * 
    9090         * e.g. 'access 1 years' 
    9191         */ 
     
    101101        if (0 == strncmp(ts, "access ", 7)) { 
    102102                type  = 0; 
    103103                ts   += 7; 
     104        } else if (0 == strncmp(ts, "now ", 4)) { 
     105                type  = 0; 
     106                ts   += 4; 
    104107        } else if (0 == strncmp(ts, "modification ", 13)) { 
    105108                type  = 1; 
    106109                ts   += 13; 
     
    119122                ts   += 5; 
    120123        } 
    121124 
    122         /* the rest is just <number> (years|months|days|hours|minutes|seconds) */ 
     125        /* the rest is just <number> (years|months|weeks|days|hours|minutes|seconds) */ 
    123126        while (1) { 
    124127                char *space, *err; 
    125128                int num; 
     
    151154                        } else if (slen == 6 && 
    152155                                   0 == strncmp(ts, "months", slen)) { 
    153156                                num *= 60 * 60 * 24 * 30; 
     157                        } else if (slen == 5 && 
     158                                   0 == strncmp(ts, "weeks", slen)) { 
     159                                num *= 60 * 60 * 24 * 7; 
    154160                        } else if (slen == 4 && 
    155161                                   0 == strncmp(ts, "days", slen)) { 
    156162                                num *= 60 * 60 * 24; 
     
    177183                                num *= 60 * 60 * 24 * 30 * 12; 
    178184                        } else if (0 == strcmp(ts, "months")) { 
    179185                                num *= 60 * 60 * 24 * 30; 
     186                        } else if (0 == strcmp(ts, "weeks")) { 
     187                                num *= 60 * 60 * 24 * 7; 
    180188                        } else if (0 == strcmp(ts, "days")) { 
    181189                                num *= 60 * 60 * 24; 
    182190                        } else if (0 == strcmp(ts, "hours")) {