diff --git a/src/tool_getparam.c b/src/tool_getparam.c index e97a1b98cbc813b4f383a7e95f96f964bd94fc8c..662c6eea278ee949a52e9244c2c083fae026f70f 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -1422,7 +1422,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ &config->last_post, (subletter=='s')?TRUE:FALSE)) /* 's' means literal string */ return PARAM_BAD_USE; - if(SetHTTPrequest(config, HTTPREQ_POST, &config->httpreq)) + if(SetHTTPrequest(config, HTTPREQ_FORMPOST, &config->httpreq)) return PARAM_BAD_USE; break; diff --git a/src/tool_helpers.c b/src/tool_helpers.c index 08248c37cb38487b80c7e4950f7af132ae56e827..2f74dc13343469cf055fb14b2775bf739ad96eb0 100644 --- a/src/tool_helpers.c +++ b/src/tool_helpers.c @@ -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; } diff --git a/src/tool_operate.c b/src/tool_operate.c index d18175f04bf507cc1f98864ff17f3a6ecf0a6a1d..b3fa14644daccc3e415f53245fd7ca43b6826ee9 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -935,7 +935,7 @@ static CURLcode operate_do(struct GlobalConfig *global, my_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, config->postfieldsize); break; - case HTTPREQ_POST: + case HTTPREQ_FORMPOST: my_setopt_httppost(curl, CURLOPT_HTTPPOST, config->httppost); break; default: diff --git a/src/tool_sdecls.h b/src/tool_sdecls.h index e74020f777a6f00c40458295ef2942cc17b2bb81..9455a251087d686aa8f5f56d4a06f3dbd2bc2d7e 100644 --- a/src/tool_sdecls.h +++ b/src/tool_sdecls.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -135,10 +135,8 @@ typedef enum { HTTPREQ_UNSPEC, /* first in list */ HTTPREQ_GET, HTTPREQ_HEAD, - HTTPREQ_POST, + HTTPREQ_FORMPOST, HTTPREQ_SIMPLEPOST, - HTTPREQ_CUSTOM, - HTTPREQ_LAST /* last in list */ } HttpReq;