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.129.124]) by mx.groups.io with SMTP id smtpd.web12.6945.1646400929929638031 for ; Fri, 04 Mar 2022 05:35:30 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q0NEMbLY; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: osteffen@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646400929; 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=ifx1IT7w1ViYx+OQIMl3C5kRMYiXqP/m/5wW393wBKY=; b=Q0NEMbLYMzdCfjo67VNgoOMF8Qza5QIsOK2z1AuX9WuF/j+Sz5RwjSsgAY/VSBno+WRhug d6UzQx4Bekq1+p8tMAv6ziGSxJTgBA2tf2skW+ThLLGcfAA1d/TcSQYbA2BzoMQSwicVz5 7gNwfVqObfABryKy6Lf21oC2dcv233o= 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-533-6Vr7iAsEM5m0DSZRL_QBhg-1; Fri, 04 Mar 2022 08:35:28 -0500 X-MC-Unique: 6Vr7iAsEM5m0DSZRL_QBhg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2946F1800D50 for ; Fri, 4 Mar 2022 13:35:27 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.39.194.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F3F17B5F1; Fri, 4 Mar 2022 13:35:22 +0000 (UTC) From: "Oliver Steffen" To: devel@edk2.groups.io Cc: Oliver Steffen Subject: [PATCH 3/4] NetworkPkg/HttpDxe: Detect 'Connection: close' header Date: Fri, 4 Mar 2022 14:34:30 +0100 Message-Id: <20220304133431.53378-4-osteffen@redhat.com> In-Reply-To: <20220304133431.53378-1-osteffen@redhat.com> References: <20220304133431.53378-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: quoted-printable Content-Type: text/plain; charset="US-ASCII" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2720 Force connecton 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 d8b014c94f..a1a3eea585 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -994,6 +994,7 @@ HttpResponseWorker ( UINTN HdrLen;=0D NET_FRAGMENT Fragment;=0D UINT32 TimeoutValue;=0D + UINTN index;=0D =20=0D if ((Wrap =3D=3D NULL) || (Wrap->HttpInstance =3D=3D NULL)) {=0D return EFI_INVALID_PARAMETER;=0D @@ -1200,6 +1201,16 @@ HttpResponseWorker ( FreePool (HttpHeaders);=0D HttpHeaders =3D NULL;=0D =20=0D + for (index =3D 0; index < HttpMsg->HeaderCount; ++index) {=0D + if ((AsciiStriCmp ("Connection", HttpMsg->Headers[index].FieldName= ) =3D=3D 0) &&=0D + (AsciiStriCmp ("close", HttpMsg->Headers[index].FieldValue) = =3D=3D 0))=0D + {=0D + DEBUG ((DEBUG_WARN, "Http: 'Connection: close' header received.\= n"));=0D + HttpInstance->ConnectionClose =3D TRUE;=0D + break;=0D + }=0D + }=0D +=0D //=0D // Init message-body parser by header information.=0D //=0D --=20 2.35.1