SNode.C
Loading...
Searching...
No Matches
web::http::server::Response Class Reference

#include <Response.h>

Inheritance diagram for web::http::server::Response:
Collaboration diagram for web::http::server::Response:

Public Member Functions

 Response (SocketContext *socketContext)
 
 Response (Response &)=delete
 
 Response (Response &&) noexcept=delete
 
Responseoperator= (Response &)=delete
 
Responseoperator= (Response &&) noexcept=delete
 
 ~Response () override
 
void stopResponse ()
 
Responsestatus (int statusCode)
 
Responseappend (const std::string &field, const std::string &value)
 
Responseset (const std::string &field, const std::string &value, bool overwrite=true)
 
Responseset (const std::map< std::string, std::string > &headers, bool overwrite=true)
 
Responsetype (const std::string &type)
 
Responsecookie (const std::string &name, const std::string &value, const std::map< std::string, std::string > &options={})
 
ResponseclearCookie (const std::string &name, const std::map< std::string, std::string > &options={})
 
ResponsesetTrailer (const std::string &field, const std::string &value, bool overwrite=true)
 
void send (const char *chunk, std::size_t chunkLen)
 
void send (const std::string &chunk)
 
void sendStatus (int statusCode)
 
void upgrade (const std::shared_ptr< Request > &request, const std::function< void(const std::string &)> &status)
 
void sendFile (const std::string &file, const std::function< void(int)> &callback)
 
void end ()
 
ResponsesendHeader ()
 
ResponsesendFragment (const char *chunk, std::size_t chunkLen)
 
ResponsesendFragment (const std::string &chunk)
 
const std::string & header (const std::string &field)
 
SocketContextgetSocketContext () const
 
- Public Member Functions inherited from core::pipe::Sink
 Sink (Sink &)=delete
 
Sinkoperator= (Sink &)=delete
 

Public Attributes

int statusCode = 200
 
int httpMajor = 1
 
int httpMinor = 1
 

Protected Attributes

web::http::CiStringMap< std::string > headers
 
web::http::CiStringMap< web::http::CookieOptionscookies
 
web::http::CiStringMap< std::string > trailer
 

Private Member Functions

virtual void init ()
 
void sendCompleted ()
 
void onSourceConnect (core::pipe::Source *source) override
 
void onSourceData (const char *chunk, std::size_t chunkLen) override
 
void onSourceEof () override
 
void onSourceError (int errnum) override
 

Private Attributes

std::size_t contentSent = 0
 
std::size_t contentLength = 0
 
SocketContextsocketContext = nullptr
 
core::socket::stream::SocketContextsocketContextUpgrade = nullptr
 
ConnectionState connectionState = ConnectionState::Default
 
TransferEncoding transferEncoding = TransferEncoding::HTTP10
 

Friends

class SocketContext
 

Additional Inherited Members

- Protected Member Functions inherited from core::pipe::Sink
 Sink ()=default
 
 Sink (Sink &&) noexcept=default
 
Sinkoperator= (Sink &&) noexcept=default
 
virtual ~Sink ()
 
bool isStreaming ()
 
void stop ()
 

Detailed Description

Definition at line 73 of file Response.h.

Constructor & Destructor Documentation

◆ Response() [1/3]

web::http::server::Response::Response ( SocketContext socketContext)
explicit

Definition at line 72 of file Response.cpp.

74 }
SocketContext * socketContext
Definition Response.h:137

References socketContext.

◆ Response() [2/3]

web::http::server::Response::Response ( Response )
explicitdelete

◆ Response() [3/3]

web::http::server::Response::Response ( Response &&  )
explicitdeletenoexcept

◆ ~Response()

web::http::server::Response::~Response ( )
override

Definition at line 76 of file Response.cpp.

76 {
77 if (socketContext != nullptr && Sink::isStreaming()) {
79 }
80
81 delete socketContextUpgrade; // delete of nullptr is valid since C++14!
82 }
core::socket::stream::SocketContext * socketContextUpgrade
Definition Response.h:138

References core::pipe::Sink::isStreaming(), socketContext, socketContextUpgrade, and core::socket::stream::SocketContext::streamEof().

Here is the call graph for this function:

Member Function Documentation

◆ append()

Response & web::http::server::Response::append ( const std::string &  field,
const std::string &  value 
)

Definition at line 108 of file Response.cpp.

