X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_request_body_api.c;h=816e9c26abe778e3ea4352388cad4a545f87bb7f;hp=401e0ac453500c15d9b5a34d616224c2632263c9;hb=dbc4ec02cd319000b5c8589910047cfe6d5738be;hpb=43923eca4429ed3ce5fb85407345d7030a1879f1 diff --git a/http_request_body_api.c b/http_request_body_api.c index 401e0ac..816e9c2 100644 --- a/http_request_body_api.c +++ b/http_request_body_api.c @@ -6,16 +6,12 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2005, Michael Wallner | + | Copyright (c) 2004-2006, Michael Wallner | +--------------------------------------------------------------------+ */ /* $Id$ */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #define HTTP_WANT_CURL #include "php_http.h" @@ -34,6 +30,7 @@ PHP_HTTP_API http_request_body *_http_request_body_init_ex(http_request_body *bo body->type = type; body->free = free; + body->priv = 0; body->data = data; body->size = size; @@ -88,9 +85,9 @@ PHP_HTTP_API http_request_body *_http_request_body_fill(http_request_body *body, if (Z_TYPE_PP(data) != IS_ARRAY) { http_error(HE_NOTICE, HTTP_E_INVALID_PARAM, "Unrecognized type of post file array entry"); - } else if ( SUCCESS != zend_hash_find(Z_ARRVAL_PP(data), "name", sizeof("name"), (void **) &name) || - SUCCESS != zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &type) || - SUCCESS != zend_hash_find(Z_ARRVAL_PP(data), "file", sizeof("file"), (void **) &file)) { + } else if ( SUCCESS != zend_hash_find(Z_ARRVAL_PP(data), "name", sizeof("name"), (void *) &name) || + SUCCESS != zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void *) &type) || + SUCCESS != zend_hash_find(Z_ARRVAL_PP(data), "file", sizeof("file"), (void *) &file)) { http_error(HE_NOTICE, HTTP_E_INVALID_PARAM, "Post file array entry misses either 'name', 'type' or 'file' entry"); } else { CURLcode err; @@ -152,21 +149,20 @@ PHP_HTTP_API void _http_request_body_dtor(http_request_body *body TSRMLS_DC) { if (body) { if (body->free) { - switch (body->type) - { + switch (body->type) { case HTTP_REQUEST_BODY_CSTRING: if (body->data) { efree(body->data); } - break; + break; case HTTP_REQUEST_BODY_CURLPOST: curl_formfree(body->data); - break; + break; case HTTP_REQUEST_BODY_UPLOADFILE: php_stream_close(body->data); - break; + break; } } memset(body, 0, sizeof(http_request_body));