www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From david sklar <sk...@student.net>
Subject mod_rewrite/1663: mod_rewrite should have the two digit year in a variable
Date Tue, 13 Jan 1998 15:56:01 GMT

>Number:         1663
>Category:       mod_rewrite
>Synopsis:       mod_rewrite should have the two digit year in a variable
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Tue Jan 13 09:10:00 PST 1998
>Last-Modified:
>Originator:     sklar@student.net
>Organization:
apache
>Release:        all
>Environment:
linux, but this is just a minor os-independent feature request
>Description:
it would be nice if mod_rewrite provided a variable that contained the two-digit year
like its variables for other date parts %{TIME_MON}, %{TIME_DAY}, etc..
>How-To-Repeat:
design a site that needs two-digit years in the URL and then find out that
mod_rewrite can't do it. :)
>Fix:
Here is a patch against mod_rewrite.c distributed with apache 1.2.5 that will put the
two digit year into %{TIME_SHORTYEAR} 

--- mod_rewrite.c.orig  Thu Jan  8 13:15:01 1998
+++ mod_rewrite.c       Tue Jan 13 10:54:13 1998
@@ -2660,6 +2660,12 @@
         ap_snprintf(resultbuf, sizeof(resultbuf), "%02d%02d", (tm->tm_year / 10
0) + 19, tm->tm_year % 100);
         result = resultbuf;
     }
+    else if (strcasecmp(var,"TIME_SHORTYEAR") == 0) {
+      tc = time(NULL);
+      tm = localtime(&tc);
+      ap_snprintf(resultbuf, sizeof(resultbuf), "%02d", tm->tm_year % 100);
+      result = resultbuf;
+    }
 #define MKTIMESTR(format, tmfield) \
     tc = time(NULL); \
     tm = localtime(&tc); \
%0
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <apbugs@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]




Mime
View raw message