mirror of
https://github.com/moparisthebest/curl
synced 2024-11-10 19:45:04 -05:00
970c22f970
The ability to do HTTP requests over a UNIX domain socket has been requested before, in Apr 2008 [0][1] and Sep 2010 [2]. While a discussion happened, no patch seems to get through. I decided to give it a go since I need to test a nginx HTTP server which listens on a UNIX domain socket. One patch [3] seems to make it possible to use the CURLOPT_OPENSOCKETFUNCTION function to gain a UNIX domain socket. Another person wrote a Go program which can do HTTP over a UNIX socket for Docker[4] which uses a special URL scheme (though the name contains cURL, it has no relation to the cURL library). This patch considers support for UNIX domain sockets at the same level as HTTP proxies / IPv6, it acts as an intermediate socket provider and not as a separate protocol. Since this feature affects network operations, a new feature flag was added ("unix-sockets") with a corresponding CURL_VERSION_UNIX_SOCKETS macro. A new CURLOPT_UNIX_SOCKET_PATH option is added and documented. This option enables UNIX domain sockets support for all requests on the handle (replacing IP sockets and skipping proxies). A new configure option (--enable-unix-sockets) and CMake option (ENABLE_UNIX_SOCKETS) can disable this optional feature. Note that I deliberately did not mark this feature as advanced, this is a feature/component that should easily be available. [0]: http://curl.haxx.se/mail/lib-2008-04/0279.html [1]: http://daniel.haxx.se/blog/2008/04/14/http-over-unix-domain-sockets/ [2]: http://sourceforge.net/p/curl/feature-requests/53/ [3]: http://curl.haxx.se/mail/lib-2008-04/0361.html [4]: https://github.com/Soulou/curl-unix-socket Signed-off-by: Peter Wu <peter@lekensteyn.nl> |
||
---|---|---|
.. | ||
curl | ||
Makefile.am | ||
README |
_ _ ____ _ ___| | | | _ \| | / __| | | | |_) | | | (__| |_| | _ <| |___ \___|\___/|_| \_\_____| Include files for libcurl, external users. They're all placed in the curl subdirectory here for better fit in any kind of environment. You must include files from here using... #include <curl/curl.h> ... style and point the compiler's include path to the directory holding the curl subdirectory. It makes it more likely to survive future modifications. NOTE FOR LIBCURL HACKERS The following notes apply to libcurl version 7.19.0 and later. * The distributed curl/curlbuild.h file is only intended to be used on systems which can not run the also distributed configure script. * The distributed curlbuild.h file is generated as a copy of curlbuild.h.dist when the libcurl source code distribution archive file is originally created. * If you check out from git on a non-configure platform, you must run the appropriate buildconf* script to set up curlbuild.h and other local files before being able of compiling the library. * On systems capable of running the configure script, the configure process will overwrite the distributed include/curl/curlbuild.h file with one that is suitable and specific to the library being configured and built, which is generated from the include/curl/curlbuild.h.in template file. * If you intend to distribute an already compiled libcurl library you _MUST_ also distribute along with it the generated curl/curlbuild.h which has been used to compile it. Otherwise the library will be of no use for the users of the library that you have built. It is _your_ responsibility to provide this file. No one at the cURL project can know how you have built the library. * File curl/curlbuild.h includes platform and configuration dependent info, and must not be modified by anyone. Configure script generates it for you. * We cannot assume anything else but very basic compiler features being present. While libcurl requires an ANSI C compiler to build, some of the earlier ANSI compilers clearly can't deal with some preprocessor operators. * Newlines must remain unix-style for older compilers' sake. * Comments must be written in the old-style /* unnested C-fashion */ To figure out how to do good and portable checks for features, operating systems or specific hardwarare, a very good resource is Bjorn Reese's collection at http://predef.sf.net/