Introduce an http client utilizing EDK2 HTTP protocol, to allow fast image downloading from http/https servers. HTTP download speed is usually faster than tftp. The client is based on the same approach as tftp dynamic command, and uses the same UEFI Shell command line parameters. This makes it easy integrating http into existing UEFI Shell scripts. Note that to enable HTTP download, feature Pcd gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections must be set to TRUE. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2860 Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Nd <nd@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/** @file
 | 
						|
  Entrypoint of "http" shell standalone application.
 | 
						|
 | 
						|
  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved. <BR>
 | 
						|
  Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
 | 
						|
  Copyright (c) 2020, Broadcom. All rights reserved.<BR>
 | 
						|
 | 
						|
  SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
						|
 | 
						|
**/
 | 
						|
#include "Http.h"
 | 
						|
 | 
						|
/*
 | 
						|
 * String token ID of help message text.
 | 
						|
 * Shell supports to find help message in the resource section of an
 | 
						|
 * application image if * .MAN file is not found.
 | 
						|
 * This global variable is added to make build tool recognizes
 | 
						|
 * that the help string is consumed by user and then build tool will
 | 
						|
 * add the string into the resource section.
 | 
						|
 * Thus the application can use '-?' option to show help message in Shell.
 | 
						|
 */
 | 
						|
GLOBAL_REMOVE_IF_UNREFERENCED
 | 
						|
EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_HTTP);
 | 
						|
 | 
						|
/**
 | 
						|
  Entry point of Http standalone application.
 | 
						|
 | 
						|
  @param ImageHandle            The image handle of the process.
 | 
						|
  @param SystemTable            The EFI System Table pointer.
 | 
						|
 | 
						|
  @retval EFI_SUCCESS           Http command is executed sucessfully.
 | 
						|
  @retval EFI_ABORTED           HII package was failed to initialize.
 | 
						|
  @retval others                Other errors when executing http command.
 | 
						|
**/
 | 
						|
EFI_STATUS
 | 
						|
EFIAPI
 | 
						|
HttpAppInitialize (
 | 
						|
  IN EFI_HANDLE               ImageHandle,
 | 
						|
  IN EFI_SYSTEM_TABLE         *SystemTable
 | 
						|
  )
 | 
						|
{
 | 
						|
  EFI_STATUS                  Status;
 | 
						|
  SHELL_STATUS                ShellStatus;
 | 
						|
 | 
						|
  mHttpHiiHandle = InitializeHiiPackage (ImageHandle);
 | 
						|
  if (mHttpHiiHandle == NULL) {
 | 
						|
    return EFI_ABORTED;
 | 
						|
  }
 | 
						|
 | 
						|
  Status = EFI_SUCCESS;
 | 
						|
 | 
						|
  ShellStatus = RunHttp (ImageHandle, SystemTable);
 | 
						|
 | 
						|
  HiiRemovePackages (mHttpHiiHandle);
 | 
						|
 | 
						|
  if (Status != SHELL_SUCCESS) {
 | 
						|
    Status = ENCODE_ERROR (ShellStatus);
 | 
						|
  }
 | 
						|
 | 
						|
  return Status;
 | 
						|
}
 |