diff options
author | Anatol Belski <ab@php.net> | 2017-12-03 12:28:41 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-12-03 12:28:41 +0100 |
commit | 36f85e17e2f7823765dca68015e386af569a62ef (patch) | |
tree | 8a5e61dcfc529709f0740240c34cdb1ac4c15330 | |
parent | f9b8bd07c7d7e87051d0c6eda77d423672240c2e (diff) | |
parent | aaf00ae0a99b84f1fb9a053fa08aef2abdab9f2b (diff) | |
download | php-git-36f85e17e2f7823765dca68015e386af569a62ef.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fix compat with libcurl 7.56.1+ and file:// wrapper
-rw-r--r-- | ext/curl/interface.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 0d1152b987..57e52d52b8 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -219,6 +219,17 @@ static int php_curl_option_url(php_curl *ch, const char *url, const size_t len) #endif } +#if LIBCURL_VERSION_NUM > 0x073800 && defined(PHP_WIN32) + if (len > sizeof("file://") - 1 && '/' != url[sizeof("file://") - 1] && !strncmp("file://", url, sizeof("file://") - 1) && len < MAXPATHLEN - 2) { + char _tmp[MAXPATHLEN] = {0}; + + memmove(_tmp, "file:///", sizeof("file:///") - 1); + memmove(_tmp + sizeof("file:///") - 1, url + sizeof("file://") - 1, len - sizeof("file://") + 1); + + return php_curl_option_str(ch, CURLOPT_URL, _tmp, len + 1, 0); + } +#endif + return php_curl_option_str(ch, CURLOPT_URL, url, len, 0); } /* }}} */ |