+#if HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL)
+ {
+ int i;
+ zval *ci_array;
+ struct curl_certinfo *ci;
+ char *colon, *keyname;
+
+ if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_CERTINFO, &ci)) {
+ MAKE_STD_ZVAL(ci_array);
+ array_init(ci_array);
+
+ for (i = 0; i < ci->num_of_certs; ++i) {
+ s = ci->certinfo[i];
+
+ MAKE_STD_ZVAL(subarray);
+ array_init(subarray);
+ for (p = s; p; p = p->next) {
+ if (p->data) {
+ if ((colon = strchr(p->data, ':'))) {
+ keyname = estrndup(p->data, colon - p->data);
+ add_assoc_string_ex(subarray, keyname, colon - p->data + 1, colon + 1, 1);
+ efree(keyname);
+ } else {
+ add_next_index_string(subarray, p->data, 1);
+ }
+ }
+ }
+ add_next_index_zval(ci_array, subarray);
+ curl_slist_free_all(s);
+ }
+ add_assoc_zval_ex(&array, "certinfo", sizeof("certinfo"), ci_array);
+ }
+ }
+#endif
+ add_assoc_string_ex(&array, "error", sizeof("error"), http_request_storage_get(request->ch)->errorbuffer, 1);