fetch: support keep-alive even if the HTTP server returns 304 (Not-Modified).

This commit is contained in:
Juan RP 2015-04-13 12:05:40 +02:00
parent f78c2986d4
commit 15893caf0b
2 changed files with 5 additions and 3 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.45 (???): xbps-0.45 (???):
* libfetch: added support for keep-alive connections even if the HTTP server returns
304 (Not Modified). This is a noticable performance improvement for `xbps-install -S`.
* xbps now autoupdates itself when there's a package update. * xbps now autoupdates itself when there's a package update.
* xbps-uchroot(8): added -O option to use overlayfs to mount CHROOTDIR in * xbps-uchroot(8): added -O option to use overlayfs to mount CHROOTDIR in

View File

@ -704,8 +704,6 @@ http_connect(struct url *URL, struct url *purl, const char *flags, int *cached)
int val; int val;
#endif #endif
*cached = 1;
#ifdef INET6 #ifdef INET6
af = AF_UNSPEC; af = AF_UNSPEC;
#else #else
@ -849,6 +847,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
length = -1; length = -1;
size = -1; size = -1;
mtime = 0; mtime = 0;
cached = 0;
/* check port */ /* check port */
if (!url->port) if (!url->port)
@ -1166,7 +1165,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
URL->offset = offset; URL->offset = offset;
URL->length = clength; URL->length = clength;
if (clength == -1 && !chunked) if (clength == -1 && !chunked && conn->err != HTTP_NOT_MODIFIED)
keep_alive = 0; keep_alive = 0;
if (conn->err == HTTP_NOT_MODIFIED) { if (conn->err == HTTP_NOT_MODIFIED) {