From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by mx.groups.io with SMTP id smtpd.web12.1290.1595613050615572181 for ; Fri, 24 Jul 2020 10:50:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@broadcom.com header.s=google header.b=HTX8Bb5r; 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.177, mailfrom: vladimir.olovyannikov@broadcom.com) Received: by mail-lj1-f177.google.com with SMTP id a27so1341937ljn.8 for ; Fri, 24 Jul 2020 10:50:50 -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=LcCeWBd5BguAAhXFmEd3sdLd5bHvlBExFloNQk4CVVU=; b=HTX8Bb5rbi2DC1920ZsxiQaG7v+jnpN6RwFertURHpr5dzFD2jiZpdJTO/zhTfjG/4 anT4ROfvpK8aN5ik6ObMbNJndxEk6u2ikAdiTncbWCGiYSwkWc4vLwfNR4L0xnC6UytF P6QaunyrtNicIjp7/rZWU/xege68Xhu1/7dgo= 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=LcCeWBd5BguAAhXFmEd3sdLd5bHvlBExFloNQk4CVVU=; b=ObrODl9UuFu/OCctkf1M+DVe0BTVmC3xAHpOnaGrLOhBJvMf1FoGpL17YQa/re9NKr EBO/osOq6Uu//tY20rStQMtQThW5yWBUbIeFB08w3KTPzdcAveK9XCKLVv5wx9MhDnDq fBrS8Cbr7oMtkKHb62fVxiAimbMFjohLwkegDfDfwqXp5zgABAUBpwT29V5z8aNSZm6f tDj4m7fE1FuGY0SCV3bUmGGevOKGyHuOBZicj0wcYpVH8hHq0/Jr0lADPt+rEg2ltn0Q eG3LmjJuSfda1PEmlA9z+HFTqK4rhshHW5U8SxuIQ5PzE3SaytKxR3Uj3t9gbaNIB8w3 kevA== X-Gm-Message-State: AOAM533LwkoMOk6Pw3bUGKzY12qVrIq8s3FuILXYpf4mmh3Lom1FXoAe e8apVLNOlujx8kdZnmb0/lYB/8OZkp8Nv5+9jrd9vg== X-Google-Smtp-Source: ABdhPJwFFEt0rEfZwK6rtZYT31mL5pCITMXbuxo8QlgWHxrUil0i5fgiZSoEPp/Fs2G5nNOtZR6pK4n1ICoLYudTCJY= X-Received: by 2002:a05:651c:3c2:: with SMTP id f2mr5009603ljp.37.1595613048406; Fri, 24 Jul 2020 10:50:48 -0700 (PDT) From: "Vladimir Olovyannikov" References: <20200713183137.9825-1-vladimir.olovyannikov@broadcom.com> <6b8ae026-a39c-3b68-4280-fc532b5954d6@redhat.com> <8de76fe2aa9ca0f8ab45fe8245428453@mail.gmail.com> <20cc1951-cd4e-a9d5-a24a-96f273002bed@redhat.com> In-Reply-To: <20cc1951-cd4e-a9d5-a24a-96f273002bed@redhat.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHWOTapeOQNV4NQfAeaKbZPaHyXkQFPgG3JApDrki8CTK1iSAFn257mqNqe+SA= Date: Fri, 24 Jul 2020 10:50:45 -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" > -----Original Message----- > From: Laszlo Ersek > Sent: Friday, July 24, 2020 8:09 AM > To: Vladimir Olovyannikov ; > devel@edk2.groups.io > 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/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" : Virus/Spyware Download Blocked

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.

File name: google.com/

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