HttpClient with UNIX_AF/SOCK_STREAM Socket instance

2020-07-24 Thread dom96
The solution here to me sounds simple, just implement UNIX socket support in the stdlib by supporting URIs like: `unix://localhost/run/podman/podman.sock` :) Happy to give pointers on how to do that if you want to tackle it.

HttpClient with UNIX_AF/SOCK_STREAM Socket instance

2020-07-23 Thread velvetkeyboard
I guess I will have to gave up on this one for now. Need more time to get used to the language to tackle this one on my own. But I'm still impressed how fast it was to build and test all the other parts not related to the socket itself. Appreciate all the replies on the issue. Thanks All.

HttpClient with UNIX_AF/SOCK_STREAM Socket instance

2020-07-23 Thread euant
.net allows passing a HttpMessageHandler to the HttpClient constructor. The handler is responsible for sending a request: [https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpmessagehandler?view=netcore-3.1](https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpmessagehandle

HttpClient with UNIX_AF/SOCK_STREAM Socket instance

2020-07-23 Thread snej
Option 1 won't work, it's just a duplicate method and I assume the compiler will complain. Option 2 is workable but requires minor changes to the HttpClient class, because Nim objects don't support dynamic dispatching by default. (In C++ terms, the overriding is non-virtual.) So if you implemen

HttpClient with UNIX_AF/SOCK_STREAM Socket instance

2020-07-23 Thread velvetkeyboard
In Python i was able to override a class method that handler to socket connection. Bellow is the simplified sample: from http.client import HTTPConnection # Core Library class HTTPConnectionUnixSocket(HTTPConnection): def connect(self): sock = socket.soc

HttpClient with UNIX_AF/SOCK_STREAM Socket instance

2020-07-23 Thread dom96
How do other languages solve this problem?

HttpClient with UNIX_AF/SOCK_STREAM Socket instance

2020-07-23 Thread velvetkeyboard
Goal: Use the _HttpClient_ to communicate with a _ReST API_ through a _UNIX socket_ provided by a _daemon_. Details: _Podman_ is providing a brand new _ReST API_ (v2.0) and the _podman daemon_ creates a _unix socket_ to which we can connect and start talking with the application using _HTTP_.