From: Dmitry Bogatov <KAction@gnu.org>
To: 白熊 <guile-user_gnu.org@sumou.com>
Cc: guile-user@gnu.org
Subject: Re: Downloading a file from a URL from the web with http-get
Date: Tue, 5 Aug 2014 11:45:35 +0400 [thread overview]
Message-ID: <20140805074535.GA6232@self.lan> (raw)
In-Reply-To: <e8274b14-3f31-4c1d-93d9-50dbb49f346e@email.android.com>
[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]
* 白熊 <guile-user_gnu.org@sumou.com> [2014-08-05 03:56:03+0400]
> Also, is there a way to determine the exact file size, so I could
> check before downloading, if the file has already been downloaded,
> i.e. same size on disk as on the web, or if the prior download failed,
> i.e. smaller size on disk, than the web?
>
> I thought the headers would have the size info of the tarball, but I see no such information in res-headers...
>
> But surely, the information must be available as any download tool
> like wget or a browser is able to determine the download file size.
Seems that wget also do not have this information.
wget -S http://hackage.haskell.org/package/HaTeX-2.1.3/HaTeX-2.1.3.tar.gz
--2014-08-05 11:27:59-- http://hackage.haskell.org/package/HaTeX-2.1.3/HaTeX-2.1.3.tar.gz
Resolving hackage.haskell.org (hackage.haskell.org)... 88.198.224.242, 88.198.224.242
Connecting to hackage.haskell.org (hackage.haskell.org)|88.198.224.242|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Server: nginx/1.6.0
Date: Mon, 04 Aug 2014 16:53:31 GMT
Content-Type: application/x-gzip
Content-MD5: c4d3cf03316068d1ef0799024f6a1dfd
ETag: "c4d3cf03316068d1ef0799024f6a1dfd"
Last-Modified: Fri, 22 Oct 2010 21:18:12 GMT
Age: 52477
Transfer-Encoding: chunked
Connection: keep-alive
Length: unspecified [application/x-gzip]
Saving to: `HaTeX-2.1.3.tar.gz'
Look, it says, that length is unspecified. My best bet is use
#:streaming? flag to `http-get` to examine headers before downloading, and if
I decide to download, get data from port via `get-bytevector` function
family. This way you also can examine first several bytes before decide,
whether file is needed, if headers information is not sufficient.
--
Best regards, Dmitry Bogatov <KAction@gnu.org>,
Free Software supporter, esperantisto and netiquette guardian.
GPG: 54B7F00D
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-08-05 7:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 8:12 Downloading a file from a URL from the web with http-get 白熊
2014-08-04 16:57 ` Dmitry Bogatov
2014-08-04 23:56 ` 白熊
2014-08-05 7:45 ` Dmitry Bogatov [this message]
2014-08-15 17:59 ` 白熊
2014-08-15 20:46 ` Mike Gran
2014-08-15 20:56 ` Mario Domenech Goulart
2014-08-16 14:41 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140805074535.GA6232@self.lan \
--to=kaction@gnu.org \
--cc=guile-user@gnu.org \
--cc=guile-user_gnu.org@sumou.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).