X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_request_api.c;h=00f4b9d48d6fb7e1d28dc05b1a820efa72191605;hb=08bec19979c75a45978c7c7a7c6d7926a9d5322e;hp=6bc27e514b03efb16d33b6f6e577d684bcb3ab11;hpb=93c640bff30c951f372a547f06169bf02e152cae;p=m6w6%2Fext-http diff --git a/http_request_api.c b/http_request_api.c index 6bc27e5..00f4b9d 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -358,6 +358,7 @@ PHP_HTTP_API void _http_request_defaults(http_request *request) HTTP_CURL_OPT(IOCTLDATA, NULL); HTTP_CURL_OPT(READDATA, NULL); HTTP_CURL_OPT(INFILESIZE, 0); + HTTP_CURL_OPT(HTTP_VERSION, CURL_HTTP_VERSION_NONE); } } /* }}} */ @@ -485,7 +486,7 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti } } 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,*;q=0.1"); + request->_cache.headers = curl_slist_append(request->_cache.headers, "Accept-Encoding: gzip;q=1.0,deflate;q=0.5"); } HTTP_CURL_OPT(HTTPHEADER, request->_cache.headers); @@ -534,6 +535,11 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti HTTP_CURL_OPT(MAXFILESIZE, Z_LVAL_P(zoption)); } + /* http protocol */ + if ((zoption = http_request_option(request, options, "protocol", IS_LONG))) { + HTTP_CURL_OPT(HTTP_VERSION, Z_LVAL_P(zoption)); + } + /* lastmodified */ if ((zoption = http_request_option(request, options, "lastmodified", IS_LONG))) { if (Z_LVAL_P(zoption)) { @@ -623,7 +629,7 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti } /* attach request body */ - if (request->body && (request->meth != HTTP_GET) && (request->meth != HTTP_HEAD)) { + if (request->body && (request->meth != HTTP_GET) && (request->meth != HTTP_HEAD) && (request->meth != HTTP_OPTIONS)) { switch (request->body->type) { case HTTP_REQUEST_BODY_CSTRING: