Fix internal half closed post bug

Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/0e1bb48d
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/0e1bb48d
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/0e1bb48d

Branch: refs/heads/4.2.x
Commit: 0e1bb48da286ecd82b80cf6311dbd1b09f06afeb
Parents: d1cf2b2
Author: Brian Geffon <bri...@apache.org>
Authored: Mon Jun 9 16:44:04 2014 -0700
Committer: Brian Geffon <bri...@apache.org>
Committed: Tue Jun 10 15:57:00 2014 -0700

----------------------------------------------------------------------
 proxy/http/HttpSM.cc | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0e1bb48d/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 8618728..66e6d6c 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -3143,10 +3143,19 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer 
* c)
   if (close_connection) {
     // If the client could be pipelining or is doing a POST, we need to
     //   set the ua_session into half close mode
-    if ((t_state.method == HTTP_WKSIDX_POST || 
t_state.client_info.pipeline_possible == true)
-        && event == VC_EVENT_WRITE_COMPLETE) {
-      ua_session->set_half_close_flag();
-    }
+
+         // only external POSTs should be subject to this logic; ruling out 
internal POSTs here
+         bool is_eligible_post_request = (t_state.method == HTTP_WKSIDX_POST);
+         if (is_eligible_post_request) {
+          NetVConnection *vc = ua_session->get_netvc();
+          if (vc) {
+                 is_eligible_post_request = vc->get_is_internal_request() ? 
false : true;
+          }
+         }
+         if ((is_eligible_post_request || 
t_state.client_info.pipeline_possible == true) &&
+                         event == VC_EVENT_WRITE_COMPLETE) {
+                 ua_session->set_half_close_flag();
+         }
 
     ua_session->do_io_close();
     ua_session = NULL;

Reply via email to