Added support for http requests over unix sockets via the unix:// protocol name.
Uses net.connect to discover the listening socket inside a full url and sends the remaining path using existing request methods.
Summary for use is added to README.md
The asynchronous socket listener discovery loop fails with an Error after 1000 ticks to prevent hangs, successful connections appear to happen within a couple of ticks.
this doesn't merge cleanly :(
Hi @mikeal I've fixed my fork to merge cleanly with 638c568. Sorry about that
i'm going to need some time to review this. i want to bring it in, but its a big change and i'll need to find a good time to review it all.
Thanks for the update @mikeal, I'll try to put together a test when I get time too. I had to wrap a big chunk of init in a secondary function so the socket lookup could callback request building.
Let me know if you have any questions at all. I've got my fork running on a production app without issues.
can we use unix socket now?
+1, useful PR.
It still says it won't merge cleanly :(
Rewrite UNIX Domain Socket support into 2.33.1. Add test.
Use setImmediate when available, otherwise fallback to nextTick
Hey @mikeal, looks like a lot has changed in request since I looked at this. I've reintegrated my fork into the latest version and wrote a test for basic UNIX domain socket requests.
I also double checked the fork merges cleanly, so hoping you are able to close this pull request. Thanks :)
should alter the indentation if you're putting this whole thing in a function.
Good point. I've indented the function. Let me know if there's anything else that needs updating.
Indent wrapped buildRequest function