zend_fcall_info_cache fcc = empty_fcall_info_cache;
php_http_client_object_t *obj;
php_http_message_object_t *msg_obj;
- php_http_client_enqueue_t q;
+ php_http_client_enqueue_t q = {0};
php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O|f", &request, php_http_get_client_request_class_entry(), &fci, &fcc), invalid_arg, return);
return;
}
+ /* set early for progress callback */
+ q.opaque = msg_obj;
+
+ if (obj->client->callback.progress.func) {
+ php_http_client_progress_state_t progress = {0};
+
+ progress.info = "prepare";
+ obj->client->callback.progress.func(obj->client->callback.progress.arg, obj->client, &q, &progress);
+ }
+
+ Z_ADDREF_P(request);
q.request = msg_obj->message;
q.options = combined_options(getThis(), request);
q.dtor = msg_queue_dtor;
}
}
- Z_ADDREF_P(request);
-
php_http_expect(SUCCESS == php_http_client_enqueue(obj->client, &q), runtime,
msg_queue_dtor(&q);
return;
switch (type) {
case CURLINFO_TEXT:
if (data[0] == '-') {
+ goto text;
} else if (php_memnstr(data, ZEND_STRL("Adding handle:"), data + length)) {
h->progress.info = "setup";
} else if (php_memnstr(data, ZEND_STRL("addHandle"), data + length)) {
h->progress.info = "connected";
} else if (php_memnstr(data, ZEND_STRL("blacklisted"), data + length)) {
h->progress.info = "blacklist check";
+ } else if (php_memnstr(data, ZEND_STRL("TLS"), data + length)) {
+ h->progress.info = "ssl negotiation";
} else if (php_memnstr(data, ZEND_STRL("SSL"), data + length)) {
h->progress.info = "ssl negotiation";
+ } else if (php_memnstr(data, ZEND_STRL("certificate"), data + length)) {
+ h->progress.info = "ssl negotiation";
+ } else if (php_memnstr(data, ZEND_STRL("ALPN"), data + length)) {
+ h->progress.info = "alpn";
+ } else if (php_memnstr(data, ZEND_STRL("NPN"), data + length)) {
+ h->progress.info = "npn";
} 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)) {
} else if (php_memnstr(data, ZEND_STRL("Operation timed out"), data + length)) {
h->progress.info = "timeout";
} else {
+ text:;
#if 0
h->progress.info = data;
data[length - 1] = '\0';
$o3 = new CallbackObserver(
function ($c, $r) {
$p = (array) $c->getProgressInfo($r);
+ if (!$p) {
+ return;
+ }
var_dump(array_key_exists("started", $p));
var_dump(array_key_exists("finished", $p));
var_dump(array_key_exists("dlnow", $p));