MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / doJWSRequest

Method doJWSRequest

src/Server/ACME/API.cpp:158–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158std::string API::doJWSRequest(
159 const Poco::URI & url,
160 const std::string & payload,
161 std::shared_ptr<Poco::Net::HTTPResponse> response) const
162{
163 LOG_TEST(log, "Making JWS request to URL: {} with payload {}", url.toString(), payload);
164
165 std::string nonce = requestNonce();
166 std::string request_data = formatJWSRequestData(url, payload, nonce);
167
168 auto r = Poco::Net::HTTPRequest(Poco::Net::HTTPRequest::HTTP_POST, url.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1);
169 r.set("User-Agent", fmt::format("ClickHouse/{}", VERSION_STRING));
170 r.set("Content-Type", APPLICATION_JOSE_JSON);
171 r.set("Content-Length", std::to_string(request_data.size()));
172
173 auto session = makeHTTPSession(HTTPConnectionGroupType::HTTP, url, connection_timeout_settings, proxy_configuration);
174 session->setKeepAlive(false);
175
176 ProfileEvents::increment(ProfileEvents::ACMEAPIRequests);
177
178 auto & ostream = session->sendRequest(r);
179 ostream << request_data;
180
181 if (!response)
182 response = std::make_shared<Poco::Net::HTTPResponse>();
183
184 auto * rstream = receiveResponse(*session, r, *response, /* allow_redirects */ false);
185
186 std::string response_data;
187 Poco::StreamCopier::copyToString(*rstream, response_data);
188
189 return response_data;
190}
191
192Poco::JSON::Object::Ptr API::doJWSRequestExpectingJSON(
193 const Poco::URI & url,

Callers

nothing calls this directly

Calls 12

makeHTTPSessionFunction · 0.85
receiveResponseFunction · 0.85
getPathAndQueryMethod · 0.80
HTTPRequestClass · 0.50
formatFunction · 0.50
to_stringFunction · 0.50
incrementFunction · 0.50
toStringMethod · 0.45
setMethod · 0.45
sizeMethod · 0.45
setKeepAliveMethod · 0.45
sendRequestMethod · 0.45

Tested by

no test coverage detected