108 {
109 const std::map<std::string, std::string>::iterator it = headers.find(field);
110
111 if (it != headers.end()) {
112 set(field, it->second.append(", ").append(value));
113 } else {
114 set(field, value);
115 }
116
117 return *this;
118 }
web::http::CiStringMap< std::string > headers
Definition Response.h:129
Response & set(const std::string &field, const std::string &value, bool overwrite=true)
Definition Response.cpp:128

References headers, and set().

Referenced by express::Response::append().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearCookie()

Response & web::http::server::Response::clearCookie ( const std::string &  name,
const std::map< std::string, std::string > &  options = {} 
)

Definition at line 184 of file Response.cpp.

184 {
185 std::map<std::string, std::string> opts = options;
186
187 opts.erase("Max-Age");
188 const time_t time = 0;
189 opts["Expires"] = httputils::to_http_date(utils::system::gmtime(&time));
190
191 return cookie(name, "", opts);
192 }
Response & cookie(const std::string &name, const std::string &value, const std::map< std::string, std::string > &options={})
Definition Response.cpp:178
std::string to_http_date(struct tm *tm)
struct tm * gmtime(const time_t *timep)
Definition time.cpp:62
time_t time(time_t *tloc)
Definition time.cpp:52

References cookie(), utils::system::gmtime(), and httputils::to_http_date().

Referenced by express::Response::clearCookie().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cookie()

Response & web::http::server::Response::cookie ( const std::string &  name,
const std::string &  value,
const std::map< std::string, std::string > &  options = {} 
)

Definition at line 178 of file Response.cpp.

178 {
179 cookies.insert({name, CookieOptions(value, options)});
180
181 return *this;
182 }
web::http::CiStringMap< web::http::CookieOptions > cookies
Definition Response.h:130

References web::http::CookieOptions::CookieOptions(), and cookies.

Referenced by clearCookie(), and express::Response::cookie().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ end()

void web::http::server::Response::end ( )

Definition at line 330 of file Response.cpp.

330 {
331 send("");
332 }
void send(const char *chunk, std::size_t chunkLen)
Definition Response.cpp:213

References send().

Referenced by express::Response::end().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSocketContext()

SocketContext * web::http::server::Response::getSocketContext ( ) const

Definition at line 457 of file Response.cpp.

457 {
458 return socketContext;
459 }

References socketContext.

Referenced by express::Response::getSocketContext().

Here is the caller graph for this function:

◆ header()

const std::string & web::http::server::Response::header ( const std::string &  field)

Definition at line 453 of file Response.cpp.

453 {
454 return headers[field];
455 }

References headers.

Referenced by express::Response::header().

Here is the caller graph for this function:

◆ init()

void web::http::server::Response::init ( )
privatevirtual

Definition at line 88 of file Response.cpp.

References connectionState, contentLength, contentSent, cookies, web::http::Default, headers, web::http::HTTP10, httpMajor, httpMinor, socketContextUpgrade, statusCode, trailer, and transferEncoding.

Referenced by web::http::server::SocketContext::deliverRequest(), and web::http::server::SocketContext::onConnected().

Here is the caller graph for this function:

◆ onSourceConnect()

void web::http::server::Response::onSourceConnect ( core::pipe::Source source)
overrideprivatevirtual

Implements core::pipe::Sink.

Definition at line 416 of file Response.cpp.

416 {
417 if (socketContext != nullptr) {
419 sendHeader();
420
421 source->start();
422 } else {
423 source->stop();
424 }
425 } else {
426 source->stop();
427 }
428 }
Source * source
Definition Sink.h:90
virtual void stop()=0
virtual void start()=0
bool streamToPeer(core::pipe::Source *source) const

References sendHeader(), socketContext, core::pipe::Source::start(), core::pipe::Source::stop(), and core::socket::stream::SocketContext::streamToPeer().

Here is the call graph for this function:

◆ onSourceData()

void web::http::server::Response::onSourceData ( const char *  chunk,
std::size_t  chunkLen 
)
overrideprivatevirtual

Implements core::pipe::Sink.

Definition at line 430 of file Response.cpp.

430 {
431 sendFragment(chunk, chunkLen);
432 }
Response & sendFragment(const char *chunk, std::size_t chunkLen)
Definition Response.cpp:371

References sendFragment().

Here is the call graph for this function:

◆ onSourceEof()

void web::http::server::Response::onSourceEof ( )
overrideprivatevirtual

