From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by mx.groups.io with SMTP id smtpd.web12.3136.1595524847261393918 for ; Thu, 23 Jul 2020 10:20:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@broadcom.com header.s=google header.b=FzGg9i8l; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: broadcom.com, ip: 209.85.208.171, mailfrom: vladimir.olovyannikov@broadcom.com) Received: by mail-lj1-f171.google.com with SMTP id q4so7217255lji.2 for ; Thu, 23 Jul 2020 10:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:references:in-reply-to:mime-version:thread-index:date :message-id:subject:to:cc; bh=ojm2acpRaF+vNsiS2gu2QPWIAbDY3T0EH5VhPUE8FG8=; b=FzGg9i8lQw4jVdUClqPcEQs44iDQpO/2rZ2KRQVJ84xB3eDAcKKZQLh/9cmvihs57g VerlZkjg3Dd/b1/t5aMnbevVByDiFn0GjxvW+U4Sq40VzOAqK/G+wJ9BNnQm7X7rsTGs dmhHoT9sW728xXipIOI2m0RkaWUQCTC57qeGs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc; bh=ojm2acpRaF+vNsiS2gu2QPWIAbDY3T0EH5VhPUE8FG8=; b=uHsP5owOloiXDTbR9Bq9WH/zUSJlZkiF1gXcIOOju8OFDvpz80Z+rwrmbTdFQaZhwp UtxPqVO0LPaya39lUdHPvK4c8Yp2zmiMuPo7jexoeXNgMkENIHJ5AXiyJHPwUbVcYfmS dyGwTj22VnjYqQ2uueq2Acr678YZgBqA36w1CpaC3LPM+FktdEjoIfwe8HlJsZJgtr9C S1ThsFV2wU9KZUk4XKgs3khJtt1qtNqTj4Z/1GtMFYz9pEqMGJb5AmklHt/JP7r21TKX do82kjjN3BanpAw2T6/nMqxiNwc316rwt4vHJlDVlotoOOVgSP6GrM+bR/ug5bt/Ibt6 3evA== X-Gm-Message-State: AOAM532A+VylR1Fz5QAi5OYN8QgVMSqrz7pJqeVqGqAdvNPQ56JPmjRO wISGuLW2oVpAR97+yKqrEvWFC6VpfcxZ59AqUKwFWw== X-Google-Smtp-Source: ABdhPJx3DHuJHSKJMonLZcmInf/J8dSrgoECqJLQvw/ToWbf7a4Yu7uthswhWqQTggEmUEThpSYfLnt9x9C/3Pzzy7k= X-Received: by 2002:a2e:a590:: with SMTP id m16mr2331887ljp.89.1595524845368; Thu, 23 Jul 2020 10:20:45 -0700 (PDT) From: "Vladimir Olovyannikov" References: <20200713183137.9825-1-vladimir.olovyannikov@broadcom.com> In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHWOTapeOQNV4NQfAeaKbZPaHyXkQJ7LNpsqQHe7PA= Date: Thu, 23 Jul 2020 10:20:43 -0700 Message-ID: Subject: Re: [edk2-devel] [PATCH v3 1/1] ShellPkg/DynamicCommand: add HttpDynamicCommand To: Laszlo Ersek , devel@edk2.groups.io Cc: Samer El-Haj-Mahmoud , Zhichao Gao , Maciej Rabeda , Jiaxin Wu , Siyuan Fu , Ray Ni , Liming Gao , Nd Content-Type: text/plain; charset="UTF-8" Hi Laszlo, > -----Original Message----- > From: Laszlo Ersek > Sent: Thursday, July 23, 2020 6:30 AM > To: devel@edk2.groups.io; vladimir.olovyannikov@broadcom.com > Cc: Samer El-Haj-Mahmoud ; Zhichao > Gao ; Maciej Rabeda > ; Jiaxin Wu ; Siyuan > Fu ; Ray Ni ; Liming Gao > ; Nd > Subject: Re: [edk2-devel] [PATCH v3 1/1] ShellPkg/DynamicCommand: add > HttpDynamicCommand > > On 07/13/20 20:31, Vladimir Olovyannikov via groups.io wrote: > > 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. > > > > Signed-off-by: Vladimir Olovyannikov > > > > Tested-By: Samer El-Haj-Mahmoud > > Cc: Zhichao Gao > > Cc: Maciej Rabeda > > Cc: Jiaxin Wu > > Cc: Siyuan Fu > > Cc: Ray Ni > > Cc: Liming Gao > > Cc: Nd > > --- > > .../DynamicCommand/HttpDynamicCommand/Http.c | 1700 > +++++++++++++++++ > > .../DynamicCommand/HttpDynamicCommand/Http.h | 84 + > > .../HttpDynamicCommand/Http.uni | 113 ++ > > .../HttpDynamicCommand/HttpApp.c | 53 + > > .../HttpDynamicCommand/HttpApp.inf | 58 + > > .../HttpDynamicCommand/HttpDynamicCommand.c | 134 ++ > > .../HttpDynamicCommand/HttpDynamicCommand.inf | 63 + > > ShellPkg/Include/Guid/ShellLibHiiGuid.h | 5 + > > ShellPkg/ShellPkg.dec | 1 + > > ShellPkg/ShellPkg.dsc | 5 + > > 10 files changed, 2216 insertions(+) > > create mode 100644 > ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c > > create mode 100644 > ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h > > create mode 100644 > > ShellPkg/DynamicCommand/HttpDynamicCommand/Http.uni > > create mode 100644 > > ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c > > create mode 100644 > > ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.inf > > create mode 100644 > > > ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand > .c > > create mode 100644 > > > ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand > .inf > > > diff --git a/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.uni > > b/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.uni > > new file mode 100644 > > index 000000000000..efe50e25819c > > --- /dev/null > > +++ b/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.uni > > @@ -0,0 +1,113 @@ > > +// /** > > +// > > +// (C) Copyright 2015-2016 Hewlett Packard Enterprise Development > > +LP
// Copyright (c) 2010 - 2018, Intel Corporation. All rights > > +reserved.
// Copyright (c) 2020, Broadcom. All rights > > +reserved.
// SPDX-License-Identifier: BSD-2-Clause-Patent // // > > +Module Name: > > +// > > +// Http.uni > > +// > > +// Abstract: > > +// > > +// String definitions for UEFI Shell HTTP command // // // **/ > > + > > +/=# > > + > > +#langdef en-US "english" > > + > > +#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too > many arguments. Try help http.\r\n" > > +#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few > arguments. Try help http.\r\n" > > +#string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid > argument - '%H%s%N'. Try help http.\r\n" > > +#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown > flag - '%H%s%N'. Try help http.\r\n" > > +#string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot > open file - '%H%s%N'\r\n" > > +#string STR_GEN_CRLF #language en-US "\r\n" > > + > > +#string STR_HTTP_ERR_NO_NIC #language en-US "No network > interface card found.\r\n" > > +#string STR_HTTP_ERR_NIC_NAME #language en-US "Failed to get the > name of the network interface card number %d - %r\r\n" > > +#string STR_HTTP_ERR_OPEN_PROTOCOL #language en-US "Unable to > open HTTP protocol on '%H%s%N' - %r\r\n" > > +#string STR_HTTP_ERR_CONFIGURE #language en-US "Unable to > configure HTTP protocol on '%H%s%N' - %r\r\n" > > +#string STR_HTTP_ERR_DOWNLOAD #language en-US "Unable to > download the file '%H%s%N' on '%H%s%N' - %r\r\n" > > +#string STR_HTTP_ERR_WRITE #language en-US "Unable to write > > into > file '%H%s%N' - %r\r\n" > > +#string STR_HTTP_ERR_NIC_NOT_FOUND #language en-US "Network > Interface Card '%H%s%N' not found.\r\n" > > +#string STR_HTTP_ERR_STATUSCODE #language en-US "\r'%H%s%N' > reports '%s' for '%H%s%N' \r\n" > > +#string STR_HTTP_DOWNLOADING #language en-US "Downloading > '%H%s%N'\r\n" > > + > > +#string STR_GET_HELP_HTTP #language en-US "" > > +".TH http 0 "Download a file from HTTP server."\r\n" > > +".SH NAME\r\n" > > +"Download a file from HTTP server.\r\n" > > +".SH SYNOPSIS\r\n" > > +" \r\n" > > +"HTTP [-i interface] [-l port] [-t timeout] [-s size]\r\n" > > +" [localfilepath]\r\n" > > +".SH OPTIONS\r\n" > > +" \r\n" > > +" -i interface - Specifies an adapter name, i.e., eth0.\r\n" > > +" -l port - Specifies the local port number. Default value is > > 0\r\n" > > +" and the port number is automatically > > assigned.\r\n" > > +" -s size The size of the download buffer for a chunk, in > > bytes.\r\n" > > +" Default is 32K. Note that larger buffer does not > > imply\r\n" > > +" better speed.\r\n" > > +" -t timeout - The number of seconds to wait for completion > > of\r\n" > > +" requests and responses. Default is 0 which is > > 'automatic'.\r\n" > > +" %HURL%N\r\n" > > +" Two types of providing of URLs are supported:\r\n" > > +" 1. tftp like, where host and http_uri are separate parameters\r\n" > > +" (example: host /host_uri), and\r\n\" > > +" 2. wget-like, where host and host_uri is one parameter.\r\n" > > +" (example: host/host_uri)\r\n" > > +"\r\n" > > +" host - Specifies HTTP Server address.\r\n > > + Can be either IPv4 address or 'http (or > > https)://addr'\r\n > > + Can use addresses resolvable by DNS as well. > > \r\n > > + Port can be specified after ':' if needed. \r\n > > + By default port 80 is used.\r\n" > > +" http_uri - HTTP server URI to download the file.\r\n" > > +"\r\n" > > +" localfilepath - Local destination file path.\r\n" > > +".SH DESCRIPTION\r\n" > > +" \r\n" > > +"NOTES:\r\n" > > +" 1. The HTTP command allows geting of the file specified by its > 'http_uri'\r\n" > > +" path from the HTTP server specified by its 'host' IPv4 address. > > If > the\r\n" > > +" optional 'localfilepath' parameter is provided, the downloaded > > file > is\r\n" > > +" stored locally using the provided file path. If the local file > > path is\r\n" > > +" not specified, the file is stored in the current directory using > > the > file\r\n" > > +" server's name.\r\n" > > +" 2. Before using the HTTP command, the network interface intended to > be\r\n" > > +" used to retrieve the file must be configured. This configuration > > may > be\r\n" > > +" done by means of the 'ifconfig' command.\r\n" > > +" 3. If a network interface is defined with the '-i' option then only > this\r\n" > > +" interface will be used to retrieve the remote file. Otherwise, > > all > network\r\n" > > +" interfaces are tried in the order they have been discovered > > during > the\r\n" > > +" DXE phase.\r\n" > > +".SH EXAMPLES\r\n" > > +" \r\n" > > +"EXAMPLES:\r\n" > > +" * To get the file "dir1/file1.dat" from the HTTP server 192.168.1.1, > > port > 8080, and\r\n" > > +" store it as file2.dat in the current directory :\r\n" > > +" fs0:\> http 192.168.1.1:8080 dir1/file1.dat file2.dat\r\n" > > +" * To get the file /image.bin via HTTPS from server 192.168.1.1 at > > port 443 > \r\n" > > +" (default HTTPS port), and store it in the current directory: \r\n" > > +" fs0:\> http https://192.168.1.1 image.bin\r\n" > > +" To get an index file from http://google.com and place it into the > > \r\n" > > +" current directory:\r\n" > > +" fs0:\> http google.com index.html" > > +".SH RETURNVALUES\r\n" > > The line ending with "google.com index.html" lacks the "\r\n" > terminator. Because of that, the help text is printed as follows: > > To get an index file from http://google.com and place it into the > current directory: > fs0:\> http google.com index.html.SH RETURNVALUES > Thank you for spotting this, I had it from day 0 as I usually did not use "help http". I will fix this in patch v4. > Thanks > Laszlo Thank you, Vladimir