diff --git a/srcpkgs/xbps/patches/b5954c80db5d7fba2b0635e758126c4d949edbb3.patch b/srcpkgs/xbps/patches/b5954c80db5d7fba2b0635e758126c4d949edbb3.patch new file mode 100644 index 00000000000..77a21c9bc14 --- /dev/null +++ b/srcpkgs/xbps/patches/b5954c80db5d7fba2b0635e758126c4d949edbb3.patch @@ -0,0 +1,55 @@ +From b5954c80db5d7fba2b0635e758126c4d949edbb3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= +Date: Sat, 2 Jul 2022 22:37:08 +0200 +Subject: [PATCH] lib/fetch: reuse http connection + +With HTTP 1.1 persistent connection is default and Connection +header is not sent. +Before patch, for every file, including 512b signature, there was +done dns query, tls handshake etc. +--- + lib/fetch/http.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/lib/fetch/http.c b/lib/fetch/http.c +index 395e7d8f..02b97a51 100644 +--- a/lib/fetch/http.c ++++ b/lib/fetch/http.c +@@ -424,7 +424,7 @@ http_cmd(conn_t *conn, const char *fmt, ...) + * Get and parse status line + */ + static int +-http_get_reply(conn_t *conn) ++http_get_reply(conn_t *conn, int *keep_alive) + { + char *p; + +@@ -445,6 +445,10 @@ http_get_reply(conn_t *conn) + if (*p == '/') { + if (p[1] != '1' || p[2] != '.' || (p[3] != '0' && p[3] != '1')) + return (HTTP_PROTOCOL_ERROR); ++ /* HTTP/1.1 defaults to the use of "persistent connections" */ ++ if (keep_alive && p[3] == '1') { ++ *keep_alive = 1; ++ } + p += 4; + } + if (*p != ' ' || +@@ -760,7 +764,7 @@ http_connect(struct url *URL, struct url *purl, const char *flags, int *cached) + + http_cmd(conn, "\r\n"); + +- if (http_get_reply(conn) != HTTP_OK) { ++ if (http_get_reply(conn, NULL) != HTTP_OK) { + http_seterr(conn->err); + fetch_close(conn); + return (NULL); +@@ -1011,7 +1015,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us, + sizeof(val)); + + /* get reply */ +- switch (http_get_reply(conn)) { ++ switch (http_get_reply(conn, &keep_alive)) { + case HTTP_OK: + case HTTP_PARTIAL: + case HTTP_NOT_MODIFIED: diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template index ba7f8c7068e..d5867b1387c 100644 --- a/srcpkgs/xbps/template +++ b/srcpkgs/xbps/template @@ -1,7 +1,7 @@ # Template file for 'xbps' pkgname=xbps version=0.59.1 -revision=6 +revision=7 bootstrap=yes build_style=configure short_desc="XBPS package system utilities"