rbb 99/12/21 08:21:44
Modified: src/lib/apr/include apr_time.h src/lib/apr/time/unix timestr.c src/main http_protocol.c Log: Change ap_gm_timestr_822 to ap_timestr. Now, one function can be used to get a timestr for GMT and Localtimes. Revision Changes Path 1.5 +1 -1 apache-2.0/src/lib/apr/include/apr_time.h Index: apr_time.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_time.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- apr_time.h 1999/12/20 16:10:11 1.4 +++ apr_time.h 1999/12/21 16:21:41 1.5 @@ -76,7 +76,7 @@ ap_status_t ap_explode_time(ap_time_t *, ap_timetype_e); ap_status_t ap_implode_time(ap_time_t *); -ap_status_t ap_gm_timestr_822(char **date_str, struct atime_t *t, ap_context_t *p); +ap_status_t ap_timestr(char **date_str, struct atime_t *t, ap_timetype_e type, ap_context_t *p); ap_status_t ap_strftime(char *s, ap_size_t max, const char *format, ap_time_t *tm); /* accessor functions */ 1.2 +8 -8 apache-2.0/src/lib/apr/time/unix/timestr.c Index: timestr.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/time/unix/timestr.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- timestr.c 1999/12/20 16:10:16 1.1 +++ timestr.c 1999/12/21 16:21:43 1.2 @@ -65,7 +65,7 @@ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; -ap_status_t ap_gm_timestr_822(char **date_str, struct atime_t *t, ap_context_t *p) +ap_status_t ap_timestr(char **date_str, struct atime_t *t, ap_timetype_e type, ap_context_t *p) { struct tm *tms; char *date_str_ptr; @@ -74,9 +74,7 @@ (*date_str) = ap_palloc(p, 48 * sizeof(char)); date_str_ptr = (*date_str); - if (t->time_ex == 0) { - ap_explode_time(t, APR_UTCTIME); - } + ap_explode_time(t, type); /* Assumption: this is always 3 */ /* i = strlen(ap_day_snames[tms->tm_wday]); */ @@ -107,10 +105,12 @@ *date_str_ptr++ = ':'; *date_str_ptr++ = t->explodedtime->tm_sec / 10 + '0'; *date_str_ptr++ = t->explodedtime->tm_sec % 10 + '0'; - *date_str_ptr++ = ' '; - *date_str_ptr++ = 'G'; - *date_str_ptr++ = 'M'; - *date_str_ptr++ = 'T'; + if (type == APR_UTCTIME) { + *date_str_ptr++ = ' '; + *date_str_ptr++ = 'G'; + *date_str_ptr++ = 'M'; + *date_str_ptr++ = 'T'; + } *date_str_ptr = '\0'; return APR_SUCCESS; /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ 1.44 +3 -3 apache-2.0/src/main/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- http_protocol.c 1999/12/21 11:33:22 1.43 +++ http_protocol.c 1999/12/21 16:21:44 1.44 @@ -605,7 +605,7 @@ { ap_time_t *mod_time = ap_rationalize_mtime(r, r->mtime); char *datestr; - ap_gm_timestr_822(&datestr, mod_time, r->pool); + ap_timestr(&datestr, mod_time, APR_UTCTIME, r->pool); ap_table_setn(r->headers_out, "Last-Modified", datestr); } @@ -1362,7 +1362,7 @@ ap_rvputs(r, protocol, " ", r->status_line, "\015\012", NULL); - ap_gm_timestr_822(&date, r->request_time, r->pool); + ap_timestr(&date, r->request_time, APR_UTCTIME, r->pool); ap_send_header_field(r, "Date", date); ap_send_header_field(r, "Server", ap_get_server_version()); @@ -1645,7 +1645,7 @@ * some other part of the server configuration. */ if (r->no_cache && !ap_table_get(r->headers_out, "Expires")) { - ap_gm_timestr_822(&date, r->request_time, r->pool); + ap_timestr(&date, r->request_time, APR_UTCTIME, r->pool); ap_table_addn(r->headers_out, "Expires", date); }