| 583 | } |
| 584 | |
| 585 | void THttpServer::returnWrappedResponse(const impala::TWrappedHttpResponse& response) { |
| 586 | int code = response.status_code; |
| 587 | string status = response.status_text; |
| 588 | std::ostringstream h; |
| 589 | h << "HTTP/1.1 "<< code << " " << status << CRLF << "Date: " << getTimeRFC1123() << CRLF; |
| 590 | vector<string> return_headers = callbacks_.return_headers_fn(); |
| 591 | for (const auto& header : response.headers) { |
| 592 | h << header.first << ": " << header.second << CRLF; |
| 593 | } |
| 594 | // TODO: response type is not added |
| 595 | // TODO: cookies are not added, but are not needed right now |
| 596 | h << CRLF; |
| 597 | h << response.content; |
| 598 | string header = h.str(); |
| 599 | transport_->write((const uint8_t*)header.c_str(), static_cast<uint32_t>(header.size())); |
| 600 | transport_->flush(); |
| 601 | } |
| 602 | |
| 603 | void THttpServer::resetAuthState() { |
| 604 | auth_value_ = ""; |