mirror of
https://github.com/curl/curl.git
synced 2026-08-26 16:03:33 +03:00
curl: point out the conflicting HTTP methods if used
It isn't always clear to the user which options that cause the HTTP methods to conflict so by spelling them out it should hopefully be easier to understand why curl complains.
This commit is contained in:
parent
ce034356d2
commit
4a889441d3
4 changed files with 16 additions and 8 deletions
|
|
@ -69,13 +69,23 @@ const char *param2text(int res)
|
|||
|
||||
int SetHTTPrequest(struct OperationConfig *config, HttpReq req, HttpReq *store)
|
||||
{
|
||||
/* this mirrors the HttpReq enum in tool_sdecls.h */
|
||||
const char *reqname[]= {
|
||||
"", /* unspec */
|
||||
"GET (-G, --get)",
|
||||
"HEAD (-I, --head)",
|
||||
"multipart formpost (-F, --form)",
|
||||
"POST (-d, --data)"
|
||||
};
|
||||
|
||||
if((*store == HTTPREQ_UNSPEC) ||
|
||||
(*store == req)) {
|
||||
*store = req;
|
||||
return 0;
|
||||
}
|
||||
|
||||
warnf(config->global, "You can only select one HTTP request method!\n");
|
||||
warnf(config->global, "You can only select one HTTP request method! "
|
||||
"You asked for both %s and %s.\n",
|
||||
reqname[req], reqname[*store]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue