summaryrefslogtreecommitdiff
path: root/ext/curl
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-08-30 17:49:10 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-08-30 17:49:10 +0000
commit307b3bcbb4b2e0256a1345c283b533ca8cad53aa (patch)
tree1604478adcc7325c6bf26ccaa7e2f73638f36358 /ext/curl
parentf231b76ba6ab9494d6c3092b8c70888e10b914d4 (diff)
downloadphp-git-307b3bcbb4b2e0256a1345c283b533ca8cad53aa.tar.gz
Fixed bug #33770 (https:// or ftps:// do not work when --with-curlwrappers
is used and ssl certificate is not verifiable).
Diffstat (limited to 'ext/curl')
-rw-r--r--ext/curl/streams.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/curl/streams.c b/ext/curl/streams.c
index f4aeded3e9..ef41a2dc69 100644
--- a/ext/curl/streams.c
+++ b/ext/curl/streams.c
@@ -301,6 +301,17 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
/* TODO: read cookies and options from context */
if (context && !strncasecmp(filename, "http", sizeof("http")-1)) {
+ if (SUCCESS == php_stream_context_get_option(context, "http", "curl_verify_ssl_host", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_BOOL && Z_LVAL_PP(ctx_opt) == 1) {
+ curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYHOST, 1);
+ } else {
+ curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYHOST, 0);
+ }
+ if (SUCCESS == php_stream_context_get_option(context, "http", "curl_verify_ssl_peer", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_BOOL && Z_LVAL_PP(ctx_opt) == 1) {
+ curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYPEER, 1);
+ } else {
+ curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYPEER, 0);
+ }
+
/* HTTP(S) */
if (SUCCESS == php_stream_context_get_option(context, "http", "user_agent", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_STRING) {
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, Z_STRVAL_PP(ctx_opt));
@@ -364,6 +375,17 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
}
curl_easy_setopt(curlstream->curl, CURLOPT_MAXREDIRS, 20L);
}
+ } else if (context && !strncasecmp(filename, "ftps", sizeof("ftps")-1)) {
+ if (SUCCESS == php_stream_context_get_option(context, "ftp", "curl_verify_ssl_host", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_BOOL && Z_LVAL_PP(ctx_opt) == 1) {
+ curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYHOST, 1);
+ } else {
+ curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYHOST, 0);
+ }
+ if (SUCCESS == php_stream_context_get_option(context, "ftp", "curl_verify_ssl_peer", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_BOOL && Z_LVAL_PP(ctx_opt) == 1) {
+ curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYPEER, 1);
+ } else {
+ curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYPEER, 0);
+ }
}
/* prepare for "pull" mode */