comparison Core/HttpClient.h @ 3386:af9432e46c07

HttpClient::IBodyStream
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Jun 2019 14:40:14 +0200
parents 4e43e67f8ecf
children a48d652f1500
comparison
equal deleted inserted replaced
3385:f5467ab24aa4 3386:af9432e46c07
35 35
36 #include "Enumerations.h" 36 #include "Enumerations.h"
37 #include "WebServiceParameters.h" 37 #include "WebServiceParameters.h"
38 38
39 #include <string> 39 #include <string>
40 #include <boost/noncopyable.hpp>
40 #include <boost/shared_ptr.hpp> 41 #include <boost/shared_ptr.hpp>
41 #include <json/json.h> 42 #include <json/json.h>
42 43
43 #if !defined(ORTHANC_ENABLE_SSL) 44 #if !defined(ORTHANC_ENABLE_SSL)
44 # error The macro ORTHANC_ENABLE_SSL must be defined 45 # error The macro ORTHANC_ENABLE_SSL must be defined
49 #endif 50 #endif
50 51
51 52
52 namespace Orthanc 53 namespace Orthanc
53 { 54 {
54 class HttpClient 55 class HttpClient : public boost::noncopyable
55 { 56 {
56 public: 57 public:
57 typedef std::map<std::string, std::string> HttpHeaders; 58 typedef std::map<std::string, std::string> HttpHeaders;
58 59
60 class IBodyStream : public boost::noncopyable
61 {
62 public:
63 virtual ~IBodyStream()
64 {
65 }
66
67 virtual bool ReadNextChunk(std::string& chunk) = 0;
68 };
69
59 private: 70 private:
71 class CurlHeaders;
72 class CurlBodyStream;
60 class GlobalParameters; 73 class GlobalParameters;
61 74
62 struct PImpl; 75 struct PImpl;
63 boost::shared_ptr<PImpl> pimpl_; 76 boost::shared_ptr<PImpl> pimpl_;
64 77
131 long GetTimeout() const 144 long GetTimeout() const
132 { 145 {
133 return timeout_; 146 return timeout_;
134 } 147 }
135 148
136 void SetBody(const std::string& data) 149 void SetBody(const std::string& data);
137 {
138 body_ = data;
139 }
140 150
141 std::string& GetBody() 151 std::string& GetBody()
142 { 152 {
143 return body_; 153 return body_;
144 } 154 }
145 155
146 const std::string& GetBody() const 156 const std::string& GetBody() const
147 { 157 {
148 return body_; 158 return body_;
149 } 159 }
160
161 void SetBodyStream(IBodyStream& stream);
162
163 void ClearBodyStream();
150 164
151 void SetVerbose(bool isVerbose); 165 void SetVerbose(bool isVerbose);
152 166
153 bool IsVerbose() const 167 bool IsVerbose() const
154 { 168 {