]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool: add --unix-socket option
authorPeter Wu <peter@lekensteyn.nl>
Thu, 27 Nov 2014 22:59:26 +0000 (23:59 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 4 Dec 2014 01:52:19 +0000 (02:52 +0100)
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
src/tool_cfgable.c
src/tool_cfgable.h
src/tool_getparam.c
src/tool_help.c
src/tool_operate.c

index fd62e4b24174e01678dae25bc852e88a5c96737c..c9ee4170374aebf9d9584c1e93d300bc69004081 100644 (file)
@@ -115,6 +115,7 @@ static void free_config_fields(struct OperationConfig *config)
 
   Curl_safefree(config->xoauth2_bearer);
 
+  Curl_safefree(config->unix_socket_path);
   Curl_safefree(config->writeout);
 
   curl_slist_free_all(config->quote);
index 11a6a98e03e5cd8c5a525cc520b71c827e05e965..2336016096141d85c7530cab7b4e50f937f19b12 100644 (file)
@@ -204,6 +204,7 @@ struct OperationConfig {
   char *xoauth2_bearer;       /* XOAUTH2 bearer token */
   bool nonpn;                 /* enable/disable TLS NPN extension */
   bool noalpn;                /* enable/disable TLS ALPN extension */
+  char *unix_socket_path;     /* path to UNIX domain socket */
 
   struct GlobalConfig *global;
   struct OperationConfig *prev;
index bf025e4e8f9069e5c0eda403bee4e442a8738223..3932ccbf533cccee91db108c81a87b6d5cfb15d1 100644 (file)
@@ -176,6 +176,7 @@ static const struct LongShort aliases[]= {
   {"$J", "metalink",                 FALSE},
   {"$K", "sasl-ir",                  FALSE},
   {"$L", "test-event",               FALSE},
+  {"$M", "unix-socket",              TRUE},
   {"0",   "http1.0",                 FALSE},
   {"01",  "http1.1",                 FALSE},
   {"02",  "http2",                   FALSE},
@@ -976,6 +977,9 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         warnf(config, "--test-event is ignored unless a debug build!\n");
 #endif
         break;
+      case 'M': /* --unix-socket */
+        GetStr(&config->unix_socket_path, nextarg);
+        break;
       }
       break;
     case '#': /* --progress-bar */
index 6f8f29263b9aa9c2b4da84c9997345d3dcbfd445..3d16e0f335ccf8b03b249c19ceacb0e8bd69a189 100644 (file)
@@ -231,6 +231,7 @@ static const char *const helptext[] = {
   "     --tlsuser USER  TLS username",
   "     --tlspassword STRING  TLS password",
   "     --tlsauthtype STRING  TLS authentication type (default: SRP)",
+  "     --unix-socket FILE    Connect through this UNIX domain socket",
   " -A, --user-agent STRING  Send User-Agent STRING to server (H)",
   " -v, --verbose       Make the operation more talkative",
   " -V, --version       Show version number and quit",
index fe54a34a7b6a41bfdac245f6c4155f54530b2151..43d6ec351ae77654c23efb2c7a7e95dfd9d65183 100644 (file)
@@ -1331,6 +1331,10 @@ static CURLcode operate_do(struct GlobalConfig *global,
           my_setopt(curl, CURLOPT_SSL_ENABLE_ALPN, 0L);
         }
 
+        /* new in 7.40.0 */
+        if(config->unix_socket_path)
+          my_setopt(curl, CURLOPT_UNIX_SOCKET_PATH, config->unix_socket_path);
+
         /* initialize retry vars for loop below */
         retry_sleep_default = (config->retry_delay) ?
           config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */