From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 AC579210C66A4 for ; Tue, 31 Jul 2018 20:22:20 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jul 2018 20:22:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,430,1526367600"; d="scan'208";a="220762451" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 31 Jul 2018 20:22:14 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 31 Jul 2018 20:22:13 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 31 Jul 2018 20:22:13 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.100]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.57]) with mapi id 14.03.0319.002; Wed, 1 Aug 2018 11:22:12 +0800 From: "Fu, Siyuan" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , Laszlo Ersek Thread-Topic: [Patch] NetworkPkg/HttpDxe: Stripped square brackets in IPv6 expressed HostName. Thread-Index: AQHUKTrRTmwh1O/TT0aNaCnheEeMMqSqJbcg//+ENYCAAJC3oA== Date: Wed, 1 Aug 2018 03:22:11 +0000 Message-ID: References: <20180801015442.6932-1-Jiaxin.wu@intel.com> <895558F6EA4E3B41AC93A00D163B72741647A371@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <895558F6EA4E3B41AC93A00D163B72741647A371@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzYzOTlhNWEtMGMzYS00MmY1LWFjYmQtYTBhMjQ3ZTMwZWZiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNk4zSjV1UXJcL3d3T3MzRlwvTHhwZ1BnektRRG9lYUdaWnZPRDJlVFFHNkpUMFhvXC9jbVVweWN1ellMakJScDgrUSJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] NetworkPkg/HttpDxe: Stripped square brackets in IPv6 expressed HostName. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Aug 2018 03:22:22 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable OK, the patch is good with me. Reviewed-by: Fu Siyuan > -----Original Message----- > From: Wu, Jiaxin > Sent: Wednesday, August 1, 2018 10:42 AM > To: Fu, Siyuan ; edk2-devel@lists.01.org > Cc: Ye, Ting ; Laszlo Ersek > Subject: RE: [Patch] NetworkPkg/HttpDxe: Stripped square brackets in IPv6 > expressed HostName. >=20 > Hi Siyuan, >=20 > Even we have one lib for us to get the IPv6 address, I still prefer to us= e > the patch did, because the format returned from the HttpUrlGetIp6 is > EFI_IPv6_ADDRESS, we have to transform it to CHAR8, which means we also > need another lib included here to do that. Actually, the patch is quite > simply even than API did. What do you think? >=20 > Thanks, > Jiaxin >=20 > > -----Original Message----- > > From: Fu, Siyuan > > Sent: Wednesday, August 1, 2018 10:06 AM > > To: Wu, Jiaxin ; edk2-devel@lists.01.org > > Cc: Ye, Ting ; Laszlo Ersek > > Subject: RE: [Patch] NetworkPkg/HttpDxe: Stripped square brackets in > IPv6 > > expressed HostName. > > > > Hi, Jiaxin > > > > The HttpLib already has HttpUrlGetIp6() for this. > > > > BestRegards > > Fu Siyuan > > > > > -----Original Message----- > > > From: Wu, Jiaxin > > > Sent: Wednesday, August 1, 2018 9:55 AM > > > To: edk2-devel@lists.01.org > > > Cc: Ye, Ting ; Fu, Siyuan ; > Laszlo > > > Ersek ; Wu, Jiaxin > > > Subject: [Patch] NetworkPkg/HttpDxe: Stripped square brackets in IPv6 > > > expressed HostName. > > > > > > In URI, the colon (:) is used to terminate the HostName path before > > > a port number. However, if HostName is expressed as IPv6 format, colo= n > > > characters in IPv6 addresses will conflict with the colon before port > > > number. To alleviate this conflict in URI, the IPv6 expressed HostNam= e > > > are enclosed in square brackets ([]). To record the real IPv6 HostNam= e, > > > square brackets should be stripped. > > > > > > Cc: Ye Ting > > > Cc: Fu Siyuan > > > Cc: Laszlo Ersek > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > > Signed-off-by: Wu Jiaxin > > > --- > > > NetworkPkg/HttpDxe/HttpImpl.c | 17 ++++++++++++++--- > > > 1 file changed, 14 insertions(+), 3 deletions(-) > > > > > > diff --git a/NetworkPkg/HttpDxe/HttpImpl.c > > b/NetworkPkg/HttpDxe/HttpImpl.c > > > index 17deceb395..e05ee9344b 100644 > > > --- a/NetworkPkg/HttpDxe/HttpImpl.c > > > +++ b/NetworkPkg/HttpDxe/HttpImpl.c > > > @@ -403,14 +403,25 @@ EfiHttpRequest ( > > > Status =3D HttpParseUrl (Url, (UINT32) AsciiStrLen (Url), FALSE, > > > &UrlParser); > > > if (EFI_ERROR (Status)) { > > > goto Error1; > > > } > > > > > > - HostName =3D NULL; > > > - Status =3D HttpUrlGetHostName (Url, UrlParser, &HostName); > > > + Status =3D HttpUrlGetHostName (Url, UrlParser, &HostName); > > > if (EFI_ERROR (Status)) { > > > - goto Error1; > > > + goto Error1; > > > + } > > > + > > > + if (HttpInstance->LocalAddressIsIPv6 && AsciiStrSize (HostName) = > > 2 > > > && > > > + HostName[0] =3D=3D '[' && *(HostName + (AsciiStrSize (HostNa= me) - > 2)) > > > =3D=3D ']') { > > > + // > > > + // HostName format is expressed as IPv6, so, remove '[' and ']= '. > > > + // > > > + HostNameSize =3D AsciiStrSize (HostName) - 2; > > > + > > > + CopyMem (HostName, HostName + 1, HostNameSize - 1); > > > + > > > + *(HostName + HostNameSize - 1) =3D '\0'; > > > } > > > > > > Status =3D HttpUrlGetPort (Url, UrlParser, &RemotePort); > > > if (EFI_ERROR (Status)) { > > > if (HttpInstance->UseHttps) { > > > -- > > > 2.17.1.windows.2