From c830652b8eb2fad7d3f835dd6aba9bfccf1416e7 Mon Sep 17 00:00:00 2001 From: scw00 <616955249@qq.com> Date: Mon, 19 Jun 2017 10:00:29 +0800 Subject: [PATCH] Missing Length if format was set in HttpBodyFactory::fabricate_with_old_api The resulting_buffer_length will be zero if format was set. --- proxy/http/HttpBodyFactory.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc index dade11953a8..2d88417268e 100644 --- a/proxy/http/HttpBodyFactory.cc +++ b/proxy/http/HttpBodyFactory.cc @@ -126,6 +126,10 @@ HttpBodyFactory::fabricate_with_old_api(const char *type, HttpTransact::State *c /////////////////////////////////////////// buffer = (format == nullptr) ? nullptr : ats_strndup(format, format_size); + if (buffer != nullptr && format_size > 0) { + *resulting_buffer_length = format_size > max_buffer_length ? 0 : format_size; + plain_flag = true; + } ///////////////////////////////////////////////////////// // try to fabricate the desired type of error response // /////////////////////////////////////////////////////////