&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;
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;
}
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:
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
HTTPREQ_UNSPEC, /* first in list */
HTTPREQ_GET,
HTTPREQ_HEAD,
- HTTPREQ_POST,
+ HTTPREQ_FORMPOST,
HTTPREQ_SIMPLEPOST,
- HTTPREQ_CUSTOM,
- HTTPREQ_LAST /* last in list */
} HttpReq;