annotate OrthancStone/Sources/Oracle/HttpCommand.h @ 1773:34eb41352dff

added missing Scene2D/CopyStyleConfigurator.cpp
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 May 2021 17:40:38 +0200
parents 9ac2a65d4172
children 3889ae96d2e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
8 * modify it under the terms of the GNU Lesser General Public License
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
15 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
16 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
18 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
19 * <http://www.gnu.org/licenses/>.
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "../Messages/IMessage.h"
1128
8e3763d1736a removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1079
diff changeset
26 #include "OracleCommandBase.h"
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
28 #include <Enumerations.h>
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #include <map>
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #include <json/value.h>
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 namespace OrthancStone
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
1128
8e3763d1736a removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1079
diff changeset
35 class HttpCommand : public OracleCommandBase
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 public:
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 typedef std::map<std::string, std::string> HttpHeaders;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 class SuccessMessage : public OriginMessage<HttpCommand>
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 private:
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
45 const HttpHeaders& headers_;
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
46 const std::string& answer_;
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 public:
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 SuccessMessage(const HttpCommand& command,
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 const HttpHeaders& answerHeaders,
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
51 const std::string& answer) :
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
52 OriginMessage(command),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
53 headers_(answerHeaders),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
54 answer_(answer)
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
55 {
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
56 }
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 const std::string& GetAnswer() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 return answer_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 void ParseJsonBody(Json::Value& target) const;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
65 const HttpHeaders& GetAnswerHeaders() const
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 return headers_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 };
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 private:
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 Orthanc::HttpMethod method_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 std::string url_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 std::string body_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 HttpHeaders headers_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 unsigned int timeout_;
1079
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
78 std::string username_;
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
79 std::string password_;
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
81 HttpCommand(const HttpCommand& other) :
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
82 method_(other.method_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
83 url_(other.url_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
84 body_(other.body_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
85 headers_(other.headers_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
86 timeout_(other.timeout_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
87 username_(other.username_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
88 password_(other.password_)
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
89 {
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
90 }
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 public:
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 HttpCommand();
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
95 virtual Type GetType() const ORTHANC_OVERRIDE
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 return Type_Http;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
100 virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
101 {
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
102 return new HttpCommand(*this);
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
103 }
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
104
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 void SetMethod(Orthanc::HttpMethod method)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 method_ = method;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 void SetUrl(const std::string& url)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 url_ = url;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 void SetBody(const std::string& body)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 body_ = body;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 void SetBody(const Json::Value& json);
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 void SwapBody(std::string& body)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 body_.swap(body);
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 void SetHttpHeaders(const HttpHeaders& headers)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 headers_ = headers;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 void SetHttpHeader(const std::string& key,
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 const std::string& value)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 headers_[key] = value;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 Orthanc::HttpMethod GetMethod() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 return method_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 const std::string& GetUrl() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 return url_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 const std::string& GetBody() const;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 const HttpHeaders& GetHttpHeaders() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 return headers_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 void SetTimeout(unsigned int seconds)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 timeout_ = seconds;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 unsigned int GetTimeout() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 return timeout_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 }
1079
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
164
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
165 void SetCredentials(const std::string& username,
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
166 const std::string& password)
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
167 {
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
168 username_ = username;
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
169 password_ = password;
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
170 }
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
171
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
172 void ClearCredentials()
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
173 {
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
174 username_.clear();
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
175 password_.clear();
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
176 }
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
177
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
178 bool HasCredentials() const
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
179 {
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
180 return !username_.empty();
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
181 }
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
182
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
183 const std::string& GetUsername() const;
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
184
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
185 const std::string& GetPassword() const;
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 };
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 }