comparison OrthancFramework/Sources/HttpServer/HttpOutput.h @ 4298:db3932f9660d

abi continued
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 05 Nov 2020 18:21:03 +0100
parents bf7b9edf6b81
children d9473bd5ed43
comparison
equal deleted inserted replaced
4297:785a2713323e 4298:db3932f9660d
113 113
114 HttpCompression GetPreferredCompression(size_t bodySize) const; 114 HttpCompression GetPreferredCompression(size_t bodySize) const;
115 115
116 public: 116 public:
117 HttpOutput(IHttpOutputStream& stream, 117 HttpOutput(IHttpOutputStream& stream,
118 bool isKeepAlive) : 118 bool isKeepAlive);
119 stateMachine_(stream, isKeepAlive),
120 isDeflateAllowed_(false),
121 isGzipAllowed_(false)
122 {
123 }
124 119
125 void SetDeflateAllowed(bool allowed) 120 void SetDeflateAllowed(bool allowed);
126 {
127 isDeflateAllowed_ = allowed;
128 }
129 121
130 bool IsDeflateAllowed() const 122 bool IsDeflateAllowed() const;
131 {
132 return isDeflateAllowed_;
133 }
134 123
135 void SetGzipAllowed(bool allowed) 124 void SetGzipAllowed(bool allowed);
136 {
137 isGzipAllowed_ = allowed;
138 }
139 125
140 bool IsGzipAllowed() const 126 bool IsGzipAllowed() const;
141 {
142 return isGzipAllowed_;
143 }
144 127
145 void SendStatus(HttpStatus status, 128 void SendStatus(HttpStatus status,
146 const char* message, 129 const char* message,
147 size_t messageSize); 130 size_t messageSize);
148 131
149 void SendStatus(HttpStatus status) 132 void SendStatus(HttpStatus status);
150 {
151 SendStatus(status, NULL, 0);
152 }
153 133
154 void SendStatus(HttpStatus status, 134 void SendStatus(HttpStatus status,
155 const std::string& message) 135 const std::string& message);
156 {
157 SendStatus(status, message.c_str(), message.size());
158 }
159 136
160 void SetContentType(MimeType contentType) 137 void SetContentType(MimeType contentType);
161 {
162 stateMachine_.SetContentType(EnumerationToString(contentType));
163 }
164 138
165 void SetContentType(const std::string& contentType) 139 void SetContentType(const std::string& contentType);
166 {
167 stateMachine_.SetContentType(contentType.c_str());
168 }
169 140
170 void SetContentFilename(const char* filename) 141 void SetContentFilename(const char* filename);
171 {
172 stateMachine_.SetContentFilename(filename);
173 }
174 142
175 void SetCookie(const std::string& cookie, 143 void SetCookie(const std::string& cookie,
176 const std::string& value) 144 const std::string& value);
177 {
178 stateMachine_.SetCookie(cookie, value);
179 }
180 145
181 void AddHeader(const std::string& key, 146 void AddHeader(const std::string& key,
182 const std::string& value) 147 const std::string& value);
183 {
184 stateMachine_.AddHeader(key, value);
185 }
186 148
187 void Answer(const void* buffer, 149 void Answer(const void* buffer,
188 size_t length); 150 size_t length);
189 151
190 void Answer(const std::string& str); 152 void Answer(const std::string& str);
196 void Redirect(const std::string& path); 158 void Redirect(const std::string& path);
197 159
198 void SendUnauthorized(const std::string& realm); 160 void SendUnauthorized(const std::string& realm);
199 161
200 void StartMultipart(const std::string& subType, 162 void StartMultipart(const std::string& subType,
201 const std::string& contentType) 163 const std::string& contentType);
202 {
203 stateMachine_.StartMultipart(subType, contentType);
204 }
205 164
206 void SendMultipartItem(const void* item, 165 void SendMultipartItem(const void* item,
207 size_t size, 166 size_t size,
208 const std::map<std::string, std::string>& headers) 167 const std::map<std::string, std::string>& headers);
209 {
210 stateMachine_.SendMultipartItem(item, size, headers);
211 }
212 168
213 void CloseMultipart() 169 void CloseMultipart();
214 {
215 stateMachine_.CloseMultipart();
216 }
217 170
218 bool IsWritingMultipart() const 171 bool IsWritingMultipart() const;
219 {
220 return stateMachine_.GetState() == StateMachine::State_WritingMultipart;
221 }
222 172
223 void Answer(IHttpStreamAnswer& stream); 173 void Answer(IHttpStreamAnswer& stream);
224 174
225 /** 175 /**
226 * This method is a replacement to the combination 176 * This method is a replacement to the combination