X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_functions.c;h=807b0a527cb94ae2f3bfeff483bf066b6eb08d7c;hb=dd199f9961262ed43fa544240df15a9d6d7d0f08;hp=aa8e51bba11f060ad78be3444ffb602cc0a8e6d6;hpb=4e2ecc5ed84649ce20fd1f11319626e0b1befa0a;p=m6w6%2Fext-http diff --git a/http_functions.c b/http_functions.c index aa8e51b..807b0a5 100644 --- a/http_functions.c +++ b/http_functions.c @@ -781,20 +781,18 @@ PHP_FUNCTION(http_redirect) FREE_ZVAL(params); } - switch (status) - { + switch (status) { case 300: RETVAL_SUCCESS(http_send_status_header(status, LOC)); efree(LOC); return; - break; case HTTP_REDIRECT_PERM: case HTTP_REDIRECT_FOUND: case HTTP_REDIRECT_POST: case HTTP_REDIRECT_PROXY: case HTTP_REDIRECT_TEMP: - break; + break; case 306: default: @@ -807,7 +805,7 @@ PHP_FUNCTION(http_redirect) } else { status = HTTP_REDIRECT_FOUND; } - break; + break; } RETURN_SUCCESS(http_exit_ex(status, LOC, RED, 1)); @@ -1099,16 +1097,21 @@ PHP_FUNCTION(http_parse_params) { char *param; int param_len; + zval *params; if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m, ¶m_len)) { RETURN_FALSE; } - object_init(return_value); - if (SUCCESS != http_parse_params(param, HASH_OF(return_value))) { - zval_dtor(return_value); + params = ecalloc(1, sizeof(zval)); + array_init(params); + if (SUCCESS != http_parse_params(param, Z_ARRVAL_P(params))) { + zval_dtor(params); + FREE_ZVAL(params); RETURN_FALSE; } + object_init(return_value); + add_property_zval(return_value, "params", params); } /* }}} */ @@ -1245,9 +1248,8 @@ PHP_FUNCTION(http_match_request_header) * - cookies: array, list of cookies as associative array * like array("cookie" => "value") * - encodecookies: bool, whether to urlencode the cookies (default: true) - * - resetcookies: bool, wheter to reset the cookies * - cookiestore: string, path to a file where cookies are/will be stored - * - cookiesession: bool, accept (true) or reset (false) sessioncookies + * - cookiesession: bool, don't load session cookies from cookiestore if TRUE * - resume: int, byte offset to start the download from; * if the server supports ranges * - range: array, array of arrays, each containing two integers, @@ -1717,8 +1719,7 @@ PHP_FUNCTION(http_request_body_encode) RETURN_FALSE; } - switch (body.type) - { + switch (body.type) { case HTTP_REQUEST_BODY_CURLPOST: if (CURLE_OK != (rc = Curl_getFormData(&data, body.data, &size))) { http_error_ex(HE_WARNING, HTTP_E_RUNTIME, "Could not encode request body: %s", curl_easy_strerror(rc)); @@ -1749,16 +1750,16 @@ PHP_FUNCTION(http_request_body_encode) } } http_request_body_dtor(&body); - break; + break; case HTTP_REQUEST_BODY_CSTRING: RETVAL_STRINGL(body.data, body.size, 0); - break; + break; default: http_request_body_dtor(&body); RETVAL_FALSE; - break; + break; } } #endif /* HTTP_HAVE_CURL */ @@ -1805,8 +1806,7 @@ PHP_FUNCTION(http_request_method_unregister) RETURN_FALSE; } - switch (Z_TYPE_P(method)) - { + switch (Z_TYPE_P(method)) { case IS_OBJECT: convert_to_string(method); case IS_STRING: @@ -1838,15 +1838,14 @@ PHP_FUNCTION(http_request_method_unregister) */ PHP_FUNCTION(http_request_method_exists) { - IF_RETVAL_USED { + if (return_value_used) { zval *method; if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/", &method)) { RETURN_FALSE; } - switch (Z_TYPE_P(method)) - { + switch (Z_TYPE_P(method)) { case IS_OBJECT: convert_to_string(method); case IS_STRING: @@ -1874,7 +1873,7 @@ PHP_FUNCTION(http_request_method_exists) */ PHP_FUNCTION(http_request_method_name) { - IF_RETVAL_USED { + if (return_value_used) { long method; if ((SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method)) || (method < 0)) {