- Fixed build on php-trunk
[m6w6/ext-http] / http_cache_api.c
index 9a6ea89057ea0d122ad68d98b63b958de507f614..4cc07b996da0e6fdb1d984b77bd13bf0b37af623 100644 (file)
@@ -6,7 +6,7 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2006, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2010, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
@@ -45,9 +45,9 @@ PHP_HTTP_API char *_http_etag(const void *data_ptr, size_t data_len, http_send_m
                        return NULL;
                } else {
                        size_t ssb_len;
-                       char ssb_buf[128] = {0};
+                       char ssb_buf[128];
                        
-                       ssb_len = snprintf(ssb_buf, 127, "%ld=%ld=%ld", (long) ssb.sb.st_mtime, 
+                       ssb_len = snprintf(ssb_buf, sizeof(ssb_buf), "%ld=%ld=%ld", (long) ssb.sb.st_mtime, 
                                                                                                                        (long) ssb.sb.st_ino, 
                                                                                                                        (long) ssb.sb.st_size);
                        http_etag_update(ctx, ssb_buf, ssb_len);
@@ -78,14 +78,16 @@ PHP_HTTP_API zend_bool _http_match_last_modified_ex(const char *entry, time_t t,
        zval *zmodified;
        char *modified, *chr_ptr;
 
-       HTTP_GSC(zmodified, entry, !enforce_presence);
+       if (!(zmodified = http_get_server_var(entry, 1))) {
+               return !enforce_presence;
+       }
 
        modified = estrndup(Z_STRVAL_P(zmodified), Z_STRLEN_P(zmodified));
        if ((chr_ptr = strrchr(modified, ';'))) {
                chr_ptr = 0;
        }
        
-       retval = (t <= http_parse_date(modified));
+       retval = (t <= http_parse_date_ex(modified, 1));
        efree(modified);
        return retval;
 }
@@ -98,7 +100,9 @@ PHP_HTTP_API zend_bool _http_match_etag_ex(const char *entry, const char *etag,
        char *quoted_etag;
        zend_bool result;
 
-       HTTP_GSC(zetag, entry, !enforce_presence);
+       if (!(zetag = http_get_server_var_ex(entry, strlen(entry)+1, 1))) {
+               return !enforce_presence;
+       }
 
        if (NULL != strchr(Z_STRVAL_P(zetag), '*')) {
                return 1;