zval ti_array, subarray;
struct curl_tlssessioninfo *ti;
+#if PHP_HTTP_CURL_VERSION(7,48,0)
+ if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_TLS_SSL_PTR, &ti)) {
+#else
if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_TLS_SESSION, &ti)) {
+#endif
char *backend;
ZVAL_NULL(&subarray);
backend = "openssl";
#if PHP_HTTP_HAVE_LIBCURL_OPENSSL
{
+#if PHP_HTTP_CURL_VERSION(7,48,0)
+ SSL *ssl = ti->internals;
+ SSL_CTX *ctx = ssl ? SSL_get_SSL_CTX(ssl) : NULL;
+#else
SSL_CTX *ctx = ti->internals;
+#endif
array_init(&subarray);
- add_assoc_long_ex(&subarray, ZEND_STRL("number"), SSL_CTX_sess_number(ctx));
- add_assoc_long_ex(&subarray, ZEND_STRL("connect"), SSL_CTX_sess_connect(ctx));
- add_assoc_long_ex(&subarray, ZEND_STRL("connect_good"), SSL_CTX_sess_connect_good(ctx));
- add_assoc_long_ex(&subarray, ZEND_STRL("connect_renegotiate"), SSL_CTX_sess_connect_renegotiate(ctx));
- add_assoc_long_ex(&subarray, ZEND_STRL("hits"), SSL_CTX_sess_hits(ctx));
- add_assoc_long_ex(&subarray, ZEND_STRL("cache_full"), SSL_CTX_sess_cache_full(ctx));
+ if (ctx) {
+ add_assoc_long_ex(&subarray, ZEND_STRL("number"), SSL_CTX_sess_number(ctx));
+ add_assoc_long_ex(&subarray, ZEND_STRL("connect"), SSL_CTX_sess_connect(ctx));
+ add_assoc_long_ex(&subarray, ZEND_STRL("connect_good"), SSL_CTX_sess_connect_good(ctx));
+ add_assoc_long_ex(&subarray, ZEND_STRL("connect_renegotiate"), SSL_CTX_sess_connect_renegotiate(ctx));
+ add_assoc_long_ex(&subarray, ZEND_STRL("hits"), SSL_CTX_sess_hits(ctx));
+ add_assoc_long_ex(&subarray, ZEND_STRL("cache_full"), SSL_CTX_sess_cache_full(ctx));
+ }
}
#endif
break;
char *desc;
array_init(&subarray);
- if ((desc = gnutls_session_get_desc(sess))) {
- add_assoc_string_ex(&subarray, ZEND_STRL("desc"), desc);
- gnutls_free(desc);
+ if (sess) {
+ if ((desc = gnutls_session_get_desc(sess))) {
+ add_assoc_string_ex(&subarray, ZEND_STRL("desc"), desc);
+ gnutls_free(desc);
+ }
+ add_assoc_bool_ex(&subarray, ZEND_STRL("resumed"), gnutls_session_is_resumed(sess));
}
- add_assoc_bool_ex(&subarray, ZEND_STRL("resumed"), gnutls_session_is_resumed(sess));
}
#endif
break;
include "skipif.inc";
skip_online_test();
skip_client_test();
+skip_curl_test("7.34.0");
?>
--FILE--
<?php
) === $client->getSslOptions()
);
+$client->attach($observer = new class implements SplObserver {
+ public $data = [];
+ function update(SplSubject $client, $req = null, $progress = null) {
+ $ti = $client->getTransferInfo($req);
+ if (isset($ti->tls_session["internals"])) {
+ foreach ((array) $ti->tls_session["internals"] as $key => $val) {
+ if (!isset($this->data[$key]) || $this->data[$key] < $val) {
+ $this->data[$key] = $val;
+ }
+ }
+ }
+ }
+});
+
$client->enqueue($req = new http\Client\Request("GET", "https://twitter.com/"));
$client->send();
-$ti = (array) $client->getTransferInfo($req);
-var_dump(array_key_exists("ssl_engines", $ti));
-var_dump(0 < count($ti["ssl_engines"]) || $ti["tls_session"]["backend"] != "openssl");
+switch ($client->getTransferInfo($req)->tls_session["backend"]) {
+ case "openssl":
+ case "gnutls":
+ if (count($observer->data) < 1) {
+ die("failed count(ssl.internals) >= 1\n");
+ }
+ break;
+ default:
+ break;
+}
?>
Done
--EXPECTF--
Test
bool(true)
-bool(true)
-bool(true)
Done