zval *info, *zresponse, *zrequest;
HashTable *info_ht;
- if (i_zend_is_true(zend_read_property(php_http_client_class_entry, &zclient, ZEND_STRL("recordHistory"), 0 TSRMLS_CC))) {
+ if (z_is_true(zend_read_property(php_http_client_class_entry, &zclient, ZEND_STRL("recordHistory"), 0 TSRMLS_CC))) {
handle_history(&zclient, *request, *response TSRMLS_CC);
}
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClient, count)
{
- if (SUCCESS == zend_parse_parameters_none()) {
+ long count_mode = -1;
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &count_mode)) {
php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETVAL_LONG(zend_llist_count(&obj->client->requests));
h->progress.info = "blacklist check";
} else if (php_memnstr(data, ZEND_STRL("SSL"), data + length)) {
h->progress.info = "ssl negotiation";
+ } else if (php_memnstr(data, ZEND_STRL("upload"), data + length)) {
+ h->progress.info = "uploaded";
} else if (php_memnstr(data, ZEND_STRL("left intact"), data + length)) {
h->progress.info = "not disconnected";
} else if (php_memnstr(data, ZEND_STRL("closed"), data + length)) {
} else {
#if PHP_DEBUG
h->progress.info = data;
+ data[length - 1] = '\0';
#endif
}
if (h->client->callback.progress.func) {
add_assoc_zval_ex(cpy, ZEND_STRS("file"), *tmp);
zend_hash_del_key_or_index(Z_ARRVAL_P(cpy), ZEND_STRS("tmp_name"), 0, HASH_DEL_KEY);
}
- zend_hash_quick_update(Z_ARRVAL_P(zfiles), key->arKey, key->nKeyLength, key->h, (void *) &cpy, sizeof(zval *), NULL);
+ if (key->nKeyLength > 0) {
+ zend_hash_quick_update(Z_ARRVAL_P(zfiles), key->arKey, key->nKeyLength, key->h, (void *) &cpy, sizeof(zval *), NULL);
+ } else {
+ zend_hash_index_update(Z_ARRVAL_P(zfiles), key->h, (void *) &cpy, sizeof(zval *), NULL);
+ }
}
}
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, count)
{
- if (SUCCESS == zend_parse_parameters_none()) {
+ long count_mode = -1;
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &count_mode)) {
long i = 0;
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
# define PHP_HTTP_ZEND_LITERAL_CCN , NULL
#endif
+#if PHP_VERSION_ID < 50700
+# define z_is_true zend_is_true
+#else
+# define z_is_true(z) zend_is_true(z TSRMLS_CC)
+#endif
+
#define INIT_PZVAL_ARRAY(zv, ht) \
{ \
INIT_PZVAL((zv)); \
<?php
echo "Test\n";
-$request = new http\Client\Request("POST", "http://dev.iworks.at/ext-http/.print_request.php");
-$request->getBody()->addForm(null, array("file"=>__FILE__, "name"=>"upload", "type"=>"text/plain"));
-
-foreach (http\Client::getAvailableDrivers() as $driver) {
- $client = new http\Client($driver);
- $client->enqueue($request)->send();
- var_dump($client->getResponse()->getBody()->toString());
-}
-?>
-Done
---EXPECTREGEX--
-Test
-(?:string\(\d+\) "Array
+$RE =
+'/(Array
\(
\[upload\] \=\> Array
\(
\[name\] \=\> client010\.php
\[type\] \=\> text\/plain
- \[tmp_name\] \=\> .*
+ \[tmp_name\] \=\> .+
\[error\] \=\> 0
\[size\] \=\> \d+
\)
\)
-"
-)+Done
+)+/';
+$request = new http\Client\Request("POST", "http://dev.iworks.at/ext-http/.print_request.php");
+$request->getBody()->addForm(null, array("file"=>__FILE__, "name"=>"upload", "type"=>"text/plain"));
+
+foreach (http\Client::getAvailableDrivers() as $driver) {
+ $client = new http\Client($driver);
+ $client->enqueue($request)->send();
+ if (!preg_match($RE, $s = $client->getResponse()->getBody()->toString())) {
+ echo($s);
+ }
+}
+?>
+Done
+--EXPECT--
+Test
+Done
\ No newline at end of file
$r->send();
?>
---EXPECTHEADERS--
-Content-Type: text/plain
+--EXPECTHEADERSF--
+Content-Type: text/plain%s
--EXPECTF--
php
[2] => good
)
- [Content-Type] => text/html
+ [Content-Type] => %s
)
Created
$body = new http\Message\Body;
$body->append("Hello, my old fellow.");
foreach (hash_algos() as $algo) {
- if ($algo == "gost-crypto") continue;
+ switch ($algo) {
+ case "gost-crypto":
+ case "fnv1a32":
+ case "fnv1a64":
+ continue 2;
+ }
ini_set("http.etag.mode", $algo);
printf("%10s: %s\n",
$algo,