X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_request_api.c;h=38eadf45f24343b653faa7aae58e5d748fbc59be;hp=496a63ed8d4e735cf057dfaf5ac2307b6323877b;hb=6fc78f4b8ea8a34a40f06985648822fbaa7ffb30;hpb=a0bca521b491711e43aef74fe19c23a8eb4d0777 diff --git a/http_request_api.c b/http_request_api.c index 496a63e..38eadf4 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -15,28 +15,21 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "php.h" + +#define HTTP_WANT_CURL +#include "php_http.h" #ifdef HTTP_HAVE_CURL -#include "php_http.h" -#include "php_http_std_defs.h" #include "php_http_api.h" #include "php_http_request_api.h" #include "php_http_request_method_api.h" #include "php_http_url_api.h" + #ifdef ZEND_ENGINE_2 # include "php_http_request_object.h" #endif -#include "phpstr/phpstr.h" - -#ifdef PHP_WIN32 -# include -#endif - -#include - /* {{{ cruft for thread safe SSL crypto locks */ #if defined(ZTS) && defined(HTTP_HAVE_SSL) # ifdef PHP_WIN32 @@ -381,11 +374,12 @@ PHP_HTTP_API void _http_request_body_dtor(http_request_body *body TSRMLS_DC) /* }}} */ /* {{{ void http_request_body_free(http_request_body *) */ -PHP_HTTP_API void _http_request_body_free(http_request_body *body TSRMLS_DC) +PHP_HTTP_API void _http_request_body_free(http_request_body **body TSRMLS_DC) { - if (body) { - http_request_body_dtor(body); - efree(body); + if (*body) { + http_request_body_dtor(*body); + efree(*body); + *body = NULL; } } /* }}} */ @@ -473,10 +467,10 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char /* compress, empty string enables all supported if libcurl was build with zlib support */ if ((zoption = http_curl_getopt(options, "compress", IS_BOOL)) && Z_LVAL_P(zoption)) { -#if defined(HTTP_HAVE_ZLIB) || defined(HAVE_ZLIB) - HTTP_CURL_OPT(ENCODING, "gzip;q=1.0, deflate;q=0.5, *;q=0"); -#else +#ifdef HTTP_HAVE_CURL_ZLIB HTTP_CURL_OPT(ENCODING, ""); +#else + HTTP_CURL_OPT(ENCODING, "gzip;q=1.0, deflate;q=0.5, *;q=0.1"); #endif } @@ -1041,7 +1035,7 @@ static inline void _http_curl_defaults(CURL *ch) HTTP_CURL_OPT(FOLLOWLOCATION, 0); HTTP_CURL_OPT(UNRESTRICTED_AUTH, 0); HTTP_CURL_OPT(REFERER, NULL); - HTTP_CURL_OPT(USERAGENT, "PECL::HTTP/" HTTP_PEXT_VERSION " (PHP/" PHP_VERSION ")"); + HTTP_CURL_OPT(USERAGENT, "PECL::HTTP/" PHP_EXT_HTTP_VERSION " (PHP/" PHP_VERSION ")"); HTTP_CURL_OPT(HTTPHEADER, NULL); HTTP_CURL_OPT(COOKIE, NULL); HTTP_CURL_OPT(COOKIEFILE, NULL);