MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / on_read_header

Method on_read_header

boost-http/http-client.cpp:103–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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();

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
receive_answerMethod · 0.45

Tested by

no test coverage detected