|
18 | 18 | #endif // PRESTO_ENABLE_JWT |
19 | 19 | #include <folly/io/async/EventBaseManager.h> |
20 | 20 | #include <folly/synchronization/Latch.h> |
| 21 | +#include <proxygen/lib/http/codec/CodecProtocol.h> |
21 | 22 | #include <velox/common/base/Exceptions.h> |
22 | 23 | #include "presto_cpp/main/common/Configs.h" |
23 | 24 | #include "presto_cpp/main/common/Counters.h" |
@@ -201,13 +202,22 @@ class ResponseHandler : public proxygen::HTTPTransactionHandler { |
201 | 202 | return promise_.getSemiFuture(); |
202 | 203 | } |
203 | 204 |
|
204 | | - void setTransaction(proxygen::HTTPTransaction* /* txn */) noexcept override {} |
| 205 | + void setTransaction(proxygen::HTTPTransaction* txn) noexcept override { |
| 206 | + if (txn) { |
| 207 | + protocol_ = txn->getTransport().getCodec().getProtocol(); |
| 208 | + } |
| 209 | + } |
| 210 | + |
205 | 211 | void detachTransaction() noexcept override { |
206 | 212 | self_.reset(); |
207 | 213 | } |
208 | 214 |
|
209 | 215 | void onHeadersComplete( |
210 | 216 | std::unique_ptr<proxygen::HTTPMessage> msg) noexcept override { |
| 217 | + if (protocol_.has_value()) { |
| 218 | + VLOG(2) << "HttpClient received response of " |
| 219 | + << proxygen::getCodecProtocolString(protocol_.value()); |
| 220 | + } |
211 | 221 | response_ = std::make_unique<HttpResponse>( |
212 | 222 | std::move(msg), |
213 | 223 | client_->memoryPool(), |
@@ -268,6 +278,7 @@ class ResponseHandler : public proxygen::HTTPTransactionHandler { |
268 | 278 | folly::Promise<std::unique_ptr<HttpResponse>> promise_; |
269 | 279 | std::shared_ptr<ResponseHandler> self_; |
270 | 280 | std::shared_ptr<HttpClient> client_; |
| 281 | + std::optional<proxygen::CodecProtocol> protocol_; |
271 | 282 | }; |
272 | 283 |
|
273 | 284 | // Responsible for making an HTTP request. The request will be made in 2 |
|
0 commit comments