Copilot commented on code in PR #3751:
URL: https://github.com/apache/thrift/pull/3751#discussion_r3875678060
##########
lib/cpp/test/OneWayHTTPTest.cpp:
##########
@@ -61,6 +62,18 @@ namespace utf = boost::unit_test;
// Define this env var to enable some logging (in case you need to debug)
#undef ENABLE_STDERR_LOGGING
+class TInspectableHttpClient : public THttpClient {
+public:
+ explicit TInspectableHttpClient(std::shared_ptr<TTransport> transport) :
THttpClient(transport) {}
+
+ bool closesAfterHeader(const string& header) {
+ std::vector<char> buffer(header.begin(), header.end());
+ buffer.push_back('\0');
+ parseHeader(buffer.data());
+ return closeAfterResponse_;
+ }
Review Comment:
`TInspectableHttpClient::closesAfterHeader()` can return a stale
`closeAfterResponse_` value because `parseHeader()` only ever sets it to `true`
and never clears it when the header does not include `close`. If this helper is
reused with multiple calls, a previous `Connection: ... close` would make later
checks incorrectly return `true`. Reset the flag at the start of the helper.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]