X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_request_body_api.c;h=88732a1dada1589551f55eca5913dd6200791478;hp=a57702379425374db517eb22126c3f5cacfad688;hb=59a1d06f1498dd2aab19316b7f5405d76b4170e7;hpb=2655b1c8838edb32ef8ac67376f123e8d613a9af diff --git a/http_request_body_api.c b/http_request_body_api.c index a577023..88732a1 100644 --- a/http_request_body_api.c +++ b/http_request_body_api.c @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2006, Michael Wallner | + | Copyright (c) 2004-2007, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -99,22 +99,21 @@ PHP_HTTP_API http_request_body *_http_request_body_init_ex(http_request_body *bo PHP_HTTP_API http_request_body *_http_request_body_fill(http_request_body *body, HashTable *fields, HashTable *files ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC TSRMLS_DC) { if (files && (zend_hash_num_elements(files) > 0)) { - char *key = NULL; - ulong idx; + HashKey key = initHashKey(0); zval **data; HashPosition pos; struct curl_httppost *http_post_data[2] = {NULL, NULL}; /* normal data */ if (fields) { - FOREACH_HASH_KEYVAL(pos, fields, key, idx, data) { - if (key) { + FOREACH_HASH_KEYVAL(pos, fields, key, data) { + if (key.type == HASH_KEY_IS_STRING) { CURLcode err; zval *orig = *data; convert_to_string_ex(data); err = curl_formadd(&http_post_data[0], &http_post_data[1], - CURLFORM_COPYNAME, key, + CURLFORM_COPYNAME, key.str, CURLFORM_COPYCONTENTS, Z_STRVAL_PP(data), CURLFORM_CONTENTSLENGTH, (long) Z_STRLEN_PP(data), CURLFORM_END @@ -129,9 +128,6 @@ PHP_HTTP_API http_request_body *_http_request_body_fill(http_request_body *body, curl_formfree(http_post_data[0]); return NULL; } - - /* reset */ - key = NULL; } } }