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

kgiusti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git

commit 493470537d35ac01e4b537d997bfc7ddd54d279c
Author: Kenneth Giusti <[email protected]>
AuthorDate: Wed Dec 16 11:09:52 2020 -0500

    DISPATCH-1744: bugfix - do not call request_complete if close expected
---
 include/qpid/dispatch/http1_codec.h | 8 ++++----
 src/adaptors/http1/http1_codec.c    | 8 +++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/qpid/dispatch/http1_codec.h 
b/include/qpid/dispatch/http1_codec.h
index 79dfcbf..8e53463 100644
--- a/include/qpid/dispatch/http1_codec.h
+++ b/include/qpid/dispatch/http1_codec.h
@@ -238,10 +238,10 @@ int h1_codec_tx_body_str(h1_codec_request_state_t *hrs, 
char *data);
 // outgoing message construction complete.  The request_complete() callback MAY
 // occur during this call.
 //
-// need_close: set to true if the message is a response that does not provide
-// an explict body length. If true it is up to the caller to close the
-// underlying socket connection after all outgoing data for this request has
-// been sent.
+// need_close: set to true if the outgoing message is an HTTP response that
+// does not provide an explict body length. If true it is up to the caller to
+// close the underlying socket connection after all outgoing data for this
+// request has been sent.
 //
 int h1_codec_tx_done(h1_codec_request_state_t *hrs, bool *need_close);
 
diff --git a/src/adaptors/http1/http1_codec.c b/src/adaptors/http1/http1_codec.c
index ffa8a9f..1047fcc 100644
--- a/src/adaptors/http1/http1_codec.c
+++ b/src/adaptors/http1/http1_codec.c
@@ -1691,9 +1691,11 @@ int h1_codec_tx_done(h1_codec_request_state_t *hrs, bool 
*need_close)
 
     encoder_reset(encoder);
 
-    if (hrs->request_complete && hrs->response_complete) {
-        conn->config.request_complete(hrs, false);
-        h1_codec_request_state_free(hrs);
+    if (!hrs->close_expected) {
+        if (hrs->request_complete && hrs->response_complete) {
+            conn->config.request_complete(hrs, false);
+            h1_codec_request_state_free(hrs);
+        }
     }
 
     return 0;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to