Reputation: 4677
I'm using el-get and failed to el-get-install color-theme. After some research I found the file color-theme-6.6.0.tar.gz
downloaded by el-get is incomplete. The size of the one downloaded using el-get is 124853
, and the size would be 124858
if the file is downloaded by wget.
Then I found el-get is using url-retrieve to downloading packages. So I evaluated this code in *scratch*
buffer.
(url-retrieve
"http://download.savannah.gnu.org/releases/color-theme/color-theme-6.6.0.tar.gz"
(lambda (s)
(write-file "/home/jxq/data/tmp")))
The file /home/jxq/data/tmp
now contains http header and body. The length of http header is 279
and the whole size is 125132
. So the file size of tar.gz it retrieved is 124853
. Where are the lost 5 bytes?
Is this a bug in url-retrieve or I'm using it incorrectly?
Upvotes: 1
Views: 784
Reputation: 154886
You need to skip the HTTP headers (the documentation calls them "MIME headers") before writing:
(url-retrieve
"http://download.savannah.gnu.org/releases/color-theme/color-theme-6.6.0.tar.gz"
(lambda (s)
(re-search-forward "\r?\n\r?\n")
(write-region (point) (point-max) "/tmp/bla")))
This version saves the same contents as Wget.
Upvotes: 4