mirror of
https://github.com/curl/curl.git
synced 2026-08-03 14:10:30 +03:00
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.
This commit is contained in:
parent
df6a4d3519
commit
481e0de00a
5 changed files with 65 additions and 16 deletions
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue