X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_request_info.c;h=a75cd0cc3f6637aea8c8edfdb85e2226ffe09aae;hb=707ee66a824e2bb5daad723f75682aea777b09a3;hp=494a5dc548116b153bb5e71555ab6c4a8b0c5347;hpb=d3485e3b28336153dca690e872ffe1ddc60fedd2;p=m6w6%2Fext-http diff --git a/php_http_request_info.c b/php_http_request_info.c index 494a5dc..a75cd0c 100644 --- a/php_http_request_info.c +++ b/php_http_request_info.c @@ -6,13 +6,11 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2010, Michael Wallner | + | Copyright (c) 2004-2011, Michael Wallner | +--------------------------------------------------------------------+ */ -/* $Id: http_request_info.c 293136 2010-01-05 08:48:52Z mike $ */ - -#include "php_http.h" +#include "php_http_api.h" PHP_HTTP_API void php_http_request_info(php_http_request_t *request, HashTable *info) { @@ -24,82 +22,82 @@ PHP_HTTP_API void php_http_request_info(php_http_request_t *request, HashTable * INIT_PZVAL_ARRAY(&array, info); /* BEGIN */ - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_EFFECTIVE_URL, &c)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_EFFECTIVE_URL, &c)) { add_assoc_string_ex(&array, "effective_url", sizeof("effective_url"), c ? c : "", 1); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_RESPONSE_CODE, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_RESPONSE_CODE, &l)) { add_assoc_long_ex(&array, "response_code", sizeof("response_code"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_TOTAL_TIME, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_TOTAL_TIME, &d)) { add_assoc_double_ex(&array, "total_time", sizeof("total_time"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_NAMELOOKUP_TIME, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_NAMELOOKUP_TIME, &d)) { add_assoc_double_ex(&array, "namelookup_time", sizeof("namelookup_time"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_CONNECT_TIME, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_CONNECT_TIME, &d)) { add_assoc_double_ex(&array, "connect_time", sizeof("connect_time"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_PRETRANSFER_TIME, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_PRETRANSFER_TIME, &d)) { add_assoc_double_ex(&array, "pretransfer_time", sizeof("pretransfer_time"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_SIZE_UPLOAD, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_SIZE_UPLOAD, &d)) { add_assoc_double_ex(&array, "size_upload", sizeof("size_upload"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_SIZE_DOWNLOAD, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_SIZE_DOWNLOAD, &d)) { add_assoc_double_ex(&array, "size_download", sizeof("size_download"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_SPEED_DOWNLOAD, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_SPEED_DOWNLOAD, &d)) { add_assoc_double_ex(&array, "speed_download", sizeof("speed_download"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_SPEED_UPLOAD, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_SPEED_UPLOAD, &d)) { add_assoc_double_ex(&array, "speed_upload", sizeof("speed_upload"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_HEADER_SIZE, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_HEADER_SIZE, &l)) { add_assoc_long_ex(&array, "header_size", sizeof("header_size"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_REQUEST_SIZE, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_REQUEST_SIZE, &l)) { add_assoc_long_ex(&array, "request_size", sizeof("request_size"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_SSL_VERIFYRESULT, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_SSL_VERIFYRESULT, &l)) { add_assoc_long_ex(&array, "ssl_verifyresult", sizeof("ssl_verifyresult"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_FILETIME, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_FILETIME, &l)) { add_assoc_long_ex(&array, "filetime", sizeof("filetime"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d)) { add_assoc_double_ex(&array, "content_length_download", sizeof("content_length_download"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_CONTENT_LENGTH_UPLOAD, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_CONTENT_LENGTH_UPLOAD, &d)) { add_assoc_double_ex(&array, "content_length_upload", sizeof("content_length_upload"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_STARTTRANSFER_TIME, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_STARTTRANSFER_TIME, &d)) { add_assoc_double_ex(&array, "starttransfer_time", sizeof("starttransfer_time"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_CONTENT_TYPE, &c)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_CONTENT_TYPE, &c)) { add_assoc_string_ex(&array, "content_type", sizeof("content_type"), c ? c : "", 1); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_REDIRECT_TIME, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_REDIRECT_TIME, &d)) { add_assoc_double_ex(&array, "redirect_time", sizeof("redirect_time"), d); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_REDIRECT_COUNT, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_REDIRECT_COUNT, &l)) { add_assoc_long_ex(&array, "redirect_count", sizeof("redirect_count"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_HTTP_CONNECTCODE, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_HTTP_CONNECTCODE, &l)) { add_assoc_long_ex(&array, "connect_code", sizeof("connect_code"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_HTTPAUTH_AVAIL, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_HTTPAUTH_AVAIL, &l)) { add_assoc_long_ex(&array, "httpauth_avail", sizeof("httpauth_avail"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_PROXYAUTH_AVAIL, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_PROXYAUTH_AVAIL, &l)) { add_assoc_long_ex(&array, "proxyauth_avail", sizeof("proxyauth_avail"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_OS_ERRNO, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_OS_ERRNO, &l)) { add_assoc_long_ex(&array, "os_errno", sizeof("os_errno"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_NUM_CONNECTS, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_NUM_CONNECTS, &l)) { add_assoc_long_ex(&array, "num_connects", sizeof("num_connects"), l); } - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_SSL_ENGINES, &s)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_SSL_ENGINES, &s)) { MAKE_STD_ZVAL(subarray); array_init(subarray); for (p = s; p; p = p->next) { @@ -111,7 +109,7 @@ PHP_HTTP_API void php_http_request_info(php_http_request_t *request, HashTable * curl_slist_free_all(s); } #if PHP_HTTP_CURL_VERSION(7,14,1) - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_COOKIELIST, &s)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_COOKIELIST, &s)) { MAKE_STD_ZVAL(subarray); array_init(subarray); for (p = s; p; p = p->next) { @@ -124,22 +122,22 @@ PHP_HTTP_API void php_http_request_info(php_http_request_t *request, HashTable * } #endif #if PHP_HTTP_CURL_VERSION(7,18,2) - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_REDIRECT_URL, &c)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_REDIRECT_URL, &c)) { add_assoc_string_ex(&array, "redirect_url", sizeof("redirect_url"), c ? c : "", 1); } #endif #if PHP_HTTP_CURL_VERSION(7,19,0) - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_PRIMARY_IP, &c)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_PRIMARY_IP, &c)) { add_assoc_string_ex(&array, "primary_ip", sizeof("primary_ip"), c ? c : "", 1); } #endif #if PHP_HTTP_CURL_VERSION(7,19,0) - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_APPCONNECT_TIME, &d)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_APPCONNECT_TIME, &d)) { add_assoc_double_ex(&array, "appconnect_time", sizeof("appconnect_time"), d); } #endif #if PHP_HTTP_CURL_VERSION(7,19,4) - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_CONDITION_UNMET, &l)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_CONDITION_UNMET, &l)) { add_assoc_long_ex(&array, "condition_unmet", sizeof("condition_unmet"), l); } #endif @@ -151,7 +149,7 @@ PHP_HTTP_API void php_http_request_info(php_http_request_t *request, HashTable * struct curl_certinfo *ci; char *colon, *keyname; - if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_CERTINFO, &ci)) { + if (CURLE_OK == curl_easy_getinfo(request->curl.handle, CURLINFO_CERTINFO, &ci)) { MAKE_STD_ZVAL(ci_array); array_init(ci_array); @@ -177,7 +175,7 @@ PHP_HTTP_API void php_http_request_info(php_http_request_t *request, HashTable * } } #endif - add_assoc_string_ex(&array, "error", sizeof("error"), php_http_request_storage_get(request->ch)->errorbuffer, 1); + add_assoc_string_ex(&array, "error", sizeof("error"), php_http_request_storage_get(request->curl.handle)->errorbuffer, 1); }