[php-src] Issue #24284: CURLOPT_PROXY is incorrectly using UNIX socket as proxy
| From: | arishat | Date: | Tue, 13 Oct 2026 00:11:18 +0000 |
| Subject: | [php-src] Issue #24284: CURLOPT_PROXY is incorrectly using UNIX socket as proxy | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252981@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/24284
Author: arishat
### Description
The following code:
```php
<?php
// let's say curl URL points to https://example.com:1234
...
curl_setopt($ch,CURLOPT_VERBOSE,true);
curl_setopt($ch,CURLOPT_PROXY,'localhost/tmp/socks-proxy.sock');
curl_setopt($ch,CURLOPT_PROXYTYPE,CURLPROXY_SOCKS5_HOSTNAME);
...
var_dump(curl_exec($ch));
```
Resulted in this output:
```
* Trying /tmp/socks-proxy.sock:0...
* SOCKS5 connect to example.com:1234 (remotely resolved)
* SOCKS5 request granted.
* Connected to localhost/tmp/socks-proxy.sock () port 1080
* using HTTP/1.x
* ALPN: curl offers h2,http/1.1
* Send failure: Broken pipe
* TLS connect error: error:00000000:lib(0)::reason(0)
* OpenSSL SSL_connect: Broken pipe in connection to example.com:1234
* closing connection #0
bool(false)
```
But I expected this output instead:
```
< HTTP/2 200
< content-type: text/html
string(10) "...
```
If I change it to normal IP:Port it works:
curl_setopt($ch,CURLOPT_PROXY,'127.0.0.1:1081');
curl_setopt($ch,CURLOPT_PROXYTYPE,CURLPROXY_SOCKS5_HOSTNAME);
* Trying 127.0.0.1:1080...
* SOCKS5 request granted.
...
< HTTP/2 200
< content-type: text/html
string(10) "...
**But I believe this is PHP bug** because the https://curl.se/libcurl/c/CURLOPT_PROXY.html
clearly support this usage:
```
Unix domain sockets are supported for SOCKS proxies. Set localhost for the host part and append the
absolute path to the domain socket. For example: socks5h://localhost/path/to/socket.sock
```
### PHP Version
```plain
PHP 8.4.26 (cli)
```
### Operating System
Linux