Implements core::pipe::Sink.

Definition at line 434 of file Response.cpp.

434 {
435 if (socketContext != nullptr) {
437 }
438
440 }

References sendCompleted(), socketContext, and core::socket::stream::SocketContext::streamEof().

Here is the call graph for this function:

◆ onSourceError()

void web::http::server::Response::onSourceError ( int  errnum)
overrideprivatevirtual

Implements core::pipe::Sink.

Definition at line 442 of file Response.cpp.

442 {
443 errno = errnum;
444
445 if (socketContext != nullptr) {
448 }
449
451 }

References core::socket::stream::SocketContext::close(), sendCompleted(), socketContext, and core::socket::stream::SocketContext::streamEof().

Here is the call graph for this function:

◆ operator=() [1/2]

Response & web::http::server::Response::operator= ( Response &&  )
deletenoexcept

◆ operator=() [2/2]

Response & web::http::server::Response::operator= ( Response )
delete

◆ send() [1/2]

void web::http::server::Response::send ( const char *  chunk,
std::size_t  chunkLen 
)

Definition at line 213 of file Response.cpp.

213 {
214 if (chunkLen > 0) {
215 set("Content-Type", "application/octet-stream", false);
216 }
217 set("Content-Length", std::to_string(chunkLen));
218
219 sendHeader();
220 sendFragment(chunk, chunkLen);
222 }

References sendCompleted(), sendFragment(), sendHeader(), and set().

Referenced by express::Response::send(), and send().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send() [2/2]

void web::http::server::Response::send ( const std::string &  chunk)

Definition at line 224 of file Response.cpp.

224 {
225 if (!chunk.empty()) {
226 set("Content-Type", "text/html; charset=utf-8", false);
227 }
228
229 send(chunk.data(), chunk.size());
230 }

References send(), and set().

Referenced by end(), express::Response::send(), and sendStatus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendCompleted()

void web::http::server::Response::sendCompleted ( )
private

Definition at line 393 of file Response.cpp.

393 {
395 sendFragment(""); // For transfer encoding chunked. Terminate the chunk sequence.
396
397 if (!trailer.empty()) {
398 for (auto& [field, value] : trailer) {
399 socketContext->sendToPeer(std::string(field).append(":").append(value).append("\r\n"));
400 }
401
402 socketContext->sendToPeer("\r\n");
403 }
404 }
405
406 if (socketContext != nullptr) {
408
409 if (socketContextUpgrade != nullptr) {
411 socketContextUpgrade = nullptr;
412 }
413 }
414 }
virtual void switchSocketContext(SocketContext *newSocketContext)
void sendToPeer(const char *chunk, std::size_t chunkLen) const final
Response & append(const std::string &field, const std::string &value)
Definition Response.cpp:108

References web::http::Chunked, contentLength, contentSent, httpMajor, httpMinor, web::http::server::SocketContext::responseCompleted(), sendFragment(), core::socket::SocketContext::sendToPeer(), socketContext, socketContextUpgrade, core::socket::stream::SocketContext::switchSocketContext(), trailer, and transferEncoding.

Referenced by onSourceEof(), onSourceError(), and send().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendFile()

void web::http::server::Response::sendFile ( const std::string &  file,
const std::function< void(int)> &  callback 
)

Definition at line 292 of file Response.cpp.

292 {
293 if (socketContext != nullptr) {
294 std::string absolutFileName = file;
295
296 if (std::filesystem::exists(absolutFileName)) {
297 std::error_code ec;
298 absolutFileName = std::filesystem::canonical(absolutFileName);
299
300 if (std::filesystem::is_regular_file(absolutFileName, ec) && !ec) {
301 core::file::FileReader::open(absolutFileName)->pipe(this, [this, &absolutFileName, &callback](int errnum) {
302 callback(errnum);
303
304 if (errnum == 0) {
305 set("Content-Type", web::http::MimeTypes::contentType(absolutFileName), false);
306 set("Last-Modified", httputils::file_mod_http_date(absolutFileName), false);
307 if (httpMajor == 1) {
308 if (httpMinor == 1) {
309 set("Transfer-Encoding", "chunked");
310 } else {
311 set("Content-Length", std::to_string(std::filesystem::file_size(absolutFileName)));
312 }
313 }
314 } else {
315 status(404);
316 }
317 });
318 } else {
319 status(404);
320 errno = EEXIST;
321 callback(errno);
322 }
323 } else {
324 errno = ENOENT;
325 callback(errno);
326 }
327 }
328 }
static FileReader * open(const std::string &path)
void pipe(Sink *sink, const std::function< void(int)> &callback)
Definition Source.cpp:60
static std::string contentType(const std::string &file)
Response & status(int statusCode)
Definition Response.cpp:102
std::string file_mod_http_date(const std::string &filePath)

