curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Supporting socks proxy via unix sockets

From: Alex Bligh via curl-users <curl-users_at_lists.haxx.se>
Date: Fri, 15 Apr 2022 19:17:43 +0200

> On 15 Apr 2022, at 11:32, Daniel Stenberg via curl-users <curl-users_at_lists.haxx.se> wrote:
>
> Maybe we could require "localhost" as hostname and if the URL then has a path it means it is a unix-socket and not a "normal one"?
>
> Like this:
>
> socks5h://localhost/path/to/socks.sock

For socks5h maybe, but if you want sockets to work in general in URLs, that's not going to work. Consider making an http request:

http://localhost/path/to/socks.sock

is a perfectly valid 127.0.0.1:80 URL. But using the above scheme it could be a socket URL.

Indeed if you want to send "GET /my/url/here/index.html" to a port 80 socket on at path path/to/socks.sock you need to encode two things that look like paths in the URL.

http:///path/to/socks.sock:/my/url/here/index.html

or similar might work. If you want a relative path:

http://./path/to/socks.sock:/my/url/here/index.html

Of course that fails with paths with a colon in.

Or perhaps:

http:/path/to/socks.sock//my/url/here/index.html

on the basis "//" is illegal in paths.

-- 
Alex Bligh
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-04-15