diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-08-29 23:56:28 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-09-11 08:53:53 +0200 |
commit | 481e0de00a9003b9c5220b120e3fc302d9b0932d (patch) | |
tree | cff919570ca5e120c731a342652691522e230c67 /src/tool_helpers.c | |
parent | df6a4d3519655b26137a90a440c5a99f4abe7e22 (diff) |
curl: point out unnecessary uses of -X in verbose mode
It uses 'Note:' as a prefix as opposed to the common 'Warning:' to take
down the tone a bit.
It adds a warning for using -XHEAD on other methods becasue that may
lead to a hanging connection.
Diffstat (limited to 'src/tool_helpers.c')
-rw-r--r-- | src/tool_helpers.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tool_helpers.c b/src/tool_helpers.c index 2f74dc133..f17d09f50 100644 --- a/src/tool_helpers.c +++ b/src/tool_helpers.c @@ -89,3 +89,26 @@ int SetHTTPrequest(struct OperationConfig *config, HttpReq req, HttpReq *store) return 1; } + +void customrequest_helper(struct OperationConfig *config, HttpReq req, + char *method) +{ + /* this mirrors the HttpReq enum in tool_sdecls.h */ + const char *dflt[]= { + "GET", + "GET", + "HEAD", + "POST", + "POST" + }; + + if(curl_strequal(method, dflt[req])) { + notef(config->global, "Unnecessary use of -X or --request, %s is already " + "inferred.\n", dflt[req]); + } + else if(curl_strequal(method, "head")) { + warnf(config->global, + "Setting custom HTTP method to HEAD may not work the way you " + "want.\n"); + } +} |