MCPcopy Create free account
hub / github.com/boostorg/beast / read_request

Method read_request

example/http/server/fast/http_server_fast.cpp:154–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152 }
153
154 void read_request()
155 {
156 // On each read the parser needs to be destroyed and
157 // recreated. We store it in a boost::optional to
158 // achieve that.
159 //
160 // Arguments passed to the parser constructor are
161 // forwarded to the message object. A single argument
162 // is forwarded to the body constructor.
163 //
164 // We construct the dynamic body with a 1MB limit
165 // to prevent vulnerability to buffer attacks.
166 //
167 parser_.emplace(
168 std::piecewise_construct,
169 std::make_tuple(),
170 std::make_tuple(alloc_));
171
172 http::async_read(
173 socket_,
174 buffer_,
175 *parser_,
176 [this](beast::error_code ec, std::size_t)
177 {
178 if (ec)
179 accept();
180 else
181 process_request(parser_->get());
182 });
183 }
184
185 void process_request(http::request<request_body_t, http::basic_fields<alloc_t>> const& req)
186 {

Callers

nothing calls this directly

Calls 3

emplaceMethod · 0.80
async_readFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected