- don't destruct the zval right after construction in http_message_tostruct_recursive()
[m6w6/ext-http] / http_headers_api.c
index 4f255fe206a2aa656b0190d6f5b23ba06dbd6331..52f2bb8e15cd51a19cd55059d26509c4373f8fc9 100644 (file)
@@ -37,6 +37,18 @@ ZEND_EXTERN_MODULE_GLOBALS(http);
 #      define HTTP_DBG_NEG 0
 #endif
 
+/* {{{ */
+PHP_MINIT_FUNCTION(http_headers)
+{
+       HTTP_LONG_CONSTANT("HTTP_REDIRECT", HTTP_REDIRECT);
+       HTTP_LONG_CONSTANT("HTTP_REDIRECT_PERM", HTTP_REDIRECT_PERM);
+       HTTP_LONG_CONSTANT("HTTP_REDIRECT_POST", HTTP_REDIRECT_POST);
+       HTTP_LONG_CONSTANT("HTTP_REDIRECT_TEMP", HTTP_REDIRECT_TEMP);
+       
+       return SUCCESS;
+}
+/* }}} */
+
 /* {{{ static int http_sort_q(const void *, const void *) */
 static int http_sort_q(const void *a, const void *b TSRMLS_DC)
 {
@@ -81,7 +93,7 @@ char *_http_negotiate_language_func(const char *test, double *quality, HashTable
                        if (    (!strncasecmp(Z_STRVAL_PP(value), test, len)) &&
                                        (       (Z_STRVAL_PP(value)[len] == '\0') || 
                                                (Z_STRVAL_PP(value)[len] == '-'))) {
-                               *quality /= 2;
+                               *quality *= .9;
                                return Z_STRVAL_PP(value);
                        }
                }
@@ -91,8 +103,8 @@ char *_http_negotiate_language_func(const char *test, double *quality, HashTable
 }
 /* }}} */
 
-/* {{{ char *http_negotiate_charset_func */
-char *_http_negotiate_charset_func(const char *test, double *quality, HashTable *supported TSRMLS_DC)
+/* {{{ char *http_negotiate_default_func */
+char *_http_negotiate_default_func(const char *test, double *quality, HashTable *supported TSRMLS_DC)
 {
        zval **value;
        
@@ -154,7 +166,7 @@ PHP_HTTP_API HashTable *_http_negotiate_q(const char *header, HashTable *support
                                        
                                        while (*++ptr && !isdigit(*ptr));
                                        
-                                       quality = strtod(ptr, NULL);
+                                       quality = atof(ptr);
                                        identifier = estrndup(Z_STRVAL_PP(entry), separator - Z_STRVAL_PP(entry));
                                } else {
                                        quality = 1000.0 - i++;
@@ -331,9 +343,7 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header
        size_t header_len;
        zval array;
 
-       INIT_PZVAL(&array);
-       Z_TYPE_P(array) = IS_ARRAY;
-       Z_ARRVAL(array) = headers;
+       INIT_ZARR(array, headers);
        
        if (body) {
                header_len = body - header;