ap_time_t *nowtime = NULL;
ap_make_time(&nowtime, r->pool);
- ap_curtime(nowtime);
+ ap_current_time(nowtime);
r->allowed = (1 << M_GET);
if (r->method_number != M_GET)
/* XXX: this is very similar to ap_scan_script_header_err_core...
* are the differences deliberate, or just a result of bit rot?
*/
-static int scan_meta_file(request_rec *r, FILE *f)
+static int scan_meta_file(request_rec *r, ap_file_t *f)
{
char w[MAX_STRING_LEN];
char *l;
ap_table_t *tmp_headers;
tmp_headers = ap_make_table(r->pool, 5);
- while (fgets(w, MAX_STRING_LEN - 1, f) != NULL) {
+ while (ap_fgets(w, MAX_STRING_LEN - 1, f) != APR_SUCCESS) {
/* Delete terminal (CR?)LF */
char *last_slash;
char *real_file;
char *scrap_book;
- FILE *f;
+ ap_file_t *f = NULL;
+ ap_status_t retcode;
cern_meta_dir_config *dconf;
int rv;
request_rec *rr;
}
ap_destroy_sub_req(rr);
- f = ap_pfopen(r->pool, metafilename, "r");
- if (f == NULL) {
+ retcode = ap_open(&f, metafilename, APR_READ | APR_CREATE, APR_OS_DEFAULT, r->pool);
+ if (retcode != APR_SUCCESS) {
if (errno == ENOENT) {
return DECLINED;
}
/* read the headers in */
rv = scan_meta_file(r, f);
- ap_pfclose(r->pool, f);
+ ap_close(f);
return rv;
}
{
expires_dir_config *conf;
char *code;
- time_t base;
+ char *timestr = NULL;
+ ap_int64_t base;
time_t additional;
time_t expires;
+ ap_time_t *finaltime = NULL;
char age[20];
if (ap_is_HTTP_ERROR(r->status)) /* Don't add Expires headers to errors */
/* there's been some discussion and it's possible that
* 'access time' will be stored in request structure
*/
- base = r->request_time;
+ ap_get_curtime(r->request_time, &base);
additional = atoi(&code[1]);
break;
default:
tzset(); /* redundant? called implicitly by localtime, at least
* under FreeBSD
*/
- ap_table_setn(r->headers_out, "Expires", ap_gm_timestr_822(r->pool, expires));
+ ap_make_time(&finaltime, r->pool);
+ ap_set_curtime(finaltime, expires);
+ ap_timestr(×tr, finaltime, APR_UTCTIME, r->pool);
+ ap_table_setn(r->headers_out, "Expires", timestr);
return OK;
}
+
static void register_hooks(void)
{
ap_hook_fixups(add_expires,NULL,NULL,HOOK_MIDDLE);
}
+
module MODULE_VAR_EXPORT expires_module =
{
STANDARD20_MODULE_STUFF,
struct tm *tms;
ap_time_t *when = NULL;
ap_int64_t req_time;
+ char *temp_cookie = NULL;
+ ap_size_t retsize;
ap_make_time(&when, r->pool);
ap_get_curtime(when, &req_time);
- ap_set_curtime(when, req_time + cls->expires);
-
#ifndef MILLENIAL_COOKIES
/*
* Only two-digit date string, so we can't trust "00" or more.
* 1/1/2000 (which is 946684799)
*/
- if (when > 946684799)
- when = 946684799;
+ if (req_time + cls->expires > 946684799) {
+ ap_set_curtime(when, 946684799);
+ }
+ else
#endif
- tms = gmtime(&when);
+ ap_set_curtime(when, req_time + cls->expires);
/* Cookie with date; as strftime '%a, %d-%h-%y %H:%M:%S GMT' */
- new_cookie = ap_psprintf(r->pool,
- "%s=%s; path=/; expires=%s, %.2d-%s-%.2d %.2d:%.2d:%.2d GMT",
- dcfg->cookie_name, cookiebuf, ap_day_snames[tms->tm_wday],
- tms->tm_mday, ap_month_snames[tms->tm_mon],
- tms->tm_year % 100,
- tms->tm_hour, tms->tm_min, tms->tm_sec);
+ ap_strftime(temp_cookie, &retsize, MAX_STRING_LEN, "%a, %d-%h-%y %H:%M:%S GMT", when);
+ new_cookie = ap_psprintf(r->pool, "%s=%s; path=/; expires=%s",
+ dcfg->cookie_name, cookiebuf, temp_cookie);
}
else {
new_cookie = ap_psprintf(r->pool, "%s=%s; path=/",
/* NOP */
}
+ap_array_header_t *ap_get_status_table(ap_context_t *p)
+{
+ /* NOP */
+ return NULL;
+}
+
API_EXPORT(void) ap_reset_connection_status(long conn_id)
{
/* NOP */