X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_cache_api.c;h=963bb7e1d0c1aecac81b10047662715b9407006c;hp=dcc833ed9f4ed93e00a66cb50e6fde6c5f6822a1;hb=92f5e5a5df0bff3d8076c1f5ed73590b40849501;hpb=e103c61ca14d22e9507379810e980075c8323ca3 diff --git a/http_cache_api.c b/http_cache_api.c index dcc833e..963bb7e 100644 --- a/http_cache_api.c +++ b/http_cache_api.c @@ -1,16 +1,13 @@ /* - +----------------------------------------------------------------------+ - | PECL :: http | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, that | - | is bundled with this package in the file LICENSE, and is available | - | through the world-wide-web at http://www.php.net/license/3_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Copyright (c) 2004-2005 Michael Wallner | - +----------------------------------------------------------------------+ + +--------------------------------------------------------------------+ + | PECL :: http | + +--------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met. | + +--------------------------------------------------------------------+ + | Copyright (c) 2004-2005, Michael Wallner | + +--------------------------------------------------------------------+ */ /* $Id$ */ @@ -45,6 +42,14 @@ PHP_MINIT_FUNCTION(http_cache) HTTP_LONG_CONSTANT("HTTP_ETAG_SHA1", HTTP_ETAG_SHA1); HTTP_LONG_CONSTANT("HTTP_ETAG_CRC32", HTTP_ETAG_CRC32); +#ifdef HTTP_HAVE_HASH_EXT + HTTP_LONG_CONSTANT("HTTP_ETAG_SHA256", HTTP_ETAG_SHA256); + HTTP_LONG_CONSTANT("HTTP_ETAG_SHA384", HTTP_ETAG_SHA384); + HTTP_LONG_CONSTANT("HTTP_ETAG_SHA512", HTTP_ETAG_SHA512); + HTTP_LONG_CONSTANT("HTTP_ETAG_RIPEMD128", HTTP_ETAG_RIPEMD128); + HTTP_LONG_CONSTANT("HTTP_ETAG_RIPEMD160", HTTP_ETAG_RIPEMD160); +#endif + #ifdef HTTP_HAVE_MHASH { int l, i, c = mhash_count(); @@ -123,7 +128,7 @@ PHP_HTTP_API zend_bool _http_match_last_modified_ex(const char *entry, time_t t, HTTP_GSC(zmodified, entry, !enforce_presence); modified = estrndup(Z_STRVAL_P(zmodified), Z_STRLEN_P(zmodified)); - if (chr_ptr = strrchr(modified, ';')) { + if ((chr_ptr = strrchr(modified, ';'))) { chr_ptr = 0; } retval = (t <= http_parse_date(modified)); @@ -163,6 +168,10 @@ PHP_HTTP_API STATUS _http_cache_last_modified(time_t last_modified, { char *sent_header = NULL; + if (SG(headers_sent)) { + return FAILURE; + } + if (cc_len && (SUCCESS != http_send_cache_control(cache_control, cc_len))) { return FAILURE; } @@ -187,6 +196,10 @@ PHP_HTTP_API STATUS _http_cache_etag(const char *etag, size_t etag_len, { char *sent_header = NULL; + if (SG(headers_sent)) { + return FAILURE; + } + if (cc_len && (SUCCESS != http_send_cache_control(cache_control, cc_len))) { return FAILURE; }