public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Oliver Steffen" <osteffen@redhat.com>
To: devel@edk2.groups.io
Cc: Oliver Steffen <osteffen@redhat.com>
Subject: [PATCH 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring
Date: Fri,  4 Mar 2022 14:34:28 +0100	[thread overview]
Message-ID: <20220304133431.53378-2-osteffen@redhat.com> (raw)
In-Reply-To: <20220304133431.53378-1-osteffen@redhat.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720

Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or
HTTP_STATE_TCP_CLOSED and de-configure the Tcp4 instance before
configuring it again.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index 9457dd2623..cd54c57404 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -1086,6 +1086,18 @@ HttpConfigureTcp4 (
   Tcp4Option->EnableNagle       = TRUE;
   Tcp4CfgData->ControlOption    = Tcp4Option;
 
+  if ((HttpInstance->State == HTTP_STATE_TCP_CONNECTED) ||
+      (HttpInstance->State == HTTP_STATE_TCP_CLOSED))
+  {
+    Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, NULL);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4(NULL) - %r\n", Status));
+      return Status;
+    }
+
+    HttpInstance->State = HTTP_STATE_TCP_UNCONFIGED;
+  }
+
   Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, Tcp4CfgData);
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4 - %r\n", Status));
-- 
2.35.1


  reply	other threads:[~2022-03-04 13:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 13:34 [PATCH 0/4] Http Fixes Oliver Steffen
2022-03-04 13:34 ` Oliver Steffen [this message]
2022-03-07 11:52   ` [edk2-devel] [PATCH 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Gerd Hoffmann
2022-03-04 13:34 ` [PATCH 2/4] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen
2022-03-07 11:55   ` [edk2-devel] " Gerd Hoffmann
2022-03-04 13:34 ` [PATCH 3/4] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen
2022-03-07 11:59   ` [edk2-devel] " Gerd Hoffmann
2022-03-04 13:34 ` [PATCH 4/4] NetworkPkg/HttpDxe: Detect non-HTTP/1.1 servers Oliver Steffen
2022-03-07 12:07   ` [edk2-devel] " Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220304133431.53378-2-osteffen@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox