forked from awwit/httpserverapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponse.cpp
More file actions
27 lines (19 loc) · 872 Bytes
/
Response.cpp
File metadata and controls
27 lines (19 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "Response.h"
#include "../transfer/http2/HPack.h"
#include <random>
namespace HttpServer
{
void Response::setStatusCode(const Http::StatusCode status) {
this->status = status;
}
bool Response::sendHeaders(const std::vector<std::pair<std::string, std::string> > &additional, const std::chrono::milliseconds &timeout, const bool endStream)
{
std::vector<std::pair<std::string, std::string> > headers;
std::copy(this->headers.begin(), this->headers.end(), std::back_inserter(headers) );
std::copy(additional.begin(), additional.end(), std::back_inserter(headers) );
return this->prot->sendHeaders(this->status, headers, timeout, endStream);
}
long Response::sendData(const void *src, const size_t size, const std::chrono::milliseconds &timeout, const bool endStream) const {
return this->prot->sendData(src, size, timeout, endStream);
}
}