From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2367B209589CD for ; Wed, 2 Aug 2017 20:28:32 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP; 02 Aug 2017 20:30:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,314,1498546800"; d="scan'208";a="114998759" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 02 Aug 2017 20:30:42 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 2 Aug 2017 20:30:28 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 2 Aug 2017 20:30:28 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0319.002; Thu, 3 Aug 2017 11:30:19 +0800 From: "Wu, Jiaxin" To: "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" Thread-Topic: [Patch] NetworkPkg: Display HTTP redirection info to the screen if need. Thread-Index: AQHTBoqZTx2Kfyl7DEmcIZ2FueGA46Jx65Tg//+SUwCAAIY8wA== Date: Thu, 3 Aug 2017 03:30:19 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B7274162FE842@SHSMSX103.ccr.corp.intel.com> References: <20170727034356.6320-1-siyuan.fu@intel.com> <895558F6EA4E3B41AC93A00D163B7274162FE72F@SHSMSX103.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMmY3OWEwMGItMDU1ZC00Mzk0LTg2OGItNmFkYjMzYzA5YTM0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlwvaFVDMzhJbkx0THlzS1YrVTNjeFN6cUVpMUVuaDJKYzA0WXkwaythMU1zPSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] NetworkPkg: Display HTTP redirection info to the screen if need. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 03:28:32 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ok, that's make sense. Reviewed-by: Wu Jiaxin > -----Original Message----- > From: Fu, Siyuan > Sent: Thursday, August 3, 2017 11:28 AM > To: Wu, Jiaxin ; edk2-devel@lists.01.org > Cc: Ye, Ting > Subject: RE: [Patch] NetworkPkg: Display HTTP redirection info to the scr= een > if need. >=20 > Hi, Jiaxin >=20 > We actually don't support HTTP redirect here, which means we won't auto > redirect and download the boot image. The HTTP boot process will be > aborted, so I think using ERROR makes more sense. >=20 > Thanks, > Siyuan >=20 > -----Original Message----- > From: Wu, Jiaxin > Sent: Thursday, August 3, 2017 10:03 AM > To: Fu, Siyuan ; edk2-devel@lists.01.org > Cc: Ye, Ting > Subject: RE: [Patch] NetworkPkg: Display HTTP redirection info to the scr= een > if need. >=20 > Hi siyuan, >=20 > > + if (HttpHeader !=3D NULL) { > > + Print (L"\n HTTP ERROR: Resource Redirected.\n New > > Location: %a\n", HttpHeader->FieldValue); > > + } >=20 > How about we use HTTP WARNING instead of HTTP ERROR? >=20 > Thanks, > Jiaxin >=20 > > -----Original Message----- > > From: Fu, Siyuan > > Sent: Thursday, July 27, 2017 11:44 AM > > To: edk2-devel@lists.01.org > > Cc: Ye, Ting ; Wu, Jiaxin > > Subject: [Patch] NetworkPkg: Display HTTP redirection info to the scree= n if > > need. > > > > HTTP defines a set of status code for redirecting a request to a differ= ent > URI > > in Section 6.4 of RFC7231 and also RFC7583. This patch updates the HTTP > boot > > driver to display the redirection info to the screen so the user would = have > > chance to know new URI address of the HTTP boot image. > > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Fu Siyuan > > Cc: Ye Ting > > Cc: Wu Jiaxin > > --- > > NetworkPkg/HttpBootDxe/HttpBootDxe.h | 4 ++++ > > NetworkPkg/HttpBootDxe/HttpBootImpl.c | 21 > ++++++++++++++++++++- > > NetworkPkg/HttpBootDxe/HttpBootSupport.c | 25 > > ++++++++++++++++++++++++- > > NetworkPkg/HttpBootDxe/HttpBootSupport.h | 13 +++++++++++++ > > 4 files changed, 61 insertions(+), 2 deletions(-) > > > > diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.h > > b/NetworkPkg/HttpBootDxe/HttpBootDxe.h > > index 8d89b3e..4632ee2 100644 > > --- a/NetworkPkg/HttpBootDxe/HttpBootDxe.h > > +++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.h > > @@ -179,6 +179,10 @@ struct _HTTP_BOOT_PRIVATE_DATA { > > UINT32 Id; > > EFI_HTTP_BOOT_CALLBACK_PROTOCOL *HttpBootCallback; > > EFI_HTTP_BOOT_CALLBACK_PROTOCOL LoadFileCallback; > > + > > + // > > + // Data for the default HTTP Boot callback protocol > > + // > > UINT64 FileSize; > > UINT64 ReceivedSize; > > UINT32 Percentage; > > diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c > > b/NetworkPkg/HttpBootDxe/HttpBootImpl.c > > index 63cf396..5cfb0f4 100644 > > --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c > > +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c > > @@ -1,7 +1,7 @@ > > /** @file > > The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot. > > > > -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> > +Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> > (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> > This program and the accompanying materials are licensed and made > > available under > > the terms and conditions of the BSD License that accompanies this > > distribution. > > @@ -665,6 +665,25 @@ HttpBootCallback ( > > case HttpBootHttpResponse: > > if (Data !=3D NULL) { > > HttpMessage =3D (EFI_HTTP_MESSAGE *) Data; > > + > > + if (HttpMessage->Data.Response !=3D NULL) { > > + if (HttpBootIsHttpRedirectStatusCode (HttpMessage- > >Data.Response- > > >StatusCode)) { > > + // > > + // Server indicates the resource has been redirected to a di= fferent > URL > > + // according to the section 6.4 of RFC7231 and the RFC 7538. > > + // Display the redirect information on the screen. > > + // > > + HttpHeader =3D HttpFindHeader ( > > + HttpMessage->HeaderCount, > > + HttpMessage->Headers, > > + HTTP_HEADER_LOCATION > > + ); > > + if (HttpHeader !=3D NULL) { > > + Print (L"\n HTTP ERROR: Resource Redirected.\n New > > Location: %a\n", HttpHeader->FieldValue); > > + } > > + } > > + } > > + > > HttpHeader =3D HttpFindHeader ( > > HttpMessage->HeaderCount, > > HttpMessage->Headers, > > diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c > > b/NetworkPkg/HttpBootDxe/HttpBootSupport.c > > index 5024f2e..6d4edfc 100644 > > --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c > > +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c > > @@ -1034,7 +1034,8 @@ HttpIoRecvResponse ( > > HttpIo->IsRxDone =3D FALSE; > > } > > > > - if (!EFI_ERROR (HttpIo->RspToken.Status) && HttpIo->Callback !=3D NU= LL) { > > + if ((HttpIo->Callback !=3D NULL) && > > + (HttpIo->RspToken.Status =3D=3D EFI_SUCCESS || HttpIo- > >RspToken.Status > > =3D=3D EFI_HTTP_ERROR)) { > > Status =3D HttpIo->Callback ( > > HttpIoResponse, > > HttpIo->RspToken.Message, > > @@ -1319,3 +1320,25 @@ HttpBootRegisterRamDisk ( > > return Status; > > } > > > > +/** > > + Indicate if the HTTP status code indicates a redirection. > > + > > + @param[in] StatusCode HTTP status code from server. > > + > > + @return TRUE if it's redirection. > > + > > +**/ > > +BOOLEAN > > +HttpBootIsHttpRedirectStatusCode ( > > + IN EFI_HTTP_STATUS_CODE StatusCode > > + ) > > +{ > > + if (StatusCode =3D=3D HTTP_STATUS_301_MOVED_PERMANENTLY || > > + StatusCode =3D=3D HTTP_STATUS_302_FOUND || > > + StatusCode =3D=3D HTTP_STATUS_307_TEMPORARY_REDIRECT || > > + StatusCode =3D=3D HTTP_STATUS_308_PERMANENT_REDIRECT) { > > + return TRUE; > > + } > > + > > + return FALSE; > > +} > > diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h > > b/NetworkPkg/HttpBootDxe/HttpBootSupport.h > > index f2b1846..c10b2cf 100644 > > --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.h > > +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.h > > @@ -445,4 +445,17 @@ HttpBootRegisterRamDisk ( > > IN VOID *Buffer, > > IN HTTP_BOOT_IMAGE_TYPE ImageType > > ); > > + > > +/** > > + Indicate if the HTTP status code indicates a redirection. > > + > > + @param[in] StatusCode HTTP status code from server. > > + > > + @return TRUE if it's redirection. > > + > > +**/ > > +BOOLEAN > > +HttpBootIsHttpRedirectStatusCode ( > > + IN EFI_HTTP_STATUS_CODE StatusCode > > + ); > > #endif > > -- > > 1.9.5.msysgit.1