-
-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unix domain socket support #803
base: master
Are you sure you want to change the base?
Conversation
Maybe rename it if it also works on Windows? Maybe something like external_socket_path or something like this? |
Actually it is named "unix socket" (or AF_UNIX) on Windows: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ |
hi @mrozigor I'm looking to start using this library, but I need this feature, how far are we from having a release with it? |
@Dwordcito after this is merged you could prepare library from the master branch. But I'm not sure when will be the next numbered version available |
I don't see a use case for pure domain sockets. If you want to use them, maybe http is not the right transport protocol. |
In my case my server application is accessed from web browser and also from another client application which internally uses curl, mostly on localhost. Curl supports http and websockets via unix domain sockets like |
The use case is similar to what Docker or Snapd uses today, basically exposing an interface. The part of exposing it through unix sockets is to guarantee securitization at the FS level. |
This has been a requested feature since before this fork, @gittiver if this passes all the tests, I think we should merge it into 1.3 |
I wanted to use unix domain socket since performance is important in my project, so I implemented based on ipkn/crow#379.
Instead of duplicating App and Server classes, I created wrapper class of acceptor so the existing Server class can be used for unix socket connection.
By specifying socket path with
app.unix_path()
(instead ofapp.port(port_num)
) the server will create and use that socket instead of listening a tcp socket. (I added example as example/example_unix_socket.cpp)Although it is named unix socket, this also works on windows.
If there is any problem please let me know.
Especially I am not sure if there is a better name than
unix_path()
. → renamed tolocal_socket_path
.