]> granicus.if.org Git - icinga2/commitdiff
Restore 'Connection: close' behaviour in HTTP responses
authorSven Wegener <swegener@gentoo.org>
Mon, 3 Dec 2018 13:27:37 +0000 (14:27 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 5 Dec 2018 14:45:09 +0000 (15:45 +0100)
Actually the `corked` functionality caused problems with
not closing connections properly.

Full Analysis: https://github.com/Icinga/icinga2/issues/6799#issuecomment-443710338

Full credits to @swegener :)

fixes #6799

lib/remote/httpresponse.cpp
lib/remote/httpserverconnection.cpp

index fe67052c9ae70ac34d7c4fafecb80eff0592549c..ef0df7e81a2dad143bd733bfcd4c3f5f7a2d6661 100644 (file)
@@ -111,6 +111,9 @@ void HttpResponse::Finish()
        }
 
        m_State = HttpResponseEnd;
+
+       if (m_Request->ProtocolVersion == HttpVersion10 || m_Request->Headers->Get("connection") == "close")
+               m_Stream->Shutdown();
 }
 
 bool HttpResponse::Parse(StreamReadContext& src, bool may_wait)
index 4f619d2f176cf87057321bfbf10857c5321db873..cd3e542f27761d16d1ff34406d4f2d9103b46658 100644 (file)
@@ -362,13 +362,6 @@ void HttpServerConnection::DataAvailableHandler()
 
                        close = true;
                }
-
-               /* Request finished, decide whether to explicitly close the connection. */
-               if (m_CurrentRequest.ProtocolVersion == HttpVersion10 ||
-                       m_CurrentRequest.Headers->Get("connection") == "close") {
-                       m_Stream->Shutdown();
-                       close = true;
-               }
        } else
                close = true;