From a7378f70dedee5d419c43fcc582338fa8618b36a Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 30 Jun 2015 21:48:21 +0200 Subject: [PATCH] fetch: fix regression introduced in 791e683e. us->size and us->{a,m}time must be set after there's real data. --- lib/fetch/http.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/fetch/http.c b/lib/fetch/http.c index f2d80bbe..848ed1a0 100644 --- a/lib/fetch/http.c +++ b/lib/fetch/http.c @@ -1134,9 +1134,8 @@ http_request(struct url *URL, const char *op, struct url_stat *us, } /* fill in stats */ - if (us) { + if (us && size) { us->size = size; - us->atime = us->mtime = mtime; } /* check for inconsistencies */ @@ -1156,6 +1155,12 @@ http_request(struct url *URL, const char *op, struct url_stat *us, if (size == -1) size = length; + /* fill in stats */ + if (us) { + us->size = size; + us->atime = us->mtime = mtime; + } + /* too far? */ if (URL->offset > 0 && offset > URL->offset) { http_seterr(HTTP_PROTOCOL_ERROR);