You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sc...@apache.org on 2017/07/01 03:57:42 UTC

[trafficserver] branch master updated: Missing Length if format was set in HttpBodyFactory::fabricate_with_old_api

This is an automated email from the ASF dual-hosted git repository.

scw00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 3387c0f  Missing Length if format was set in HttpBodyFactory::fabricate_with_old_api
3387c0f is described below

commit 3387c0f6eb985331a0d47f921c341247183aace3
Author: scw00 <61...@qq.com>
AuthorDate: Mon Jun 19 10:00:29 2017 +0800

    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 0d496e2..97d093d 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 //
   /////////////////////////////////////////////////////////

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].