From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.9875.1647955841572732868 for ; Tue, 22 Mar 2022 06:30:41 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NaVdqEIA; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: osteffen@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647955840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ENtWJu8eCZcm7z/YVDsJJmvs66YNNYpWM3SfawconOc=; b=NaVdqEIA0aVTGVwSAM+c8/qrNJANt36c9U6vDhOAGFGqWXJ3lE615rvLAQuaKPN/Y2vjK1 0KjZrJSijdA0D2PoRabnv6geT9do4e59YUwCEzlBAkq/ZnkeYb7ErfPDe/rKkgiy6yqTQh gALqDIy9y/DKYX5n5ShJunnwyTg+rvc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-312-EtTEogfpMdGfjaIgmYyCdw-1; Tue, 22 Mar 2022 09:30:36 -0400 X-MC-Unique: EtTEogfpMdGfjaIgmYyCdw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B0F2682A682; Tue, 22 Mar 2022 13:30:35 +0000 (UTC) Received: from osteffen-laptop.fritz.box (unknown [10.39.195.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3452B40CF900; Tue, 22 Mar 2022 13:30:34 +0000 (UTC) From: "Oliver Steffen" To: devel@edk2.groups.io Cc: maciej.rabeda@linux.intel.com, jiaxin.wu@intel.com, siyuan.fu@intel.com, kraxel@redhat.com, Oliver Steffen Subject: [PATCH v3 4/5] NetworkPkg/HttpDxe: Detect 'Connection: close' header Date: Tue, 22 Mar 2022 14:30:07 +0100 Message-Id: <20220322133008.152037-5-osteffen@redhat.com> In-Reply-To: <20220322133008.152037-1-osteffen@redhat.com> References: <20220304130403.47832-1-osteffen@redhat.com> <20220322133008.152037-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=osteffen@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Force connection close before the next request if the server sends the 'Connection: close' header. Signed-off-by: Oliver Steffen --- NetworkPkg/HttpDxe/HttpImpl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d8b014c94f3a..d40d55ac92ad 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -994,6 +994,7 @@ HttpResponseWorker ( UINTN HdrLen; NET_FRAGMENT Fragment; UINT32 TimeoutValue; + UINTN index; if ((Wrap == NULL) || (Wrap->HttpInstance == NULL)) { return EFI_INVALID_PARAMETER; @@ -1200,6 +1201,16 @@ HttpResponseWorker ( FreePool (HttpHeaders); HttpHeaders = NULL; + for (index = 0; index < HttpMsg->HeaderCount; ++index) { + if ((AsciiStriCmp ("Connection", HttpMsg->Headers[index].FieldName) == 0) && + (AsciiStriCmp ("close", HttpMsg->Headers[index].FieldValue) == 0)) + { + DEBUG ((DEBUG_VERBOSE, "Http: 'Connection: close' header received.\n")); + HttpInstance->ConnectionClose = TRUE; + break; + } + } + // // Init message-body parser by header information. // -- 2.35.1