diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-11-27 23:59:26 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-12-04 02:52:19 +0100 |
commit | c8644d1f638fdd8f4bf34fe64e910ba704fb26c0 (patch) | |
tree | 907f2f618906215abfea7259dac8b35db462808a /src | |
parent | 970c22f970f0172e6a4c98ccc3176c740ddaa1c6 (diff) | |
download | curl-c8644d1f638fdd8f4bf34fe64e910ba704fb26c0.tar.gz |
tool: add --unix-socket option
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_cfgable.c | 1 | ||||
-rw-r--r-- | src/tool_cfgable.h | 1 | ||||
-rw-r--r-- | src/tool_getparam.c | 4 | ||||
-rw-r--r-- | src/tool_help.c | 1 | ||||
-rw-r--r-- | src/tool_operate.c | 4 |
5 files changed, 11 insertions, 0 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index fd62e4b24..c9ee41703 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -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); diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h index 11a6a98e0..233601609 100644 --- a/src/tool_cfgable.h +++ b/src/tool_cfgable.h @@ -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; diff --git a/src/tool_getparam.c b/src/tool_getparam.c index bf025e4e8..3932ccbf5 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -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 */ diff --git a/src/tool_help.c b/src/tool_help.c index 6f8f29263..3d16e0f33 100644 --- a/src/tool_help.c +++ b/src/tool_help.c @@ -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", diff --git a/src/tool_operate.c b/src/tool_operate.c index fe54a34a7..43d6ec351 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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 */ |