| 101 | } |
| 102 | |
| 103 | void on_read_header(beast::error_code error, std::size_t) { |
| 104 | if (error) { |
| 105 | return fail("read_headers", std::move(error)); |
| 106 | } |
| 107 | |
| 108 | const auto &res = parser_.get(); |
| 109 | |
| 110 | auto status_code = res.result_int(); |
| 111 | std::string content_type; |
| 112 | |
| 113 | auto it = res.find(http::field::content_type); |
| 114 | if (it != res.end()) { |
| 115 | content_type = it->value(); |
| 116 | } |
| 117 | |
| 118 | std::vector<std::pair<std::string, std::string>> headers; |
| 119 | for (auto &h : res) { |
| 120 | if (!allow_header(h.name_string())) { |
| 121 | continue; |
| 122 | } |
| 123 | headers.emplace_back(h.name_string(), h.value()); |
| 124 | } |
| 125 | |
| 126 | sent_answer_ = true; |
| 127 | callback_->receive_answer(status_code, std::move(content_type), std::move(headers), "", false); |
| 128 | |
| 129 | read_payload(); |
| 130 | } |
| 131 | |
| 132 | void read_payload() { |
| 133 | auto &b = parser_.get().body(); |
nothing calls this directly
no test coverage detected