annotate OrthancStone/Sources/Oracle/HttpCommand.h @ 2177:4d21befb1501 default tip

clarify DICOMweb version check
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Oct 2024 19:27:56 +0200
parents 16c01cc201e7
children
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
2124
16c01cc201e7 updated copyright, as Osimis is not active on Orthanc anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2114
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
2114
c23eef785569 update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2077
diff changeset
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * 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
9 * modify it under the terms of the GNU Lesser General Public License
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * the License, or (at your option) any later version.
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * 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
15 * 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
16 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
17 *
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
18 * 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
19 * 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
20 * <http://www.gnu.org/licenses/>.
979
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
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "../Messages/IMessage.h"
1128
8e3763d1736a removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1079
diff changeset
27 #include "OracleCommandBase.h"
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
29 #include <Enumerations.h>
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #include <map>
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include <json/value.h>
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 namespace OrthancStone
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
1128
8e3763d1736a removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1079
diff changeset
36 class HttpCommand : public OracleCommandBase
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 public:
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 typedef std::map<std::string, std::string> HttpHeaders;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 class SuccessMessage : public OriginMessage<HttpCommand>
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 private:
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
46 const HttpHeaders& headers_;
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
47 const std::string& answer_;
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 public:
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 SuccessMessage(const HttpCommand& command,
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 const HttpHeaders& answerHeaders,
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
52 const std::string& answer) :
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
53 OriginMessage(command),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
54 headers_(answerHeaders),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
55 answer_(answer)
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
56 {
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
57 }
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 const std::string& GetAnswer() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 return answer_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 void ParseJsonBody(Json::Value& target) const;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1128
diff changeset
66 const HttpHeaders& GetAnswerHeaders() const
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 return headers_;
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
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 private:
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 Orthanc::HttpMethod method_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 std::string url_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 std::string body_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 HttpHeaders headers_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 unsigned int timeout_;
1079
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
79 std::string username_;
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
80 std::string password_;
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
82 HttpCommand(const HttpCommand& other) :
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
83 method_(other.method_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
84 url_(other.url_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
85 body_(other.body_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
86 headers_(other.headers_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
87 timeout_(other.timeout_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
88 username_(other.username_),
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
89 password_(other.password_)
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
90 {
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
91 }
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 public:
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 HttpCommand();
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
96 virtual Type GetType() const ORTHANC_OVERRIDE
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 return Type_Http;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
101 virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
102 {
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
103 return new HttpCommand(*this);
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
104 }
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
105
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 void SetMethod(Orthanc::HttpMethod method)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 method_ = method;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 void SetUrl(const std::string& url)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 url_ = url;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 void SetBody(const std::string& body)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 body_ = body;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 void SetBody(const Json::Value& json);
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 void SwapBody(std::string& body)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 body_.swap(body);
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 void SetHttpHeaders(const HttpHeaders& headers)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 headers_ = headers;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 void SetHttpHeader(const std::string& key,
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 const std::string& value)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 headers_[key] = value;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 Orthanc::HttpMethod GetMethod() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 return method_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 const std::string& GetUrl() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 return url_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 const std::string& GetBody() const;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 const HttpHeaders& GetHttpHeaders() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 return headers_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 void SetTimeout(unsigned int seconds)
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 timeout_ = seconds;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 }
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 unsigned int GetTimeout() const
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 return timeout_;
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
1079
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
165
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
166 void SetCredentials(const std::string& username,
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
167 const std::string& password)
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
168 {
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
169 username_ = username;
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
170 password_ = password;
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
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
173 void ClearCredentials()
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
174 {
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
175 username_.clear();
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
176 password_.clear();
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
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
179 bool HasCredentials() const
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
180 {
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
181 return !username_.empty();
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
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
184 const std::string& GetUsername() const;
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
185
e6d2ff8f1ab4 credentials in HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 979
diff changeset
186 const std::string& GetPassword() const;
979
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 };
18d53a8b41b7 HttpCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 }