projects
/
m6w6
/
ext-http
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
4a06586
)
ensure string and custom options are reset properly
author
Michael Wallner
<mike@php.net>
Fri, 1 Aug 2014 07:22:56 +0000
(09:22 +0200)
committer
Michael Wallner
<mike@php.net>
Fri, 1 Aug 2014 07:22:56 +0000
(09:22 +0200)
php_http_client_curl.c
patch
|
blob
|
history
diff --git
a/php_http_client_curl.c
b/php_http_client_curl.c
index 1e6d6678fb97c7e36de82223cb4cc1718bccd448..15d26192cedfdc27dbeff17d8ec7ab23a3e5c7d2 100644
(file)
--- a/
php_http_client_curl.c
+++ b/
php_http_client_curl.c
@@
-815,19
+815,20
@@
static STATUS php_http_curle_option_set_cookiestore(php_http_option_t *opt, zval
{
php_http_client_curl_handler_t *curl = userdata;
CURL *ch = curl->handle;
{
php_http_client_curl_handler_t *curl = userdata;
CURL *ch = curl->handle;
+ php_http_curle_storage_t *storage = php_http_curle_get_storage(curl->handle);
- if (val) {
- php_http_curle_storage_t *storage = php_http_curle_get_storage(curl->handle);
-
- if (storage->cookiestore) {
- pefree(storage->cookiestore, 1);
- }
+ if (storage->cookiestore) {
+ pefree(storage->cookiestore, 1);
+ }
+ if (val && Z_STRLEN_P(val)) {
storage->cookiestore = pestrndup(Z_STRVAL_P(val), Z_STRLEN_P(val), 1);
storage->cookiestore = pestrndup(Z_STRVAL_P(val), Z_STRLEN_P(val), 1);
- if ( CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore)
- || CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore)
- ) {
- return FAILURE;
- }
+ } else {
+ storage->cookiestore = NULL;
+ }
+ if ( CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEFILE, storage->cookiestore)
+ || CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIEJAR, storage->cookiestore)
+ ) {
+ return FAILURE;
}
return SUCCESS;
}
}
return SUCCESS;
}
@@
-870,6
+871,11
@@
static STATUS php_http_curle_option_set_cookies(php_http_option_t *opt, zval *va
}
}
}
}
}
}
+ } else {
+ php_http_buffer_reset(&curl->options.cookies);
+ if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIE, NULL)) {
+ return FAILURE;
+ }
}
return SUCCESS;
}
}
return SUCCESS;
}