References web::http::MimeTypes::contentType(), httputils::file_mod_http_date(), httpMajor, httpMinor, core::file::FileReader::open(), core::pipe::Source::pipe(), set(), socketContext, and status().

Referenced by express::Response::sendFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendFragment() [1/2]

Response & web::http::server::Response::sendFragment ( const char *  chunk,
std::size_t  chunkLen 
)

Definition at line 371 of file Response.cpp.

371 {
372 if (socketContext != nullptr) {
374 socketContext->sendToPeer(to_hex_str(chunkLen).append("\r\n"));
375 }
376
377 socketContext->sendToPeer(chunk, chunkLen);
378 contentSent += chunkLen;
379
381 socketContext->sendToPeer("\r\n");
382 contentLength += chunkLen;
383 }
384 }
385
386 return *this;
387 }
#define to_hex_str(int_val)
Definition Request.cpp:71

References web::http::Chunked, contentLength, contentSent, core::socket::stream::SocketContext::sendToPeer(), core::socket::SocketContext::sendToPeer(), socketContext, and transferEncoding.

Referenced by onSourceData(), send(), express::Response::sendFragment(), and sendFragment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendFragment() [2/2]

Response & web::http::server::Response::sendFragment ( const std::string &  chunk)

Definition at line 389 of file Response.cpp.

389 {
390 return sendFragment(chunk.data(), chunk.size());
391 }

References sendFragment().

Referenced by sendCompleted(), and express::Response::sendFragment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendHeader()

Response & web::http::server::Response::sendHeader ( )

Definition at line 334 of file Response.cpp.

334 {
335 if (socketContext != nullptr) {
337
338 socketContext->sendToPeer("HTTP/" + std::to_string(httpMajor)
339 .append(".")
340 .append(std::to_string(httpMinor))
341 .append(" ")
342 .append(std::to_string(statusCode))
343 .append(" ")
345 .append("\r\n"));
346 socketContext->sendToPeer("Date: " + httputils::to_http_date() + "\r\n");
347
348 set("X-Powered-By", "snode.c");
349
350 for (const auto& [field, value] : headers) {
351 socketContext->sendToPeer(std::string(field).append(": ").append(value).append("\r\n"));
352 }
353
354 for (const auto& [cookie, cookieValue] : cookies) {
355 const std::string cookieString = std::accumulate(
356 cookieValue.getOptions().begin(),
357 cookieValue.getOptions().end(),
358 cookie + "=" + cookieValue.getValue(),
359 [](const std::string& str, const std::pair<const std::string&, const std::string&> option) -> std::string {
360 return str + "; " + option.first + (!option.second.empty() ? "=" + option.second : "");
361 });
362 socketContext->sendToPeer("Set-Cookie: " + cookieString + "\r\n");
363 }
364
365 socketContext->sendToPeer("\r\n");
366 }
367
368 return *this;
369 }
static std::string reason(int status)

References cookies, web::http::CookieOptions::getOptions(), web::http::CookieOptions::getValue(), headers, httpMajor, httpMinor, web::http::StatusCode::reason(), web::http::server::SocketContext::responseStarted(), core::socket::SocketContext::sendToPeer(), set(), socketContext, statusCode, and httputils::to_http_date().

Referenced by onSourceConnect(), send(), and express::Response::sendHeader().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendStatus()

void web::http::server::Response::sendStatus ( int  statusCode)

Definition at line 232 of file Response.cpp.

232 {
234
236 }

References web::http::StatusCode::reason(), send(), and status().

Here is the call graph for this function:

◆ set() [1/2]

Response & web::http::server::Response::set ( const std::map< std::string, std::string > &  headers,
bool  overwrite = true 
)

Definition at line 120 of file Response.cpp.

120 {
121 for (const auto& [field, value] : headers) {
122 set(field, value, overwrite);
123 }
124
125 return *this;
126 }

References set().

Referenced by express::Response::set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set() [2/2]

