MCPcopy Create free account
hub / github.com/ClassicOldSong/Apollo / accept

Method accept

src/nvhttp.cpp:97–138  ·  view source on GitHub ↗

This is Server ::accept() with SSL validation support added

Source from the content-addressed store, hash-verified

95
96 // This is Server<HTTPS>::accept() with SSL validation support added
97 void accept() override {
98 auto connection = create_connection(*io_service, context);
99
100 acceptor->async_accept(connection->socket->lowest_layer(), [this, connection](const SimpleWeb::error_code &ec) {
101 auto lock = connection->handler_runner->continue_lock();
102 if (!lock) {
103 return;
104 }
105
106 if (ec != SimpleWeb::error::operation_aborted) {
107 this->accept();
108 }
109
110 auto session = std::make_shared<Session>(config.max_request_streambuf_size, connection);
111
112 if (!ec) {
113 boost::asio::ip::tcp::no_delay option(true);
114 SimpleWeb::error_code ec;
115 session->connection->socket->lowest_layer().set_option(option, ec);
116
117 session->connection->set_timeout(config.timeout_request);
118 session->connection->socket->async_handshake(boost::asio::ssl::stream_base::server, [this, session](const SimpleWeb::error_code &ec) {
119 session->connection->cancel_timeout();
120 auto lock = session->connection->handler_runner->continue_lock();
121 if (!lock) {
122 return;
123 }
124 if (!ec) {
125 if (verify && !verify(session->request, session->connection->socket->native_handle())) {
126 this->write(session, on_verify_failed);
127 } else {
128 this->read(session);
129 }
130 } else if (this->on_error) {
131 this->on_error(session->request, ec);
132 }
133 });
134 } else if (this->on_error) {
135 this->on_error(session->request, ec);
136 }
137 });
138 }
139 };
140
141 using https_server_t = SunshineHTTPSServer;

Callers

nothing calls this directly

Calls 3

verifyFunction · 0.85
writeMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected