- fix occurrence of PHPSTR_LEN(x) = 0;
[m6w6/ext-http] / http_cache_api.c
index dcc833ed9f4ed93e00a66cb50e6fde6c5f6822a1..322c509d2f5a8873a526a1be104f6b7fc8a9768f 100644 (file)
@@ -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 <mike@php.net>               |
-   +----------------------------------------------------------------------+
+    +--------------------------------------------------------------------+
+    | 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 <mike@php.net>            |
+    +--------------------------------------------------------------------+
 */
 
 /* $Id$ */
@@ -163,6 +160,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 +188,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;
        }