| 22 | */ |
| 23 | |
| 24 | void ClientRunner::run_http_request(http::HttpCallback::RequestType request_type, |
| 25 | std::vector<std::pair<std::string, std::string>> headers, std::string path, |
| 26 | std::vector<std::pair<std::string, std::string>> args, std::string body, |
| 27 | std::unique_ptr<http::HttpRequestCallback> answer_callback) { |
| 28 | auto proxy_target = get_ready_proxy_target(); |
| 29 | if (!proxy_target || !proxy_target->is_ready()) { |
| 30 | return http_send_static_answer(503 /* service unavailable */, "no working proxy connections", |
| 31 | std::move(answer_callback)); |
| 32 | } |
| 33 | |
| 34 | auto connection = get_connection(proxy_target->connection_id()); |
| 35 | if (!connection || !connection->is_ready()) { |
| 36 | return http_send_static_answer(503 /* service unavailable */, "no working proxy connections", |
| 37 | std::move(answer_callback)); |
| 38 | } |
| 39 | |
| 40 | td::Bits256 request_id; |
| 41 | td::Random::secure_bytes(request_id.as_slice()); |
| 42 | |
| 43 | auto proxy_conn = static_cast<ClientProxyConnection *>(connection); |
| 44 | auto proxy = proxy_conn->proxy(); |
| 45 | |
| 46 | proxy->request_started(); |
| 47 | auto active_config_version = runner_config()->root_contract_config->version(); |
| 48 | auto req = td::actor::create_actor<ClientRunningRequest>( |
| 49 | PSTRING() << "request_" << request_id.to_hex(), request_id, request_type, std::move(headers), |
| 50 | std::move(path), std::move(args), std::move(body), std::move(answer_callback), proxy, |
| 51 | connection->connection_id(), proxy_conn->proto_version(), active_config_version, actor_id(this)) |
| 52 | .release(); |
| 53 | running_queries_.emplace(request_id, req); |
| 54 | } |
| 55 | |
| 56 | void ClientRunner::run_get_models_request(std::unique_ptr<http::HttpRequestCallback> answer_callback) { |
| 57 | auto proxy_target = get_ready_proxy_target(); |
nothing calls this directly
no test coverage detected