MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / ProcessRequest

Method ProcessRequest

cpp/webdriver-server/server.cc:232–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232int Server::ProcessRequest(struct mg_connection* conn,
233 const struct mg_request_info* request_info) {
234 LOG(TRACE) << "Entering Server::ProcessRequest";
235
236 int http_response_code = 0;
237 std::string http_verb = request_info->request_method;
238 std::string request_body = "{}";
239 if (http_verb == "POST") {
240 request_body = this->ReadRequestBody(conn, request_info);
241 }
242
243 LOG(TRACE) << "Process request with:"
244 << " URI: " << request_info->local_uri
245 << " HTTP verb: " << http_verb << std::endl
246 << "body: " << request_body;
247
248 if (strcmp(request_info->local_uri, "/") == 0) {
249 this->SendHttpOk(conn,
250 request_info,
251 SERVER_DEFAULT_PAGE,
252 HTML_CONTENT_TYPE);
253 http_response_code = 0;
254 } else if (strcmp(request_info->local_uri, "/shutdown") == 0) {
255 this->SendHttpOk(conn,
256 request_info,
257 SERVER_DEFAULT_PAGE,
258 HTML_CONTENT_TYPE);
259 http_response_code = 0;
260 this->ShutDown();
261 } else {
262 std::string serialized_response = this->DispatchCommand(request_info->local_uri,
263 http_verb,
264 request_body);
265 http_response_code = this->SendResponseToClient(conn,
266 request_info,
267 serialized_response);
268 }
269
270 return http_response_code;
271}
272
273void Server::AddCommand(const std::string& url,
274 const std::string& http_verb,

Callers 1

OnNewHttpRequestMethod · 0.80

Calls 6

ReadRequestBodyMethod · 0.95
SendHttpOkMethod · 0.95
DispatchCommandMethod · 0.95
SendResponseToClientMethod · 0.95
LOGClass · 0.70
ShutDownMethod · 0.45

Tested by

no test coverage detected