From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id AF0CBAC1630 for ; Mon, 18 Sep 2023 15:41:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=H+r8m+ogo+t3cvI0ZfhSvswBoJEnCrHEtpCnaTIMZsc=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1695051680; v=1; b=l4quc+NfyamYiV6odWAJNIRbvjh3OEyoJ+73hdFTjX6reI6JIj+FUJhNO3I3YBaLoFh1SH/Z jVOdafAmLqIN6LWtObnUsdxEvR0Qs/eOglBWWmUPQRnRT9YIhjkTht0Kzt10DFLHVHar50mW2d6 7t6dY6QXFuqk7zFlvC73d+0E= X-Received: by 127.0.0.2 with SMTP id 4OX6YY7687511xGp11JCAZYF; Mon, 18 Sep 2023 08:41:20 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.77]) by mx.groups.io with SMTP id smtpd.web10.54745.1695051679402128415 for ; Mon, 18 Sep 2023 08:41:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MmZBrPLEItIqOex3T71N0k4yuW71HnUx6Q7EbjisO7KSptmqDxmlO+i3T7FVKvHKyFRPreg5wxfJ+yI4K3+Q5LDJZdNO+nK+/0jqyhAs1whtg7yIVqES/V0R2DK//luvsYsAYhMC/fDYLMGTXbPejWKR+fYmDdo+31G4rme2sq2KqNHn2W+5ZotqykCymUPfiVYkKii6a+oGkG+c0TGPh3NIsS4rr7D5GltHR4CZwmSJVlsxEKRbHJIR4RSSVklNQvwgxFB7vKcG2roJ84Vbp4agiAKLEWWSonn8iXCLcxygKXrIRTnK9yMRclgG6xukUa73oT86cIQzQfEw3lQJRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yWD66qX9SloZwZ/IMo0ZDpR/FjXB+bn9+zYc7Zy5QmQ=; b=ggNZHHvHsvA/nwGu2WX3+Z0eIxpqWLIPn1Nak2e/5EDnbvEpj6lP9X9MX5DH/oo8ktmYJGdiZiGsCmmhX3mnOMdeoQCb5Aw+8Yd8iYr3c5q5RDYZwcQYe9ZqgqNp1M5A/qUNMFVckIWln0zqFAlQjL7kPJ2kM8xIvydwwDAZu8cj2GxyHNherB7aI4BeBRJ/uyhlXP9UtHiDwCG9g5byAySqHIva+QWoMCmTWRPbn1JogKpTTbK6x1gzjoxOJy8NvRkBwttC8CElzfs+UI7p/tNqKnN08Kp4SBRM+3903pIv4ttijeS/i1YejP0Pn25ssxodqKq6ihQW9C8h4YHsfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by LV2PR12MB5728.namprd12.prod.outlook.com (2603:10b6:408:17c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Mon, 18 Sep 2023 15:41:17 +0000 X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::2061:ca33:b659:2c02]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::2061:ca33:b659:2c02%4]) with mapi id 15.20.6792.026; Mon, 18 Sep 2023 15:41:17 +0000 From: "Chang, Abner via groups.io" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy , Nick Ramirez , Mike Maslenkin Subject: Re: [edk2-devel] [PATCH v2] RedfishPkg/RedfishRestExDxe: return HTTP status code to caller. Thread-Topic: [PATCH v2] RedfishPkg/RedfishRestExDxe: return HTTP status code to caller. Thread-Index: AQHZ6jHwKWdy8IFm50KCdNwfMa6M2rAguKjw Date: Mon, 18 Sep 2023 15:41:16 +0000 Message-ID: References: <20230918131322.7761-1-nicklew@nvidia.com> In-Reply-To: <20230918131322.7761-1-nicklew@nvidia.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=18571a23-e6ab-46f4-b894-397358ef4fc5;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-09-18T15:40:59Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|LV2PR12MB5728:EE_ x-ms-office365-filtering-correlation-id: a2e8e84b-ae45-434f-09c1-08dbb85db286 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: LVotwKLlfD6f0V9fbXy2uz5hZfVZ2MXSnLgBCeAoZAXR5cJOl9Wd3HQUXVv0rPzKVx4IJJJ2VjVhZyiUCfQELu1IcgS53HiXGVB5mVBx90Wh8EYuIv1Qaa53QW/ZHn+fdTSl63/Rt1eWc68K/JB2UcXEplAxBkhosNyg+PDYIrmS7SfVS/d0T0QXkaSHTtpKDRpKFRw42NUVA4VaL4qJy6ORajq2GfszBRdIqzKqtJWGzpa0xx2fxNPtxyixXydr51ad3azFflgFGVkJIqkOQHFDt0HhQ2+RzdOQGTccio+XpkRf2x6lFACUTSQyjP6xSIkBieq1CaP6susZli0QdotgFkx6lxPS3nP1nc14uvMsG6CLNYYZgKLqKRoGbb7MhQOypktSI5eWky+zbarkvie2rvEhIsbV7iaCWo93zTiH/ngNr5uIic6a6gVfWGwYHFV8F1pWiHnY+5x6AVpWitt5wLKBcLBVWeVooge3B/4Dm1uLHQw98LnaNuCnExAVFALgLwjnyhQMNCdGY1zsPZfcEjbN3UlBcYazoGPNQtCZ9jNbPwiyBGH4eNsH9v1XfWg/q8ocO8cblq2kfxLFL1+b45TqJUZuwB2useGwUcIVyECUtvAv7Bb6rowW1Clr x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?MY3Zql9uuU5phlOA/KrIEu7RSBU13juWq1YvBOT086DcTrhkuaqao+LjQ8h1?= =?us-ascii?Q?HAOMfIHKU4itiHSGD/O0jpRT9Vdj10FiA23E4hrh2PJEh/XvBBNQKabEDa20?= =?us-ascii?Q?zjH12lCoW0Nq4BrjAj9sTfHwANJAAwhXTeuCsQCVmEi278diXZVUl2vL/ACm?= =?us-ascii?Q?XEEYnHfaNpxHo/AfX7SBR3y6etfJGD8EFHmovieNDYYtIyIirh5toaw6Oo0I?= =?us-ascii?Q?aozh1JlUf3ghD3iOK3OWM2m1TkcscPdq3BWlZoMuAjUokd1FufBi3/KD5UND?= =?us-ascii?Q?JGdUkOdhpHpcZcXyzDyCUrJrlEWCEHy6cRCGRRBXfoTDy0DCyybEG9/9aYh8?= =?us-ascii?Q?zVvh8T9MOCTRexmPU9hZl0Dj5f9mY1oyeNVUgu8MWQv9Jwk+Duzsb+ey/nF+?=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H2DV0ClZCuAZV9aPeck/t4glA?= =?us-ascii?Q?E0b3zDnPhOQEU4/a++KJtbbjliY9AqUP37DbEeQWsDxd18x7HeEyyaxXk6zm?= =?us-ascii?Q?Y03FAMpt+bZTDA4VvogUuuURF5yOPj2Tr80ynZjtGOb0J5H5neZbZtZlH8+V?= =?us-ascii?Q?PWqbjkh1zcrmrqfwDZcIR0Bhgfb18RvfcKVMuZ9AMNfC35Ck9RgOMo/+M0OY?= =?us-ascii?Q?iBC5KVmDmL/VQTV2Zc3uHpSU6Cpww1snrTRzWgzddELlGMpxp918qRxR58vm?= =?us-ascii?Q?M3s5m3ygow1ILJEUYsA=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2e8e84b-ae45-434f-09c1-08dbb85db286 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Sep 2023 15:41:16.9638 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XTnekKee+LO3w/RGvG0TKQM87nszZ7Ni6MCtt6mBTaO11gUVR/jYgboY/zo/jHxlp7tiKvK481sq8wyEHaN0oA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5728 Precedence: Bulk 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,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: IS9RPNBdjpfNdEwObUr1MC6Ax7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=l4quc+Nf; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io [AMD Official Use Only - General] Reviewed-by: Abner Chang > -----Original Message----- > From: Nickle Wang > Sent: Monday, September 18, 2023 9:13 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez ; Mike Maslenkin > > Subject: [PATCH v2] RedfishPkg/RedfishRestExDxe: return HTTP status code = to > caller. > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > Return unsupported HTTP status code to caller so caller can handle > HTTP error status code. Current implementation only return EFI error > to caller. Without knowing the HTTP status code, caller has trouble > to handle HTTP request failure. > > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > Cc: Mike Maslenkin > --- > MdePkg/Include/Protocol/RestEx.h | 3 ++- > .../RedfishRestExDxe/RedfishRestExProtocol.c | 27 ++++++++++--------- > 2 files changed, 16 insertions(+), 14 deletions(-) > > diff --git a/MdePkg/Include/Protocol/RestEx.h > b/MdePkg/Include/Protocol/RestEx.h > index e9bc7be94f2c..da9f1c3f87ef 100644 > --- a/MdePkg/Include/Protocol/RestEx.h > +++ b/MdePkg/Include/Protocol/RestEx.h > @@ -131,7 +131,8 @@ typedef struct { > response when the data is retrieved from the service. RequestMessage > contains the HTTP > request to the REST resource identified by RequestMessage.Request.Url.= The > ResponseMessage is the returned HTTP response for that request, includ= ing > any HTTP > - status. > + status. It's caller's responsibility to free this ResponseMessage usin= g > FreePool(). > + RestConfigFreeHttpMessage() in RedfishLib is an example to release > ResponseMessage structure. > > @param[in] This Pointer to EFI_REST_EX_PROTOCOL instan= ce for a > particular > REST service. > diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c > b/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c > index 90973619f2bc..5bcdade4b18c 100644 > --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c > +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c > @@ -29,7 +29,8 @@ EFI_REST_EX_PROTOCOL mRedfishRestExProtocol =3D { > response when the data is retrieved from the service. RequestMessage > contains the HTTP > request to the REST resource identified by RequestMessage.Request.Url.= The > ResponseMessage is the returned HTTP response for that request, includ= ing > any HTTP > - status. > + status. It's caller's responsibility to free this ResponseMessage usin= g > FreePool(). > + RestConfigFreeHttpMessage() in RedfishLib is an example to release > ResponseMessage structure. > > @param[in] This Pointer to EFI_REST_EX_PROTOCOL instan= ce for a > particular > REST service. > @@ -320,6 +321,18 @@ ReSendRequest:; > DEBUG ((DEBUG_ERROR, "This HTTP Status is not handled!\n")); > DumpHttpStatusCode (DEBUG_REDFISH_NETWORK, ResponseData- > >Response.StatusCode); > Status =3D EFI_UNSUPPORTED; > + > + // > + // Deliver status code back to caller so caller can handle it. > + // > + ResponseMessage->Data.Response =3D AllocateZeroPool (sizeof > (EFI_HTTP_RESPONSE_DATA)); > + if (ResponseMessage->Data.Response =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + goto ON_EXIT; > + } > + > + ResponseMessage->Data.Response->StatusCode =3D ResponseData- > >Response.StatusCode; > + > goto ON_EXIT; > } > > @@ -443,18 +456,6 @@ ON_EXIT: > FreePool (ResponseData); > } > > - if (EFI_ERROR (Status)) { > - if (ResponseMessage->Data.Response !=3D NULL) { > - FreePool (ResponseMessage->Data.Response); > - ResponseMessage->Data.Response =3D NULL; > - } > - > - if (ResponseMessage->Body !=3D NULL) { > - FreePool (ResponseMessage->Body); > - ResponseMessage->Body =3D NULL; > - } > - } > - > return Status; > } > > -- > 2.17.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 (#108798): https://edk2.groups.io/g/devel/message/108798 Mute This Topic: https://groups.io/mt/101432753/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-