Response & web::http::server::Response::set ( const std::string &  field,
const std::string &  value,
bool  overwrite = true 
)

Definition at line 128 of file Response.cpp.

128 {
129 if (!value.empty()) {
130 if (overwrite) {
131 headers.insert_or_assign(field, value);
132 } else {
133 headers.insert({field, value});
134 }
135
136 if (web::http::ciEquals(field, "Connection")) {
137 if (web::http::ciContains(headers[field], "keep-alive")) {
139 } else if (web::http::ciContains(headers[field], "close")) {
141 }
142 } else if (web::http::ciEquals(field, "Content-Length")) {
143 contentLength = std::stoul(value);
145 headers.erase("Transfer-Encoding");
146 } else if (web::http::ciEquals(field, "Transfer-Encoding")) {
147 if (web::http::ciContains(headers[field], "chunked")) {
149 headers.erase("Content-Length");
150 }
151 if (web::http::ciContains(headers[field], "compressed")) {
152 }
153 if (web::http::ciContains(headers[field], "deflate")) {
154 }
155 if (web::http::ciContains(headers[field], "gzip")) {
156 }
157 } else if (web::http::ciEquals(field, "Content-Encoding")) {
158 if (web::http::ciContains(headers[field], "compressed")) {
159 }
160 if (web::http::ciContains(headers[field], "deflate")) {
161 }
162 if (web::http::ciContains(headers[field], "gzip")) {
163 }
164 if (web::http::ciContains(headers[field], "br")) {
165 }
166 }
167 } else {
168 headers.erase(field);
169 }
170
171 return *this;
172 }
bool ciEquals(const std::string &str1, const std::string &str2)
bool ciContains(const std::string &str1, const std::string &str2)

References web::http::Chunked, web::http::ciContains(), web::http::ciEquals(), web::http::Close, connectionState, contentLength, headers, web::http::Identity, web::http::Keep, and transferEncoding.

Referenced by append(), web::websocket::server::SocketContextUpgradeFactory::create(), web::http::server::SocketContext::deliverRequest(), send(), send(), sendFile(), sendHeader(), set(), express::Response::set(), setTrailer(), type(), and upgrade().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTrailer()

Response & web::http::server::Response::setTrailer ( const std::string &  field,
const std::string &  value,
bool  overwrite = true 
)

Definition at line 194 of file Response.cpp.

194 {
195 if (!value.empty()) {
196 if (overwrite) {
197 trailer.insert_or_assign(field, value);
198 } else {
199 trailer.insert({field, value});
200 }
201 if (!headers.contains("Trailer")) {
202 set("Trailer", field);
203 } else {
204 headers["Trailer"].append("," + field);
205 }
206 } else {
207 trailer.erase(field);
208 }
209
210 return *this;
211 }

References headers, set(), and trailer.

Referenced by express::Response::setTrailer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ status()

Response & web::http::server::Response::status ( int  statusCode)

Definition at line 102 of file Response.cpp.

102 {
103 this->statusCode = statusCode;
104
105 return *this;
106 }

References statusCode.

Referenced by web::websocket::server::SocketContextUpgradeFactory::create(), sendFile(), sendStatus(), express::Response::status(), and upgrade().

Here is the caller graph for this function:

◆ stopResponse()

void web::http::server::Response::stopResponse ( )

Definition at line 84 of file Response.cpp.

84 {
85 stop();
86 }
void stop()
Definition Sink.cpp:68

References core::pipe::Sink::stop().

Referenced by web::http::server::SocketContext::onDisconnected().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ type()

Response & web::http::server::Response::type ( const std::string &  type)

Definition at line 174 of file Response.cpp.

174 {
175 return set("Content-Type", type);
176 }
Response & type(const std::string &type)
Definition Response.cpp:174

References set().

Referenced by express::Response::type().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upgrade()

void web::http::server::Response::upgrade ( const std::shared_ptr< Request > &  request,
const std::function< void(const std::string &)> &  status 
)

Sequence diagram of res.upgrade(req).

Definition at line 244 of file Response.cpp.

