Changes of Revision 15
[-] | Changed | php5-pecl_http.changes |
1
2 ------------------------------------------------------------------- 3 +Sun Mar 3 09:41:48 UTC 2013 - cs@linux-administrator.com 4 + 5 +- update to release 1.7.5 6 + 7 +------------------------------------------------------------------- 8 Mon Apr 9 08:30:47 UTC 2012 - cs@linux-administrator.com 9 10 - update to release 1.7.4 11 |
||
[-] | Changed | php5-pecl_http.spec ^ |
10 1
2 %define php_version %(php-config --version 2>/dev/null) 3 # 4 Name: php5-pecl_http 5 -Version: 1.7.4 6 +Version: 1.7.5 7 Release: 0 8 # 9 License: BSD 10 |
||
[+] | Deleted | pecl_http-1.7.4.tar.bz2/pecl_http-1.7.4/http_request_api.c ^ |
@@ -1,1326 +0,0 @@ -/* - +--------------------------------------------------------------------+ - | PECL :: http | - +--------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the conditions mentioned | - | in the accompanying LICENSE file are met. | - +--------------------------------------------------------------------+ - | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> | - +--------------------------------------------------------------------+ -*/ - -/* $Id: http_request_api.c 310775 2011-05-05 06:02:50Z mike $ */ - -#define HTTP_WANT_SAPI -#define HTTP_WANT_CURL -#include "php_http.h" - -#ifdef HTTP_HAVE_CURL - -#include "php_http_api.h" -#include "php_http_persistent_handle_api.h" -#include "php_http_request_api.h" -#include "php_http_url_api.h" - -#ifdef ZEND_ENGINE_2 -# include "php_http_request_object.h" -#endif - -#include "php_http_request_int.h" - -/* {{{ cruft for thread safe SSL crypto locks */ -#ifdef HTTP_NEED_OPENSSL_TSL -static MUTEX_T *http_openssl_tsl = NULL; - -static void http_openssl_thread_lock(int mode, int n, const char * file, int line) -{ - if (mode & CRYPTO_LOCK) { - tsrm_mutex_lock(http_openssl_tsl[n]); - } else { - tsrm_mutex_unlock(http_openssl_tsl[n]); - } -} - -static ulong http_openssl_thread_id(void) -{ - return (ulong) tsrm_thread_id(); -} -#endif -#ifdef HTTP_NEED_GNUTLS_TSL -static int http_gnutls_mutex_create(void **m) -{ - if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) { - return SUCCESS; - } else { - return FAILURE; - } -} - -static int http_gnutls_mutex_destroy(void **m) -{ - tsrm_mutex_free(*((MUTEX_T *) m)); - return SUCCESS; -} - -static int http_gnutls_mutex_lock(void **m) -{ - return tsrm_mutex_lock(*((MUTEX_T *) m)); -} - -static int http_gnutls_mutex_unlock(void **m) -{ - return tsrm_mutex_unlock(*((MUTEX_T *) m)); -} - -static struct gcry_thread_cbs http_gnutls_tsl = { - GCRY_THREAD_OPTION_USER, - NULL, - http_gnutls_mutex_create, - http_gnutls_mutex_destroy, - http_gnutls_mutex_lock, - http_gnutls_mutex_unlock -}; -#endif -/* }}} */ - -/* safe curl wrappers */ -#define init_curl_storage(ch) \ - {\ - http_request_storage *st = pecalloc(1, sizeof(http_request_storage), 1); \ - curl_easy_setopt(ch, CURLOPT_PRIVATE, st); \ - curl_easy_setopt(ch, CURLOPT_ERRORBUFFER, st->errorbuffer); \ - } - -static void *safe_curl_init(void) -{ - CURL *ch; - - if ((ch = curl_easy_init())) { - init_curl_storage(ch); - return ch; - } - return NULL; -} -static void *safe_curl_copy(void *p) -{ - CURL *ch; - - if ((ch = curl_easy_duphandle(p))) { - init_curl_storage(ch); - return ch; - } - return NULL; -} -static void safe_curl_dtor(void *p) { - http_request_storage *st = http_request_storage_get(p); - - curl_easy_cleanup(p); - - if (st) { - if (st->url) { - pefree(st->url, 1); - } - if (st->cookiestore) { - pefree(st->cookiestore, 1); - } - pefree(st, 1); - } -} -/* }}} */ - -/* {{{ MINIT */ -PHP_MINIT_FUNCTION(http_request) -{ -#ifdef HTTP_NEED_OPENSSL_TSL - /* mod_ssl, libpq or ext/curl might already have set thread lock callbacks */ - if (!CRYPTO_get_id_callback()) { - int i, c = CRYPTO_num_locks(); - - http_openssl_tsl = malloc(c * sizeof(MUTEX_T)); - - for (i = 0; i < c; ++i) { - http_openssl_tsl[i] = tsrm_mutex_alloc(); - } - - CRYPTO_set_id_callback(http_openssl_thread_id); - CRYPTO_set_locking_callback(http_openssl_thread_lock); - } -#endif -#ifdef HTTP_NEED_GNUTLS_TSL - gcry_control(GCRYCTL_SET_THREAD_CBS, &http_gnutls_tsl); -#endif - - if (CURLE_OK != curl_global_init(CURL_GLOBAL_ALL)) { - return FAILURE; - } - - if (SUCCESS != http_persistent_handle_provide("http_request", safe_curl_init, safe_curl_dtor, safe_curl_copy)) { - return FAILURE; - } - - HTTP_LONG_CONSTANT("HTTP_AUTH_BASIC", CURLAUTH_BASIC); - HTTP_LONG_CONSTANT("HTTP_AUTH_DIGEST", CURLAUTH_DIGEST); -#if HTTP_CURL_VERSION(7,19,3) - HTTP_LONG_CONSTANT("HTTP_AUTH_DIGEST_IE", CURLAUTH_DIGEST_IE); -#endif - HTTP_LONG_CONSTANT("HTTP_AUTH_NTLM", CURLAUTH_NTLM); - HTTP_LONG_CONSTANT("HTTP_AUTH_GSSNEG", CURLAUTH_GSSNEGOTIATE); - HTTP_LONG_CONSTANT("HTTP_AUTH_ANY", CURLAUTH_ANY); - - HTTP_LONG_CONSTANT("HTTP_VERSION_NONE", CURL_HTTP_VERSION_NONE); /* to be removed */ - HTTP_LONG_CONSTANT("HTTP_VERSION_1_0", CURL_HTTP_VERSION_1_0); - HTTP_LONG_CONSTANT("HTTP_VERSION_1_1", CURL_HTTP_VERSION_1_1); - HTTP_LONG_CONSTANT("HTTP_VERSION_ANY", CURL_HTTP_VERSION_NONE); - - HTTP_LONG_CONSTANT("HTTP_SSL_VERSION_TLSv1", CURL_SSLVERSION_TLSv1); - HTTP_LONG_CONSTANT("HTTP_SSL_VERSION_SSLv2", CURL_SSLVERSION_SSLv2); - HTTP_LONG_CONSTANT("HTTP_SSL_VERSION_SSLv3", CURL_SSLVERSION_SSLv3); - HTTP_LONG_CONSTANT("HTTP_SSL_VERSION_ANY", CURL_SSLVERSION_DEFAULT); - - HTTP_LONG_CONSTANT("HTTP_IPRESOLVE_V4", CURL_IPRESOLVE_V4); - HTTP_LONG_CONSTANT("HTTP_IPRESOLVE_V6", CURL_IPRESOLVE_V6); - HTTP_LONG_CONSTANT("HTTP_IPRESOLVE_ANY", CURL_IPRESOLVE_WHATEVER); - -#if HTTP_CURL_VERSION(7,15,2) - HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS4", CURLPROXY_SOCKS4); -#endif -#if HTTP_CURL_VERSION(7,18,0) - HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS4A", CURLPROXY_SOCKS4A); - HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS5_HOSTNAME", CURLPROXY_SOCKS5_HOSTNAME); -#endif - HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS5", CURLPROXY_SOCKS5); - HTTP_LONG_CONSTANT("HTTP_PROXY_HTTP", CURLPROXY_HTTP); -#if HTTP_CURL_VERSION(7,19,4) - HTTP_LONG_CONSTANT("HTTP_PROXY_HTTP_1_0", CURLPROXY_HTTP_1_0); -#endif - -#if HTTP_CURL_VERSION(7,19,1) - HTTP_LONG_CONSTANT("HTTP_POSTREDIR_301", CURL_REDIR_POST_301); - HTTP_LONG_CONSTANT("HTTP_POSTREDIR_302", CURL_REDIR_POST_302); - HTTP_LONG_CONSTANT("HTTP_POSTREDIR_ALL", CURL_REDIR_POST_ALL); -#endif - return SUCCESS; -} -/* }}} */ - -/* {{{ MSHUTDOWN */ -PHP_MSHUTDOWN_FUNCTION(http_request) -{ - curl_global_cleanup(); -#ifdef HTTP_NEED_OPENSSL_TSL - if (http_openssl_tsl) { - int i, c = CRYPTO_num_locks(); - - CRYPTO_set_id_callback(NULL); - CRYPTO_set_locking_callback(NULL); - - for (i = 0; i < c; ++i) { - tsrm_mutex_free(http_openssl_tsl[i]); - } - - free(http_openssl_tsl); - http_openssl_tsl = NULL; - } -#endif - return SUCCESS; -} -/* }}} */ - -/* {{{ forward declarations */ -#define http_request_option(r, o, k, t) _http_request_option_ex((r), (o), (k), sizeof(k), (t) TSRMLS_CC) -#define http_request_option_ex(r, o, k, l, t) _http_request_option_ex((r), (o), (k), (l), (t) TSRMLS_CC) -static inline zval *_http_request_option_ex(http_request *request, HashTable *options, char *key, size_t keylen, int type TSRMLS_DC); -#define http_request_option_cache(r, k, z) _http_request_option_cache_ex((r), (k), sizeof(k), 0, (z) TSRMLS_CC) -#define http_request_option_cache_ex(r, k, kl, h, z) _http_request_option_cache_ex((r), (k), (kl), (h), (z) TSRMLS_CC) -static inline zval *_http_request_option_cache_ex(http_request *r, char *key, size_t keylen, ulong h, zval *opt TSRMLS_DC); - -#define http_request_cookies_enabled(r) _http_request_cookies_enabled((r)) -static inline int _http_request_cookies_enabled(http_request *r); - -static size_t http_curl_read_callback(void *, size_t, size_t, void *); -static int http_curl_progress_callback(void *, double, double, double, double); -static int http_curl_raw_callback(CURL *, curl_infotype, char *, size_t, void *); -static int http_curl_dummy_callback(char *data, size_t n, size_t l, void *s) { return n*l; } -static curlioerr http_curl_ioctl_callback(CURL *, curliocmd, void *); -/* }}} */ - -/* {{{ CURL *http_curl_init(http_request *) */ -PHP_HTTP_API CURL * _http_curl_init_ex(CURL *ch, http_request *request TSRMLS_DC) -{ - if (ch || (SUCCESS == http_persistent_handle_acquire("http_request", &ch))) { -#if defined(ZTS) - curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); -#endif - curl_easy_setopt(ch, CURLOPT_HEADER, 0L); - curl_easy_setopt(ch, CURLOPT_FILETIME, 1L); - curl_easy_setopt(ch, CURLOPT_AUTOREFERER, 1L); - curl_easy_setopt(ch, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, NULL); - curl_easy_setopt(ch, CURLOPT_DEBUGFUNCTION, http_curl_raw_callback); - curl_easy_setopt(ch, CURLOPT_READFUNCTION, http_curl_read_callback); - curl_easy_setopt(ch, CURLOPT_IOCTLFUNCTION, http_curl_ioctl_callback); - curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, http_curl_dummy_callback); - - /* set context */ - if (request) { - curl_easy_setopt(ch, CURLOPT_DEBUGDATA, request); - - /* attach curl handle */ - request->ch = ch; - /* set defaults (also in http_request_reset()) */ - http_request_defaults(request); - } - } - - return ch; -} -/* }}} */ - -/* {{{ CURL *http_curl_copy(CURL *) */ -PHP_HTTP_API CURL *_http_curl_copy(CURL *ch TSRMLS_DC) -{ - CURL *copy; - - if (SUCCESS == http_persistent_handle_accrete("http_request", ch, ©)) { - return copy; - } - return NULL; -} -/* }}} */ - -/* {{{ void http_curl_free(CURL **) */ -PHP_HTTP_API void _http_curl_free(CURL **ch TSRMLS_DC) -{ - if (*ch) { - curl_easy_setopt(*ch, CURLOPT_NOPROGRESS, 1L); - curl_easy_setopt(*ch, CURLOPT_PROGRESSFUNCTION, NULL); - curl_easy_setopt(*ch, CURLOPT_VERBOSE, 0L); - curl_easy_setopt(*ch, CURLOPT_DEBUGFUNCTION, NULL); - - http_persistent_handle_release("http_request", ch); - } -} -/* }}} */ - -/* {{{ http_request *http_request_init(http_request *) */ -PHP_HTTP_API http_request *_http_request_init_ex(http_request *request, CURL *ch, http_request_method meth, const char *url ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC TSRMLS_DC) -{ - http_request *r; - - if (request) { - r = request; - } else { - r = emalloc_rel(sizeof(http_request)); - } - memset(r, 0, sizeof(http_request)); - - r->ch = ch; - r->url = (url) ? http_absolute_url(url) : NULL; - r->meth = (meth > 0) ? meth : HTTP_GET; - - phpstr_init(&r->conv.request); - phpstr_init_ex(&r->conv.response, HTTP_CURLBUF_SIZE, 0); - phpstr_init(&r->_cache.cookies); - zend_hash_init(&r->_cache.options, 0, NULL, ZVAL_PTR_DTOR, 0); - - TSRMLS_SET_CTX(r->tsrm_ls); - - return r; -} -/* }}} */ - -/* {{{ void http_request_dtor(http_request *) */ -PHP_HTTP_API void _http_request_dtor(http_request *request) -{ - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - - http_request_reset(request); - http_curl_free(&request->ch); - - phpstr_dtor(&request->_cache.cookies); - zend_hash_destroy(&request->_cache.options); - if (request->_cache.headers) { - curl_slist_free_all(request->_cache.headers); - request->_cache.headers = NULL; - } - if (request->_progress_callback) { - zval_ptr_dtor(&request->_progress_callback); - request->_progress_callback = NULL; - } -} -/* }}} */ - -/* {{{ void http_request_free(http_request **) */ -PHP_HTTP_API void _http_request_free(http_request **request) -{ - if (*request) { - TSRMLS_FETCH_FROM_CTX((*request)->tsrm_ls); - http_request_body_free(&(*request)->body); - http_request_dtor(*request); - efree(*request); - *request = NULL; - } -} -/* }}} */ - -/* {{{ void http_request_reset(http_request *) */ -PHP_HTTP_API void _http_request_reset(http_request *request) -{ - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - STR_SET(request->url, NULL); - request->conv.last_type = 0; - phpstr_dtor(&request->conv.request); - phpstr_dtor(&request->conv.response); - http_request_body_dtor(request->body); - http_request_defaults(request); - - if (request->ch) { - http_request_storage *st = http_request_storage_get(request->ch); - - if (st) { - if (st->url) { - pefree(st->url, 1); - st->url = NULL; - } - if (st->cookiestore) { - pefree(st->cookiestore, 1); - st->cookiestore = NULL; - } - st->errorbuffer[0] = '\0'; - } - } -} -/* }}} */ - -/* {{{ STATUS http_request_enable_cookies(http_request *) */ -PHP_HTTP_API STATUS _http_request_enable_cookies(http_request *request) -{ - int initialized = 1; - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - - HTTP_CHECK_CURL_INIT(request->ch, http_curl_init_ex(request->ch, request), initialized = 0); - if (initialized && (http_request_cookies_enabled(request) || (CURLE_OK == curl_easy_setopt(request->ch, CURLOPT_COOKIEFILE, "")))) { - return SUCCESS; - } - http_error(HE_WARNING, HTTP_E_REQUEST, "Could not enable cookies for this session"); - return FAILURE; -} -/* }}} */ - -/* {{{ STATUS http_request_reset_cookies(http_request *, int) */ -PHP_HTTP_API STATUS _http_request_reset_cookies(http_request *request, int session_only) -{ - int initialized = 1; - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - - HTTP_CHECK_CURL_INIT(request->ch, http_curl_init_ex(request->ch, request), initialized = 0); - if (initialized) { - if (!http_request_cookies_enabled(request)) { - if (SUCCESS != http_request_enable_cookies(request)) { - return FAILURE; - } - } - if (session_only) { -#if HTTP_CURL_VERSION(7,15,4) - if (CURLE_OK == curl_easy_setopt(request->ch, CURLOPT_COOKIELIST, "SESS")) { - return SUCCESS; - } -#else - http_error(HE_WARNING, HTTP_E_REQUEST, "Could not reset session cookies (need libcurl >= v7.15.4)"); -#endif - } else { -#if HTTP_CURL_VERSION(7,14,1) - if (CURLE_OK == curl_easy_setopt(request->ch, CURLOPT_COOKIELIST, "ALL")) { - return SUCCESS; - } -#else - http_error(HE_WARNING, HTTP_E_REQUEST, "Could not reset cookies (need libcurl >= v7.14.1)"); -#endif - } - } - return FAILURE; -} -/* }}} */ - -PHP_HTTP_API STATUS _http_request_flush_cookies(http_request *request) -{ - int initialized = 1; - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - - HTTP_CHECK_CURL_INIT(request->ch, http_curl_init_ex(request->ch, request), initialized = 0); - if (initialized) { - if (!http_request_cookies_enabled(request)) { - return FAILURE; - } -#if HTTP_CURL_VERSION(7,17,1) - if (CURLE_OK == curl_easy_setopt(request->ch, CURLOPT_COOKIELIST, "FLUSH")) { - return SUCCESS; - } -#else - http_error(HE_WARNING, HTTP_E_REQUEST, "Could not flush cookies (need libcurl >= v7.17.1)"); -#endif - } - return FAILURE; -} - -/* {{{ void http_request_defaults(http_request *) */ -PHP_HTTP_API void _http_request_defaults(http_request *request) -{ - if (request->ch) { - HTTP_CURL_OPT(CURLOPT_PROGRESSFUNCTION, NULL); - HTTP_CURL_OPT(CURLOPT_URL, NULL); - HTTP_CURL_OPT(CURLOPT_NOPROGRESS, 1L); -#if HTTP_CURL_VERSION(7,19,4) - HTTP_CURL_OPT(CURLOPT_NOPROXY, NULL); -#endif - HTTP_CURL_OPT(CURLOPT_PROXY, NULL); - HTTP_CURL_OPT(CURLOPT_PROXYPORT, 0L); - HTTP_CURL_OPT(CURLOPT_PROXYTYPE, 0L); - /* libcurl < 7.19.6 does not clear auth info with USERPWD set to NULL */ -#if HTTP_CURL_VERSION(7,19,1) - HTTP_CURL_OPT(CURLOPT_PROXYUSERNAME, NULL); - HTTP_CURL_OPT(CURLOPT_PROXYPASSWORD, NULL); -#endif - HTTP_CURL_OPT(CURLOPT_PROXYAUTH, 0L); - HTTP_CURL_OPT(CURLOPT_HTTPPROXYTUNNEL, 0L); - HTTP_CURL_OPT(CURLOPT_DNS_CACHE_TIMEOUT, 60L); - HTTP_CURL_OPT(CURLOPT_IPRESOLVE, 0); - HTTP_CURL_OPT(CURLOPT_LOW_SPEED_LIMIT, 0L); - HTTP_CURL_OPT(CURLOPT_LOW_SPEED_TIME, 0L); -#if HTTP_CURL_VERSION(7,15,5) - /* LFS weirdance - HTTP_CURL_OPT(CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t) 0); - HTTP_CURL_OPT(CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t) 0); - */ -#endif - /* crashes - HTTP_CURL_OPT(CURLOPT_MAXCONNECTS, 5L); */ - HTTP_CURL_OPT(CURLOPT_FRESH_CONNECT, 0L); - HTTP_CURL_OPT(CURLOPT_FORBID_REUSE, 0L); - HTTP_CURL_OPT(CURLOPT_INTERFACE, NULL); - HTTP_CURL_OPT(CURLOPT_PORT, 0L); -#if HTTP_CURL_VERSION(7,19,0) - HTTP_CURL_OPT(CURLOPT_ADDRESS_SCOPE, 0L); -#endif -#if HTTP_CURL_VERSION(7,15,2) - HTTP_CURL_OPT(CURLOPT_LOCALPORT, 0L); - HTTP_CURL_OPT(CURLOPT_LOCALPORTRANGE, 0L); -#endif - /* libcurl < 7.19.6 does not clear auth info with USERPWD set to NULL */ -#if HTTP_CURL_VERSION(7,19,1) - HTTP_CURL_OPT(CURLOPT_USERNAME, NULL); - HTTP_CURL_OPT(CURLOPT_PASSWORD, NULL); -#endif - HTTP_CURL_OPT(CURLOPT_HTTPAUTH, 0L); - HTTP_CURL_OPT(CURLOPT_ENCODING, NULL); -#if HTTP_CURL_VERSION(7,16,2) - /* we do this ourself anyway */ - HTTP_CURL_OPT(CURLOPT_HTTP_CONTENT_DECODING, 0L); - HTTP_CURL_OPT(CURLOPT_HTTP_TRANSFER_DECODING, 0L); -#endif - HTTP_CURL_OPT(CURLOPT_FOLLOWLOCATION, 0L); -#if HTTP_CURL_VERSION(7,19,1) - HTTP_CURL_OPT(CURLOPT_POSTREDIR, 0L); -#elif HTTP_CURL_VERSION(7,17,1) - HTTP_CURL_OPT(CURLOPT_POST301, 0L); -#endif - HTTP_CURL_OPT(CURLOPT_UNRESTRICTED_AUTH, 0L); - HTTP_CURL_OPT(CURLOPT_REFERER, NULL); - HTTP_CURL_OPT(CURLOPT_USERAGENT, "PECL::HTTP/" PHP_HTTP_VERSION " (PHP/" PHP_VERSION ")"); - HTTP_CURL_OPT(CURLOPT_HTTPHEADER, NULL); - HTTP_CURL_OPT(CURLOPT_COOKIE, NULL); - HTTP_CURL_OPT(CURLOPT_COOKIESESSION, 0L); - /* these options would enable curl's cookie engine by default which we don't want - HTTP_CURL_OPT(CURLOPT_COOKIEFILE, NULL); - HTTP_CURL_OPT(CURLOPT_COOKIEJAR, NULL); */ -#if HTTP_CURL_VERSION(7,14,1) - HTTP_CURL_OPT(CURLOPT_COOKIELIST, NULL); -#endif - HTTP_CURL_OPT(CURLOPT_RANGE, NULL); - HTTP_CURL_OPT(CURLOPT_RESUME_FROM, 0L); - HTTP_CURL_OPT(CURLOPT_MAXFILESIZE, 0L); - HTTP_CURL_OPT(CURLOPT_TIMECONDITION, 0L); - HTTP_CURL_OPT(CURLOPT_TIMEVALUE, 0L); - HTTP_CURL_OPT(CURLOPT_TIMEOUT, 0L); - HTTP_CURL_OPT(CURLOPT_CONNECTTIMEOUT, 3); - HTTP_CURL_OPT(CURLOPT_SSLCERT, NULL); - HTTP_CURL_OPT(CURLOPT_SSLCERTTYPE, NULL); - HTTP_CURL_OPT(CURLOPT_SSLCERTPASSWD, NULL); - HTTP_CURL_OPT(CURLOPT_SSLKEY, NULL); - HTTP_CURL_OPT(CURLOPT_SSLKEYTYPE, NULL); - HTTP_CURL_OPT(CURLOPT_SSLKEYPASSWD, NULL); - HTTP_CURL_OPT(CURLOPT_SSLENGINE, NULL); - HTTP_CURL_OPT(CURLOPT_SSLVERSION, 0L); - HTTP_CURL_OPT(CURLOPT_SSL_VERIFYPEER, 0L); - HTTP_CURL_OPT(CURLOPT_SSL_VERIFYHOST, 0L); - HTTP_CURL_OPT(CURLOPT_SSL_CIPHER_LIST, NULL); -#if HTTP_CURL_VERSION(7,19,0) - HTTP_CURL_OPT(CURLOPT_ISSUERCERT, NULL); - #if defined(HTTP_HAVE_OPENSSL) - HTTP_CURL_OPT(CURLOPT_CRLFILE, NULL); - #endif -#endif -#if HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL) - HTTP_CURL_OPT(CURLOPT_CERTINFO, NULL); -#endif -#ifdef HTTP_CURL_CAINFO - HTTP_CURL_OPT(CURLOPT_CAINFO, HTTP_CURL_CAINFO); -#else - HTTP_CURL_OPT(CURLOPT_CAINFO, NULL); -#endif - HTTP_CURL_OPT(CURLOPT_CAPATH, NULL); - HTTP_CURL_OPT(CURLOPT_RANDOM_FILE, NULL); - HTTP_CURL_OPT(CURLOPT_EGDSOCKET, NULL); - HTTP_CURL_OPT(CURLOPT_POSTFIELDS, NULL); - HTTP_CURL_OPT(CURLOPT_POSTFIELDSIZE, 0L); - HTTP_CURL_OPT(CURLOPT_HTTPPOST, NULL); - HTTP_CURL_OPT(CURLOPT_IOCTLDATA, NULL); - HTTP_CURL_OPT(CURLOPT_READDATA, NULL); - HTTP_CURL_OPT(CURLOPT_INFILESIZE, 0L); - HTTP_CURL_OPT(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE); - HTTP_CURL_OPT(CURLOPT_CUSTOMREQUEST, NULL); - HTTP_CURL_OPT(CURLOPT_NOBODY, 0L); - HTTP_CURL_OPT(CURLOPT_POST, 0L); - HTTP_CURL_OPT(CURLOPT_UPLOAD, 0L); - HTTP_CURL_OPT(CURLOPT_HTTPGET, 1L); - } -} -/* }}} */ - -PHP_HTTP_API void _http_request_set_progress_callback(http_request *request, zval *cb) -{ - if (request->_progress_callback) { - zval_ptr_dtor(&request->_progress_callback); - } - if ((request->_progress_callback = cb)) { - ZVAL_ADDREF(cb); - HTTP_CURL_OPT(CURLOPT_NOPROGRESS, 0); - HTTP_CURL_OPT(CURLOPT_PROGRESSDATA, request); - HTTP_CURL_OPT(CURLOPT_PROGRESSFUNCTION, http_curl_progress_callback); - } else { - HTTP_CURL_OPT(CURLOPT_NOPROGRESS, 1); - HTTP_CURL_OPT(CURLOPT_PROGRESSDATA, NULL); - HTTP_CURL_OPT(CURLOPT_PROGRESSFUNCTION, NULL); - } -} - -/* {{{ STATUS http_request_prepare(http_request *, HashTable *) */ -PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *options) -{ - zval *zoption; - zend_bool range_req = 0; - http_request_storage *storage; - - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - - HTTP_CHECK_CURL_INIT(request->ch, http_curl_init(request), return FAILURE); - - if (!request->url) { - return FAILURE; - } - if (!(storage = http_request_storage_get(request->ch))) { - return FAILURE; - } - storage->errorbuffer[0] = '\0'; - /* set options */ - if (storage->url) { - pefree(storage->url, 1); - } - storage->url = pestrdup(request->url, 1); - HTTP_CURL_OPT(CURLOPT_URL, storage->url); - - /* progress callback */ - if ((zoption = http_request_option(request, options, "onprogress", -1))) { - http_request_set_progress_callback(request, zoption); - } - - /* proxy */ - if ((zoption = http_request_option(request, options, "proxyhost", IS_STRING))) { - HTTP_CURL_OPT(CURLOPT_PROXY, Z_STRVAL_P(zoption)); - /* type */ - if ((zoption = http_request_option(request, options, "proxytype", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_PROXYTYPE, Z_LVAL_P(zoption)); - } - /* port */ - if ((zoption = http_request_option(request, options, "proxyport", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_PROXYPORT, Z_LVAL_P(zoption)); - } - /* user:pass */ - if ((zoption = http_request_option(request, options, "proxyauth", IS_STRING)) && Z_STRLEN_P(zoption)) { - HTTP_CURL_OPT(CURLOPT_PROXYUSERPWD, Z_STRVAL_P(zoption)); - } - /* auth method */ - if ((zoption = http_request_option(request, options, "proxyauthtype", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_PROXYAUTH, Z_LVAL_P(zoption)); - } - /* tunnel */ - if ((zoption = http_request_option(request, options, "proxytunnel", IS_BOOL)) && Z_BVAL_P(zoption)) { - HTTP_CURL_OPT(CURLOPT_HTTPPROXYTUNNEL, 1L); - } - } -#if HTTP_CURL_VERSION(7,19,4) - if ((zoption = http_request_option(request, options, "noproxy", IS_STRING))) { - HTTP_CURL_OPT(CURLOPT_NOPROXY, Z_STRVAL_P(zoption)); - } -#endif - - /* dns */ - if ((zoption = http_request_option(request, options, "dns_cache_timeout", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_DNS_CACHE_TIMEOUT, Z_LVAL_P(zoption)); - } - if ((zoption = http_request_option(request, options, "ipresolve", IS_LONG)) && Z_LVAL_P(zoption)) { - HTTP_CURL_OPT(CURLOPT_IPRESOLVE, Z_LVAL_P(zoption)); - } - - /* limits */ - if ((zoption = http_request_option(request, options, "low_speed_limit", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_LOW_SPEED_LIMIT, Z_LVAL_P(zoption)); - } - if ((zoption = http_request_option(request, options, "low_speed_time", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_LOW_SPEED_TIME, Z_LVAL_P(zoption)); - } -#if HTTP_CURL_VERSION(7,15,5) - /* LSF weirdance - if ((zoption = http_request_option(request, options, "max_send_speed", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t) Z_LVAL_P(zoption)); - } - if ((zoption = http_request_option(request, options, "max_recv_speed", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t) Z_LVAL_P(zoption)); - } - */ -#endif - /* crashes - if ((zoption = http_request_option(request, options, "maxconnects", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_MAXCONNECTS, Z_LVAL_P(zoption)); - } */ - if ((zoption = http_request_option(request, options, "fresh_connect", IS_BOOL)) && Z_BVAL_P(zoption)) { - HTTP_CURL_OPT(CURLOPT_FRESH_CONNECT, 1L); - } - if ((zoption = http_request_option(request, options, "forbid_reuse", IS_BOOL)) && Z_BVAL_P(zoption)) { - HTTP_CURL_OPT(CURLOPT_FORBID_REUSE, 1L); - } - - /* outgoing interface */ - if ((zoption = http_request_option(request, options, "interface", IS_STRING))) { - HTTP_CURL_OPT(CURLOPT_INTERFACE, Z_STRVAL_P(zoption)); - -#if HTTP_CURL_VERSION(7,15,2) - if ((zoption = http_request_option(request, options, "portrange", IS_ARRAY))) { - zval **prs, **pre; - - zend_hash_internal_pointer_reset(Z_ARRVAL_P(zoption)); - if (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(zoption), (void *) &prs)) { - zend_hash_move_forward(Z_ARRVAL_P(zoption)); - if (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(zoption), (void *) &pre)) { - zval *prs_cpy = http_zsep(IS_LONG, *prs); - zval *pre_cpy = http_zsep(IS_LONG, *pre); - - if (Z_LVAL_P(prs_cpy) && Z_LVAL_P(pre_cpy)) { - HTTP_CURL_OPT(CURLOPT_LOCALPORT, MIN(Z_LVAL_P(prs_cpy), Z_LVAL_P(pre_cpy))); - HTTP_CURL_OPT(CURLOPT_LOCALPORTRANGE, labs(Z_LVAL_P(prs_cpy)-Z_LVAL_P(pre_cpy))+1L); - } - zval_ptr_dtor(&prs_cpy); - zval_ptr_dtor(&pre_cpy); - } - } - } -#endif - } - - /* another port */ - if ((zoption = http_request_option(request, options, "port", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_PORT, Z_LVAL_P(zoption)); - } - - /* RFC4007 zone_id */ -#if HTTP_CURL_VERSION(7,19,0) - if ((zoption = http_request_option(request, options, "address_scope", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_ADDRESS_SCOPE, Z_LVAL_P(zoption)); - } -#endif - - /* auth */ - if ((zoption = http_request_option(request, options, "httpauth", IS_STRING)) && Z_STRLEN_P(zoption)) { - HTTP_CURL_OPT(CURLOPT_USERPWD, Z_STRVAL_P(zoption)); - } - if ((zoption = http_request_option(request, options, "httpauthtype", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_HTTPAUTH, Z_LVAL_P(zoption)); - } - - /* redirects, defaults to 0 */ - if ((zoption = http_request_option(request, options, "redirect", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_FOLLOWLOCATION, Z_LVAL_P(zoption) ? 1L : 0L); - HTTP_CURL_OPT(CURLOPT_MAXREDIRS, Z_LVAL_P(zoption)); - if ((zoption = http_request_option(request, options, "unrestrictedauth", IS_BOOL))) { - HTTP_CURL_OPT(CURLOPT_UNRESTRICTED_AUTH, Z_LVAL_P(zoption)); - } -#if HTTP_CURL_VERSION(7,17,1) - if ((zoption = http_request_option(request, options, "postredir", IS_BOOL))) { -# if HTTP_CURL_VERSION(7,19,1) - HTTP_CURL_OPT(CURLOPT_POSTREDIR, Z_BVAL_P(zoption) ? 1L : 0L); -# else - HTTP_CURL_OPT(CURLOPT_POST301, Z_BVAL_P(zoption) ? 1L : 0L); -# endif - } -#endif - } - - /* retries, defaults to 0 */ - if ((zoption = http_request_option(request, options, "retrycount", IS_LONG))) { - request->_retry.count = Z_LVAL_P(zoption); - if ((zoption = http_request_option(request, options, "retrydelay", IS_DOUBLE))) { - request->_retry.delay = Z_DVAL_P(zoption); - } else { - request->_retry.delay = 0; - } - } else { - request->_retry.count = 0; - } - - /* referer */ - if ((zoption = http_request_option(request, options, "referer", IS_STRING)) && Z_STRLEN_P(zoption)) { - HTTP_CURL_OPT(CURLOPT_REFERER, Z_STRVAL_P(zoption)); - } - - /* useragent, default "PECL::HTTP/version (PHP/version)" */ - if ((zoption = http_request_option(request, options, "useragent", IS_STRING))) { - /* allow to send no user agent, not even default one */ - if (Z_STRLEN_P(zoption)) { - HTTP_CURL_OPT(CURLOPT_USERAGENT, Z_STRVAL_P(zoption)); - } else { - HTTP_CURL_OPT(CURLOPT_USERAGENT, NULL); - } - } - - /* resume */ - if ((zoption = http_request_option(request, options, "resume", IS_LONG)) && (Z_LVAL_P(zoption) > 0)) { - range_req = 1; - HTTP_CURL_OPT(CURLOPT_RESUME_FROM, Z_LVAL_P(zoption)); - } - /* or range of kind array(array(0,499), array(100,1499)) */ - else if ((zoption = http_request_option(request, options, "range", IS_ARRAY)) && zend_hash_num_elements(Z_ARRVAL_P(zoption))) { - HashPosition pos1, pos2; - zval **rr, **rb, **re; - phpstr rs; - - phpstr_init(&rs); - FOREACH_VAL(pos1, zoption, rr) { - if (Z_TYPE_PP(rr) == IS_ARRAY) { - zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(rr), &pos2); - if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(rr), (void *) &rb, &pos2)) { - zend_hash_move_forward_ex(Z_ARRVAL_PP(rr), &pos2); - if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(rr), (void *) &re, &pos2)) { - if ( ((Z_TYPE_PP(rb) == IS_LONG) || ((Z_TYPE_PP(rb) == IS_STRING) && is_numeric_string(Z_STRVAL_PP(rb), Z_STRLEN_PP(rb), NULL, NULL, 1))) && - ((Z_TYPE_PP(re) == IS_LONG) || ((Z_TYPE_PP(re) == IS_STRING) && is_numeric_string(Z_STRVAL_PP(re), Z_STRLEN_PP(re), NULL, NULL, 1)))) { - zval *rbl = http_zsep(IS_LONG, *rb); - zval *rel = http_zsep(IS_LONG, *re); - - if ((Z_LVAL_P(rbl) >= 0) && (Z_LVAL_P(rel) >= 0)) { - phpstr_appendf(&rs, "%ld-%ld,", Z_LVAL_P(rbl), Z_LVAL_P(rel)); - } - zval_ptr_dtor(&rbl); - zval_ptr_dtor(&rel); - } - } - } - } - } - - if (PHPSTR_LEN(&rs)) { - zval *cached_range; - - /* ditch last comma */ - PHPSTR_VAL(&rs)[PHPSTR_LEN(&rs)-- -1] = '\0'; - /* cache string */ - MAKE_STD_ZVAL(cached_range); - ZVAL_STRINGL(cached_range, PHPSTR_VAL(&rs), PHPSTR_LEN(&rs), 0); - HTTP_CURL_OPT(CURLOPT_RANGE, Z_STRVAL_P(http_request_option_cache(request, "range", cached_range))); - zval_ptr_dtor(&cached_range); - } - } - - /* additional headers, array('name' => 'value') */ - if (request->_cache.headers) { - curl_slist_free_all(request->_cache.headers); - request->_cache.headers = NULL; - } - if ((zoption = http_request_option(request, options, "headers", IS_ARRAY))) { - HashKey header_key = initHashKey(0); - zval **header_val; - HashPosition pos; - phpstr header; - - phpstr_init(&header); - FOREACH_KEYVAL(pos, zoption, header_key, header_val) { - if (header_key.type == HASH_KEY_IS_STRING) { - zval *header_cpy = http_zsep(IS_STRING, *header_val); - - if (!strcasecmp(header_key.str, "range")) { - range_req = 1; - } - - phpstr_appendf(&header, "%s: %s", header_key.str, Z_STRVAL_P(header_cpy)); - phpstr_fix(&header); - request->_cache.headers = curl_slist_append(request->_cache.headers, PHPSTR_VAL(&header)); - phpstr_reset(&header); - - zval_ptr_dtor(&header_cpy); - } - } - phpstr_dtor(&header); - } - /* etag */ - if ((zoption = http_request_option(request, options, "etag", IS_STRING)) && Z_STRLEN_P(zoption)) { - zend_bool is_quoted = !((Z_STRVAL_P(zoption)[0] != '"') || (Z_STRVAL_P(zoption)[Z_STRLEN_P(zoption)-1] != '"')); - phpstr header; - - phpstr_init(&header); - phpstr_appendf(&header, is_quoted?"%s: %s":"%s: \"%s\"", range_req?"If-Match":"If-None-Match", Z_STRVAL_P(zoption)); - phpstr_fix(&header); - request->_cache.headers = curl_slist_append(request->_cache.headers, PHPSTR_VAL(&header)); - phpstr_dtor(&header); - } - /* compression */ - if ((zoption = http_request_option(request, options, "compress", IS_BOOL)) && Z_LVAL_P(zoption)) { - request->_cache.headers = curl_slist_append(request->_cache.headers, "Accept-Encoding: gzip;q=1.0,deflate;q=0.5"); - } - HTTP_CURL_OPT(CURLOPT_HTTPHEADER, request->_cache.headers); - - /* lastmodified */ - if ((zoption = http_request_option(request, options, "lastmodified", IS_LONG))) { - if (Z_LVAL_P(zoption)) { - if (Z_LVAL_P(zoption) > 0) { - HTTP_CURL_OPT(CURLOPT_TIMEVALUE, Z_LVAL_P(zoption)); - } else { - HTTP_CURL_OPT(CURLOPT_TIMEVALUE, (long) HTTP_G->request.time + Z_LVAL_P(zoption)); - } - HTTP_CURL_OPT(CURLOPT_TIMECONDITION, (long) (range_req ? CURL_TIMECOND_IFUNMODSINCE : CURL_TIMECOND_IFMODSINCE)); - } else { - HTTP_CURL_OPT(CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE); - } - } - - /* cookies, array('name' => 'value') */ - if ((zoption = http_request_option(request, options, "cookies", IS_ARRAY))) { - phpstr_dtor(&request->_cache.cookies); - if (zend_hash_num_elements(Z_ARRVAL_P(zoption))) { - zval *urlenc_cookies = NULL; - /* check whether cookies should not be urlencoded; default is to urlencode them */ - if ((!(urlenc_cookies = http_request_option(request, options, "encodecookies", IS_BOOL))) || Z_BVAL_P(urlenc_cookies)) { - if (SUCCESS == http_urlencode_hash_recursive(HASH_OF(zoption), &request->_cache.cookies, "; ", lenof("; "), NULL, 0)) { - phpstr_fix(&request->_cache.cookies); - HTTP_CURL_OPT(CURLOPT_COOKIE, request->_cache.cookies.data); - } - } else { - HashPosition pos; - HashKey cookie_key = initHashKey(0); - zval **cookie_val; - - FOREACH_KEYVAL(pos, zoption, cookie_key, cookie_val) { - if (cookie_key.type == HASH_KEY_IS_STRING) { - zval *val = http_zsep(IS_STRING, *cookie_val); - phpstr_appendf(&request->_cache.cookies, "%s=%s; ", cookie_key.str, Z_STRVAL_P(val)); - zval_ptr_dtor(&val); - } - } - - phpstr_fix(&request->_cache.cookies); - if (PHPSTR_LEN(&request->_cache.cookies)) { - HTTP_CURL_OPT(CURLOPT_COOKIE, PHPSTR_VAL(&request->_cache.cookies)); - } - } - } - } - - /* don't load session cookies from cookiestore */ - if ((zoption = http_request_option(request, options, "cookiesession", IS_BOOL)) && Z_BVAL_P(zoption)) { - HTTP_CURL_OPT(CURLOPT_COOKIESESSION, 1L); - } - - /* cookiestore, read initial cookies from that file and store cookies back into that file */ - if ((zoption = http_request_option(request, options, "cookiestore", IS_STRING))) { - if (Z_STRLEN_P(zoption)) { - HTTP_CHECK_OPEN_BASEDIR(Z_STRVAL_P(zoption), return FAILURE); - } - if (storage->cookiestore) { - pefree(storage->cookiestore, 1); - } - storage->cookiestore = pestrndup(Z_STRVAL_P(zoption), Z_STRLEN_P(zoption), 1); - HTTP_CURL_OPT(CURLOPT_COOKIEFILE, storage->cookiestore); - HTTP_CURL_OPT(CURLOPT_COOKIEJAR, storage->cookiestore); - } - - /* maxfilesize */ - if ((zoption = http_request_option(request, options, "maxfilesize", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_MAXFILESIZE, Z_LVAL_P(zoption)); - } - - /* http protocol */ - if ((zoption = http_request_option(request, options, "protocol", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_HTTP_VERSION, Z_LVAL_P(zoption)); - } - -#if HTTP_CURL_VERSION(7,16,2) - /* timeout, defaults to 0 */ - if ((zoption = http_request_option(request, options, "timeout", IS_DOUBLE))) { - HTTP_CURL_OPT(CURLOPT_TIMEOUT_MS, (long)(Z_DVAL_P(zoption)*1000)); - } - /* connecttimeout, defaults to 0 */ - if ((zoption = http_request_option(request, options, "connecttimeout", IS_DOUBLE))) { - HTTP_CURL_OPT(CURLOPT_CONNECTTIMEOUT_MS, (long)(Z_DVAL_P(zoption)*1000)); - } -#else - /* timeout, defaults to 0 */ - if ((zoption = http_request_option(request, options, "timeout", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_TIMEOUT, Z_LVAL_P(zoption)); - } - /* connecttimeout, defaults to 0 */ - if ((zoption = http_request_option(request, options, "connecttimeout", IS_LONG))) { - HTTP_CURL_OPT(CURLOPT_CONNECTTIMEOUT, Z_LVAL_P(zoption)); - } -#endif - - /* ssl */ - if ((zoption = http_request_option(request, options, "ssl", IS_ARRAY))) { - HashKey key = initHashKey(0); - zval **param; - HashPosition pos; - - FOREACH_KEYVAL(pos, zoption, key, param) { - if (key.type == HASH_KEY_IS_STRING) { - HTTP_CURL_OPT_STRING(CURLOPT_SSLCERT, 0, 1); - HTTP_CURL_OPT_STRING(CURLOPT_SSLCERTTYPE, 0, 0); - HTTP_CURL_OPT_STRING(CURLOPT_SSLCERTPASSWD, 0, 0); - - HTTP_CURL_OPT_STRING(CURLOPT_SSLKEY, 0, 0); - HTTP_CURL_OPT_STRING(CURLOPT_SSLKEYTYPE, 0, 0); - HTTP_CURL_OPT_STRING(CURLOPT_SSLKEYPASSWD, 0, 0); - - HTTP_CURL_OPT_STRING(CURLOPT_SSLENGINE, 0, 0); - HTTP_CURL_OPT_LONG(CURLOPT_SSLVERSION, 0); - - HTTP_CURL_OPT_LONG(CURLOPT_SSL_VERIFYPEER, 1); - HTTP_CURL_OPT_LONG(CURLOPT_SSL_VERIFYHOST, 1); - HTTP_CURL_OPT_STRING(CURLOPT_SSL_CIPHER_LIST, 1, 0); - - HTTP_CURL_OPT_STRING(CURLOPT_CAINFO, -3, 1); - HTTP_CURL_OPT_STRING(CURLOPT_CAPATH, -3, 1); - HTTP_CURL_OPT_STRING(CURLOPT_RANDOM_FILE, -3, 1); - HTTP_CURL_OPT_STRING(CURLOPT_EGDSOCKET, -3, 1); -#if HTTP_CURL_VERSION(7,19,0) - HTTP_CURL_OPT_STRING(CURLOPT_ISSUERCERT, -3, 1); - #if defined(HTTP_HAVE_OPENSSL) - HTTP_CURL_OPT_STRING(CURLOPT_CRLFILE, -3, 1); - #endif -#endif -#if HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL) - HTTP_CURL_OPT_LONG(CURLOPT_CERTINFO, -3); -#endif - } - } - } - - /* request method */ - switch (request->meth) { - case HTTP_GET: - HTTP_CURL_OPT(CURLOPT_HTTPGET, 1L); - break; - - case HTTP_HEAD: - HTTP_CURL_OPT(CURLOPT_NOBODY, 1L); - break; - - case HTTP_POST: - HTTP_CURL_OPT(CURLOPT_POST, 1L); - break; - - case HTTP_PUT: - HTTP_CURL_OPT(CURLOPT_UPLOAD, 1L); - break; - - default: - if (http_request_method_exists(0, request->meth, NULL)) { - HTTP_CURL_OPT(CURLOPT_CUSTOMREQUEST, http_request_method_name(request->meth)); - } else { - http_error_ex(HE_WARNING, HTTP_E_REQUEST_METHOD, "Unsupported request method: %d (%s)", request->meth, request->url); - return FAILURE; - } - break; - } - - /* attach request body */ - if (request->body && (request->meth != HTTP_GET) && (request->meth != HTTP_HEAD) && (request->meth != HTTP_OPTIONS)) { - switch (request->body->type) { - case HTTP_REQUEST_BODY_EMPTY: - /* nothing */ - break; - - case HTTP_REQUEST_BODY_CURLPOST: - HTTP_CURL_OPT(CURLOPT_HTTPPOST, (struct curl_httppost *) request->body->data); - break; - - case HTTP_REQUEST_BODY_CSTRING: - if (request->meth != HTTP_PUT) { - HTTP_CURL_OPT(CURLOPT_POSTFIELDS, request->body->data); - HTTP_CURL_OPT(CURLOPT_POSTFIELDSIZE, request->body->size); - break; - } - /* fallthrough, PUT/UPLOAD _needs_ READDATA */ - case HTTP_REQUEST_BODY_UPLOADFILE: - HTTP_CURL_OPT(CURLOPT_IOCTLDATA, request); - HTTP_CURL_OPT(CURLOPT_READDATA, request); - HTTP_CURL_OPT(CURLOPT_INFILESIZE, request->body->size); - break; - - default: - /* shouldn't ever happen */ - http_error_ex(HE_ERROR, 0, "Unknown request body type: %d (%s)", request->body->type, request->url); - return FAILURE; - } - } - - return SUCCESS; -} -/* }}} */ - -/* {{{ void http_request_exec(http_request *) */ -PHP_HTTP_API void _http_request_exec(http_request *request) -{ - uint tries = 0; - CURLcode result; - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - -retry: - if (CURLE_OK != (result = curl_easy_perform(request->ch))) { - http_error_ex(HE_WARNING, HTTP_E_REQUEST, "%s; %s (%s)", curl_easy_strerror(result), http_request_storage_get(request->ch)->errorbuffer, request->url); -#ifdef ZEND_ENGINE_2 - if ((HTTP_G->only_exceptions || GLOBAL_ERROR_HANDLING == EH_THROW) && EG(exception)) { - add_property_long(EG(exception), "curlCode", result); - } -#endif - - if (request->_retry.count > tries++) { - switch (result) { - case CURLE_COULDNT_RESOLVE_PROXY: - case CURLE_COULDNT_RESOLVE_HOST: - case CURLE_COULDNT_CONNECT: - case CURLE_WRITE_ERROR: - case CURLE_READ_ERROR: - case CURLE_OPERATION_TIMEDOUT: - case CURLE_SSL_CONNECT_ERROR: - case CURLE_GOT_NOTHING: - case CURLE_SSL_ENGINE_SETFAILED: - case CURLE_SEND_ERROR: - case CURLE_RECV_ERROR: - case CURLE_SSL_ENGINE_INITFAILED: - case CURLE_LOGIN_DENIED: - if (request->_retry.delay >= HTTP_DIFFSEC) { - http_sleep(request->_retry.delay); - } - goto retry; - default: - break; - } - } - } -} -/* }}} */ - -/* {{{ static size_t http_curl_read_callback(void *, size_t, size_t, void *) */ -static size_t http_curl_read_callback(void *data, size_t len, size_t n, void *ctx) -{ - http_request *request = (http_request *) ctx; - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - - if (request->body) { - switch (request->body->type) { - case HTTP_REQUEST_BODY_CSTRING: - { - size_t out = MIN(len * n, request->body->size - request->body->priv); - - if (out) { - memcpy(data, ((char *) request->body->data) + request->body->priv, out); - request->body->priv += out; - return out; - } - break; - } - - case HTTP_REQUEST_BODY_UPLOADFILE: - return php_stream_read((php_stream *) request->body->data, data, len * n); - } - } - return 0; -} -/* }}} */ - -/* {{{ static int http_curl_progress_callback(void *, double, double, double, double) */ -static int http_curl_progress_callback(void *ctx, double dltotal, double dlnow, double ultotal, double ulnow) -{ - zval *param, retval; - http_request *request = (http_request *) ctx; - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - - INIT_PZVAL(&retval); - ZVAL_NULL(&retval); - - MAKE_STD_ZVAL(param); - array_init(param); - add_assoc_double(param, "dltotal", dltotal); - add_assoc_double(param, "dlnow", dlnow); - add_assoc_double(param, "ultotal", ultotal); - add_assoc_double(param, "ulnow", ulnow); - - with_error_handling(EH_NORMAL, NULL) { - request->_in_progress_cb = 1; - call_user_function(EG(function_table), NULL, request->_progress_callback, &retval, 1, ¶m TSRMLS_CC); - request->_in_progress_cb = 0; - } end_error_handling(); - - zval_ptr_dtor(¶m); - zval_dtor(&retval); - - return 0; -} -/* }}} */ - -/* {{{ static curlioerr http_curl_ioctl_callback(CURL *, curliocmd, void *) */ -static curlioerr http_curl_ioctl_callback(CURL *ch, curliocmd cmd, void *ctx) -{ - http_request *request = (http_request *) ctx; - TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - - if (cmd != CURLIOCMD_RESTARTREAD) { - return CURLIOE_UNKNOWNCMD; - } - - if (request->body) { - switch (request->body->type) { - case HTTP_REQUEST_BODY_CSTRING: - request->body->priv = 0; - return CURLIOE_OK; - break; - - case HTTP_REQUEST_BODY_UPLOADFILE: - if (SUCCESS == php_stream_rewind((php_stream *) request->body->data)) { - return CURLIOE_OK; - } - break; - } - } - - return CURLIOE_FAILRESTART; -} -/* }}} */ - -/* {{{ static int http_curl_raw_callback(CURL *, curl_infotype, char *, size_t, void *) */ -static int http_curl_raw_callback(CURL *ch, curl_infotype type, char *data, size_t length, void *ctx) -{ - http_request *request = (http_request *) ctx; - -#define EMPTY_HEADER(d, l) (!l || (l == 1 && d[0] == '\n') || (l == 2 && d[0] == '\r' && d[1] == '\n')) - switch (type) { - case CURLINFO_DATA_IN: - if (request->conv.last_type == CURLINFO_HEADER_IN) { - phpstr_appends(&request->conv.response, HTTP_CRLF); - } - phpstr_append(&request->conv.response, data, length); - break; - case CURLINFO_HEADER_IN: - if (!EMPTY_HEADER(data, length)) { - phpstr_append(&request->conv.response, data, length); - } - break; - case CURLINFO_DATA_OUT: - case CURLINFO_HEADER_OUT: - phpstr_append(&request->conv.request, data, length); - break; - default: - break; - } - -#if 0 - { - const char _sym[] = "><><><"; - if (type) { - for (fprintf(stderr, "%c ", _sym[type-1]); length--; data++) { - fprintf(stderr, HTTP_IS_CTYPE(print, *data)?"%c":"\\x%02X", (int) *data); - if (*data == '\n' && length) { - fprintf(stderr, "\n%c ", _sym[type-1]); - } - } - fprintf(stderr, "\n"); - } else { - fprintf(stderr, "# %s", data); - } - } -#endif - - if (type) { - request->conv.last_type = type; - } - return 0; -} -/* }}} */ - -/* {{{ static inline zval *http_request_option(http_request *, HashTable *, char *, size_t, int) */ -static inline zval *_http_request_option_ex(http_request *r, HashTable *options, char *key, size_t keylen, int type TSRMLS_DC) -{ - if (options) { - zval **zoption; - ulong h = zend_hash_func(key, keylen); - - if (SUCCESS == zend_hash_quick_find(options, key, keylen, h, (void *) &zoption)) { - zval *option, *cached; - - option = http_zsep(type, *zoption); - cached = http_request_option_cache_ex(r, key, keylen, h, option); - - zval_ptr_dtor(&option); - return cached; - } - } - - return NULL; -} -/* }}} */ - -/* {{{ static inline zval *http_request_option_cache(http_request *, char *key, zval *) */ -static inline zval *_http_request_option_cache_ex(http_request *r, char *key, size_t keylen, ulong h, zval *opt TSRMLS_DC) -{ - ZVAL_ADDREF(opt); - - if (h) { - zend_hash_quick_update(&r->_cache.options, key, keylen, h, &opt, sizeof(zval *), NULL); - } else { - zend_hash_update(&r->_cache.options, key, keylen, &opt, sizeof(zval *), NULL); - } - - return opt; -} -/* }}} */ - -/* {{{ static inline int http_request_cookies_enabled(http_request *) */ -static inline int _http_request_cookies_enabled(http_request *request) { - http_request_storage *st; - - if (request->ch && (st = http_request_storage_get(request->ch)) && st->cookiestore) { - /* cookies are enabled */ - return 1; - } - return 0; -} -/* }}} */ - -#endif /* HTTP_HAVE_CURL */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ - | ||
[+] | Deleted | pecl_http-1.7.4.tar.bz2/pecl_http-1.7.4/php_http.h ^ |
@@ -1,262 +0,0 @@ -/* - +--------------------------------------------------------------------+ - | PECL :: http | - +--------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the conditions mentioned | - | in the accompanying LICENSE file are met. | - +--------------------------------------------------------------------+ - | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> | - +--------------------------------------------------------------------+ -*/ - -/* $Id: php_http.h 324012 2012-03-08 08:44:32Z mike $ */ - -#ifndef PHP_EXT_HTTP_H -#define PHP_EXT_HTTP_H - -#define PHP_HTTP_VERSION "1.7.4" - -#ifdef HAVE_CONFIG_H -# include "config.h" -#else -# ifndef PHP_WIN32 -# include "php_config.h" -# endif -#endif - -#include "php.h" -#include "missing.h" -#include "php_http_std_defs.h" -#include "phpstr/phpstr.h" - -#ifdef HTTP_WANT_SAPI -# if PHP_API_VERSION > 20041225 -# define HTTP_HAVE_SAPI_RTIME -# endif -# include "SAPI.h" -#endif - -#ifdef HTTP_WANT_NETDB -# ifdef PHP_WIN32 -# define HTTP_HAVE_NETDB -# include <winsock2.h> -# elif defined(HAVE_NETDB_H) -# define HTTP_HAVE_NETDB -# include <netdb.h> -# ifdef HAVE_UNISTD_H -# include <unistd.h> -# endif -# endif -#endif - -#if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL) -# ifdef PHP_WIN32 -# include <winsock2.h> -# define CURL_STATICLIB -# endif -# include <curl/curl.h> -# define HTTP_CURL_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= (((x)<<16) + ((y)<<8) + (z))) -# -# if defined(HTTP_WANT_EVENT) && defined(HTTP_HAVE_EVENT) -# include <event.h> -# endif -#endif - -#if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC) -# if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC) -# define USE_MAGIC_STATIC -# endif -# include <magic.h> -#endif - -#if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB) -# include <zlib.h> -#endif - -#include <ctype.h> -#define HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c)) -#define HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c)) - -extern zend_module_entry http_module_entry; -#define phpext_http_ptr &http_module_entry - -extern int http_module_number; - -ZEND_BEGIN_MODULE_GLOBALS(http) - - struct _http_globals_etag { - char *mode; - void *ctx; - zend_bool started; - } etag; - - struct _http_globals_log { - char *cache; - char *redirect; - char *not_found; - char *allowed_methods; - char *composite; - } log; - - struct _http_globals_send { - double throttle_delay; - size_t buffer_size; - char *content_type; - char *unquoted_etag; - time_t last_modified; - struct _http_globals_send_deflate { - zend_bool response; - zend_bool start_auto; - long start_flags; - int encoding; - void *stream; - } deflate; - struct _http_globals_send_inflate { - zend_bool start_auto; - long start_flags; - void *stream; - } inflate; - zend_bool not_found_404; - } send; - - struct _http_globals_request { - time_t time; - HashTable *headers; - struct _http_globals_request_methods { - HashTable registered; - char *allowed; - char *custom; - } methods; -#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) - struct _http_globals_request_datashare { - zend_llist handles; - zend_bool cookie; - zend_bool dns; - zend_bool ssl; - zend_bool connect; - } datashare; -#endif -#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_EVENT) - struct _http_globals_request_pool { - struct _http_globals_request_pool_event { - void *base; - } event; - } pool; -#endif - } request; - - struct _http_globals_persistent { - struct _http_globals_persistent_handles { - ulong limit; - struct _http_globals_persistent_handles_ident { - ulong h; - char *s; - size_t l; - } ident; - } handles; - } persistent; - -#ifdef ZEND_ENGINE_2 - zend_bool only_exceptions; -#endif - - zend_bool force_exit; - zend_bool read_post_data; - zval *server_var; - -ZEND_END_MODULE_GLOBALS(http) - -ZEND_EXTERN_MODULE_GLOBALS(http); - -#ifdef ZTS -# include "TSRM.h" -# define HTTP_G ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)]) -#else -# define HTTP_G (&http_globals) -#endif - -#if defined(HAVE_ICONV) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV)) -# define HTTP_HAVE_ICONV -#endif - -#if defined(HAVE_PHP_SESSION) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_SESSION)) -# define HTTP_HAVE_SESSION -#endif - -#if defined(HAVE_HASH_EXT) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_HASH)) && defined(HTTP_HAVE_PHP_HASH_H) -# define HTTP_HAVE_HASH -#endif - -#if defined(HAVE_SPL) -# define HTTP_HAVE_SPL -#endif - -PHP_FUNCTION(http_date); -PHP_FUNCTION(http_build_url); -PHP_FUNCTION(http_build_str); -PHP_FUNCTION(http_negotiate_language); -PHP_FUNCTION(http_negotiate_charset); -PHP_FUNCTION(http_negotiate_content_type); -PHP_FUNCTION(http_negotiate); -PHP_FUNCTION(http_redirect); -PHP_FUNCTION(http_throttle); -PHP_FUNCTION(http_send_status); -PHP_FUNCTION(http_send_last_modified); -PHP_FUNCTION(http_send_content_type); -PHP_FUNCTION(http_send_content_disposition); -PHP_FUNCTION(http_match_modified); -PHP_FUNCTION(http_match_etag); -PHP_FUNCTION(http_cache_last_modified); -PHP_FUNCTION(http_cache_etag); -PHP_FUNCTION(http_send_data); -PHP_FUNCTION(http_send_file); -PHP_FUNCTION(http_send_stream); -PHP_FUNCTION(http_chunked_decode); -PHP_FUNCTION(http_parse_message); -PHP_FUNCTION(http_parse_headers); -PHP_FUNCTION(http_parse_cookie); -PHP_FUNCTION(http_build_cookie); -PHP_FUNCTION(http_parse_params); -PHP_FUNCTION(http_get_request_headers); -PHP_FUNCTION(http_get_request_body); -PHP_FUNCTION(http_get_request_body_stream); -PHP_FUNCTION(http_match_request_header); -PHP_FUNCTION(http_persistent_handles_count); -PHP_FUNCTION(http_persistent_handles_clean); -PHP_FUNCTION(http_persistent_handles_ident); -#ifdef HTTP_HAVE_CURL -PHP_FUNCTION(http_get); -PHP_FUNCTION(http_head); -PHP_FUNCTION(http_post_data); -PHP_FUNCTION(http_post_fields); -PHP_FUNCTION(http_put_data); -PHP_FUNCTION(http_put_file); -PHP_FUNCTION(http_put_stream); -PHP_FUNCTION(http_request); -PHP_FUNCTION(http_request_body_encode); -#endif /* HTTP_HAVE_CURL */ -PHP_FUNCTION(http_request_method_register); -PHP_FUNCTION(http_request_method_unregister); -PHP_FUNCTION(http_request_method_exists); -PHP_FUNCTION(http_request_method_name); -PHP_FUNCTION(ob_etaghandler); -#ifdef HTTP_HAVE_ZLIB -PHP_FUNCTION(http_deflate); -PHP_FUNCTION(http_inflate); -PHP_FUNCTION(ob_deflatehandler); -PHP_FUNCTION(ob_inflatehandler); -#endif -PHP_FUNCTION(http_support); - -#endif /* PHP_HTTP_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ - | ||
[+] | Deleted | pecl_http-1.7.4.tar.bz2/pecl_http-1.7.4/php_http_api.h ^ |
@@ -1,326 +0,0 @@ -/* - +--------------------------------------------------------------------+ - | PECL :: http | - +--------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the conditions mentioned | - | in the accompanying LICENSE file are met. | - +--------------------------------------------------------------------+ - | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> | - +--------------------------------------------------------------------+ -*/ - -/* $Id: php_http_api.h 323304 2012-02-17 21:13:24Z mike $ */ - -#ifndef PHP_HTTP_API_H -#define PHP_HTTP_API_H - -#define HTTP_SUPPORT 0x01L -#define HTTP_SUPPORT_REQUESTS 0x02L -#define HTTP_SUPPORT_MAGICMIME 0x04L -#define HTTP_SUPPORT_ENCODINGS 0x08L -#define HTTP_SUPPORT_SSLREQUESTS 0x20L -#define HTTP_SUPPORT_PERSISTENCE 0x40L -#define HTTP_SUPPORT_EVENTS 0x80L - -#define HTTP_PARAMS_ALLOW_COMMA 0x01 -#define HTTP_PARAMS_ALLOW_FAILURE 0x02 -#define HTTP_PARAMS_RAISE_ERROR 0x04 -#define HTTP_PARAMS_DEFAULT (HTTP_PARAMS_ALLOW_COMMA|HTTP_PARAMS_ALLOW_FAILURE|HTTP_PARAMS_RAISE_ERROR) -#define HTTP_PARAMS_COLON_SEPARATOR 0x10 - -extern PHP_MINIT_FUNCTION(http_support); - -#define http_support(f) _http_support(f) -PHP_HTTP_API long _http_support(long feature); - -#define pretty_key(key, key_len, uctitle, xhyphen) _http_pretty_key(key, key_len, uctitle, xhyphen) -extern char *_http_pretty_key(char *key, size_t key_len, zend_bool uctitle, zend_bool xhyphen); - -#define http_boundary(b, l) _http_boundary((b), (l) TSRMLS_CC) -extern size_t _http_boundary(char *buf, size_t len TSRMLS_DC); - -#define http_error(type, code, string) _http_error_ex(type, code, "%s", string) -#define http_error_ex _http_error_ex -extern void _http_error_ex(long type TSRMLS_DC, long code, const char *format, ...); - - -#ifdef ZEND_ENGINE_2 -#define http_exception_wrap(o, n, ce) _http_exception_wrap((o), (n), (ce) TSRMLS_CC) -extern zval *_http_exception_wrap(zval *old_exception, zval *new_exception, zend_class_entry *ce TSRMLS_DC); - -#define http_try \ -{ \ - zval *old_exception = EG(exception); \ - EG(exception) = NULL; -#define http_catch(ex_ce) \ - if (EG(exception) && old_exception) { \ - EG(exception) = http_exception_wrap(old_exception, EG(exception), ex_ce); \ - } \ -} -#define http_final(ex_ce) \ - if (EG(exception)) { \ - EG(exception) = http_exception_wrap(EG(exception), NULL, ex_ce); \ - } - -typedef zend_object_value (*http_object_new_t)(zend_class_entry *ce, void *, void ** TSRMLS_DC); - -#define http_object_new(ov, cn, cl, co, ce, i, pp) _http_object_new((ov), (cn), (cl), (http_object_new_t) (co), (ce), (i), (void *) (pp) TSRMLS_CC) -extern STATUS _http_object_new(zend_object_value *ov, const char *cname_str, uint cname_len, http_object_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC); -#endif /* ZEND_ENGINE_2 */ - - -#define HTTP_CHECK_CURL_INIT(ch, init, action) \ - if ((!(ch)) && (!((ch) = init))) { \ - http_error(HE_WARNING, HTTP_E_REQUEST, "Could not initialize curl"); \ - action; \ - } -#define HTTP_CHECK_CONTENT_TYPE(ct, action) \ - if (!strchr((ct), '/')) { \ - http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, \ - "Content type \"%s\" does not seem to contain a primary and a secondary part", (ct)); \ - action; \ - } -#define HTTP_CHECK_MESSAGE_TYPE_RESPONSE(msg, action) \ - if (!HTTP_MSG_TYPE(RESPONSE, (msg))) { \ - http_error(HE_NOTICE, HTTP_E_MESSAGE_TYPE, "HttpMessage is not of type HTTP_MSG_RESPONSE"); \ - action; \ - } -#define HTTP_CHECK_MESSAGE_TYPE_REQUEST(msg, action) \ - if (!HTTP_MSG_TYPE(REQUEST, (msg))) { \ - http_error(HE_NOTICE, HTTP_E_MESSAGE_TYPE, "HttpMessage is not of type HTTP_MSG_REQUEST"); \ - action; \ - } -#define HTTP_CHECK_GZIP_LEVEL(level, action) \ - if (level < -1 || level > 9) { \ - http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid compression level (-1 to 9): %d", level); \ - action; \ - } -#ifndef PHP_OUTPUT_NEWAPI -# define HTTP_GET_OUTPUT_START() \ - char *output_start_filename = php_get_output_start_filename(TSRMLS_C); \ - int output_start_lineno = php_get_output_start_lineno(TSRMLS_C) -#else -# define HTTP_GET_OUTPUT_START() \ - char *output_start_filename = php_output_get_start_filename(TSRMLS_C); \ - int output_start_lineno = php_output_get_start_lineno(TSRMLS_C) -#endif -#define HTTP_CHECK_HEADERS_SENT(action) \ - if (SG(headers_sent) && !SG(request_info).no_headers) { \ - HTTP_GET_OUTPUT_START(); \ - if (output_start_filename) { \ - http_error_ex(HE_WARNING, HTTP_E_HEADER, "Cannot modify header information - headers already sent by (output started at %s:%d)", \ - output_start_filename, output_start_lineno); \ - } else { \ - http_error(HE_WARNING, HTTP_E_HEADER, "Cannot modify header information - headers already sent"); \ - } \ - action; \ - } - -#define http_log(f, i, m) _http_log_ex((f), (i), (m) TSRMLS_CC) -extern void _http_log_ex(char *file, const char *ident, const char *message TSRMLS_DC); - -#define http_exit(s, h) http_exit_ex((s), (h), NULL, 1) -#define http_exit_ex(s, h, b, e) _http_exit_ex((s), (h), (b), (e) TSRMLS_CC) -extern STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header TSRMLS_DC); - -#define http_check_method(m) http_check_method_ex((m), HTTP_KNOWN_METHODS) -#define http_check_method_ex(m, a) _http_check_method_ex((m), (a)) -extern STATUS _http_check_method_ex(const char *method, const char *methods); - -#define http_got_server_var(v) (NULL != http_get_server_var_ex((v), strlen(v), 1)) -#define http_get_server_var(v, c) http_get_server_var_ex((v), strlen(v), (c)) -#define http_get_server_var_ex(v, l, c) _http_get_server_var_ex((v), (l), (c) TSRMLS_CC) -PHP_HTTP_API zval *_http_get_server_var_ex(const char *key, size_t key_len, zend_bool check TSRMLS_DC); - -#define http_get_request_body(b, l) _http_get_request_body_ex((b), (l), 1 TSRMLS_CC) -#define http_get_request_body_ex(b, l, d) _http_get_request_body_ex((b), (l), (d) TSRMLS_CC) -PHP_HTTP_API STATUS _http_get_request_body_ex(char **body, size_t *length, zend_bool dup TSRMLS_DC); - -#define http_get_request_body_stream() _http_get_request_body_stream(TSRMLS_C) -PHP_HTTP_API php_stream *_http_get_request_body_stream(TSRMLS_D); - - -typedef void (*http_parse_params_callback)(void *cb_arg, const char *key, int keylen, const char *val, int vallen TSRMLS_DC); - -#define http_parse_params_default_callback _http_parse_params_default_callback -PHP_HTTP_API void _http_parse_params_default_callback(void *ht, const char *key, int keylen, const char *val, int vallen TSRMLS_DC); - -#define http_parse_params(s, f, ht) _http_parse_params_ex((s), (f), _http_parse_params_default_callback, (ht) TSRMLS_CC) -#define http_parse_params_ex(s, f, cb, a) _http_parse_params_ex((s), (f), (cb), (a) TSRMLS_CC) -PHP_HTTP_API STATUS _http_parse_params_ex(const char *params, int flags, http_parse_params_callback cb, void *cb_arg TSRMLS_DC); - - -#define http_sleep(s) _http_sleep(s) -static inline void _http_sleep(double s) -{ -#define HTTP_DIFFSEC (0.001) -#define HTTP_MLLISEC (1000) -#define HTTP_MCROSEC (1000 * 1000) -#define HTTP_NANOSEC (1000 * 1000 * 1000) -#define HTTP_MSEC(s) ((long)(s * HTTP_MLLISEC)) -#define HTTP_USEC(s) ((long)(s * HTTP_MCROSEC)) -#define HTTP_NSEC(s) ((long)(s * HTTP_NANOSEC)) - -#if defined(PHP_WIN32) - Sleep((DWORD) HTTP_MSEC(s)); -#elif defined(HAVE_USLEEP) - usleep(HTTP_USEC(s)); -#elif defined(HAVE_NANOSLEEP) - struct timespec req, rem; - - req.tv_sec = (time_t) s; - req.tv_nsec = HTTP_NSEC(s) % HTTP_NANOSEC; - - while (nanosleep(&req, &rem) && (errno == EINTR) && (HTTP_NSEC(rem.tv_sec) + rem.tv_nsec) > HTTP_NSEC(HTTP_DIFFSEC))) { - req.tv_sec = rem.tv_sec; - req.tv_nsec = rem.tv_nsec; - } -#else - struct timeval timeout; - - timeout.tv.sec = (time_t) s; - timeout.tv_usec = HTTP_USEC(s) % HTTP_MCROSEC; - - select(0, NULL, NULL, NULL, &timeout); -#endif -} - -#define http_locate_str _http_locate_str -static inline const char *_http_locate_str(const char *h, size_t h_len, const char *n, size_t n_len) -{ - const char *p, *e; - - if (n_len && h_len) { - e = h + h_len; - do { - if (*h == *n) { - for (p = n; *p == h[p-n]; ++p) { - if (p == n+n_len-1) { - return h; - } - } - } - } while (h++ != e); - } - - return NULL; -} - -#define http_locate_body _http_locate_body -static inline const char *_http_locate_body(const char *message) -{ - const char *body = NULL, *msg = message; - - while (*msg) { - if (*msg == '\n') { - if (*(msg+1) == '\n') { - body = msg + 2; - break; - } else if (*(msg+1) == '\r' && *(msg+2) == '\n') { - body = msg + 3; - break; - } - } - ++msg; - } - return body; -} - -#define http_locate_eol _http_locate_eol -static inline const char *_http_locate_eol(const char *line, int *eol_len) -{ - const char *eol = strpbrk(line, "\r\n"); - - if (eol_len) { - *eol_len = eol ? ((eol[0] == '\r' && eol[1] == '\n') ? 2 : 1) : 0; - } - return eol; -} - -#define http_zset(t, z) _http_zset((t), (z)) -static inline zval *_http_zset(int type, zval *z) -{ - if (Z_TYPE_P(z) != type) { - switch (type) { - case IS_NULL: convert_to_null(z); break; - case IS_BOOL: convert_to_boolean(z); break; - case IS_LONG: convert_to_long(z); break; - case IS_DOUBLE: convert_to_double(z); break; - case IS_STRING: convert_to_string(z); break; - case IS_ARRAY: convert_to_array(z); break; - case IS_OBJECT: convert_to_object(z); break; - } - } - return z; -} -#define http_zsep(t, z) _http_zsep_ex((t), (z), NULL) -#define http_zsep_ex(t, z, p) _http_zsep_ex((t), (z), (p)) -static inline zval *_http_zsep_ex(int type, zval *z, zval **p) { - ZVAL_ADDREF(z); - if (Z_TYPE_P(z) != type) { - switch (type) { - case IS_NULL: convert_to_null_ex(&z); break; - case IS_BOOL: convert_to_boolean_ex(&z); break; - case IS_LONG: convert_to_long_ex(&z); break; - case IS_DOUBLE: convert_to_double_ex(&z); break; - case IS_STRING: convert_to_string_ex(&z); break; - case IS_ARRAY: convert_to_array_ex(&z); break; - case IS_OBJECT: convert_to_object_ex(&z); break; - } - } else { - SEPARATE_ZVAL_IF_NOT_REF(&z); - } - if (p) { - *p = z; - } - return z; -} - -typedef struct _HashKey { - char *str; - uint len; - ulong num; - uint dup:1; - uint type:31; -} HashKey; -#define initHashKey(dup) {NULL, 0, 0, (dup), 0} - -#define FOREACH_VAL(pos, array, val) FOREACH_HASH_VAL(pos, Z_ARRVAL_P(array), val) -#define FOREACH_HASH_VAL(pos, hash, val) \ - for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \ - zend_hash_get_current_data_ex(hash, (void *) &val, &pos) == SUCCESS; \ - zend_hash_move_forward_ex(hash, &pos)) - -#define FOREACH_KEY(pos, array, key) FOREACH_HASH_KEY(pos, Z_ARRVAL_P(array), key) -#define FOREACH_HASH_KEY(pos, hash, _key) \ - for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \ - ((_key).type = zend_hash_get_current_key_ex(hash, &(_key).str, &(_key).len, &(_key).num, (zend_bool) (_key).dup, &pos)) != HASH_KEY_NON_EXISTANT; \ - zend_hash_move_forward_ex(hash, &pos)) \ - -#define FOREACH_KEYVAL(pos, array, key, val) FOREACH_HASH_KEYVAL(pos, Z_ARRVAL_P(array), key, val) -#define FOREACH_HASH_KEYVAL(pos, hash, _key, val) \ - for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \ - ((_key).type = zend_hash_get_current_key_ex(hash, &(_key).str, &(_key).len, &(_key).num, (zend_bool) (_key).dup, &pos)) != HASH_KEY_NON_EXISTANT && \ - zend_hash_get_current_data_ex(hash, (void *) &val, &pos) == SUCCESS; \ - zend_hash_move_forward_ex(hash, &pos)) - -#define array_copy(src, dst) zend_hash_copy(dst, src, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)) -#define ARRAY_JOIN_STRONLY 1 -#define ARRAY_JOIN_PRETTIFY 2 -#define array_join(src, dst, append, flags) zend_hash_apply_with_arguments(src HTTP_ZAPI_HASH_TSRMLS_CC, (append)?apply_array_append_func:apply_array_merge_func, 2, dst, (int)flags) - -extern int apply_array_append_func(void *pDest HTTP_ZAPI_HASH_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); -extern int apply_array_merge_func(void *pDest HTTP_ZAPI_HASH_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ - | ||
[+] | Deleted | pecl_http-1.7.4.tar.bz2/pecl_http-1.7.4/tests/HttpRequest_007.phpt ^ |
@@ -1,63 +0,0 @@ ---TEST-- -HttpRequest PUT ---SKIPIF-- -<?php -include 'skip.inc'; -checkcls('HttpRequest'); -?> ---FILE-- -<?php -echo "-TEST\n"; - -$r = new HttpRequest('http://dev.iworks.at/ext-http/.print_put.php5', HTTP_METH_PUT); -$r->recordHistory = true; -$r->addHeaders(array('content-type' => 'text/plain')); -$r->setPutFile(__FILE__); -$r->send(); -var_dump($r->getHistory()->toString(true)); -echo "Done\n"; -?> ---EXPECTF-- -%aTEST -string(%d) "PUT /ext-http/.print_put.php5 HTTP/1.1 -User-Agent: PECL::HTTP/%a -Host: dev.iworks.at -Accept: */* -Content-Type: text/plain -Content-Length: %d -Expect: 100-continue - -<?php -echo "-TEST\n"; - -$r = new HttpRequest('http://dev.iworks.at/ext-http/.print_put.php5', HTTP_METH_PUT); -$r->recordHistory = true; -$r->addHeaders(array('content-type' => 'text/plain')); -$r->setPutFile(__FILE__); -$r->send(); -var_dump($r->getHistory()->toString(true)); -echo "Done\n"; -?> - -HTTP/1.1 100 Continue -HTTP/1.1 200 OK -Date: %a -Server: %a -Vary: Accept-Encoding -Content-Length: %d -Content-Type: text/html - -<?php -echo "-TEST\n"; - -$r = new HttpRequest('http://dev.iworks.at/ext-http/.print_put.php5', HTTP_METH_PUT); -$r->recordHistory = true; -$r->addHeaders(array('content-type' => 'text/plain')); -$r->setPutFile(__FILE__); -$r->send(); -var_dump($r->getHistory()->toString(true)); -echo "Done\n"; -?> - -" -Done | ||
[+] | Deleted | pecl_http-1.7.4.tar.bz2/pecl_http-1.7.4/tests/request_gzip.phpt ^ |
@@ -1,51 +0,0 @@ ---TEST-- -GZIP request ---SKIPIF-- -<?php -include 'skip.inc'; -checkurl('dev.iworks.at'); -skipif(!http_support(HTTP_SUPPORT_REQUESTS), 'need curl support'); -?> ---FILE-- -<?php -echo "-TEST\n"; - -var_dump(http_parse_message(http_get('http://dev.iworks.at/ext-http/.print_request.php?gzip=1', array('compress' => true)))); - -echo "Done\n"; ---EXPECTF-- -%aTEST -object(stdClass)%a { - ["type"]=> - int(2) - ["httpVersion"]=> - float(1.1) - ["responseCode"]=> - int(200) - ["responseStatus"]=> - string(2) "OK" - ["headers"]=> - array(%d) { - %a - ["Vary"]=> - string(15) "Accept-Encoding" - ["Content-Length"]=> - string(2) "26" - ["Content-Type"]=> - string(9) "text/html" - ["X-Original-Content-Encoding"]=> - string(4) "gzip" - ["X-Original-Content-Length"]=> - string(2) "51" - } - ["body"]=> - string(26) "Array -( - [gzip] => 1 -) -" - ["parentMessage"]=> - NULL -} -Done - | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/package.xml ^ |
@@ -19,10 +19,10 @@ <email>mike@php.net</email> <active>yes</active> </lead> - <date>2012-04-02</date> - <time>09:41:50</time> + <date>2013-03-03</date> + <time>07:15:01</time> <version> - <release>1.7.4</release> + <release>1.7.5</release> <api>1.7.0</api> </version> <stability> @@ -31,7 +31,7 @@ </stability> <license>BSD, revised</license> <notes> -* Fixed Bug #61372 (build fails with "undefined symbol Z_ADDREF_P) +* Fixed Bug #64310 (weak etags W/"abc" are quoted as "W/"abc"") </notes> <contents> <dir name="/"> @@ -92,7 +92,7 @@ <file md5sum="18de009f52c1b700c051e56d1b4cf171" name="tests/HttpRequest_004.phpt" role="test" /> <file md5sum="d46d38bfcf4f5be07765232fec89e7f8" name="tests/HttpRequest_005.phpt" role="test" /> <file md5sum="0e7c9a69f0a50dac5c5a88d8e23416f9" name="tests/HttpRequest_006.phpt" role="test" /> - <file md5sum="94cc098ede2c66c2f65716bfda5d7e88" name="tests/HttpRequest_007.phpt" role="test" /> + <file md5sum="41687db50f870bcb032413e054fe6b1a" name="tests/HttpRequest_007.phpt" role="test" /> <file md5sum="9878c6353e1ef849aea82214078e7c9b" name="tests/HttpRequest_008.phpt" role="test" /> <file md5sum="0483b9580d3c1976b00fb850c2edf645" name="tests/HttpRequest_009.phpt" role="test" /> <file md5sum="da3c2f2514f84d51bc3b05c9680d7852" name="tests/HttpRequest_010.phpt" role="test" /> @@ -134,7 +134,7 @@ <file md5sum="3f13f9ac0932e5169b12c1d9ec69c72d" name="tests/redirect_013.phpt" role="test" /> <file md5sum="93823bb27d8a52dfc5393d698cf1f936" name="tests/request_cookies.phpt" role="test" /> <file md5sum="4128e694fbffde7db58f238cd76a856d" name="tests/request_etag.phpt" role="test" /> - <file md5sum="28affbbc0310d97611fda87fad8b5dc2" name="tests/request_gzip.phpt" role="test" /> + <file md5sum="5a20e767240a726057a230cc5545db2d" name="tests/request_gzip.phpt" role="test" /> <file md5sum="f50d4d9d1f7bc7208041254e3d7ca82a" name="tests/request_methods.phpt" role="test" /> <file md5sum="cfde1b9b21d5e468adeddcbaeed5bb27" name="tests/request_put_data.phpt" role="test" /> <file md5sum="1610dc88736fd93d4706982dffb2bdcc" name="tests/send_data_001.phpt" role="test" /> @@ -171,9 +171,9 @@ <file md5sum="4651b8f10cac719b18f1f3d70bc509f7" name="Makefile.frag" role="src" /> <file md5sum="5ccf12d575c0eb4ef316ed9c491a9b21" name="missing.h" role="src" /> <file md5sum="c2a9dc699482caf44122e26f823cb906" name="missing.c" role="src" /> - <file md5sum="c3029891460b1af5c9ed5a0efb4ddf3a" name="php_http.h" role="src" /> + <file md5sum="53acc65e5206c83f5ddab34cb145fe7f" name="php_http.h" role="src" /> <file md5sum="388b6779d20b33c4d5e92d858c86f880" name="php_http_std_defs.h" role="src" /> - <file md5sum="e4c84cc82f574a220a49d74f114b3038" name="php_http_api.h" role="src" /> + <file md5sum="fb69ee5b3e11a0395e7d3d4d46d4a39f" name="php_http_api.h" role="src" /> <file md5sum="49213f4828106819dd3ebb6ef2dcbc5a" name="php_http_cache_api.h" role="src" /> <file md5sum="c59363a76ea8ff7f8d512158831cf297" name="php_http_cookie_api.h" role="src" /> <file md5sum="b6132ac2d92a3865e2c575889b2d8e9c" name="php_http_date_api.h" role="src" /> @@ -215,7 +215,7 @@ <file md5sum="9a9e7c4bace7fc8cf71cff11e4b3a3a4" name="http_message_api.c" role="src" /> <file md5sum="34bfff1201c388e5eed086da1df05ec8" name="http_persistent_handle_api.c" role="src" /> <file md5sum="478c6fdb9733ff69f947de10c1158f72" name="http_querystring_api.c" role="src" /> - <file md5sum="afb824b727a76145881635ac83aacfe6" name="http_request_api.c" role="src" /> + <file md5sum="52ec7895789aeb466dbaa069bf3ede5c" name="http_request_api.c" role="src" /> <file md5sum="535af2976eec4ca4f2c002d90bc850de" name="http_request_info.c" role="src" /> <file md5sum="a31d61a0ee7d00e4388f04bb38659001" name="http_request_body_api.c" role="src" /> <file md5sum="7e1eeb6179270a2a5ba874c702fe8f09" name="http_request_datashare_api.c" role="src" /> | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/CREDITS ^ |
(renamed from pecl_http-1.7.4/CREDITS) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/CREDITS ^ |
(renamed from pecl_http-1.7.4/CREDITS) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/KnownIssues.txt ^ |
(renamed from pecl_http-1.7.4/KnownIssues.txt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/KnownIssues.txt ^ |
(renamed from pecl_http-1.7.4/KnownIssues.txt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/LICENSE ^ |
(renamed from pecl_http-1.7.4/LICENSE) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/LICENSE ^ |
(renamed from pecl_http-1.7.4/LICENSE) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/Makefile.frag ^ |
(renamed from pecl_http-1.7.4/Makefile.frag) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/Makefile.frag ^ |
(renamed from pecl_http-1.7.4/Makefile.frag) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/ThanksTo.txt ^ |
(renamed from pecl_http-1.7.4/ThanksTo.txt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/ThanksTo.txt ^ |
(renamed from pecl_http-1.7.4/ThanksTo.txt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/config.m4 ^ |
(renamed from pecl_http-1.7.4/config.m4) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/config.m4 ^ |
(renamed from pecl_http-1.7.4/config.m4) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/config.w32 ^ |
(renamed from pecl_http-1.7.4/config.w32) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/config.w32 ^ |
(renamed from pecl_http-1.7.4/config.w32) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/config9.m4 ^ |
(renamed from pecl_http-1.7.4/config9.m4) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/config9.m4 ^ |
(renamed from pecl_http-1.7.4/config9.m4) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/docs/examples/tutorial.txt ^ |
(renamed from pecl_http-1.7.4/docs/examples/tutorial.txt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/docs/examples/tutorial.txt ^ |
(renamed from pecl_http-1.7.4/docs/examples/tutorial.txt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/docs/http.ini ^ |
(renamed from pecl_http-1.7.4/docs/http.ini) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/docs/http.ini ^ |
(renamed from pecl_http-1.7.4/docs/http.ini) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http.c ^ |
(renamed from pecl_http-1.7.4/http.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http.c ^ |
(renamed from pecl_http-1.7.4/http.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http.dsp ^ |
(renamed from pecl_http-1.7.4/http.dsp) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http.dsp ^ |
(renamed from pecl_http-1.7.4/http.dsp) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_api.c ^ |
(renamed from pecl_http-1.7.4/http_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_api.c ^ |
(renamed from pecl_http-1.7.4/http_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_cache_api.c ^ |
(renamed from pecl_http-1.7.4/http_cache_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_cache_api.c ^ |
(renamed from pecl_http-1.7.4/http_cache_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_cookie_api.c ^ |
(renamed from pecl_http-1.7.4/http_cookie_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_cookie_api.c ^ |
(renamed from pecl_http-1.7.4/http_cookie_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_date_api.c ^ |
(renamed from pecl_http-1.7.4/http_date_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_date_api.c ^ |
(renamed from pecl_http-1.7.4/http_date_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_deflatestream_object.c ^ |
(renamed from pecl_http-1.7.4/http_deflatestream_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_deflatestream_object.c ^ |
(renamed from pecl_http-1.7.4/http_deflatestream_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_encoding_api.c ^ |
(renamed from pecl_http-1.7.4/http_encoding_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_encoding_api.c ^ |
(renamed from pecl_http-1.7.4/http_encoding_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_exception_object.c ^ |
(renamed from pecl_http-1.7.4/http_exception_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_exception_object.c ^ |
(renamed from pecl_http-1.7.4/http_exception_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_filter_api.c ^ |
(renamed from pecl_http-1.7.4/http_filter_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_filter_api.c ^ |
(renamed from pecl_http-1.7.4/http_filter_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_functions.c ^ |
(renamed from pecl_http-1.7.4/http_functions.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_functions.c ^ |
(renamed from pecl_http-1.7.4/http_functions.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_headers_api.c ^ |
(renamed from pecl_http-1.7.4/http_headers_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_headers_api.c ^ |
(renamed from pecl_http-1.7.4/http_headers_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_inflatestream_object.c ^ |
(renamed from pecl_http-1.7.4/http_inflatestream_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_inflatestream_object.c ^ |
(renamed from pecl_http-1.7.4/http_inflatestream_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_info_api.c ^ |
(renamed from pecl_http-1.7.4/http_info_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_info_api.c ^ |
(renamed from pecl_http-1.7.4/http_info_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_message_api.c ^ |
(renamed from pecl_http-1.7.4/http_message_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_message_api.c ^ |
(renamed from pecl_http-1.7.4/http_message_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_message_object.c ^ |
(renamed from pecl_http-1.7.4/http_message_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_message_object.c ^ |
(renamed from pecl_http-1.7.4/http_message_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_persistent_handle_api.c ^ |
(renamed from pecl_http-1.7.4/http_persistent_handle_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_persistent_handle_api.c ^ |
(renamed from pecl_http-1.7.4/http_persistent_handle_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_querystring_api.c ^ |
(renamed from pecl_http-1.7.4/http_querystring_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_querystring_api.c ^ |
(renamed from pecl_http-1.7.4/http_querystring_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_querystring_object.c ^ |
(renamed from pecl_http-1.7.4/http_querystring_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_querystring_object.c ^ |
(renamed from pecl_http-1.7.4/http_querystring_object.c) | ||
[+] | Added | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_api.c ^ |
@@ -0,0 +1,1343 @@ +/* + +--------------------------------------------------------------------+ + | PECL :: http | + +--------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met. | + +--------------------------------------------------------------------+ + | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> | + +--------------------------------------------------------------------+ +*/ + +/* $Id: http_request_api.c 329618 2013-03-02 20:13:19Z mike $ */ + +#define HTTP_WANT_SAPI +#define HTTP_WANT_CURL +#include "php_http.h" + +#ifdef HTTP_HAVE_CURL + +#include "php_http_api.h" +#include "php_http_persistent_handle_api.h" +#include "php_http_request_api.h" +#include "php_http_url_api.h" + +#ifdef ZEND_ENGINE_2 +# include "php_http_request_object.h" +#endif + +#include "php_http_request_int.h" + +/* {{{ cruft for thread safe SSL crypto locks */ +#ifdef HTTP_NEED_OPENSSL_TSL +static MUTEX_T *http_openssl_tsl = NULL; + +static void http_openssl_thread_lock(int mode, int n, const char * file, int line) +{ + if (mode & CRYPTO_LOCK) { + tsrm_mutex_lock(http_openssl_tsl[n]); + } else { + tsrm_mutex_unlock(http_openssl_tsl[n]); + } +} + +static ulong http_openssl_thread_id(void) +{ + return (ulong) tsrm_thread_id(); +} +#endif +#ifdef HTTP_NEED_GNUTLS_TSL +static int http_gnutls_mutex_create(void **m) +{ + if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) { + return SUCCESS; + } else { + return FAILURE; + } +} + +static int http_gnutls_mutex_destroy(void **m) +{ + tsrm_mutex_free(*((MUTEX_T *) m)); + return SUCCESS; +} + +static int http_gnutls_mutex_lock(void **m) +{ + return tsrm_mutex_lock(*((MUTEX_T *) m)); +} + +static int http_gnutls_mutex_unlock(void **m) +{ + return tsrm_mutex_unlock(*((MUTEX_T *) m)); +} + +static struct gcry_thread_cbs http_gnutls_tsl = { + GCRY_THREAD_OPTION_USER, + NULL, + http_gnutls_mutex_create, + http_gnutls_mutex_destroy, + http_gnutls_mutex_lock, + http_gnutls_mutex_unlock +}; +#endif +/* }}} */ + +/* safe curl wrappers */ +#define init_curl_storage(ch) \ + {\ + http_request_storage *st = pecalloc(1, sizeof(http_request_storage), 1); \ + curl_easy_setopt(ch, CURLOPT_PRIVATE, st); \ + curl_easy_setopt(ch, CURLOPT_ERRORBUFFER, st->errorbuffer); \ + } + +static void *safe_curl_init(void) +{ + CURL *ch; + + if ((ch = curl_easy_init())) { + init_curl_storage(ch); + return ch; + } + return NULL; +} +static void *safe_curl_copy(void *p) +{ + CURL *ch; + + if ((ch = curl_easy_duphandle(p))) { + init_curl_storage(ch); + return ch; + } + return NULL; +} +static void safe_curl_dtor(void *p) { + http_request_storage *st = http_request_storage_get(p); + + curl_easy_cleanup(p); + + if (st) { + if (st->url) { + pefree(st->url, 1); + } + if (st->cookiestore) { + pefree(st->cookiestore, 1); + } + pefree(st, 1); + } +} +/* }}} */ + +/* {{{ MINIT */ +PHP_MINIT_FUNCTION(http_request) +{ +#ifdef HTTP_NEED_OPENSSL_TSL + /* mod_ssl, libpq or ext/curl might already have set thread lock callbacks */ + if (!CRYPTO_get_id_callback()) { + int i, c = CRYPTO_num_locks(); + + http_openssl_tsl = malloc(c * sizeof(MUTEX_T)); + + for (i = 0; i < c; ++i) { + http_openssl_tsl[i] = tsrm_mutex_alloc(); + } + + CRYPTO_set_id_callback(http_openssl_thread_id); + CRYPTO_set_locking_callback(http_openssl_thread_lock); + } +#endif +#ifdef HTTP_NEED_GNUTLS_TSL + gcry_control(GCRYCTL_SET_THREAD_CBS, &http_gnutls_tsl); +#endif + + if (CURLE_OK != curl_global_init(CURL_GLOBAL_ALL)) { + return FAILURE; + } + + if (SUCCESS != http_persistent_handle_provide("http_request", safe_curl_init, safe_curl_dtor, safe_curl_copy)) { + return FAILURE; + } + + HTTP_LONG_CONSTANT("HTTP_AUTH_BASIC", CURLAUTH_BASIC); + HTTP_LONG_CONSTANT("HTTP_AUTH_DIGEST", CURLAUTH_DIGEST); +#if HTTP_CURL_VERSION(7,19,3) + HTTP_LONG_CONSTANT("HTTP_AUTH_DIGEST_IE", CURLAUTH_DIGEST_IE); +#endif + HTTP_LONG_CONSTANT("HTTP_AUTH_NTLM", CURLAUTH_NTLM); + HTTP_LONG_CONSTANT("HTTP_AUTH_GSSNEG", CURLAUTH_GSSNEGOTIATE); + HTTP_LONG_CONSTANT("HTTP_AUTH_ANY", CURLAUTH_ANY); + + HTTP_LONG_CONSTANT("HTTP_VERSION_NONE", CURL_HTTP_VERSION_NONE); /* to be removed */ + HTTP_LONG_CONSTANT("HTTP_VERSION_1_0", CURL_HTTP_VERSION_1_0); + HTTP_LONG_CONSTANT("HTTP_VERSION_1_1", CURL_HTTP_VERSION_1_1); + HTTP_LONG_CONSTANT("HTTP_VERSION_ANY", CURL_HTTP_VERSION_NONE); + + HTTP_LONG_CONSTANT("HTTP_SSL_VERSION_TLSv1", CURL_SSLVERSION_TLSv1); + HTTP_LONG_CONSTANT("HTTP_SSL_VERSION_SSLv2", CURL_SSLVERSION_SSLv2); + HTTP_LONG_CONSTANT("HTTP_SSL_VERSION_SSLv3", CURL_SSLVERSION_SSLv3); + HTTP_LONG_CONSTANT("HTTP_SSL_VERSION_ANY", CURL_SSLVERSION_DEFAULT); + + HTTP_LONG_CONSTANT("HTTP_IPRESOLVE_V4", CURL_IPRESOLVE_V4); + HTTP_LONG_CONSTANT("HTTP_IPRESOLVE_V6", CURL_IPRESOLVE_V6); + HTTP_LONG_CONSTANT("HTTP_IPRESOLVE_ANY", CURL_IPRESOLVE_WHATEVER); + +#if HTTP_CURL_VERSION(7,15,2) + HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS4", CURLPROXY_SOCKS4); +#endif +#if HTTP_CURL_VERSION(7,18,0) + HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS4A", CURLPROXY_SOCKS4A); + HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS5_HOSTNAME", CURLPROXY_SOCKS5_HOSTNAME); +#endif + HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS5", CURLPROXY_SOCKS5); + HTTP_LONG_CONSTANT("HTTP_PROXY_HTTP", CURLPROXY_HTTP); +#if HTTP_CURL_VERSION(7,19,4) + HTTP_LONG_CONSTANT("HTTP_PROXY_HTTP_1_0", CURLPROXY_HTTP_1_0); +#endif + +#if HTTP_CURL_VERSION(7,19,1) + HTTP_LONG_CONSTANT("HTTP_POSTREDIR_301", CURL_REDIR_POST_301); + HTTP_LONG_CONSTANT("HTTP_POSTREDIR_302", CURL_REDIR_POST_302); + HTTP_LONG_CONSTANT("HTTP_POSTREDIR_ALL", CURL_REDIR_POST_ALL); +#endif + return SUCCESS; +} +/* }}} */ + +/* {{{ MSHUTDOWN */ +PHP_MSHUTDOWN_FUNCTION(http_request) +{ + curl_global_cleanup(); +#ifdef HTTP_NEED_OPENSSL_TSL + if (http_openssl_tsl) { + int i, c = CRYPTO_num_locks(); + + CRYPTO_set_id_callback(NULL); + CRYPTO_set_locking_callback(NULL); + + for (i = 0; i < c; ++i) { + tsrm_mutex_free(http_openssl_tsl[i]); + } + + free(http_openssl_tsl); + http_openssl_tsl = NULL; + } +#endif + return SUCCESS; +} +/* }}} */ + +/* {{{ forward declarations */ +#define http_request_option(r, o, k, t) _http_request_option_ex((r), (o), (k), sizeof(k), (t) TSRMLS_CC) +#define http_request_option_ex(r, o, k, l, t) _http_request_option_ex((r), (o), (k), (l), (t) TSRMLS_CC) +static inline zval *_http_request_option_ex(http_request *request, HashTable *options, char *key, size_t keylen, int type TSRMLS_DC); +#define http_request_option_cache(r, k, z) _http_request_option_cache_ex((r), (k), sizeof(k), 0, (z) TSRMLS_CC) +#define http_request_option_cache_ex(r, k, kl, h, z) _http_request_option_cache_ex((r), (k), (kl), (h), (z) TSRMLS_CC) +static inline zval *_http_request_option_cache_ex(http_request *r, char *key, size_t keylen, ulong h, zval *opt TSRMLS_DC); + +#define http_request_cookies_enabled(r) _http_request_cookies_enabled((r)) +static inline int _http_request_cookies_enabled(http_request *r); + +static size_t http_curl_read_callback(void *, size_t, size_t, void *); +static int http_curl_progress_callback(void *, double, double, double, double); +static int http_curl_raw_callback(CURL *, curl_infotype, char *, size_t, void *); +static int http_curl_dummy_callback(char *data, size_t n, size_t l, void *s) { return n*l; } +static curlioerr http_curl_ioctl_callback(CURL *, curliocmd, void *); +/* }}} */ + +/* {{{ CURL *http_curl_init(http_request *) */ +PHP_HTTP_API CURL * _http_curl_init_ex(CURL *ch, http_request *request TSRMLS_DC) +{ + if (ch || (SUCCESS == http_persistent_handle_acquire("http_request", &ch))) { +#if defined(ZTS) + curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); +#endif + curl_easy_setopt(ch, CURLOPT_HEADER, 0L); + curl_easy_setopt(ch, CURLOPT_FILETIME, 1L); + curl_easy_setopt(ch, CURLOPT_AUTOREFERER, 1L); + curl_easy_setopt(ch, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, NULL); + curl_easy_setopt(ch, CURLOPT_DEBUGFUNCTION, http_curl_raw_callback); + curl_easy_setopt(ch, CURLOPT_READFUNCTION, http_curl_read_callback); + curl_easy_setopt(ch, CURLOPT_IOCTLFUNCTION, http_curl_ioctl_callback); + curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, http_curl_dummy_callback); + + /* set context */ + if (request) { + curl_easy_setopt(ch, CURLOPT_DEBUGDATA, request); + + /* attach curl handle */ + request->ch = ch; + /* set defaults (also in http_request_reset()) */ + http_request_defaults(request); + } + } + + return ch; +} +/* }}} */ + +/* {{{ CURL *http_curl_copy(CURL *) */ +PHP_HTTP_API CURL *_http_curl_copy(CURL *ch TSRMLS_DC) +{ + CURL *copy; + + if (SUCCESS == http_persistent_handle_accrete("http_request", ch, ©)) { + return copy; + } + return NULL; +} +/* }}} */ + +/* {{{ void http_curl_free(CURL **) */ +PHP_HTTP_API void _http_curl_free(CURL **ch TSRMLS_DC) +{ + if (*ch) { + curl_easy_setopt(*ch, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(*ch, CURLOPT_PROGRESSFUNCTION, NULL); + curl_easy_setopt(*ch, CURLOPT_VERBOSE, 0L); + curl_easy_setopt(*ch, CURLOPT_DEBUGFUNCTION, NULL); + + http_persistent_handle_release("http_request", ch); + } +} +/* }}} */ + +/* {{{ http_request *http_request_init(http_request *) */ +PHP_HTTP_API http_request *_http_request_init_ex(http_request *request, CURL *ch, http_request_method meth, const char *url ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC TSRMLS_DC) +{ + http_request *r; + + if (request) { + r = request; + } else { + r = emalloc_rel(sizeof(http_request)); + } + memset(r, 0, sizeof(http_request)); + + r->ch = ch; + r->url = (url) ? http_absolute_url(url) : NULL; + r->meth = (meth > 0) ? meth : HTTP_GET; + + phpstr_init(&r->conv.request); + phpstr_init_ex(&r->conv.response, HTTP_CURLBUF_SIZE, 0); + phpstr_init(&r->_cache.cookies); + zend_hash_init(&r->_cache.options, 0, NULL, ZVAL_PTR_DTOR, 0); + + TSRMLS_SET_CTX(r->tsrm_ls); + + return r; +} +/* }}} */ + +/* {{{ void http_request_dtor(http_request *) */ +PHP_HTTP_API void _http_request_dtor(http_request *request) +{ + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + + http_request_reset(request); + http_curl_free(&request->ch); + + phpstr_dtor(&request->_cache.cookies); + zend_hash_destroy(&request->_cache.options); + if (request->_cache.headers) { + curl_slist_free_all(request->_cache.headers); + request->_cache.headers = NULL; + } + if (request->_progress_callback) { + zval_ptr_dtor(&request->_progress_callback); + request->_progress_callback = NULL; + } +} +/* }}} */ + +/* {{{ void http_request_free(http_request **) */ +PHP_HTTP_API void _http_request_free(http_request **request) +{ + if (*request) { + TSRMLS_FETCH_FROM_CTX((*request)->tsrm_ls); + http_request_body_free(&(*request)->body); + http_request_dtor(*request); + efree(*request); + *request = NULL; + } +} +/* }}} */ + +/* {{{ void http_request_reset(http_request *) */ +PHP_HTTP_API void _http_request_reset(http_request *request) +{ + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + STR_SET(request->url, NULL); + request->conv.last_type = 0; + phpstr_dtor(&request->conv.request); + phpstr_dtor(&request->conv.response); + http_request_body_dtor(request->body); + http_request_defaults(request); + + if (request->ch) { + http_request_storage *st = http_request_storage_get(request->ch); + + if (st) { + if (st->url) { + pefree(st->url, 1); + st->url = NULL; + } + if (st->cookiestore) { + pefree(st->cookiestore, 1); + st->cookiestore = NULL; + } + st->errorbuffer[0] = '\0'; + } + } +} +/* }}} */ + +/* {{{ STATUS http_request_enable_cookies(http_request *) */ +PHP_HTTP_API STATUS _http_request_enable_cookies(http_request *request) +{ + int initialized = 1; + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + + HTTP_CHECK_CURL_INIT(request->ch, http_curl_init_ex(request->ch, request), initialized = 0); + if (initialized && (http_request_cookies_enabled(request) || (CURLE_OK == curl_easy_setopt(request->ch, CURLOPT_COOKIEFILE, "")))) { + return SUCCESS; + } + http_error(HE_WARNING, HTTP_E_REQUEST, "Could not enable cookies for this session"); + return FAILURE; +} +/* }}} */ + +/* {{{ STATUS http_request_reset_cookies(http_request *, int) */ +PHP_HTTP_API STATUS _http_request_reset_cookies(http_request *request, int session_only) +{ + int initialized = 1; + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + + HTTP_CHECK_CURL_INIT(request->ch, http_curl_init_ex(request->ch, request), initialized = 0); + if (initialized) { + if (!http_request_cookies_enabled(request)) { + if (SUCCESS != http_request_enable_cookies(request)) { + return FAILURE; + } + } + if (session_only) { +#if HTTP_CURL_VERSION(7,15,4) + if (CURLE_OK == curl_easy_setopt(request->ch, CURLOPT_COOKIELIST, "SESS")) { + return SUCCESS; + } +#else + http_error(HE_WARNING, HTTP_E_REQUEST, "Could not reset session cookies (need libcurl >= v7.15.4)"); +#endif + } else { +#if HTTP_CURL_VERSION(7,14,1) + if (CURLE_OK == curl_easy_setopt(request->ch, CURLOPT_COOKIELIST, "ALL")) { + return SUCCESS; + } +#else + http_error(HE_WARNING, HTTP_E_REQUEST, "Could not reset cookies (need libcurl >= v7.14.1)"); +#endif + } + } + return FAILURE; +} +/* }}} */ + +PHP_HTTP_API STATUS _http_request_flush_cookies(http_request *request) +{ + int initialized = 1; + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + + HTTP_CHECK_CURL_INIT(request->ch, http_curl_init_ex(request->ch, request), initialized = 0); + if (initialized) { + if (!http_request_cookies_enabled(request)) { + return FAILURE; + } +#if HTTP_CURL_VERSION(7,17,1) + if (CURLE_OK == curl_easy_setopt(request->ch, CURLOPT_COOKIELIST, "FLUSH")) { + return SUCCESS; + } +#else + http_error(HE_WARNING, HTTP_E_REQUEST, "Could not flush cookies (need libcurl >= v7.17.1)"); +#endif + } + return FAILURE; +} + +/* {{{ void http_request_defaults(http_request *) */ +PHP_HTTP_API void _http_request_defaults(http_request *request) +{ + if (request->ch) { + HTTP_CURL_OPT(CURLOPT_PROGRESSFUNCTION, NULL); + HTTP_CURL_OPT(CURLOPT_URL, NULL); + HTTP_CURL_OPT(CURLOPT_NOPROGRESS, 1L); +#if HTTP_CURL_VERSION(7,19,4) + HTTP_CURL_OPT(CURLOPT_NOPROXY, NULL); +#endif + HTTP_CURL_OPT(CURLOPT_PROXY, NULL); + HTTP_CURL_OPT(CURLOPT_PROXYPORT, 0L); + HTTP_CURL_OPT(CURLOPT_PROXYTYPE, 0L); + /* libcurl < 7.19.6 does not clear auth info with USERPWD set to NULL */ +#if HTTP_CURL_VERSION(7,19,1) + HTTP_CURL_OPT(CURLOPT_PROXYUSERNAME, NULL); + HTTP_CURL_OPT(CURLOPT_PROXYPASSWORD, NULL); +#endif + HTTP_CURL_OPT(CURLOPT_PROXYAUTH, 0L); + HTTP_CURL_OPT(CURLOPT_HTTPPROXYTUNNEL, 0L); + HTTP_CURL_OPT(CURLOPT_DNS_CACHE_TIMEOUT, 60L); + HTTP_CURL_OPT(CURLOPT_IPRESOLVE, 0); + HTTP_CURL_OPT(CURLOPT_LOW_SPEED_LIMIT, 0L); + HTTP_CURL_OPT(CURLOPT_LOW_SPEED_TIME, 0L); +#if HTTP_CURL_VERSION(7,15,5) + /* LFS weirdance + HTTP_CURL_OPT(CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t) 0); + HTTP_CURL_OPT(CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t) 0); + */ +#endif + /* crashes + HTTP_CURL_OPT(CURLOPT_MAXCONNECTS, 5L); */ + HTTP_CURL_OPT(CURLOPT_FRESH_CONNECT, 0L); + HTTP_CURL_OPT(CURLOPT_FORBID_REUSE, 0L); + HTTP_CURL_OPT(CURLOPT_INTERFACE, NULL); + HTTP_CURL_OPT(CURLOPT_PORT, 0L); +#if HTTP_CURL_VERSION(7,19,0) + HTTP_CURL_OPT(CURLOPT_ADDRESS_SCOPE, 0L); +#endif +#if HTTP_CURL_VERSION(7,15,2) + HTTP_CURL_OPT(CURLOPT_LOCALPORT, 0L); + HTTP_CURL_OPT(CURLOPT_LOCALPORTRANGE, 0L); +#endif + /* libcurl < 7.19.6 does not clear auth info with USERPWD set to NULL */ +#if HTTP_CURL_VERSION(7,19,1) + HTTP_CURL_OPT(CURLOPT_USERNAME, NULL); + HTTP_CURL_OPT(CURLOPT_PASSWORD, NULL); +#endif + HTTP_CURL_OPT(CURLOPT_HTTPAUTH, 0L); + HTTP_CURL_OPT(CURLOPT_ENCODING, NULL); +#if HTTP_CURL_VERSION(7,16,2) + /* we do this ourself anyway */ + HTTP_CURL_OPT(CURLOPT_HTTP_CONTENT_DECODING, 0L); + HTTP_CURL_OPT(CURLOPT_HTTP_TRANSFER_DECODING, 0L); +#endif + HTTP_CURL_OPT(CURLOPT_FOLLOWLOCATION, 0L); +#if HTTP_CURL_VERSION(7,19,1) + HTTP_CURL_OPT(CURLOPT_POSTREDIR, 0L); +#elif HTTP_CURL_VERSION(7,17,1) + HTTP_CURL_OPT(CURLOPT_POST301, 0L); +#endif + HTTP_CURL_OPT(CURLOPT_UNRESTRICTED_AUTH, 0L); + HTTP_CURL_OPT(CURLOPT_REFERER, NULL); + HTTP_CURL_OPT(CURLOPT_USERAGENT, "PECL::HTTP/" PHP_HTTP_VERSION " (PHP/" PHP_VERSION ")"); + HTTP_CURL_OPT(CURLOPT_HTTPHEADER, NULL); + HTTP_CURL_OPT(CURLOPT_COOKIE, NULL); + HTTP_CURL_OPT(CURLOPT_COOKIESESSION, 0L); + /* these options would enable curl's cookie engine by default which we don't want + HTTP_CURL_OPT(CURLOPT_COOKIEFILE, NULL); + HTTP_CURL_OPT(CURLOPT_COOKIEJAR, NULL); */ +#if HTTP_CURL_VERSION(7,14,1) + HTTP_CURL_OPT(CURLOPT_COOKIELIST, NULL); +#endif + HTTP_CURL_OPT(CURLOPT_RANGE, NULL); + HTTP_CURL_OPT(CURLOPT_RESUME_FROM, 0L); + HTTP_CURL_OPT(CURLOPT_MAXFILESIZE, 0L); + HTTP_CURL_OPT(CURLOPT_TIMECONDITION, 0L); + HTTP_CURL_OPT(CURLOPT_TIMEVALUE, 0L); + HTTP_CURL_OPT(CURLOPT_TIMEOUT, 0L); + HTTP_CURL_OPT(CURLOPT_CONNECTTIMEOUT, 3); + HTTP_CURL_OPT(CURLOPT_SSLCERT, NULL); + HTTP_CURL_OPT(CURLOPT_SSLCERTTYPE, NULL); + HTTP_CURL_OPT(CURLOPT_SSLCERTPASSWD, NULL); + HTTP_CURL_OPT(CURLOPT_SSLKEY, NULL); + HTTP_CURL_OPT(CURLOPT_SSLKEYTYPE, NULL); + HTTP_CURL_OPT(CURLOPT_SSLKEYPASSWD, NULL); + HTTP_CURL_OPT(CURLOPT_SSLENGINE, NULL); + HTTP_CURL_OPT(CURLOPT_SSLVERSION, 0L); + HTTP_CURL_OPT(CURLOPT_SSL_VERIFYPEER, 0L); + HTTP_CURL_OPT(CURLOPT_SSL_VERIFYHOST, 0L); + HTTP_CURL_OPT(CURLOPT_SSL_CIPHER_LIST, NULL); +#if HTTP_CURL_VERSION(7,19,0) + HTTP_CURL_OPT(CURLOPT_ISSUERCERT, NULL); + #if defined(HTTP_HAVE_OPENSSL) + HTTP_CURL_OPT(CURLOPT_CRLFILE, NULL); + #endif +#endif +#if HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL) + HTTP_CURL_OPT(CURLOPT_CERTINFO, NULL); +#endif +#ifdef HTTP_CURL_CAINFO + HTTP_CURL_OPT(CURLOPT_CAINFO, HTTP_CURL_CAINFO); +#else + HTTP_CURL_OPT(CURLOPT_CAINFO, NULL); +#endif + HTTP_CURL_OPT(CURLOPT_CAPATH, NULL); + HTTP_CURL_OPT(CURLOPT_RANDOM_FILE, NULL); + HTTP_CURL_OPT(CURLOPT_EGDSOCKET, NULL); + HTTP_CURL_OPT(CURLOPT_POSTFIELDS, NULL); + HTTP_CURL_OPT(CURLOPT_POSTFIELDSIZE, 0L); + HTTP_CURL_OPT(CURLOPT_HTTPPOST, NULL); + HTTP_CURL_OPT(CURLOPT_IOCTLDATA, NULL); + HTTP_CURL_OPT(CURLOPT_READDATA, NULL); + HTTP_CURL_OPT(CURLOPT_INFILESIZE, 0L); + HTTP_CURL_OPT(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE); + HTTP_CURL_OPT(CURLOPT_CUSTOMREQUEST, NULL); + HTTP_CURL_OPT(CURLOPT_NOBODY, 0L); + HTTP_CURL_OPT(CURLOPT_POST, 0L); + HTTP_CURL_OPT(CURLOPT_UPLOAD, 0L); + HTTP_CURL_OPT(CURLOPT_HTTPGET, 1L); + } +} +/* }}} */ + +PHP_HTTP_API void _http_request_set_progress_callback(http_request *request, zval *cb) +{ + if (request->_progress_callback) { + zval_ptr_dtor(&request->_progress_callback); + } + if ((request->_progress_callback = cb)) { + ZVAL_ADDREF(cb); + HTTP_CURL_OPT(CURLOPT_NOPROGRESS, 0); + HTTP_CURL_OPT(CURLOPT_PROGRESSDATA, request); + HTTP_CURL_OPT(CURLOPT_PROGRESSFUNCTION, http_curl_progress_callback); + } else { + HTTP_CURL_OPT(CURLOPT_NOPROGRESS, 1); + HTTP_CURL_OPT(CURLOPT_PROGRESSDATA, NULL); + HTTP_CURL_OPT(CURLOPT_PROGRESSFUNCTION, NULL); + } +} + +/* {{{ STATUS http_request_prepare(http_request *, HashTable *) */ +PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *options) +{ + zval *zoption; + zend_bool range_req = 0; + http_request_storage *storage; + + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + + HTTP_CHECK_CURL_INIT(request->ch, http_curl_init(request), return FAILURE); + + if (!request->url) { + return FAILURE; + } + if (!(storage = http_request_storage_get(request->ch))) { + return FAILURE; + } + storage->errorbuffer[0] = '\0'; + /* set options */ + if (storage->url) { + pefree(storage->url, 1); + } + storage->url = pestrdup(request->url, 1); + HTTP_CURL_OPT(CURLOPT_URL, storage->url); + + /* progress callback */ + if ((zoption = http_request_option(request, options, "onprogress", -1))) { + http_request_set_progress_callback(request, zoption); + } + + /* proxy */ + if ((zoption = http_request_option(request, options, "proxyhost", IS_STRING))) { + HTTP_CURL_OPT(CURLOPT_PROXY, Z_STRVAL_P(zoption)); + /* type */ + if ((zoption = http_request_option(request, options, "proxytype", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_PROXYTYPE, Z_LVAL_P(zoption)); + } + /* port */ + if ((zoption = http_request_option(request, options, "proxyport", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_PROXYPORT, Z_LVAL_P(zoption)); + } + /* user:pass */ + if ((zoption = http_request_option(request, options, "proxyauth", IS_STRING)) && Z_STRLEN_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_PROXYUSERPWD, Z_STRVAL_P(zoption)); + } + /* auth method */ + if ((zoption = http_request_option(request, options, "proxyauthtype", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_PROXYAUTH, Z_LVAL_P(zoption)); + } + /* tunnel */ + if ((zoption = http_request_option(request, options, "proxytunnel", IS_BOOL)) && Z_BVAL_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_HTTPPROXYTUNNEL, 1L); + } + } +#if HTTP_CURL_VERSION(7,19,4) + if ((zoption = http_request_option(request, options, "noproxy", IS_STRING))) { + HTTP_CURL_OPT(CURLOPT_NOPROXY, Z_STRVAL_P(zoption)); + } +#endif + + /* dns */ + if ((zoption = http_request_option(request, options, "dns_cache_timeout", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_DNS_CACHE_TIMEOUT, Z_LVAL_P(zoption)); + } + if ((zoption = http_request_option(request, options, "ipresolve", IS_LONG)) && Z_LVAL_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_IPRESOLVE, Z_LVAL_P(zoption)); + } + + /* limits */ + if ((zoption = http_request_option(request, options, "low_speed_limit", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_LOW_SPEED_LIMIT, Z_LVAL_P(zoption)); + } + if ((zoption = http_request_option(request, options, "low_speed_time", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_LOW_SPEED_TIME, Z_LVAL_P(zoption)); + } +#if HTTP_CURL_VERSION(7,15,5) + /* LSF weirdance + if ((zoption = http_request_option(request, options, "max_send_speed", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t) Z_LVAL_P(zoption)); + } + if ((zoption = http_request_option(request, options, "max_recv_speed", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t) Z_LVAL_P(zoption)); + } + */ +#endif + /* crashes + if ((zoption = http_request_option(request, options, "maxconnects", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_MAXCONNECTS, Z_LVAL_P(zoption)); + } */ + if ((zoption = http_request_option(request, options, "fresh_connect", IS_BOOL)) && Z_BVAL_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_FRESH_CONNECT, 1L); + } + if ((zoption = http_request_option(request, options, "forbid_reuse", IS_BOOL)) && Z_BVAL_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_FORBID_REUSE, 1L); + } + + /* outgoing interface */ + if ((zoption = http_request_option(request, options, "interface", IS_STRING))) { + HTTP_CURL_OPT(CURLOPT_INTERFACE, Z_STRVAL_P(zoption)); + +#if HTTP_CURL_VERSION(7,15,2) + if ((zoption = http_request_option(request, options, "portrange", IS_ARRAY))) { + zval **prs, **pre; + + zend_hash_internal_pointer_reset(Z_ARRVAL_P(zoption)); + if (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(zoption), (void *) &prs)) { + zend_hash_move_forward(Z_ARRVAL_P(zoption)); + if (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(zoption), (void *) &pre)) { + zval *prs_cpy = http_zsep(IS_LONG, *prs); + zval *pre_cpy = http_zsep(IS_LONG, *pre); + + if (Z_LVAL_P(prs_cpy) && Z_LVAL_P(pre_cpy)) { + HTTP_CURL_OPT(CURLOPT_LOCALPORT, MIN(Z_LVAL_P(prs_cpy), Z_LVAL_P(pre_cpy))); + HTTP_CURL_OPT(CURLOPT_LOCALPORTRANGE, labs(Z_LVAL_P(prs_cpy)-Z_LVAL_P(pre_cpy))+1L); + } + zval_ptr_dtor(&prs_cpy); + zval_ptr_dtor(&pre_cpy); + } + } + } +#endif + } + + /* another port */ + if ((zoption = http_request_option(request, options, "port", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_PORT, Z_LVAL_P(zoption)); + } + + /* RFC4007 zone_id */ +#if HTTP_CURL_VERSION(7,19,0) + if ((zoption = http_request_option(request, options, "address_scope", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_ADDRESS_SCOPE, Z_LVAL_P(zoption)); + } +#endif + + /* auth */ + if ((zoption = http_request_option(request, options, "httpauth", IS_STRING)) && Z_STRLEN_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_USERPWD, Z_STRVAL_P(zoption)); + } + if ((zoption = http_request_option(request, options, "httpauthtype", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_HTTPAUTH, Z_LVAL_P(zoption)); + } + + /* redirects, defaults to 0 */ + if ((zoption = http_request_option(request, options, "redirect", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_FOLLOWLOCATION, Z_LVAL_P(zoption) ? 1L : 0L); + HTTP_CURL_OPT(CURLOPT_MAXREDIRS, Z_LVAL_P(zoption)); + if ((zoption = http_request_option(request, options, "unrestrictedauth", IS_BOOL))) { + HTTP_CURL_OPT(CURLOPT_UNRESTRICTED_AUTH, Z_LVAL_P(zoption)); + } +#if HTTP_CURL_VERSION(7,17,1) + if ((zoption = http_request_option(request, options, "postredir", IS_BOOL))) { +# if HTTP_CURL_VERSION(7,19,1) + HTTP_CURL_OPT(CURLOPT_POSTREDIR, Z_BVAL_P(zoption) ? 1L : 0L); +# else + HTTP_CURL_OPT(CURLOPT_POST301, Z_BVAL_P(zoption) ? 1L : 0L); +# endif + } +#endif + } + + /* retries, defaults to 0 */ + if ((zoption = http_request_option(request, options, "retrycount", IS_LONG))) { + request->_retry.count = Z_LVAL_P(zoption); + if ((zoption = http_request_option(request, options, "retrydelay", IS_DOUBLE))) { + request->_retry.delay = Z_DVAL_P(zoption); + } else { + request->_retry.delay = 0; + } + } else { + request->_retry.count = 0; + } + + /* referer */ + if ((zoption = http_request_option(request, options, "referer", IS_STRING)) && Z_STRLEN_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_REFERER, Z_STRVAL_P(zoption)); + } + + /* useragent, default "PECL::HTTP/version (PHP/version)" */ + if ((zoption = http_request_option(request, options, "useragent", IS_STRING))) { + /* allow to send no user agent, not even default one */ + if (Z_STRLEN_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_USERAGENT, Z_STRVAL_P(zoption)); + } else { + HTTP_CURL_OPT(CURLOPT_USERAGENT, NULL); + } + } + + /* resume */ + if ((zoption = http_request_option(request, options, "resume", IS_LONG)) && (Z_LVAL_P(zoption) > 0)) { + range_req = 1; + HTTP_CURL_OPT(CURLOPT_RESUME_FROM, Z_LVAL_P(zoption)); + } + /* or range of kind array(array(0,499), array(100,1499)) */ + else if ((zoption = http_request_option(request, options, "range", IS_ARRAY)) && zend_hash_num_elements(Z_ARRVAL_P(zoption))) { + HashPosition pos1, pos2; + zval **rr, **rb, **re; + phpstr rs; + + phpstr_init(&rs); + FOREACH_VAL(pos1, zoption, rr) { + if (Z_TYPE_PP(rr) == IS_ARRAY) { + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(rr), &pos2); + if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(rr), (void *) &rb, &pos2)) { + zend_hash_move_forward_ex(Z_ARRVAL_PP(rr), &pos2); + if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(rr), (void *) &re, &pos2)) { + if ( ((Z_TYPE_PP(rb) == IS_LONG) || ((Z_TYPE_PP(rb) == IS_STRING) && is_numeric_string(Z_STRVAL_PP(rb), Z_STRLEN_PP(rb), NULL, NULL, 1))) && + ((Z_TYPE_PP(re) == IS_LONG) || ((Z_TYPE_PP(re) == IS_STRING) && is_numeric_string(Z_STRVAL_PP(re), Z_STRLEN_PP(re), NULL, NULL, 1)))) { + zval *rbl = http_zsep(IS_LONG, *rb); + zval *rel = http_zsep(IS_LONG, *re); + + if ((Z_LVAL_P(rbl) >= 0) && (Z_LVAL_P(rel) >= 0)) { + phpstr_appendf(&rs, "%ld-%ld,", Z_LVAL_P(rbl), Z_LVAL_P(rel)); + } + zval_ptr_dtor(&rbl); + zval_ptr_dtor(&rel); + } + } + } + } + } + + if (PHPSTR_LEN(&rs)) { + zval *cached_range; + + /* ditch last comma */ + PHPSTR_VAL(&rs)[PHPSTR_LEN(&rs)-- -1] = '\0'; + /* cache string */ + MAKE_STD_ZVAL(cached_range); + ZVAL_STRINGL(cached_range, PHPSTR_VAL(&rs), PHPSTR_LEN(&rs), 0); + HTTP_CURL_OPT(CURLOPT_RANGE, Z_STRVAL_P(http_request_option_cache(request, "range", cached_range))); + zval_ptr_dtor(&cached_range); + } + } + + /* additional headers, array('name' => 'value') */ + if (request->_cache.headers) { + curl_slist_free_all(request->_cache.headers); + request->_cache.headers = NULL; + } + if ((zoption = http_request_option(request, options, "headers", IS_ARRAY))) { + HashKey header_key = initHashKey(0); + zval **header_val; + HashPosition pos; + phpstr header; + + phpstr_init(&header); + FOREACH_KEYVAL(pos, zoption, header_key, header_val) { + if (header_key.type == HASH_KEY_IS_STRING) { + zval *header_cpy = http_zsep(IS_STRING, *header_val); + + if (!strcasecmp(header_key.str, "range")) { + range_req = 1; + } + + phpstr_appendf(&header, "%s: %s", header_key.str, Z_STRVAL_P(header_cpy)); + phpstr_fix(&header); + request->_cache.headers = curl_slist_append(request->_cache.headers, PHPSTR_VAL(&header)); + phpstr_reset(&header); + + zval_ptr_dtor(&header_cpy); + } + } + phpstr_dtor(&header); + } + /* etag */ + if ((zoption = http_request_option(request, options, "etag", IS_STRING)) && Z_STRLEN_P(zoption)) { + zend_bool is_quoted; + phpstr header; + + phpstr_init(&header); + phpstr_appendf(&header, "%s: ", range_req?"If-Match":"If-None-Match"); + if ((Z_STRVAL_P(zoption)[0] == '"') && (Z_STRVAL_P(zoption)[Z_STRLEN_P(zoption)-1] == '"')) { + /* properly quoted etag */ + phpstr_append(&header, Z_STRVAL_P(zoption), Z_STRLEN_P(zoption)); + } else if ((Z_STRVAL_P(zoption)[0] == 'W') && (Z_STRVAL_P(zoption)[1] == '/')) { + /* weak etag */ + if ((Z_STRLEN_P(zoption) > 3) && (Z_STRVAL_P(zoption)[2] == '"') && (Z_STRVAL_P(zoption)[Z_STRLEN_P(zoption)-1] == '"')) { + /* quoted */ + phpstr_append(&header, Z_STRVAL_P(zoption), Z_STRLEN_P(zoption)); + } else { + /* unquoted */ + phpstr_appendf(&header, "W/\"%s\"", Z_STRVAL_P(zoption) + 2); + } + } else { + /* assume unquoted etag */ + phpstr_appendf(&header, "\"%s\"", Z_STRVAL_P(zoption)); + } + phpstr_fix(&header); + + request->_cache.headers = curl_slist_append(request->_cache.headers, PHPSTR_VAL(&header)); + phpstr_dtor(&header); + } + /* compression */ + if ((zoption = http_request_option(request, options, "compress", IS_BOOL)) && Z_LVAL_P(zoption)) { + request->_cache.headers = curl_slist_append(request->_cache.headers, "Accept-Encoding: gzip;q=1.0,deflate;q=0.5"); + } + HTTP_CURL_OPT(CURLOPT_HTTPHEADER, request->_cache.headers); + + /* lastmodified */ + if ((zoption = http_request_option(request, options, "lastmodified", IS_LONG))) { + if (Z_LVAL_P(zoption)) { + if (Z_LVAL_P(zoption) > 0) { + HTTP_CURL_OPT(CURLOPT_TIMEVALUE, Z_LVAL_P(zoption)); + } else { + HTTP_CURL_OPT(CURLOPT_TIMEVALUE, (long) HTTP_G->request.time + Z_LVAL_P(zoption)); + } + HTTP_CURL_OPT(CURLOPT_TIMECONDITION, (long) (range_req ? CURL_TIMECOND_IFUNMODSINCE : CURL_TIMECOND_IFMODSINCE)); + } else { + HTTP_CURL_OPT(CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE); + } + } + + /* cookies, array('name' => 'value') */ + if ((zoption = http_request_option(request, options, "cookies", IS_ARRAY))) { + phpstr_dtor(&request->_cache.cookies); + if (zend_hash_num_elements(Z_ARRVAL_P(zoption))) { + zval *urlenc_cookies = NULL; + /* check whether cookies should not be urlencoded; default is to urlencode them */ + if ((!(urlenc_cookies = http_request_option(request, options, "encodecookies", IS_BOOL))) || Z_BVAL_P(urlenc_cookies)) { + if (SUCCESS == http_urlencode_hash_recursive(HASH_OF(zoption), &request->_cache.cookies, "; ", lenof("; "), NULL, 0)) { + phpstr_fix(&request->_cache.cookies); + HTTP_CURL_OPT(CURLOPT_COOKIE, request->_cache.cookies.data); + } + } else { + HashPosition pos; + HashKey cookie_key = initHashKey(0); + zval **cookie_val; + + FOREACH_KEYVAL(pos, zoption, cookie_key, cookie_val) { + if (cookie_key.type == HASH_KEY_IS_STRING) { + zval *val = http_zsep(IS_STRING, *cookie_val); + phpstr_appendf(&request->_cache.cookies, "%s=%s; ", cookie_key.str, Z_STRVAL_P(val)); + zval_ptr_dtor(&val); + } + } + + phpstr_fix(&request->_cache.cookies); + if (PHPSTR_LEN(&request->_cache.cookies)) { + HTTP_CURL_OPT(CURLOPT_COOKIE, PHPSTR_VAL(&request->_cache.cookies)); + } + } + } + } + + /* don't load session cookies from cookiestore */ + if ((zoption = http_request_option(request, options, "cookiesession", IS_BOOL)) && Z_BVAL_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_COOKIESESSION, 1L); + } + + /* cookiestore, read initial cookies from that file and store cookies back into that file */ + if ((zoption = http_request_option(request, options, "cookiestore", IS_STRING))) { + if (Z_STRLEN_P(zoption)) { + HTTP_CHECK_OPEN_BASEDIR(Z_STRVAL_P(zoption), return FAILURE); + } + if (storage->cookiestore) { + pefree(storage->cookiestore, 1); + } + storage->cookiestore = pestrndup(Z_STRVAL_P(zoption), Z_STRLEN_P(zoption), 1); + HTTP_CURL_OPT(CURLOPT_COOKIEFILE, storage->cookiestore); + HTTP_CURL_OPT(CURLOPT_COOKIEJAR, storage->cookiestore); + } + + /* maxfilesize */ + if ((zoption = http_request_option(request, options, "maxfilesize", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_MAXFILESIZE, Z_LVAL_P(zoption)); + } + + /* http protocol */ + if ((zoption = http_request_option(request, options, "protocol", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_HTTP_VERSION, Z_LVAL_P(zoption)); + } + +#if HTTP_CURL_VERSION(7,16,2) + /* timeout, defaults to 0 */ + if ((zoption = http_request_option(request, options, "timeout", IS_DOUBLE))) { + HTTP_CURL_OPT(CURLOPT_TIMEOUT_MS, (long)(Z_DVAL_P(zoption)*1000)); + } + /* connecttimeout, defaults to 0 */ + if ((zoption = http_request_option(request, options, "connecttimeout", IS_DOUBLE))) { + HTTP_CURL_OPT(CURLOPT_CONNECTTIMEOUT_MS, (long)(Z_DVAL_P(zoption)*1000)); + } +#else + /* timeout, defaults to 0 */ + if ((zoption = http_request_option(request, options, "timeout", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_TIMEOUT, Z_LVAL_P(zoption)); + } + /* connecttimeout, defaults to 0 */ + if ((zoption = http_request_option(request, options, "connecttimeout", IS_LONG))) { + HTTP_CURL_OPT(CURLOPT_CONNECTTIMEOUT, Z_LVAL_P(zoption)); + } +#endif + + /* ssl */ + if ((zoption = http_request_option(request, options, "ssl", IS_ARRAY))) { + HashKey key = initHashKey(0); + zval **param; + HashPosition pos; + + FOREACH_KEYVAL(pos, zoption, key, param) { + if (key.type == HASH_KEY_IS_STRING) { + HTTP_CURL_OPT_STRING(CURLOPT_SSLCERT, 0, 1); + HTTP_CURL_OPT_STRING(CURLOPT_SSLCERTTYPE, 0, 0); + HTTP_CURL_OPT_STRING(CURLOPT_SSLCERTPASSWD, 0, 0); + + HTTP_CURL_OPT_STRING(CURLOPT_SSLKEY, 0, 0); + HTTP_CURL_OPT_STRING(CURLOPT_SSLKEYTYPE, 0, 0); + HTTP_CURL_OPT_STRING(CURLOPT_SSLKEYPASSWD, 0, 0); + + HTTP_CURL_OPT_STRING(CURLOPT_SSLENGINE, 0, 0); + HTTP_CURL_OPT_LONG(CURLOPT_SSLVERSION, 0); + + HTTP_CURL_OPT_LONG(CURLOPT_SSL_VERIFYPEER, 1); + HTTP_CURL_OPT_LONG(CURLOPT_SSL_VERIFYHOST, 1); + HTTP_CURL_OPT_STRING(CURLOPT_SSL_CIPHER_LIST, 1, 0); + + HTTP_CURL_OPT_STRING(CURLOPT_CAINFO, -3, 1); + HTTP_CURL_OPT_STRING(CURLOPT_CAPATH, -3, 1); + HTTP_CURL_OPT_STRING(CURLOPT_RANDOM_FILE, -3, 1); + HTTP_CURL_OPT_STRING(CURLOPT_EGDSOCKET, -3, 1); +#if HTTP_CURL_VERSION(7,19,0) + HTTP_CURL_OPT_STRING(CURLOPT_ISSUERCERT, -3, 1); + #if defined(HTTP_HAVE_OPENSSL) + HTTP_CURL_OPT_STRING(CURLOPT_CRLFILE, -3, 1); + #endif +#endif +#if HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL) + HTTP_CURL_OPT_LONG(CURLOPT_CERTINFO, -3); +#endif + } + } + } + + /* request method */ + switch (request->meth) { + case HTTP_GET: + HTTP_CURL_OPT(CURLOPT_HTTPGET, 1L); + break; + + case HTTP_HEAD: + HTTP_CURL_OPT(CURLOPT_NOBODY, 1L); + break; + + case HTTP_POST: + HTTP_CURL_OPT(CURLOPT_POST, 1L); + break; + + case HTTP_PUT: + HTTP_CURL_OPT(CURLOPT_UPLOAD, 1L); + break; + + default: + if (http_request_method_exists(0, request->meth, NULL)) { + HTTP_CURL_OPT(CURLOPT_CUSTOMREQUEST, http_request_method_name(request->meth)); + } else { + http_error_ex(HE_WARNING, HTTP_E_REQUEST_METHOD, "Unsupported request method: %d (%s)", request->meth, request->url); + return FAILURE; + } + break; + } + + /* attach request body */ + if (request->body && (request->meth != HTTP_GET) && (request->meth != HTTP_HEAD) && (request->meth != HTTP_OPTIONS)) { + switch (request->body->type) { + case HTTP_REQUEST_BODY_EMPTY: + /* nothing */ + break; + + case HTTP_REQUEST_BODY_CURLPOST: + HTTP_CURL_OPT(CURLOPT_HTTPPOST, (struct curl_httppost *) request->body->data); + break; + + case HTTP_REQUEST_BODY_CSTRING: + if (request->meth != HTTP_PUT) { + HTTP_CURL_OPT(CURLOPT_POSTFIELDS, request->body->data); + HTTP_CURL_OPT(CURLOPT_POSTFIELDSIZE, request->body->size); + break; + } + /* fallthrough, PUT/UPLOAD _needs_ READDATA */ + case HTTP_REQUEST_BODY_UPLOADFILE: + HTTP_CURL_OPT(CURLOPT_IOCTLDATA, request); + HTTP_CURL_OPT(CURLOPT_READDATA, request); + HTTP_CURL_OPT(CURLOPT_INFILESIZE, request->body->size); + break; + + default: + /* shouldn't ever happen */ + http_error_ex(HE_ERROR, 0, "Unknown request body type: %d (%s)", request->body->type, request->url); + return FAILURE; + } + } + + return SUCCESS; +} +/* }}} */ + +/* {{{ void http_request_exec(http_request *) */ +PHP_HTTP_API void _http_request_exec(http_request *request) +{ + uint tries = 0; + CURLcode result; + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + +retry: + if (CURLE_OK != (result = curl_easy_perform(request->ch))) { + http_error_ex(HE_WARNING, HTTP_E_REQUEST, "%s; %s (%s)", curl_easy_strerror(result), http_request_storage_get(request->ch)->errorbuffer, request->url); +#ifdef ZEND_ENGINE_2 + if ((HTTP_G->only_exceptions || GLOBAL_ERROR_HANDLING == EH_THROW) && EG(exception)) { + add_property_long(EG(exception), "curlCode", result); + } +#endif + + if (request->_retry.count > tries++) { + switch (result) { + case CURLE_COULDNT_RESOLVE_PROXY: + case CURLE_COULDNT_RESOLVE_HOST: + case CURLE_COULDNT_CONNECT: + case CURLE_WRITE_ERROR: + case CURLE_READ_ERROR: + case CURLE_OPERATION_TIMEDOUT: + case CURLE_SSL_CONNECT_ERROR: + case CURLE_GOT_NOTHING: + case CURLE_SSL_ENGINE_SETFAILED: + case CURLE_SEND_ERROR: + case CURLE_RECV_ERROR: + case CURLE_SSL_ENGINE_INITFAILED: + case CURLE_LOGIN_DENIED: + if (request->_retry.delay >= HTTP_DIFFSEC) { + http_sleep(request->_retry.delay); + } + goto retry; + default: + break; + } + } + } +} +/* }}} */ + +/* {{{ static size_t http_curl_read_callback(void *, size_t, size_t, void *) */ +static size_t http_curl_read_callback(void *data, size_t len, size_t n, void *ctx) +{ + http_request *request = (http_request *) ctx; + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + + if (request->body) { + switch (request->body->type) { + case HTTP_REQUEST_BODY_CSTRING: + { + size_t out = MIN(len * n, request->body->size - request->body->priv); + + if (out) { + memcpy(data, ((char *) request->body->data) + request->body->priv, out); + request->body->priv += out; + return out; + } + break; + } + + case HTTP_REQUEST_BODY_UPLOADFILE: + return php_stream_read((php_stream *) request->body->data, data, len * n); + } + } + return 0; +} +/* }}} */ + +/* {{{ static int http_curl_progress_callback(void *, double, double, double, double) */ +static int http_curl_progress_callback(void *ctx, double dltotal, double dlnow, double ultotal, double ulnow) +{ + zval *param, retval; + http_request *request = (http_request *) ctx; + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + + INIT_PZVAL(&retval); + ZVAL_NULL(&retval); + + MAKE_STD_ZVAL(param); + array_init(param); + add_assoc_double(param, "dltotal", dltotal); + add_assoc_double(param, "dlnow", dlnow); + add_assoc_double(param, "ultotal", ultotal); + add_assoc_double(param, "ulnow", ulnow); + + with_error_handling(EH_NORMAL, NULL) { + request->_in_progress_cb = 1; + call_user_function(EG(function_table), NULL, request->_progress_callback, &retval, 1, ¶m TSRMLS_CC); + request->_in_progress_cb = 0; + } end_error_handling(); + + zval_ptr_dtor(¶m); + zval_dtor(&retval); + + return 0; +} +/* }}} */ + +/* {{{ static curlioerr http_curl_ioctl_callback(CURL *, curliocmd, void *) */ +static curlioerr http_curl_ioctl_callback(CURL *ch, curliocmd cmd, void *ctx) +{ + http_request *request = (http_request *) ctx; + TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); + + if (cmd != CURLIOCMD_RESTARTREAD) { + return CURLIOE_UNKNOWNCMD; + } + + if (request->body) { + switch (request->body->type) { + case HTTP_REQUEST_BODY_CSTRING: + request->body->priv = 0; + return CURLIOE_OK; + break; + + case HTTP_REQUEST_BODY_UPLOADFILE: + if (SUCCESS == php_stream_rewind((php_stream *) request->body->data)) { + return CURLIOE_OK; + } + break; + } + } + + return CURLIOE_FAILRESTART; +} +/* }}} */ + +/* {{{ static int http_curl_raw_callback(CURL *, curl_infotype, char *, size_t, void *) */ +static int http_curl_raw_callback(CURL *ch, curl_infotype type, char *data, size_t length, void *ctx) +{ + http_request *request = (http_request *) ctx; + +#define EMPTY_HEADER(d, l) (!l || (l == 1 && d[0] == '\n') || (l == 2 && d[0] == '\r' && d[1] == '\n')) + switch (type) { + case CURLINFO_DATA_IN: + if (request->conv.last_type == CURLINFO_HEADER_IN) { + phpstr_appends(&request->conv.response, HTTP_CRLF); + } + phpstr_append(&request->conv.response, data, length); + break; + case CURLINFO_HEADER_IN: + if (!EMPTY_HEADER(data, length)) { + phpstr_append(&request->conv.response, data, length); + } + break; + case CURLINFO_DATA_OUT: + case CURLINFO_HEADER_OUT: + phpstr_append(&request->conv.request, data, length); + break; + default: + break; + } + +#if 0 + { + const char _sym[] = "><><><"; + if (type) { + for (fprintf(stderr, "%c ", _sym[type-1]); length--; data++) { + fprintf(stderr, HTTP_IS_CTYPE(print, *data)?"%c":"\\x%02X", (int) *data); + if (*data == '\n' && length) { + fprintf(stderr, "\n%c ", _sym[type-1]); + } + } + fprintf(stderr, "\n"); + } else { + fprintf(stderr, "# %s", data); + } + } +#endif + + if (type) { + request->conv.last_type = type; + } + return 0; +} +/* }}} */ + +/* {{{ static inline zval *http_request_option(http_request *, HashTable *, char *, size_t, int) */ +static inline zval *_http_request_option_ex(http_request *r, HashTable *options, char *key, size_t keylen, int type TSRMLS_DC) +{ + if (options) { + zval **zoption; + ulong h = zend_hash_func(key, keylen); + + if (SUCCESS == zend_hash_quick_find(options, key, keylen, h, (void *) &zoption)) { + zval *option, *cached; + + option = http_zsep(type, *zoption); + cached = http_request_option_cache_ex(r, key, keylen, h, option); + + zval_ptr_dtor(&option); + return cached; + } + } + + return NULL; +} +/* }}} */ + +/* {{{ static inline zval *http_request_option_cache(http_request *, char *key, zval *) */ +static inline zval *_http_request_option_cache_ex(http_request *r, char *key, size_t keylen, ulong h, zval *opt TSRMLS_DC) +{ + ZVAL_ADDREF(opt); + + if (h) { + zend_hash_quick_update(&r->_cache.options, key, keylen, h, &opt, sizeof(zval *), NULL); + } else { + zend_hash_update(&r->_cache.options, key, keylen, &opt, sizeof(zval *), NULL); + } + + return opt; +} +/* }}} */ + +/* {{{ static inline int http_request_cookies_enabled(http_request *) */ +static inline int _http_request_cookies_enabled(http_request *request) { + http_request_storage *st; + + if (request->ch && (st = http_request_storage_get(request->ch)) && st->cookiestore) { + /* cookies are enabled */ + return 1; + } + return 0; +} +/* }}} */ + +#endif /* HTTP_HAVE_CURL */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ + | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_body_api.c ^ |
(renamed from pecl_http-1.7.4/http_request_body_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_body_api.c ^ |
(renamed from pecl_http-1.7.4/http_request_body_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_datashare_api.c ^ |
(renamed from pecl_http-1.7.4/http_request_datashare_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_datashare_api.c ^ |
(renamed from pecl_http-1.7.4/http_request_datashare_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_info.c ^ |
(renamed from pecl_http-1.7.4/http_request_info.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_info.c ^ |
(renamed from pecl_http-1.7.4/http_request_info.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_method_api.c ^ |
(renamed from pecl_http-1.7.4/http_request_method_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_method_api.c ^ |
(renamed from pecl_http-1.7.4/http_request_method_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_object.c ^ |
(renamed from pecl_http-1.7.4/http_request_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_object.c ^ |
(renamed from pecl_http-1.7.4/http_request_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_pool_api.c ^ |
(renamed from pecl_http-1.7.4/http_request_pool_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_request_pool_api.c ^ |
(renamed from pecl_http-1.7.4/http_request_pool_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_requestdatashare_object.c ^ |
(renamed from pecl_http-1.7.4/http_requestdatashare_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_requestdatashare_object.c ^ |
(renamed from pecl_http-1.7.4/http_requestdatashare_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_requestpool_object.c ^ |
(renamed from pecl_http-1.7.4/http_requestpool_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_requestpool_object.c ^ |
(renamed from pecl_http-1.7.4/http_requestpool_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_response_object.c ^ |
(renamed from pecl_http-1.7.4/http_response_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_response_object.c ^ |
(renamed from pecl_http-1.7.4/http_response_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_send_api.c ^ |
(renamed from pecl_http-1.7.4/http_send_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_send_api.c ^ |
(renamed from pecl_http-1.7.4/http_send_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_url_api.c ^ |
(renamed from pecl_http-1.7.4/http_url_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_url_api.c ^ |
(renamed from pecl_http-1.7.4/http_url_api.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_util_object.c ^ |
(renamed from pecl_http-1.7.4/http_util_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/http_util_object.c ^ |
(renamed from pecl_http-1.7.4/http_util_object.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/BigGet.php ^ |
(renamed from pecl_http-1.7.4/lib/BigGet.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/BigGet.php ^ |
(renamed from pecl_http-1.7.4/lib/BigGet.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/FeedAggregator.php ^ |
(renamed from pecl_http-1.7.4/lib/FeedAggregator.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/FeedAggregator.php ^ |
(renamed from pecl_http-1.7.4/lib/FeedAggregator.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/PgLobStream.php ^ |
(renamed from pecl_http-1.7.4/lib/PgLobStream.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/PgLobStream.php ^ |
(renamed from pecl_http-1.7.4/lib/PgLobStream.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/XmlRpcClient.php ^ |
(renamed from pecl_http-1.7.4/lib/XmlRpcClient.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/XmlRpcClient.php ^ |
(renamed from pecl_http-1.7.4/lib/XmlRpcClient.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/XmlRpcServer.php ^ |
(renamed from pecl_http-1.7.4/lib/XmlRpcServer.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/lib/XmlRpcServer.php ^ |
(renamed from pecl_http-1.7.4/lib/XmlRpcServer.php) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/missing.c ^ |
(renamed from pecl_http-1.7.4/missing.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/missing.c ^ |
(renamed from pecl_http-1.7.4/missing.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/missing.h ^ |
(renamed from pecl_http-1.7.4/missing.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/missing.h ^ |
(renamed from pecl_http-1.7.4/missing.h) | ||
[+] | Added | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http.h ^ |
@@ -0,0 +1,262 @@ +/* + +--------------------------------------------------------------------+ + | PECL :: http | + +--------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met. | + +--------------------------------------------------------------------+ + | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> | + +--------------------------------------------------------------------+ +*/ + +/* $Id: php_http.h 329632 2013-03-03 07:14:52Z mike $ */ + +#ifndef PHP_EXT_HTTP_H +#define PHP_EXT_HTTP_H + +#define PHP_HTTP_VERSION "1.7.5" + +#ifdef HAVE_CONFIG_H +# include "config.h" +#else +# ifndef PHP_WIN32 +# include "php_config.h" +# endif +#endif + +#include "php.h" +#include "missing.h" +#include "php_http_std_defs.h" +#include "phpstr/phpstr.h" + +#ifdef HTTP_WANT_SAPI +# if PHP_API_VERSION > 20041225 +# define HTTP_HAVE_SAPI_RTIME +# endif +# include "SAPI.h" +#endif + +#ifdef HTTP_WANT_NETDB +# ifdef PHP_WIN32 +# define HTTP_HAVE_NETDB +# include <winsock2.h> +# elif defined(HAVE_NETDB_H) +# define HTTP_HAVE_NETDB +# include <netdb.h> +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif +# endif +#endif + +#if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL) +# ifdef PHP_WIN32 +# include <winsock2.h> +# define CURL_STATICLIB +# endif +# include <curl/curl.h> +# define HTTP_CURL_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= (((x)<<16) + ((y)<<8) + (z))) +# +# if defined(HTTP_WANT_EVENT) && defined(HTTP_HAVE_EVENT) +# include <event.h> +# endif +#endif + +#if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC) +# if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC) +# define USE_MAGIC_STATIC +# endif +# include <magic.h> +#endif + +#if defined(HTTP_WANT_ZLIB) && defined(HTTP_HAVE_ZLIB) +# include <zlib.h> +#endif + +#include <ctype.h> +#define HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c)) +#define HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c)) + +extern zend_module_entry http_module_entry; +#define phpext_http_ptr &http_module_entry + +extern int http_module_number; + +ZEND_BEGIN_MODULE_GLOBALS(http) + + struct _http_globals_etag { + char *mode; + void *ctx; + zend_bool started; + } etag; + + struct _http_globals_log { + char *cache; + char *redirect; + char *not_found; + char *allowed_methods; + char *composite; + } log; + + struct _http_globals_send { + double throttle_delay; + size_t buffer_size; + char *content_type; + char *unquoted_etag; + time_t last_modified; + struct _http_globals_send_deflate { + zend_bool response; + zend_bool start_auto; + long start_flags; + int encoding; + void *stream; + } deflate; + struct _http_globals_send_inflate { + zend_bool start_auto; + long start_flags; + void *stream; + } inflate; + zend_bool not_found_404; + } send; + + struct _http_globals_request { + time_t time; + HashTable *headers; + struct _http_globals_request_methods { + HashTable registered; + char *allowed; + char *custom; + } methods; +#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) + struct _http_globals_request_datashare { + zend_llist handles; + zend_bool cookie; + zend_bool dns; + zend_bool ssl; + zend_bool connect; + } datashare; +#endif +#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_EVENT) + struct _http_globals_request_pool { + struct _http_globals_request_pool_event { + void *base; + } event; + } pool; +#endif + } request; + + struct _http_globals_persistent { + struct _http_globals_persistent_handles { + ulong limit; + struct _http_globals_persistent_handles_ident { + ulong h; + char *s; + size_t l; + } ident; + } handles; + } persistent; + +#ifdef ZEND_ENGINE_2 + zend_bool only_exceptions; +#endif + + zend_bool force_exit; + zend_bool read_post_data; + zval *server_var; + +ZEND_END_MODULE_GLOBALS(http) + +ZEND_EXTERN_MODULE_GLOBALS(http); + +#ifdef ZTS +# include "TSRM.h" +# define HTTP_G ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(http_globals_id)]) +#else +# define HTTP_G (&http_globals) +#endif + +#if defined(HAVE_ICONV) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV)) +# define HTTP_HAVE_ICONV +#endif + +#if defined(HAVE_PHP_SESSION) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_SESSION)) +# define HTTP_HAVE_SESSION +#endif + +#if defined(HAVE_HASH_EXT) && (HTTP_SHARED_DEPS || !defined(COMPILE_DL_HASH)) && defined(HTTP_HAVE_PHP_HASH_H) +# define HTTP_HAVE_HASH +#endif + +#if defined(HAVE_SPL) +# define HTTP_HAVE_SPL +#endif + +PHP_FUNCTION(http_date); +PHP_FUNCTION(http_build_url); +PHP_FUNCTION(http_build_str); +PHP_FUNCTION(http_negotiate_language); +PHP_FUNCTION(http_negotiate_charset); +PHP_FUNCTION(http_negotiate_content_type); +PHP_FUNCTION(http_negotiate); +PHP_FUNCTION(http_redirect); +PHP_FUNCTION(http_throttle); +PHP_FUNCTION(http_send_status); +PHP_FUNCTION(http_send_last_modified); +PHP_FUNCTION(http_send_content_type); +PHP_FUNCTION(http_send_content_disposition); +PHP_FUNCTION(http_match_modified); +PHP_FUNCTION(http_match_etag); +PHP_FUNCTION(http_cache_last_modified); +PHP_FUNCTION(http_cache_etag); +PHP_FUNCTION(http_send_data); +PHP_FUNCTION(http_send_file); +PHP_FUNCTION(http_send_stream); +PHP_FUNCTION(http_chunked_decode); +PHP_FUNCTION(http_parse_message); +PHP_FUNCTION(http_parse_headers); +PHP_FUNCTION(http_parse_cookie); +PHP_FUNCTION(http_build_cookie); +PHP_FUNCTION(http_parse_params); +PHP_FUNCTION(http_get_request_headers); +PHP_FUNCTION(http_get_request_body); +PHP_FUNCTION(http_get_request_body_stream); +PHP_FUNCTION(http_match_request_header); +PHP_FUNCTION(http_persistent_handles_count); +PHP_FUNCTION(http_persistent_handles_clean); +PHP_FUNCTION(http_persistent_handles_ident); +#ifdef HTTP_HAVE_CURL +PHP_FUNCTION(http_get); +PHP_FUNCTION(http_head); +PHP_FUNCTION(http_post_data); +PHP_FUNCTION(http_post_fields); +PHP_FUNCTION(http_put_data); +PHP_FUNCTION(http_put_file); +PHP_FUNCTION(http_put_stream); +PHP_FUNCTION(http_request); +PHP_FUNCTION(http_request_body_encode); +#endif /* HTTP_HAVE_CURL */ +PHP_FUNCTION(http_request_method_register); +PHP_FUNCTION(http_request_method_unregister); +PHP_FUNCTION(http_request_method_exists); +PHP_FUNCTION(http_request_method_name); +PHP_FUNCTION(ob_etaghandler); +#ifdef HTTP_HAVE_ZLIB +PHP_FUNCTION(http_deflate); +PHP_FUNCTION(http_inflate); +PHP_FUNCTION(ob_deflatehandler); +PHP_FUNCTION(ob_inflatehandler); +#endif +PHP_FUNCTION(http_support); + +#endif /* PHP_HTTP_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ + | ||
[+] | Added | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_api.h ^ |
@@ -0,0 +1,326 @@ +/* + +--------------------------------------------------------------------+ + | PECL :: http | + +--------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met. | + +--------------------------------------------------------------------+ + | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> | + +--------------------------------------------------------------------+ +*/ + +/* $Id: php_http_api.h 324706 2012-04-02 09:42:38Z mike $ */ + +#ifndef PHP_HTTP_API_H +#define PHP_HTTP_API_H + +#define HTTP_SUPPORT 0x01L +#define HTTP_SUPPORT_REQUESTS 0x02L +#define HTTP_SUPPORT_MAGICMIME 0x04L +#define HTTP_SUPPORT_ENCODINGS 0x08L +#define HTTP_SUPPORT_SSLREQUESTS 0x20L +#define HTTP_SUPPORT_PERSISTENCE 0x40L +#define HTTP_SUPPORT_EVENTS 0x80L + +#define HTTP_PARAMS_ALLOW_COMMA 0x01 +#define HTTP_PARAMS_ALLOW_FAILURE 0x02 +#define HTTP_PARAMS_RAISE_ERROR 0x04 +#define HTTP_PARAMS_DEFAULT (HTTP_PARAMS_ALLOW_COMMA|HTTP_PARAMS_ALLOW_FAILURE|HTTP_PARAMS_RAISE_ERROR) +#define HTTP_PARAMS_COLON_SEPARATOR 0x10 + +extern PHP_MINIT_FUNCTION(http_support); + +#define http_support(f) _http_support(f) +PHP_HTTP_API long _http_support(long feature); + +#define pretty_key(key, key_len, uctitle, xhyphen) _http_pretty_key(key, key_len, uctitle, xhyphen) +extern char *_http_pretty_key(char *key, size_t key_len, zend_bool uctitle, zend_bool xhyphen); + +#define http_boundary(b, l) _http_boundary((b), (l) TSRMLS_CC) +extern size_t _http_boundary(char *buf, size_t len TSRMLS_DC); + +#define http_error(type, code, string) _http_error_ex(type, code, "%s", string) +#define http_error_ex _http_error_ex +extern void _http_error_ex(long type TSRMLS_DC, long code, const char *format, ...); + + +#ifdef ZEND_ENGINE_2 +#define http_exception_wrap(o, n, ce) _http_exception_wrap((o), (n), (ce) TSRMLS_CC) +extern zval *_http_exception_wrap(zval *old_exception, zval *new_exception, zend_class_entry *ce TSRMLS_DC); + +#define http_try \ +{ \ + zval *old_exception = EG(exception); \ + EG(exception) = NULL; +#define http_catch(ex_ce) \ + if (EG(exception) && old_exception) { \ + EG(exception) = http_exception_wrap(old_exception, EG(exception), ex_ce); \ + } \ +} +#define http_final(ex_ce) \ + if (EG(exception)) { \ + EG(exception) = http_exception_wrap(EG(exception), NULL, ex_ce); \ + } + +typedef zend_object_value (*http_object_new_t)(zend_class_entry *ce, void *, void ** TSRMLS_DC); + +#define http_object_new(ov, cn, cl, co, ce, i, pp) _http_object_new((ov), (cn), (cl), (http_object_new_t) (co), (ce), (i), (void *) (pp) TSRMLS_CC) +extern STATUS _http_object_new(zend_object_value *ov, const char *cname_str, uint cname_len, http_object_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC); +#endif /* ZEND_ENGINE_2 */ + + +#define HTTP_CHECK_CURL_INIT(ch, init, action) \ + if ((!(ch)) && (!((ch) = init))) { \ + http_error(HE_WARNING, HTTP_E_REQUEST, "Could not initialize curl"); \ + action; \ + } +#define HTTP_CHECK_CONTENT_TYPE(ct, action) \ + if (!strchr((ct), '/')) { \ + http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, \ + "Content type \"%s\" does not seem to contain a primary and a secondary part", (ct)); \ + action; \ + } +#define HTTP_CHECK_MESSAGE_TYPE_RESPONSE(msg, action) \ + if (!HTTP_MSG_TYPE(RESPONSE, (msg))) { \ + http_error(HE_NOTICE, HTTP_E_MESSAGE_TYPE, "HttpMessage is not of type HTTP_MSG_RESPONSE"); \ + action; \ + } +#define HTTP_CHECK_MESSAGE_TYPE_REQUEST(msg, action) \ + if (!HTTP_MSG_TYPE(REQUEST, (msg))) { \ + http_error(HE_NOTICE, HTTP_E_MESSAGE_TYPE, "HttpMessage is not of type HTTP_MSG_REQUEST"); \ + action; \ + } +#define HTTP_CHECK_GZIP_LEVEL(level, action) \ + if (level < -1 || level > 9) { \ + http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid compression level (-1 to 9): %d", level); \ + action; \ + } +#ifndef PHP_OUTPUT_NEWAPI +# define HTTP_GET_OUTPUT_START() \ + char *output_start_filename = php_get_output_start_filename(TSRMLS_C); \ + int output_start_lineno = php_get_output_start_lineno(TSRMLS_C) +#else +# define HTTP_GET_OUTPUT_START() \ + char *output_start_filename = php_output_get_start_filename(TSRMLS_C); \ + int output_start_lineno = php_output_get_start_lineno(TSRMLS_C) +#endif +#define HTTP_CHECK_HEADERS_SENT(action) \ + if (SG(headers_sent) && !SG(request_info).no_headers) { \ + HTTP_GET_OUTPUT_START(); \ + if (output_start_filename) { \ + http_error_ex(HE_WARNING, HTTP_E_HEADER, "Cannot modify header information - headers already sent by (output started at %s:%d)", \ + output_start_filename, output_start_lineno); \ + } else { \ + http_error(HE_WARNING, HTTP_E_HEADER, "Cannot modify header information - headers already sent"); \ + } \ + action; \ + } + +#define http_log(f, i, m) _http_log_ex((f), (i), (m) TSRMLS_CC) +extern void _http_log_ex(char *file, const char *ident, const char *message TSRMLS_DC); + +#define http_exit(s, h) http_exit_ex((s), (h), NULL, 1) +#define http_exit_ex(s, h, b, e) _http_exit_ex((s), (h), (b), (e) TSRMLS_CC) +extern STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header TSRMLS_DC); + +#define http_check_method(m) http_check_method_ex((m), HTTP_KNOWN_METHODS) +#define http_check_method_ex(m, a) _http_check_method_ex((m), (a)) +extern STATUS _http_check_method_ex(const char *method, const char *methods); + +#define http_got_server_var(v) (NULL != http_get_server_var_ex((v), strlen(v), 1)) +#define http_get_server_var(v, c) http_get_server_var_ex((v), strlen(v), (c)) +#define http_get_server_var_ex(v, l, c) _http_get_server_var_ex((v), (l), (c) TSRMLS_CC) +PHP_HTTP_API zval *_http_get_server_var_ex(const char *key, size_t key_len, zend_bool check TSRMLS_DC); + +#define http_get_request_body(b, l) _http_get_request_body_ex((b), (l), 1 TSRMLS_CC) +#define http_get_request_body_ex(b, l, d) _http_get_request_body_ex((b), (l), (d) TSRMLS_CC) +PHP_HTTP_API STATUS _http_get_request_body_ex(char **body, size_t *length, zend_bool dup TSRMLS_DC); + +#define http_get_request_body_stream() _http_get_request_body_stream(TSRMLS_C) +PHP_HTTP_API php_stream *_http_get_request_body_stream(TSRMLS_D); + + +typedef void (*http_parse_params_callback)(void *cb_arg, const char *key, int keylen, const char *val, int vallen TSRMLS_DC); + +#define http_parse_params_default_callback _http_parse_params_default_callback +PHP_HTTP_API void _http_parse_params_default_callback(void *ht, const char *key, int keylen, const char *val, int vallen TSRMLS_DC); + +#define http_parse_params(s, f, ht) _http_parse_params_ex((s), (f), _http_parse_params_default_callback, (ht) TSRMLS_CC) +#define http_parse_params_ex(s, f, cb, a) _http_parse_params_ex((s), (f), (cb), (a) TSRMLS_CC) +PHP_HTTP_API STATUS _http_parse_params_ex(const char *params, int flags, http_parse_params_callback cb, void *cb_arg TSRMLS_DC); + + +#define http_sleep(s) _http_sleep(s) +static inline void _http_sleep(double s) +{ +#define HTTP_DIFFSEC (0.001) +#define HTTP_MLLISEC (1000) +#define HTTP_MCROSEC (1000 * 1000) +#define HTTP_NANOSEC (1000 * 1000 * 1000) +#define HTTP_MSEC(s) ((long)(s * HTTP_MLLISEC)) +#define HTTP_USEC(s) ((long)(s * HTTP_MCROSEC)) +#define HTTP_NSEC(s) ((long)(s * HTTP_NANOSEC)) + +#if defined(PHP_WIN32) + Sleep((DWORD) HTTP_MSEC(s)); +#elif defined(HAVE_USLEEP) + usleep(HTTP_USEC(s)); +#elif defined(HAVE_NANOSLEEP) + struct timespec req, rem; + + req.tv_sec = (time_t) s; + req.tv_nsec = HTTP_NSEC(s) % HTTP_NANOSEC; + + while (nanosleep(&req, &rem) && (errno == EINTR) && (HTTP_NSEC(rem.tv_sec) + rem.tv_nsec) > HTTP_NSEC(HTTP_DIFFSEC))) { + req.tv_sec = rem.tv_sec; + req.tv_nsec = rem.tv_nsec; + } +#else + struct timeval timeout; + + timeout.tv.sec = (time_t) s; + timeout.tv_usec = HTTP_USEC(s) % HTTP_MCROSEC; + + select(0, NULL, NULL, NULL, &timeout); +#endif +} + +#define http_locate_str _http_locate_str +static inline const char *_http_locate_str(const char *h, size_t h_len, const char *n, size_t n_len) +{ + const char *p, *e; + + if (n_len && h_len) { + e = h + h_len; + do { + if (*h == *n) { + for (p = n; *p == h[p-n]; ++p) { + if (p == n+n_len-1) { + return h; + } + } + } + } while (h++ != e); + } + + return NULL; +} + +#define http_locate_body _http_locate_body +static inline const char *_http_locate_body(const char *message) +{ + const char *body = NULL, *msg = message; + + while (*msg) { + if (*msg == '\n') { + if (*(msg+1) == '\n') { + body = msg + 2; + break; + } else if (*(msg+1) == '\r' && *(msg+2) == '\n') { + body = msg + 3; + break; + } + } + ++msg; + } + return body; +} + +#define http_locate_eol _http_locate_eol +static inline const char *_http_locate_eol(const char *line, int *eol_len) +{ + const char *eol = strpbrk(line, "\r\n"); + + if (eol_len) { + *eol_len = eol ? ((eol[0] == '\r' && eol[1] == '\n') ? 2 : 1) : 0; + } + return eol; +} + +#define http_zset(t, z) _http_zset((t), (z)) +static inline zval *_http_zset(int type, zval *z) +{ + if (Z_TYPE_P(z) != type) { + switch (type) { + case IS_NULL: convert_to_null(z); break; + case IS_BOOL: convert_to_boolean(z); break; + case IS_LONG: convert_to_long(z); break; + case IS_DOUBLE: convert_to_double(z); break; + case IS_STRING: convert_to_string(z); break; + case IS_ARRAY: convert_to_array(z); break; + case IS_OBJECT: convert_to_object(z); break; + } + } + return z; +} +#define http_zsep(t, z) _http_zsep_ex((t), (z), NULL) +#define http_zsep_ex(t, z, p) _http_zsep_ex((t), (z), (p)) +static inline zval *_http_zsep_ex(int type, zval *z, zval **p) { + ZVAL_ADDREF(z); + if (Z_TYPE_P(z) != type) { + switch (type) { + case IS_NULL: convert_to_null_ex(&z); break; + case IS_BOOL: convert_to_boolean_ex(&z); break; + case IS_LONG: convert_to_long_ex(&z); break; + case IS_DOUBLE: convert_to_double_ex(&z); break; + case IS_STRING: convert_to_string_ex(&z); break; + case IS_ARRAY: convert_to_array_ex(&z); break; + case IS_OBJECT: convert_to_object_ex(&z); break; + } + } else { + SEPARATE_ZVAL_IF_NOT_REF(&z); + } + if (p) { + *p = z; + } + return z; +} + +typedef struct _HashKey { + char *str; + uint len; + ulong num; + uint dup:1; + uint type:31; +} HashKey; +#define initHashKey(dup) {NULL, 0, 0, (dup), 0} + +#define FOREACH_VAL(pos, array, val) FOREACH_HASH_VAL(pos, Z_ARRVAL_P(array), val) +#define FOREACH_HASH_VAL(pos, hash, val) \ + for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \ + zend_hash_get_current_data_ex(hash, (void *) &val, &pos) == SUCCESS; \ + zend_hash_move_forward_ex(hash, &pos)) + +#define FOREACH_KEY(pos, array, key) FOREACH_HASH_KEY(pos, Z_ARRVAL_P(array), key) +#define FOREACH_HASH_KEY(pos, hash, _key) \ + for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \ + ((_key).type = zend_hash_get_current_key_ex(hash, &(_key).str, &(_key).len, &(_key).num, (zend_bool) (_key).dup, &pos)) != HASH_KEY_NON_EXISTANT; \ + zend_hash_move_forward_ex(hash, &pos)) \ + +#define FOREACH_KEYVAL(pos, array, key, val) FOREACH_HASH_KEYVAL(pos, Z_ARRVAL_P(array), key, val) +#define FOREACH_HASH_KEYVAL(pos, hash, _key, val) \ + for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \ + ((_key).type = zend_hash_get_current_key_ex(hash, &(_key).str, &(_key).len, &(_key).num, (zend_bool) (_key).dup, &pos)) != HASH_KEY_NON_EXISTANT && \ + zend_hash_get_current_data_ex(hash, (void *) &val, &pos) == SUCCESS; \ + zend_hash_move_forward_ex(hash, &pos)) + +#define array_copy(src, dst) zend_hash_copy(dst, src, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)) +#define ARRAY_JOIN_STRONLY 1 +#define ARRAY_JOIN_PRETTIFY 2 +#define array_join(src, dst, append, flags) zend_hash_apply_with_arguments(src HTTP_ZAPI_HASH_TSRMLS_CC, (append)?apply_array_append_func:apply_array_merge_func, 2, dst, (int)flags) + +extern int apply_array_append_func(void *pDest HTTP_ZAPI_HASH_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); +extern int apply_array_merge_func(void *pDest HTTP_ZAPI_HASH_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ + | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_cache_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_cache_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_cache_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_cache_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_cookie_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_cookie_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_cookie_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_cookie_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_date_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_date_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_date_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_date_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_deflatestream_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_deflatestream_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_deflatestream_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_deflatestream_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_encoding_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_encoding_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_encoding_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_encoding_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_exception_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_exception_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_exception_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_exception_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_filter_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_filter_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_filter_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_filter_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_headers_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_headers_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_headers_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_headers_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_inflatestream_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_inflatestream_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_inflatestream_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_inflatestream_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_info_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_info_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_info_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_info_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_message_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_message_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_message_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_message_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_message_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_message_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_message_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_message_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_persistent_handle_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_persistent_handle_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_persistent_handle_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_persistent_handle_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_querystring_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_querystring_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_querystring_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_querystring_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_querystring_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_querystring_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_querystring_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_querystring_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_body_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_body_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_body_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_body_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_datashare_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_datashare_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_datashare_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_datashare_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_int.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_int.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_int.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_int.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_method_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_method_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_method_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_method_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_pool_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_pool_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_request_pool_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_request_pool_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_requestdatashare_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_requestdatashare_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_requestdatashare_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_requestdatashare_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_requestpool_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_requestpool_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_requestpool_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_requestpool_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_response_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_response_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_response_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_response_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_send_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_send_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_send_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_send_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_std_defs.h ^ |
(renamed from pecl_http-1.7.4/php_http_std_defs.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_std_defs.h ^ |
(renamed from pecl_http-1.7.4/php_http_std_defs.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_url_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_url_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_url_api.h ^ |
(renamed from pecl_http-1.7.4/php_http_url_api.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_util_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_util_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/php_http_util_object.h ^ |
(renamed from pecl_http-1.7.4/php_http_util_object.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/phpstr/phpstr.c ^ |
(renamed from pecl_http-1.7.4/phpstr/phpstr.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/phpstr/phpstr.c ^ |
(renamed from pecl_http-1.7.4/phpstr/phpstr.c) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/phpstr/phpstr.h ^ |
(renamed from pecl_http-1.7.4/phpstr/phpstr.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/phpstr/phpstr.h ^ |
(renamed from pecl_http-1.7.4/phpstr/phpstr.h) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_006.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_006.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_007.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_007.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_007.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_007.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_008.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_008.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_008.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_008.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_009_bug16700.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_009_bug16700.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpMessage_009_bug16700.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpMessage_009_bug16700.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpQueryString_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpQueryString_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpQueryString_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpQueryString_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpQueryString_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpQueryString_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpQueryString_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpQueryString_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpQueryString_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpQueryString_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpQueryString_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpQueryString_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpQueryString_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpQueryString_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpQueryString_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpQueryString_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestDataShare_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestDataShare_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestDataShare_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestDataShare_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestDataShare_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestDataShare_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestDataShare_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestDataShare_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_006.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequestPool_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequestPool_006.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_006.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_006.phpt) | ||
[+] | Added | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_007.phpt ^ |
@@ -0,0 +1,64 @@ +--TEST-- +HttpRequest PUT +--SKIPIF-- +<?php +include 'skip.inc'; +checkcls('HttpRequest'); +?> +--FILE-- +<?php +echo "-TEST\n"; + +$r = new HttpRequest('http://dev.iworks.at/ext-http/.print_put.php5', HTTP_METH_PUT); +$r->recordHistory = true; +$r->addHeaders(array('content-type' => 'text/plain')); +$r->setPutFile(__FILE__); +$r->send(); +var_dump($r->getHistory()->toString(true)); +echo "Done\n"; +?> +--EXPECTF-- +%aTEST +string(%d) "PUT /ext-http/.print_put.php5 HTTP/1.1 +User-Agent: PECL::HTTP/%a +Host: dev.iworks.at +Accept: */* +Content-Type: text/plain +Content-Length: %d +Expect: 100-continue + +<?php +echo "-TEST\n"; + +$r = new HttpRequest('http://dev.iworks.at/ext-http/.print_put.php5', HTTP_METH_PUT); +$r->recordHistory = true; +$r->addHeaders(array('content-type' => 'text/plain')); +$r->setPutFile(__FILE__); +$r->send(); +var_dump($r->getHistory()->toString(true)); +echo "Done\n"; +?> + +HTTP/1.1 100 Continue +HTTP/1.1 200 OK +Date: %a +Server: %a +Vary: Accept-Encoding +Content-Type: text/html +X-Original-Transfer-Encoding: chunked +Content-Length: %d + +<?php +echo "-TEST\n"; + +$r = new HttpRequest('http://dev.iworks.at/ext-http/.print_put.php5', HTTP_METH_PUT); +$r->recordHistory = true; +$r->addHeaders(array('content-type' => 'text/plain')); +$r->setPutFile(__FILE__); +$r->send(); +var_dump($r->getHistory()->toString(true)); +echo "Done\n"; +?> + +" +Done | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_008.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_008.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_008.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_008.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_009.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_009.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_009.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_009.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_010.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_010.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpRequest_010.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpRequest_010.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/HttpResponse_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/HttpResponse_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/allowed_methods_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/allowed_methods_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/allowed_methods_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/allowed_methods_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/allowed_methods_002_logging.phpt ^ |
(renamed from pecl_http-1.7.4/tests/allowed_methods_002_logging.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/allowed_methods_002_logging.phpt ^ |
(renamed from pecl_http-1.7.4/tests/allowed_methods_002_logging.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/bug_15800.phpt ^ |
(renamed from pecl_http-1.7.4/tests/bug_15800.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/bug_15800.phpt ^ |
(renamed from pecl_http-1.7.4/tests/bug_15800.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_str_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_str_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_str_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_str_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_url_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_url_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_url_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_url_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_url_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_url_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_url_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_url_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_url_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_url_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_url_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_url_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_url_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_url_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/build_url_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/build_url_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/chunked_decode_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/chunked_decode_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/chunked_decode_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/chunked_decode_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/chunked_decode_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/chunked_decode_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/chunked_decode_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/chunked_decode_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/chunked_decode_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/chunked_decode_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/chunked_decode_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/chunked_decode_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/chunked_decode_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/chunked_decode_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/chunked_decode_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/chunked_decode_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/cloning_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/cloning_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/cloning_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/cloning_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/data.txt ^ |
(renamed from pecl_http-1.7.4/tests/data.txt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/data.txt ^ |
(renamed from pecl_http-1.7.4/tests/data.txt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/date_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/date_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/date_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/date_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/date_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/date_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/date_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/date_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/encoding_objects_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/encoding_objects_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/encoding_objects_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/encoding_objects_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/encodings.phpt ^ |
(renamed from pecl_http-1.7.4/tests/encodings.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/encodings.phpt ^ |
(renamed from pecl_http-1.7.4/tests/encodings.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_031.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_031.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_031.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_031.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_032.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_032.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_032.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_032.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_033.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_033.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_033.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_033.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_034.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_034.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_034.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_034.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_041.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_041.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_041.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_041.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_042.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_042.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_042.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_042.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_043.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_043.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_043.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_043.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_044.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_044.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/etag_mode_044.phpt ^ |
(renamed from pecl_http-1.7.4/tests/etag_mode_044.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/exceptions.phpt ^ |
(renamed from pecl_http-1.7.4/tests/exceptions.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/exceptions.phpt ^ |
(renamed from pecl_http-1.7.4/tests/exceptions.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/get_request_data_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/get_request_data_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/get_request_data_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/get_request_data_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/log.inc ^ |
(renamed from pecl_http-1.7.4/tests/log.inc) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/log.inc ^ |
(renamed from pecl_http-1.7.4/tests/log.inc) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/match_request_header_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/match_request_header_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/match_request_header_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/match_request_header_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/negotiation_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/negotiation_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/negotiation_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/negotiation_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/ob_deflatehandler_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/ob_deflatehandler_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/ob_deflatehandler_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/ob_deflatehandler_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/ob_inflatehandler_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/ob_inflatehandler_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/ob_inflatehandler_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/ob_inflatehandler_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_cookie_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_cookie_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_cookie_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_cookie_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_cookie_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_cookie_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_cookie_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_cookie_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_headers_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_headers_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_headers_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_headers_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_006.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_message_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_message_006.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_params_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_params_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/parse_params_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/parse_params_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/persistent_handles_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/persistent_handles_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/persistent_handles_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/persistent_handles_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/persistent_handles_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/persistent_handles_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/persistent_handles_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/persistent_handles_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/persistent_handles_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/persistent_handles_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/persistent_handles_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/persistent_handles_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_011.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_011.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_011.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_011.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_011_logging.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_011_logging.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_011_logging.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_011_logging.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_012.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_012.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_012.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_012.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_012_logging.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_012_logging.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_012_logging.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_012_logging.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_013.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_013.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_013.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_013.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_013_logging.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_013_logging.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/redirect_013_logging.phpt ^ |
(renamed from pecl_http-1.7.4/tests/redirect_013_logging.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/request_cookies.phpt ^ |
(renamed from pecl_http-1.7.4/tests/request_cookies.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/request_cookies.phpt ^ |
(renamed from pecl_http-1.7.4/tests/request_cookies.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/request_etag.phpt ^ |
(renamed from pecl_http-1.7.4/tests/request_etag.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/request_etag.phpt ^ |
(renamed from pecl_http-1.7.4/tests/request_etag.phpt) | ||
[+] | Added | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/request_gzip.phpt ^ |
@@ -0,0 +1,53 @@ +--TEST-- +GZIP request +--SKIPIF-- +<?php +include 'skip.inc'; +checkurl('dev.iworks.at'); +skipif(!http_support(HTTP_SUPPORT_REQUESTS), 'need curl support'); +?> +--FILE-- +<?php +echo "-TEST\n"; + +var_dump(http_parse_message(http_get('http://dev.iworks.at/ext-http/.print_request.php?gzip=1', array('compress' => true)))); + +echo "Done\n"; +--EXPECTF-- +%aTEST +object(stdClass)%a { + ["type"]=> + int(2) + ["httpVersion"]=> + float(1.1) + ["responseCode"]=> + int(200) + ["responseStatus"]=> + string(2) "OK" + ["headers"]=> + array(%d) { + %a + ["Vary"]=> + string(15) "Accept-Encoding" + ["Content-Type"]=> + string(9) "text/html" + ["X-Original-Transfer-Encoding"]=> + string(7) "chunked" + ["Content-Length"]=> + string(2) "26" + ["X-Original-Content-Encoding"]=> + string(4) "gzip" + ["X-Original-Content-Length"]=> + string(2) "51" + } + ["body"]=> + string(26) "Array +( + [gzip] => 1 +) +" + ["parentMessage"]=> + NULL +} +Done + | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/request_methods.phpt ^ |
(renamed from pecl_http-1.7.4/tests/request_methods.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/request_methods.phpt ^ |
(renamed from pecl_http-1.7.4/tests/request_methods.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/request_put_data.phpt ^ |
(renamed from pecl_http-1.7.4/tests/request_put_data.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/request_put_data.phpt ^ |
(renamed from pecl_http-1.7.4/tests/request_put_data.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_004.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_004.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_006.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_006.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_006.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_010.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_010.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_010.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_010.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_011.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_011.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_data_011.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_data_011.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_failed_precond_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_failed_precond_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_failed_precond_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_failed_precond_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_005.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_005.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_008.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_008.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_008.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_008.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_009.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_009.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_009.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_009.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_010.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_010.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_010.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_010.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_011.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_011.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_011.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_011.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_012.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_012.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_012.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_012.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_013.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_013.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_file_013.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_file_013.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_ifrange_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_ifrange_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_ifrange_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_ifrange_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_ifrange_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_ifrange_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/send_ifrange_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/send_ifrange_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/skip.inc ^ |
(renamed from pecl_http-1.7.4/tests/skip.inc) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/skip.inc ^ |
(renamed from pecl_http-1.7.4/tests/skip.inc) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/stream_filters_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/stream_filters_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/stream_filters_001.phpt ^ |
(renamed from pecl_http-1.7.4/tests/stream_filters_001.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/stream_filters_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/stream_filters_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/stream_filters_002.phpt ^ |
(renamed from pecl_http-1.7.4/tests/stream_filters_002.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/stream_filters_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/stream_filters_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/stream_filters_003.phpt ^ |
(renamed from pecl_http-1.7.4/tests/stream_filters_003.phpt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/urls.txt ^ |
(renamed from pecl_http-1.7.4/tests/urls.txt) | ||
[+] | Changed | pecl_http-1.7.5.tar.bz2/pecl_http-1.7.5/tests/urls.txt ^ |
(renamed from pecl_http-1.7.4/tests/urls.txt) |