stability "stable"
[m6w6/ext-http] / http_functions.c
index d915b3f832e2cda66de129102afd397686c9f4b7..f7f73f75afd5b957368ee8951a6df83e96c1f386 100644 (file)
@@ -56,13 +56,13 @@ PHP_FUNCTION(http_date)
 }
 /* }}} */
 
-/* {{{ proto string http_build_url([mixed url[, mixed parts[, int flags = HTTP_URL_REPLACE[, array &new_url]]]])
+/* {{{ proto string http_build_url([mixed url[, mixed parts[, int flags = HTTP_URL_REPLACE|HTTP_URL_FROM_ENV[, array &new_url]]]])
        Build an URL. */
 PHP_FUNCTION(http_build_url)
 {
        char *url_str = NULL;
        size_t url_len = 0;
-       long flags = HTTP_URL_REPLACE;
+       long flags = HTTP_URL_REPLACE|HTTP_URL_FROM_ENV;
        zval *z_old_url = NULL, *z_new_url = NULL, *z_composed_url = NULL;
        php_url *old_url = NULL, *new_url = NULL, *composed_url = NULL;
 
@@ -492,7 +492,7 @@ PHP_FUNCTION(http_redirect)
                }
        }
 
-       URI = http_absolute_url(url);
+       URI = http_absolute_url_ex(url, HTTP_URL_FROM_ENV);
 
        if (query_len) {
                spprintf(&LOC, 0, "Location: %s?%s", URI, query);
@@ -733,15 +733,18 @@ PHP_FUNCTION(http_parse_params)
                RETURN_FALSE;
        }
        
-       params = ecalloc(1, sizeof(zval));
+       MAKE_STD_ZVAL(params);
        array_init(params);
        if (SUCCESS != http_parse_params(param, flags, Z_ARRVAL_P(params))) {
-               zval_dtor(params);
-               FREE_ZVAL(params);
+               zval_ptr_dtor(&params);
                RETURN_FALSE;
        }
+       
        object_init(return_value);
        add_property_zval(return_value, "params", params);
+#ifdef ZEND_ENGINE_2
+       zval_ptr_dtor(&params);
+#endif
 }
 /* }}} */
 
@@ -853,7 +856,7 @@ PHP_FUNCTION(http_persistent_handles_ident)
                zval **bodyonly; \
                 \
                /* check if only the body should be returned */ \
-               if (options && (SUCCESS == zend_hash_find(Z_ARRVAL_P(options), "bodyonly", sizeof("bodyonly"), (void *) &bodyonly)) && zval_is_true(*bodyonly)) { \
+               if (options && (SUCCESS == zend_hash_find(Z_ARRVAL_P(options), "bodyonly", sizeof("bodyonly"), (void *) &bodyonly)) && i_zend_is_true(*bodyonly)) { \
                        http_message *msg = http_message_parse(PHPSTR_VAL(&request.conv.response), PHPSTR_LEN(&request.conv.response)); \
                         \
                        if (msg) { \