X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_request_info.c;h=db72fac7a3050cdd6e54cc6e375691531d78ffa9;hb=94a301a8e3c3544c1177f74e15f2c7f0bd7036cf;hp=bb7e601e66de2904a4abc8904de79b1683eb98f7;hpb=aebfa7783e7b280bff4975649b20494e5eb932bc;p=m6w6%2Fext-http diff --git a/http_request_info.c b/http_request_info.c index bb7e601..db72fac 100644 --- a/http_request_info.c +++ b/http_request_info.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 | +--------------------------------------------------------------------+ */ @@ -15,6 +15,7 @@ #define HTTP_WANT_CURL #include "php_http.h" +#ifdef HTTP_HAVE_CURL #include "php_http_request_api.h" /* {{{ void http_request_info(http_request *, HashTable *) */ @@ -119,15 +120,43 @@ PHP_HTTP_API void _http_request_info(http_request *request, HashTable *info) for (p = s; p; p = p->next) { add_next_index_string(subarray, p->data, 1); } - add_assoc_zval_ex(&array, "cookielist", sizeof("cookielist"), subarray); + add_assoc_zval_ex(&array, "cookies", sizeof("cookies"), subarray); + curl_slist_free_all(s); + } +#endif +#if HTTP_CURL_VERSION(7,18,2) + if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_REDIRECT_URL, &c)) { + add_assoc_string_ex(&array, "redirect_url", sizeof("redirect_url"), c ? c : "", 1); + } +#endif +#if HTTP_CURL_VERSION(7,19,0) + if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_PRIMARY_IP, &c)) { + add_assoc_string_ex(&array, "primary_ip", sizeof("primary_ip"), c ? c : "", 1); + } +#endif +#if HTTP_CURL_VERSION(7,19,0) + if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_APPCONNECT_TIME, &d)) { + add_assoc_double_ex(&array, "appconnect_time", sizeof("appconnect_time"), d); + } +#endif +#if HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL) + if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_CERTINFO, &s)) { + MAKE_STD_ZVAL(subarray); + array_init(subarray); + for (p = s; p; p = p->next) { + add_next_index_string(subarray, p->data, 1); + } + add_assoc_zval_ex(&array, "certinfo", sizeof("certinfo"), subarray); curl_slist_free_all(s); } #endif /* END */ - add_assoc_string_ex(&array, "error", sizeof("error"), request->_error, 1); + add_assoc_string_ex(&array, "error", sizeof("error"), http_request_storage_get(request->ch)->errorbuffer, 1); } /* }}} */ +#endif /* HTTP_HAVE_CURL */ + /* * Local variables: * tab-width: 4