From nobody Sun May 19 06:23:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87352+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87352+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646745681; cv=none; d=zohomail.com; s=zohoarc; b=RD+v5NxGMUn/wW5LTqBibfa8dezZSK5eMNWzlQNuWSV6MXdj/62BGk4jxd1EQhgmkPZwir99bBIad97V4aqRxwlgJmAJXdQLE81zYfYXFyW6GP6ykuQkI3Ovkf1w6mHBq3qL6Y21nwDOnhnryzhddHeRneApjeIaicx6rfgPDL0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646745681; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=pXt3Wapiyii0vzYMh6amLFASmJwub5s25xBbb0HftUk=; b=B2IIWhm/Kj/T5TTRTAJk1pNO5zR6LkZILTggi/Qf3UItkyMG+MseSXsWuWutE0rCg6JWN0TQCjot2kpF2uWNW5WX1NFVwloKOoP6obkNynyZulc0nenJamFUbhGGrEkv64Lr5PqwRE7KLCR8faKtwZF7azvNE3GG76PgnOH4ZZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87352+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1646745681509890.5264003534302; Tue, 8 Mar 2022 05:21:21 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6PvXYY1788612x8NLboM6UD0; Tue, 08 Mar 2022 05:21:21 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web08.7651.1646745678886171872 for ; Tue, 08 Mar 2022 05:21:19 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-179-GBTahR16Pw2FUvfge8Zgkw-1; Tue, 08 Mar 2022 08:21:15 -0500 X-MC-Unique: GBTahR16Pw2FUvfge8Zgkw-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 575E81091DA3 for ; Tue, 8 Mar 2022 13:21:14 +0000 (UTC) X-Received: from osteffen-laptop.fritz.box (unknown [10.39.193.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id A440C7D3C9; Tue, 8 Mar 2022 13:21:13 +0000 (UTC) From: "Oliver Steffen" To: devel@edk2.groups.io Cc: Oliver Steffen Subject: [edk2-devel] [PATCH v2 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Date: Tue, 8 Mar 2022 14:21:01 +0100 Message-Id: <20220308132104.407800-2-osteffen@redhat.com> In-Reply-To: <20220308132104.407800-1-osteffen@redhat.com> References: <20220304130403.47832-1-osteffen@redhat.com> <20220308132104.407800-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,osteffen@redhat.com X-Gm-Message-State: Lx5IfbdItTrYVITdMyJzkOrJx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646745681; bh=IgyxABFp7Zxk/BDiVk88f8GtkvH5QKXs4ZGrSeClkzI=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=brm13BV3DV/nB0m2gK5fz3okg04NOWg1c7Jc/pPBXfRxMnlnZZe8Wa6SBdHApU4h9D+ 5N6gaxM7fVIqwCVOkpW17qCi/nxsoo4M8jcanuXelK39PJVT50POCW2HUEY+c7laE9w39 yhVH+wupQVnhUZ3DckmAhgZLpx0WRfRDht4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646745682675100007 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2720 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 Reviewed-by: Gerd Hoffmann --- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 9457dd2623d3..cd54c574044b 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1086,6 +1086,18 @@ HttpConfigureTcp4 ( Tcp4Option->EnableNagle =3D TRUE; Tcp4CfgData->ControlOption =3D Tcp4Option; =20 + if ((HttpInstance->State =3D=3D HTTP_STATE_TCP_CONNECTED) || + (HttpInstance->State =3D=3D HTTP_STATE_TCP_CLOSED)) + { + Status =3D HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4(NULL) - %r\n", Status)); + return Status; + } + + HttpInstance->State =3D HTTP_STATE_TCP_UNCONFIGED; + } + Status =3D HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, Tcp4CfgDat= a); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4 - %r\n", Status)); --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87352): https://edk2.groups.io/g/devel/message/87352 Mute This Topic: https://groups.io/mt/89636384/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 06:23:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87351+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87351+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646745680; cv=none; d=zohomail.com; s=zohoarc; b=crKTemfUegaZ0UpAWvlwC0T5SI+lVdZnnADM6xYtxJRkAC2L5I9Nb0LHwK5em70iNIHINJ3bh+DzjgkASfq/gWSocBynr7YJ+0+zaU0G+dOIBkD15ifbAdjIOUaE7f2ChXfCTMrRyMXB3zP8xtWTEOqTQ62ErM4c3m/y/AgcX9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646745680; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=AabgOuQGee2mcLPc2FCTvvI8aQ1Xabq3UviRAUrSJhI=; b=VOrU44pzDrd+dAvLXq2okRwnn8xp9ZP+nXSLUKeMYcXlmYGCKVkTLG6w7Zy70b7fwGqio6eW858uPSMVrsE7ikeJkAU5BW0UvwCHGSLrumiPHf4bXoeaG7bZQW0Ga6qrCmy/MvB15/sROLEaXtS3UdVwctOeWjbGLHOFsPcpPMk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87351+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1646745680105517.9259060470474; Tue, 8 Mar 2022 05:21:20 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 36N5YY1788612x6xIOEznwtK; Tue, 08 Mar 2022 05:21:20 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.7951.1646745678803651193 for ; Tue, 08 Mar 2022 05:21:19 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-jzRm10sRO6Kx91CV6H_TyA-1; Tue, 08 Mar 2022 08:21:16 -0500 X-MC-Unique: jzRm10sRO6Kx91CV6H_TyA-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 521C4801DDC for ; Tue, 8 Mar 2022 13:21:15 +0000 (UTC) X-Received: from osteffen-laptop.fritz.box (unknown [10.39.193.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id A009F7C0E7; Tue, 8 Mar 2022 13:21:14 +0000 (UTC) From: "Oliver Steffen" To: devel@edk2.groups.io Cc: Oliver Steffen Subject: [edk2-devel] [PATCH v2 2/4] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Date: Tue, 8 Mar 2022 14:21:02 +0100 Message-Id: <20220308132104.407800-3-osteffen@redhat.com> In-Reply-To: <20220308132104.407800-1-osteffen@redhat.com> References: <20220304130403.47832-1-osteffen@redhat.com> <20220308132104.407800-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,osteffen@redhat.com X-Gm-Message-State: HZzGuFwVDrrZ00xb76TR9t5gx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646745680; bh=5T7+OjEeNIOhVlItUJqTk9F1sh1GvePD8Hww51NsUy8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=q8S9Iaq8fcoMTwQFoNxAPJUrmB3f6Vbi11aNsrcZ8wAjyezmt5nwRLtDZV3XZE3LbQ2 jFsPWtqmkDAMc+DabfKlUAuy038lQESclu7/XYK0QcaoGFO2cgerMJ8MPP4BLCdDECLnh PKCWsJwqwNqN9NGkfXijuCy5lM0uWeOOZss= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646745695818100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2720 Add ConnectionClose flag to HTTP_PROTOCOL. This boolean is FALSE by default. If set to TRUE, a reconfigure of the Http instance is forced on the next request. The flag is then reset. Signed-off-by: Oliver Steffen Reviewed-by: Gerd Hoffmann --- NetworkPkg/HttpDxe/HttpProto.h | 2 ++ NetworkPkg/HttpDxe/HttpImpl.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h index 8ed99c7a02d3..620eb3915843 100644 --- a/NetworkPkg/HttpDxe/HttpProto.h +++ b/NetworkPkg/HttpDxe/HttpProto.h @@ -194,6 +194,8 @@ typedef struct _HTTP_PROTOCOL { EFI_TCP6_IO_TOKEN Tcp6TlsRxToken; EFI_TCP6_RECEIVE_DATA Tcp6TlsRxData; BOOLEAN TlsIsRxDone; + + BOOLEAN ConnectionClose; } HTTP_PROTOCOL; =20 typedef struct { diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d64cd9e965c0..d8b014c94f3a 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -161,6 +161,7 @@ EfiHttpConfigure ( HttpInstance->HttpVersion =3D HttpConfigData->HttpVersion; HttpInstance->TimeOutMillisec =3D HttpConfigData->TimeOutMillisec; HttpInstance->LocalAddressIsIPv6 =3D HttpConfigData->LocalAddressIsIPv= 6; + HttpInstance->ConnectionClose =3D FALSE; =20 if (HttpConfigData->LocalAddressIsIPv6) { CopyMem ( @@ -440,7 +441,8 @@ EfiHttpRequest ( // ReConfigure =3D FALSE; } else { - if ((HttpInstance->RemotePort =3D=3D RemotePort) && + if ((HttpInstance->ConnectionClose =3D=3D FALSE) && + (HttpInstance->RemotePort =3D=3D RemotePort) && (AsciiStrCmp (HttpInstance->RemoteHost, HostName) =3D=3D 0) && (!HttpInstance->UseHttps || (HttpInstance->UseHttps && !TlsConfigure && @@ -649,6 +651,8 @@ EfiHttpRequest ( } } =20 + HttpInstance->ConnectionClose =3D FALSE; + // // Transmit the request message. // --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87351): https://edk2.groups.io/g/devel/message/87351 Mute This Topic: https://groups.io/mt/89636383/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 06:23:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87353+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87353+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646745681; cv=none; d=zohomail.com; s=zohoarc; b=Tgqdqk4dTY5qJvPZZkG8cPI7OcJxcX70zv8F7vdDUZ2lvp37CWhAkHrpWKTgbgrxJVUnpxRsUzS3zHSf+bhpKdheyqdbONkXxvcvLWiwntbez/vWLkmaZxt6swAYbP8cBxPN6o/URUnHvnwTe2oPhuE6YsmU8Js7wjKzvhbUkOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646745681; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=WgzWQl1ejf4Yv4VyKwjnPS8w1OQm4wcxv5zBkc1XT/Y=; b=Gqic6BXmnvWajILh0ASZX+C0NdH9qJuSoE8ZnEHa2rYvA2fj6sAduj3/UlSsrlv1yu/iOuxmBLG6ED34wgQzz/VZPEILimHqiN2XZ5J2dZ7wIueyyAI158lMA67XceXlQ7v8z72ZLODxoGZFuVrA1zZr9FzqY62Zb3N+y+cCYFE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87353+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1646745681688673.8943864130406; Tue, 8 Mar 2022 05:21:21 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id ta5vYY1788612xfGRZ7HAGTX; Tue, 08 Mar 2022 05:21:21 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web08.7652.1646745679333592196 for ; Tue, 08 Mar 2022 05:21:19 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-589-bdWVjHSmMYKgUU_0KhEVlQ-1; Tue, 08 Mar 2022 08:21:17 -0500 X-MC-Unique: bdWVjHSmMYKgUU_0KhEVlQ-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F7D5FC83 for ; Tue, 8 Mar 2022 13:21:16 +0000 (UTC) X-Received: from osteffen-laptop.fritz.box (unknown [10.39.193.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F4E17C0E7; Tue, 8 Mar 2022 13:21:15 +0000 (UTC) From: "Oliver Steffen" To: devel@edk2.groups.io Cc: Oliver Steffen Subject: [edk2-devel] [PATCH v2 3/4] NetworkPkg/HttpDxe: Detect 'Connection: close' header Date: Tue, 8 Mar 2022 14:21:03 +0100 Message-Id: <20220308132104.407800-4-osteffen@redhat.com> In-Reply-To: <20220308132104.407800-1-osteffen@redhat.com> References: <20220304130403.47832-1-osteffen@redhat.com> <20220308132104.407800-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,osteffen@redhat.com X-Gm-Message-State: xaVAi0jvYU0MQo7CulODHJ56x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646745681; bh=NTcUciSs3yiU4UMeFsrd1kEKl9dwrOlFp8FsE28OozM=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=adiaZGM5qzeodUqMq5IkoacT3Q1wN/u1dvY/ZJ/aC5lcpFfHoDUmEciKDVLTf0z64+k yh7CzRjGevhBvR+FbU4diHcOFCzT79fBCX0Z9xl9auQ7e2ZmpkcJYXkiWBkIzPPzq7Pr/ WAcFPshze0zLZIWQ1Hn6jOyu0wWe4s+vuC8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646746583582100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2720 Force connection close before the next request if the server sends the 'Connection: close' header. Signed-off-by: Oliver Steffen Reviewed-by: Gerd Hoffmann --- 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; =20 if ((Wrap =3D=3D NULL) || (Wrap->HttpInstance =3D=3D NULL)) { return EFI_INVALID_PARAMETER; @@ -1200,6 +1201,16 @@ HttpResponseWorker ( FreePool (HttpHeaders); HttpHeaders =3D NULL; =20 + for (index =3D 0; index < HttpMsg->HeaderCount; ++index) { + if ((AsciiStriCmp ("Connection", HttpMsg->Headers[index].FieldName= ) =3D=3D 0) && + (AsciiStriCmp ("close", HttpMsg->Headers[index].FieldValue) = =3D=3D 0)) + { + DEBUG ((DEBUG_VERBOSE, "Http: 'Connection: close' header receive= d.\n")); + HttpInstance->ConnectionClose =3D TRUE; + break; + } + } + // // Init message-body parser by header information. // --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87353): https://edk2.groups.io/g/devel/message/87353 Mute This Topic: https://groups.io/mt/89636385/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 06:23:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87354+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87354+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646745682; cv=none; d=zohomail.com; s=zohoarc; b=Qp4SV8rgm6NIYyqXJjsUnVfwHNMzEs6OmsUQt8bv8ZJSl58JMWsOhO7Pv/jUN8H7hTwn9LMZiNPj/XBH0eG8A0hFmoyhc1c4dV6OY0NWCl501jHyIG2RIUhTit1M47bBAb46man2v9Hx6m+odWZezDg7mp4vjBdsyzwN/XvwBfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646745682; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=n2VRgA1FLU9upVor/VEp6MfITiMe4DkE4IakVo67BFA=; b=VxxKxbrFlRfq4WPwveJjj8DTueKyJ+2Km0dBeZQUCP0CbVvM+BTxkZAvnA0BhULlNXC1cmp++jZ/2knuTWhh0svIZHnud0g9qg9HJqkGEJVlPiSv2mo07I2MmlG/7aEra2nDolq9DpY2mzr2bXoy0vRnj7AlZkqxQuM3ml1GxuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87354+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1646745682152180.9798100137308; Tue, 8 Mar 2022 05:21:22 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id DaUbYY1788612xk9HwLWv669; Tue, 08 Mar 2022 05:21:21 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web08.7653.1646745680133587145 for ; Tue, 08 Mar 2022 05:21:20 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-XeGeWo8QMO2cKXZv2_AsTw-1; Tue, 08 Mar 2022 08:21:18 -0500 X-MC-Unique: XeGeWo8QMO2cKXZv2_AsTw-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4DB25824FA6 for ; Tue, 8 Mar 2022 13:21:17 +0000 (UTC) X-Received: from osteffen-laptop.fritz.box (unknown [10.39.193.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E5D37C0E7; Tue, 8 Mar 2022 13:21:16 +0000 (UTC) From: "Oliver Steffen" To: devel@edk2.groups.io Cc: Oliver Steffen Subject: [edk2-devel] [PATCH v2 4/4] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Date: Tue, 8 Mar 2022 14:21:04 +0100 Message-Id: <20220308132104.407800-5-osteffen@redhat.com> In-Reply-To: <20220308132104.407800-1-osteffen@redhat.com> References: <20220304130403.47832-1-osteffen@redhat.com> <20220308132104.407800-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,osteffen@redhat.com X-Gm-Message-State: 9RueQ8o5ELvr5yyzCdm3MLlEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646745681; bh=j/BaqHzOZtmQQtlBF+u4mr0r+TUO6ywJePfiiDfzFls=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=pVwZfuDmbs4iFSTHIxTy/BcdudDpkz2ZHSho0GKjKM11/3/tz4HkKhf+QRTpa7FUzar xp1hBvbgzp+m8sc3jA8Hc9wE4mAhxUxNxuMjy5xUrEsjxroq+1UNpl5sDkPdkBT7iH93K gh8FVmrKJhFxw+kL7pl+daZBP6dz97Z+y3g= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646745682812100011 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2720 Force connection close before the next request if the server identifies as version 1.0. Signed-off-by: Oliver Steffen Reviewed-by: Gerd Hoffmann --- NetworkPkg/HttpDxe/HttpImpl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d40d55ac92ad..623e029c606e 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -1105,6 +1105,14 @@ HttpResponseWorker ( HttpInstance->CacheLen =3D BodyLen; } =20 + // + // Check server's HTTP version. + // + if (AsciiStrnCmp (HttpHeaders, "HTTP/1.0", AsciiStrLen ("HTTP/1.0")) = =3D=3D 0) { + DEBUG ((DEBUG_VERBOSE, "HTTP: Server version is 1.0. Setting Connect= ion close.\n")); + HttpInstance->ConnectionClose =3D TRUE; + } + // // Search for Status Code. // --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87354): https://edk2.groups.io/g/devel/message/87354 Mute This Topic: https://groups.io/mt/89636387/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-