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 A0155AC0DA5 for ; Sat, 22 Jul 2023 08:18:37 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Z+isDjSfkyZ0v0MBdaiybSwOL00DEj/GPROYDfMtfoc=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:X-Received:X-Received:X-MS-Exchange-Authentication-Results:Received-SPF:X-Received:X-Received:X-Received:X-Received:From:To:CC:Subject:Date:Message-ID:MIME-Version:X-NV-OnPremToCloud:X-EOPAttributedMessage:X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam-Message-Info:X-OriginatorOrg:X-MS-Exchange-CrossTenant-OriginalArrivalTime:X-MS-Exchange-CrossTenant-Network-Message-Id:X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp:X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs:X-MS-Exchange-CrossTenant-FromEntityHeader:X-MS-Exchange-Transport-CrossTenantHeadersStamped:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Transfer-Encod ing:Content-Type; s=20140610; t=1690013916; v=1; b=sHyK67cSxodK8yxxtPnxpkP3LiffEZG+atNyM5L/2DD5FLRTaM8u0JzjHeICcRa/YPjU1Enf C2oNTgOaogc6SyfSfcI3OOvMkT47FyQCNvT8BQVp6ONQqMdZ5xJpQCr4erdAfnUIFHJdfMrQgty i+Kwdb3DFOxvpx2PkLPJ+G0k= X-Received: by 127.0.0.2 with SMTP id OLcOYY7687511xeIpRslrI0S; Sat, 22 Jul 2023 01:18:36 -0700 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.50]) by mx.groups.io with SMTP id smtpd.web10.1819.1690013915802825445 for ; Sat, 22 Jul 2023 01:18:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LWUBChWLe/s6QbQvFammaq847ryn4DisFF0y4yo+znH7mAEs8lW+WjiLEslyCXp718WOY27C4OMwZE3HfkIRdLm+1RSMidLKILzm6ABbHkywFWz4PVhwp0uaafF3/4HUGpVnsqZlO4Bb6C0JcESOOmc7liVuGl8BwT0GapfQ2FapIzyPFNKuYIZ3NUIO4SZv2Yn1QFIrY7AWc9KewTtTirEHS81m3jl/yRfyO5ZVivZKR0iJnKsjKf+bQkJctoZWBLuBE8/EyWRnc37mV27XRixHIi5sVD+3M50ODqpC9GnLJPEgYUMMMGYC1aPimhgy+lnH9omz7p/2KZm3fsLfOw== 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=+jjJ1nRBjl/5sm3R4OFBmKEcgCFehK0MqJyzbThpKzs=; b=SK+8XpyC9qXbfiaHZfNftATtwRCJvznkstjcFCejA1lRUL18xUT0Y8AIfWnkWXngYw7Aq/a+Hlo379NNZg4rFFciyRihc0VMT3gKsP5Txpz1/fDqLh+RJv42+Coz41OByM28xB4G7vfF7V6XZljjfQfs0+O+PzzV7abl076SYVNRc+xTvXMUMVDTBznc+PjSkkOsLbxTOFWKVrfiZmECzWa5cxsJ6e/JNgZWQ4LgD6STIJe/3aJloG+x0nmdZ8C8X3QLqAs6Jnh1HygEHakQMgjlSOUJGuel/eAZ03BBoIWOsHbMQn4ITiNuiZuUPZL5ak61xDBElOk9By6r6gw+Pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none X-Received: from BN9PR03CA0621.namprd03.prod.outlook.com (2603:10b6:408:106::26) by DM4PR12MB5248.namprd12.prod.outlook.com (2603:10b6:5:39c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Sat, 22 Jul 2023 08:18:33 +0000 X-Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::28) by BN9PR03CA0621.outlook.office365.com (2603:10b6:408:106::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.30 via Frontend Transport; Sat, 22 Jul 2023 08:18:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28 via Frontend Transport; Sat, 22 Jul 2023 08:18:33 +0000 X-Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sat, 22 Jul 2023 01:18:27 -0700 X-Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sat, 22 Jul 2023 01:18:27 -0700 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Sat, 22 Jul 2023 01:18:26 -0700 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [PATCH] RedfishPkg/RedfishRestExDxe: return HTTP status code to caller. Date: Sat, 22 Jul 2023 16:18:26 +0800 Message-ID: <20230722081826.301-1-nicklew@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT016:EE_|DM4PR12MB5248:EE_ X-MS-Office365-Filtering-Correlation-Id: e3d4d543-f619-4b1b-6240-08db8a8c3d86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: MK7asYqklX2E5Zdx6i8j0KZATOnNlA6lBIKXzBJP/pYhh+mebAxfKWMJFGyIFtjE+O4x9JnOAaQIoe+xBq6fMegbr2KRBkXNVGWnTh2R43LoWkJdiRM0xC8cSqA3cQ5WSsDC4J2r59VC7fpfgK9wWxdGSkQs6koU+tXCeKiw2S88RwaARplfFERNARfTDMNum2GySsAwUGmn9x34XiRyiyjfwsI4mzUUkijFXDHGyLTQ87oMdjdHfoKQ7LFi10HbaAv9sSkqr46hjDs32s3tCyyatzmX9nKQQ4HZjoeSzm6b8LpdtpXJ7qyrysmNfSYfHFxJOj1np5UlHssMFFPMu5AZMSwHVMiikJW671nWSKAMn9PSOHCgxl6pbaR1v3l8w8lRezlaYX9oFEPgbotCAUqpWlDdldEjh15h0JUoK6rIbFOKiKp2Qg3z4geA0SM4wEi861olVAa8tjSAYLoW76EYqNe6/MhqSVGv/Qd9XBtItMTfZSuJQNYrDRokzJrfk0Eem7I22Ai7cPR1yGKnEHPGNFZS5GQPGJXrewwSOQJTUsY4w7VhNPXkznxehlbRN89skYZUnmbmoBepPN/rTuZxEa+zCuuiihuEMeOJt3Xm/Gwftd1u2dPOMx3LkHHvxnceuuxjJx4jWYboQh7ZOfke9uKTuHnv3If5ElDWNl33aVIZ6msAoC7s/YN8glO1GrhAnU9h76ytMwZcot83g7RoUU9A/Fr3IZmDMYpgKrl5DgZfvZc8IFoQkia+0+oc X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2023 08:18:33.3297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3d4d543-f619-4b1b-6240-08db8a8c3d86 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5248 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,nicklew@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: UwMc3CUPJnGIfY8ySB1xcnC0x7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=sHyK67cS; 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 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 --- .../RedfishRestExDxe/RedfishRestExProtocol.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c b/RedfishP= kg/RedfishRestExDxe/RedfishRestExProtocol.c index 90973619f2bc..f11cee8542fb 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c @@ -320,6 +320,18 @@ ReSendRequest:; DEBUG ((DEBUG_ERROR, "This HTTP Status is not handled!\n")); DumpHttpStatusCode (DEBUG_REDFISH_NETWORK, ResponseData->Response.Stat= usCode); 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; } =20 @@ -444,11 +456,6 @@ ON_EXIT: } =20 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; --=20 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 (#107141): https://edk2.groups.io/g/devel/message/107141 Mute This Topic: https://groups.io/mt/100292372/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-