244 {
245 std::string name;
246
247 if (socketContext != nullptr) {
248 if (request != nullptr) {
249 if (web::http::ciContains(request->get("connection"), "Upgrade")) {
250 web::http::server::SocketContextUpgradeFactory* socketContextUpgradeFactory =
252
253 if (socketContextUpgradeFactory != nullptr) {
254 name = socketContextUpgradeFactory->name();
256 << " HTTP upgrade: SocketContextUpgradeFactory created successful: " << name;
257
258 socketContextUpgrade = socketContextUpgradeFactory->create(socketContext->getSocketConnection());
259
260 if (socketContextUpgrade != nullptr) {
262 << " HTTP upgrade: SocketContextUpgrade created successful: " << name;
263 } else {
265 << " HTTP upgrade: Create SocketContextUpgrade failed: " << name;
266
267 set("Connection", "close").status(404);
268 }
269 } else {
271 << " HTTP upgrade: SocketContextUpgradeFactory not supported: " << request->get("upgrade");
272
273 set("Connection", "close").status(404);
274 }
275 } else {
276 LOG(DEBUG) << socketContext->getSocketConnection()->getConnectionName() << " HTTP upgrade: No upgrade requested";
277
278 set("Connection", "close").status(400);
279 }
280 } else {
281 LOG(ERROR) << socketContext->getSocketConnection()->getConnectionName() << " HTTP upgrade: Request has gone away";
282
283 set("Connection", "close").status(500);
284 }
285 } else {
286 LOG(ERROR) << "HTTP upgrade: SocketContext has gone away";
287 }
288
289 status(name);
290 }
const std::string & getConnectionName() const
SocketConnection * getSocketConnection() const
virtual SocketContextUpgrade< Request, Response > * create(core::socket::stream::SocketConnection *socketConnection, Request *request, Response *response)=0
SocketContextUpgradeFactory * select(Request &req, Response &res) override

References web::http::ciContains(), web::http::SocketContextUpgradeFactory< RequestT, ResponseT >::create(), web::http::server::Request::get(), core::socket::stream::SocketConnection::getConnectionName(), core::socket::stream::SocketContext::getSocketConnection(), web::http::server::SocketContextUpgradeFactorySelector::instance(), web::http::SocketContextUpgradeFactory< RequestT, ResponseT >::name(), web::http::server::SocketContextUpgradeFactorySelector::select(), set(), socketContext, socketContextUpgrade, and status().

Referenced by express::Response::upgrade().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ SocketContext

friend class SocketContext
friend

Definition at line 143 of file Response.h.

Member Data Documentation

◆ connectionState

ConnectionState web::http::server::Response::connectionState = ConnectionState::Default
private

Definition at line 140 of file Response.h.

Referenced by init(), web::http::server::SocketContext::responseCompleted(), and set().

◆ contentLength

std::size_t web::http::server::Response::contentLength = 0
private

Definition at line 135 of file Response.h.

Referenced by init(), sendCompleted(), sendFragment(), and set().

◆ contentSent

std::size_t web::http::server::Response::contentSent = 0
private

Definition at line 134 of file Response.h.

Referenced by init(), sendCompleted(), and sendFragment().

◆ cookies

web::http::CiStringMap<web::http::CookieOptions> web::http::server::Response::cookies
protected

Definition at line 130 of file Response.h.

Referenced by cookie(), init(), and sendHeader().

◆ headers

web::http::CiStringMap<std::string> web::http::server::Response::headers
protected

Definition at line 129 of file Response.h.

Referenced by append(), header(), init(), sendHeader(), set(), and setTrailer().

◆ httpMajor

int web::http::server::Response::httpMajor = 1

◆ httpMinor

int web::http::server::Response::httpMinor = 1

◆ socketContext

SocketContext* web::http::server::Response::socketContext = nullptr
private

◆ socketContextUpgrade

core::socket::stream::SocketContext* web::http::server::Response::socketContextUpgrade = nullptr
private

Definition at line 138 of file Response.h.

Referenced by init(), sendCompleted(), upgrade(), and ~Response().

◆ statusCode

int web::http::server::Response::statusCode = 200

Definition at line 124 of file Response.h.

Referenced by init(), sendHeader(), and status().

◆ trailer

web::http::CiStringMap<std::string> web::http::server::Response::trailer
protected

Definition at line 131 of file Response.h.

Referenced by init(), sendCompleted(), and setTrailer().

◆ transferEncoding

TransferEncoding web::http::server::Response::transferEncoding = TransferEncoding::HTTP10
private

Definition at line 141 of file Response.h.

Referenced by init(), sendCompleted(), sendFragment(), and set().


The documentation for this class was generated from the following files: