> -----Original Message----- > From: Laszlo Ersek <ler...@redhat.com> > Sent: Friday, July 24, 2020 8:09 AM > To: Vladimir Olovyannikov <vladimir.olovyanni...@broadcom.com>; > devel@edk2.groups.io > Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahm...@arm.com>; Zhichao > Gao <zhichao....@intel.com>; Maciej Rabeda > <maciej.rab...@linux.intel.com>; Jiaxin Wu <jiaxin...@intel.com>; Siyuan > Fu <siyuan...@intel.com>; Ray Ni <ray...@intel.com>; Liming Gao > <liming....@intel.com>; Nd <n...@arm.com> > Subject: Re: [edk2-devel] [PATCH v3 1/1] ShellPkg/DynamicCommand: add > HttpDynamicCommand > > On 07/23/20 19:18, Vladimir Olovyannikov wrote: > > > >>> One suggestion: if the download fails for some reason, but the local > >>> file creation succeeded, then upon exit, the local file should be > >>> deleted. Otherwise an incomplete (possibly zero size) file is left > >>> in the filesystem. > > > I was thinking about this. > > Sometimes, an error file returned by HTTP server (say, on 404 or 503) > > has more information than just 404, 503, etc. > > That was the only reason I do not delete it. > > I still return error code to the caller, so the caller can read it > > (maybe, to provide more information to the user), and/or delete it right > away. > > What do you think? > > Seems unusual to me; at least I'm not used to it with "wget". I seem to > remember that, whenever I get a 404 or 503 with wget, I don't have to > clean > up after wget. > > With a graphical web browser, things are different, in that case, > rendering > the textual (HTML etc) response can be helpful. > > If you decide to keep the local files in such cases (i.e., on failure), I > suggest > documenting that fact in the built-in help text. Can you please take a look at the v4 patch I sent yesterday? Now, by default, if there was an error during download, the file is deleted. There is a way to specify -k switch on the command line to keep the file.
As I told, sometimes it is useful to have error body from the server. Say, if I try "http google.com -k", the result would be Downloading 'http://google.com/' 'http://google.com' reports '503 Service unavailable' for '/' When you do "cat index.html" : <title>Virus/Spyware Download Blocked</title> <p>Download of the virus/spyware has been blocked in accordance with company policy. Please contact your system administrator if you believe this is in error.</p> <p><b>File name:</b> google.com/ </p> This is probably our company firewall response, but without the body it would be hard to understand what it does not like. This way it works (content is chunked, so the progress indicator only shows downloaded size, no percentage) : http google.com/index.html Downloading 'http://google.com/index.html' Downloading 'http://www.google.com/index.html' [ ] 46 Kb > > Thanks! > Laszlo Thank you, Vladimir -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63261): https://edk2.groups.io/g/devel/message/63261 Mute This Topic: https://groups.io/mt/75483573/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-