header cleanups and fix some warnings
[m6w6/ext-http] / php_http_env_response.c
index e30cab955b9df80016b5d1f2f7a8b54ab1bdafd3..bc30b3c0d1adf50b3e90c4e000f197dd0871dea0 100644 (file)
@@ -6,15 +6,12 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2010, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2011, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
-/* $Id $ */
+#include "php_http_api.h"
 
-#include "php_http.h"
-
-#include <main/SAPI.h>
 #include <ext/date/php_date.h>
 #include <ext/standard/php_string.h>
 
@@ -70,7 +67,7 @@ static zval *get_option(zval *options, const char *name_str, size_t name_len TSR
                val = zend_read_property(Z_OBJCE_P(options), options, name, name_len, 0 TSRMLS_CC);
                efree(name);
        } else {
-               if (SUCCESS == zend_hash_find(Z_ARRVAL_P(options), name_str, name_len + 1, (void *) &valptr)) {
+               if (SUCCESS == zend_symtable_find(Z_ARRVAL_P(options), name_str, name_len + 1, (void *) &valptr)) {
                        val = *valptr;
                } else {
                        val = NULL;
@@ -88,7 +85,7 @@ PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_etag(zva
        char *header, *etag;
        zval *zetag, *zbody = NULL;
 
-       if (    !(header = php_http_env_get_request_header(header_str, header_len TSRMLS_CC))
+       if (    !(header = php_http_env_get_request_header(header_str, header_len, NULL TSRMLS_CC))
        ||              !(zbody = get_option(options, ZEND_STRL("body") TSRMLS_CC))
        ||              !(Z_TYPE_P(zbody) == IS_OBJECT)
        ||              !instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry TSRMLS_CC)
@@ -138,7 +135,7 @@ PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_last_mod
        time_t ums, lm = 0;
        zval *zbody = NULL, *zlm;
 
-       if (    !(header = php_http_env_get_request_header(header_str, header_len TSRMLS_CC))
+       if (    !(header = php_http_env_get_request_header(header_str, header_len, NULL TSRMLS_CC))
        ||              !(zbody = get_option(options, ZEND_STRL("body") TSRMLS_CC))
        ||              !(Z_TYPE_P(zbody) == IS_OBJECT)
        ||              !instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry TSRMLS_CC)
@@ -392,6 +389,7 @@ static STATUS php_http_env_response_send_head(php_http_env_response_t *r)
                                switch (Z_LVAL_P(zdisposition_copy)) {
                                        case PHP_HTTP_CONTENT_DISPOSITION_NONE:
                                                ret = php_http_env_set_response_header_value(0, ZEND_STRL("Content-Disposition"), NULL, 1 TSRMLS_CC);
+                                               break;
                                        case PHP_HTTP_CONTENT_DISPOSITION_INLINE:
                                                tmp = "inline";
                                                break;
@@ -496,6 +494,7 @@ static STATUS php_http_env_response_send_head(php_http_env_response_t *r)
                                if (PHP_HTTP_CACHE_HIT != php_http_env_is_response_cached_by_last_modified(options, ZEND_STRL("If-Modified-Since") TSRMLS_CC)) {
                                        break;
                                }
+                               /*  fallthrough */
 
                        case PHP_HTTP_CACHE_HIT:
                                ret = php_http_env_set_response_code(304 TSRMLS_CC);
@@ -664,6 +663,8 @@ PHP_HTTP_API STATUS php_http_env_response_send(php_http_env_response_t *r)
                                                }
                                                break;
                                        }
+
+                                       break;
                        }
                }
        } else if (zbody) {