1/***************************************************************************
2 *                                  _   _ ____  _
3 *  Project                     ___| | | |  _ \| |
4 *                             / __| | | | |_) | |
5 *                            | (__| |_| |  _ <| |___
6 *                             \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at http://curl.haxx.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ***************************************************************************/
22#include "setup.h"
23
24#include <curl/curl.h>
25
26#include "rawstr.h"
27
28#define ENABLE_CURLX_PRINTF
29/* use our own printf() functions */
30#include "curlx.h"
31
32#include "tool_cfgable.h"
33#include "tool_msgs.h"
34#include "tool_getparam.h"
35#include "tool_helpers.h"
36
37#include "memdebug.h" /* keep this as LAST include */
38
39/*
40** Helper functions that are used from more tha one source file.
41*/
42
43const char *param2text(int res)
44{
45  ParameterError error = (ParameterError)res;
46  switch(error) {
47  case PARAM_GOT_EXTRA_PARAMETER:
48    return "had unsupported trailing garbage";
49  case PARAM_OPTION_UNKNOWN:
50    return "is unknown";
51  case PARAM_OPTION_AMBIGUOUS:
52    return "is ambiguous";
53  case PARAM_REQUIRES_PARAMETER:
54    return "requires parameter";
55  case PARAM_BAD_USE:
56    return "is badly used here";
57  case PARAM_BAD_NUMERIC:
58    return "expected a proper numerical parameter";
59  case PARAM_LIBCURL_DOESNT_SUPPORT:
60    return "the installed libcurl version doesn't support this";
61  case PARAM_NO_MEM:
62    return "out of memory";
63  default:
64    return "unknown error";
65  }
66}
67
68int SetHTTPrequest(struct Configurable *config, HttpReq req, HttpReq *store)
69{
70  if((*store == HTTPREQ_UNSPEC) ||
71     (*store == req)) {
72    *store = req;
73    return 0;
74  }
75  warnf(config, "You can only select one HTTP request!\n");
76  return 1;
77}
78
79