X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=src%2Fphp_http_client_curl.c;h=435008cdb99a6c42e48a815577657b00088f76fa;hp=5dd7a54b9995e76f5a9b0e2c4e0e1ee5b24445ee;hb=68ae94f5c4c5310de996fc4c2bbfa75561c82b83;hpb=343738ad56eb70017704fdac57cf0d74da3d0f2e;ds=sidebyside diff --git a/src/php_http_client_curl.c b/src/php_http_client_curl.c index 5dd7a54..435008c 100644 --- a/src/php_http_client_curl.c +++ b/src/php_http_client_curl.c @@ -878,6 +878,23 @@ static ZEND_RESULT_CODE php_http_curle_option_set_ssl_verifyhost(php_http_option return SUCCESS; } +static ZEND_RESULT_CODE php_http_curle_option_set_cookiesession(php_http_option_t *opt, zval *val, void *userdata) +{ + php_http_client_curl_handler_t *curl = userdata; + CURL *ch = curl->handle; + + if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIESESSION, (long) Z_BVAL_P(val))) { + return FAILURE; + } + if (Z_BVAL_P(val)) { + if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIELIST, "SESS")) { + return FAILURE; + } + } + + return SUCCESS; +} + static ZEND_RESULT_CODE php_http_curle_option_set_cookiestore(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; @@ -1419,7 +1436,9 @@ static void php_http_curle_options_init(php_http_options_t *registry TSRMLS_DC) } /* cookiesession, don't load session cookies from cookiestore */ - php_http_option_register(registry, ZEND_STRL("cookiesession"), CURLOPT_COOKIESESSION, IS_BOOL); + if ((opt = php_http_option_register(registry, ZEND_STRL("cookiesession"), CURLOPT_COOKIESESSION, IS_BOOL))) { + opt->setter = php_http_curle_option_set_cookiesession; + } /* cookiestore, read initial cookies from that file and store cookies back into that file */ if ((opt = php_http_option_register(registry, ZEND_STRL("cookiestore"), 0, IS_STRING))) { opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN;