| 106 | } |
| 107 | |
| 108 | std::string API::requestNonce() const |
| 109 | { |
| 110 | if (!directory) |
| 111 | throw Exception(ErrorCodes::LOGICAL_ERROR, "Directory is not initialized"); |
| 112 | |
| 113 | LOG_TEST(log, "Requesting nonce from {}", directory->new_nonce.toString()); |
| 114 | |
| 115 | auto uri = Poco::URI(directory->new_nonce); |
| 116 | auto r = Poco::Net::HTTPRequest(Poco::Net::HTTPRequest::HTTP_HEAD, uri.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1); |
| 117 | r.set("User-Agent", fmt::format("ClickHouse/{}", VERSION_STRING)); |
| 118 | |
| 119 | auto session = makeHTTPSession(HTTPConnectionGroupType::HTTP, uri, connection_timeout_settings, proxy_configuration); |
| 120 | session->setKeepAlive(false); |
| 121 | session->sendRequest(r); |
| 122 | |
| 123 | auto response = Poco::Net::HTTPResponse(); |
| 124 | receiveResponse(*session, r, response, /* allow_redirects */ false); |
| 125 | |
| 126 | return response.get(NONCE_HEADER_NAME); |
| 127 | } |
| 128 | |
| 129 | std::string API::formatJWSRequestData(const Poco::URI & url, const std::string & payload, const std::string & nonce) const |
| 130 | { |
nothing calls this directly
no test coverage detected