Add support to using HTTP Status Code through Poco::Net::HTTPResponse (#2390) (#2392)

This commit is contained in:
Edson A. Soares
2018-07-18 12:00:55 -03:00
committed by Aleksandar Fabijanic
parent 256b6855fa
commit ec8a38f3ba
3 changed files with 12 additions and 0 deletions

View File

@@ -62,6 +62,9 @@ public:
/// is used, or if it is not known whether a secure
/// connection is used.
void setStatus(int status);
/// Set specific HTTP status code for the request.
private:
request_rec* _pRec;
};

View File

@@ -137,6 +137,12 @@ bool ApacheRequestRec::secure()
}
void ApacheRequestRec::setStatus(int status)
{
_pRec->status = status;
}
void ApacheRequestRec::copyHeaders(ApacheServerRequest& request)
{
const apr_array_header_t* arr = apr_table_elts(_pRec->headers_in);

View File

@@ -47,6 +47,9 @@ void ApacheServerResponse::initApacheOutputStream()
_pApacheRequest->setContentType(getContentType());
int statusCode = static_cast<std::underlying_type<Poco::Net::HTTPResponse::HTTPStatus>::type>(getStatus());
_pApacheRequest->setStatus(statusCode);
std::vector<HTTPCookie> cookies;
getCookies(cookies);