Skip to content

Commit 5aebe49

Browse files
Sotirios Delimanolismeta-codesync[bot]
authored andcommitted
Remove size limit on uexw header
Summary: Don't truncate error reason in the uexw header. Meta: Similar to D92278388 diff, [other parts of `ThriftServer`](https://www.internalfb.com/code/fbsource/[3f91896f158796f40f690d866fab893f29f3b59e]/fbcode/thrift/lib/cpp2/transport/core/ThriftRequest.h?lines=318-319) do not truncate the error reason. This one shouldn't either. remove the max length. Reviewed By: aristidisp Differential Revision: D92279288 fbshipit-source-id: 697826dd5fd56e08eb0d499f35e47b2be4d56b31
1 parent 9c5aab7 commit 5aebe49

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

thrift/lib/cpp2/GeneratedCodeHelper.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ using namespace std;
3535
using namespace folly;
3636
using namespace apache::thrift::transport;
3737

38+
THRIFT_FLAG_DEFINE_bool(enforce_uexw_header_length, false);
39+
3840
namespace apache::thrift {
3941

4042
namespace detail {
@@ -295,10 +297,14 @@ void setUserExceptionHeader(
295297
}
296298

297299
header->setHeader(std::string(detail::kHeaderUex), std::move(exType));
298-
header->setHeader(
299-
std::string(detail::kHeaderUexw),
300-
exReason.size() > kMaxUexwSize ? exReason.substr(0, kMaxUexwSize)
301-
: std::move(exReason));
300+
if (THRIFT_FLAG(enforce_uexw_header_length)) {
301+
header->setHeader(
302+
std::string(detail::kHeaderUexw),
303+
exReason.size() > kMaxUexwSize ? exReason.substr(0, kMaxUexwSize)
304+
: std::move(exReason));
305+
} else {
306+
header->setHeader(std::string(detail::kHeaderUexw), std::move(exReason));
307+
}
302308
}
303309

304310
} // namespace

0 commit comments

Comments
 (0)