Are you sur you have nothing listening using netstat 127.0.0.1:80 ?
It seems you can inject a TSocketHandler class into TFPHTTPClient, so you just need to write a wrapper using TUnixSocket
I'm trying to query the Docker daemon, which could be exposed to a real network host, but I want to avoid that.
I've played around for some time and connecting to the daemon is as easy as:
UnixSocket := TUnixSocket.Create('/var/run/docker.sock');
After that you can send the HTTP-Request with the
WriteBuffer method and read data with the
ReadBuffer method.
Now the interesting part:the
TFPHTTPClient class creates a
TInetSocket instance for the private field
FSocket, which is also of type
TInetSocket, in the protected method
ConnectToServer. There are no dependencies to the functionality of
TInetSocket in any other methods, everywhere else just methods of the parent class
TSocketStream of
TInetSocket and
TUnixSocket are used.
So if I could change
FSocket from a private to a protected field and override the
ConnectToServer method in a subclass, all should be fine. Unfortunately to change the private field in
TFPHTTPClient, I would have to create a copy of the
fphttpclient unit, wouldn't I? Any chance to take another route to solve this problem?
I also think it would be a good idea to contact the author of the unit (Michael Van Canneyt?) to propose such changes, so that the class is usable with Unix domain sockets, too (as more and more Linux services use HTTP over UDS, for example Docker and Node.js).