From 5dca59e3a269c903b395d97abe831c0fc138b5b6 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 22 Sep 2005 11:48:22 +0000 Subject: [PATCH] - add first version of package2.xml - define PHPSTR_DEFAULT_SIZE in the header - some minor tidbits --- http_request_api.c | 14 +-- http_response_object.c | 2 + missing.c | 3 +- package2.xml | 214 +++++++++++++++++++++++++++++++++++++++++ phpstr/phpstr.c | 4 - phpstr/phpstr.h | 4 + 6 files changed, 229 insertions(+), 12 deletions(-) create mode 100644 package2.xml diff --git a/http_request_api.c b/http_request_api.c index 8b195f8..d9b1a21 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -275,12 +275,14 @@ PHP_HTTP_API STATUS _http_request_body_fill(http_request_body *body, HashTable * /* file data */ FOREACH_HASH_VAL(files, data) { - CURLcode err; zval **file, **type, **name; - 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)) { - err = curl_formadd(&http_post_data[0], &http_post_data[1], + + 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 = curl_formadd(&http_post_data[0], &http_post_data[1], CURLFORM_COPYNAME, Z_STRVAL_PP(name), CURLFORM_FILE, Z_STRVAL_PP(file), CURLFORM_CONTENTTYPE, Z_STRVAL_PP(type), @@ -291,8 +293,6 @@ PHP_HTTP_API STATUS _http_request_body_fill(http_request_body *body, HashTable * curl_formfree(http_post_data[0]); return FAILURE; } - } else { - http_error(HE_NOTICE, HTTP_E_INVALID_PARAM, "Post file array entry misses either 'name', 'type' or 'file' entry"); } } diff --git a/http_response_object.c b/http_response_object.c index c0c66af..2307198 100644 --- a/http_response_object.c +++ b/http_response_object.c @@ -545,6 +545,8 @@ PHP_METHOD(HttpResponse, guessContentType) } } SET_EH_NORMAL(); +#else + http_error(HE_THROW, HTTP_E_RUNTIME, "Cannot guess Content-Type; libmagic not available"); #endif } /* }}} */ diff --git a/missing.c b/missing.c index 9d9b941..584a75c 100644 --- a/missing.c +++ b/missing.c @@ -43,7 +43,8 @@ int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length } void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC) -{ zval *tmp = ecalloc(1, sizeof(zval)); +{ + zval *tmp = ecalloc(1, sizeof(zval)); ZVAL_BOOL(tmp, value); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } diff --git a/package2.xml b/package2.xml new file mode 100644 index 0000000..9972ba9 --- /dev/null +++ b/package2.xml @@ -0,0 +1,214 @@ + + + http + pecl.php.net + Extended HTTP Support + + + Michael Wallner + mike + mike@php.net + yes + + 2005-00-00 + + 0.14.0dev + 0.14.0 + + + beta + beta + + PHP License + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4.3 + 6.0.0 + 6.0.0 + + + 1.4.0 + + + + + session + + + + http + + + + + + + + \ No newline at end of file diff --git a/phpstr/phpstr.c b/phpstr/phpstr.c index acee06f..70673a9 100644 --- a/phpstr/phpstr.c +++ b/phpstr/phpstr.c @@ -4,10 +4,6 @@ #include "php.h" #include "phpstr.h" -#ifndef PHPSTR_DEFAULT_SIZE -#define PHPSTR_DEFAULT_SIZE 256 -#endif - PHPSTR_API phpstr *phpstr_init_ex(phpstr *buf, size_t chunk_size, zend_bool pre_alloc) { if (!buf) { diff --git a/phpstr/phpstr.h b/phpstr/phpstr.h index a36f88a..5b2ee56 100644 --- a/phpstr/phpstr.h +++ b/phpstr/phpstr.h @@ -6,6 +6,10 @@ #include "php.h" +#ifndef PHPSTR_DEFAULT_SIZE +# define PHPSTR_DEFAULT_SIZE 256 +#endif + #ifndef STR_SET # define STR_SET(STR, SET) \ { \ -- 2.30.2