fetch: fix regression introduced in 791e683e.

us->size and us->{a,m}time must be set after there's real data.
This commit is contained in:
Juan RP 2015-06-30 21:48:21 +02:00
parent 22ffc14026
commit a7378f70de

View File

@ -1134,9 +1134,8 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
} }
/* fill in stats */ /* fill in stats */
if (us) { if (us && size) {
us->size = size; us->size = size;
us->atime = us->mtime = mtime;
} }
/* check for inconsistencies */ /* check for inconsistencies */
@ -1156,6 +1155,12 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
if (size == -1) if (size == -1)
size = length; size = length;
/* fill in stats */
if (us) {
us->size = size;
us->atime = us->mtime = mtime;
}
/* too far? */ /* too far? */
if (URL->offset > 0 && offset > URL->offset) { if (URL->offset > 0 && offset > URL->offset) {
http_seterr(HTTP_PROTOCOL_ERROR); http_seterr(HTTP_PROTOCOL_ERROR);