summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Wauck <waucka@ironstarconsulting.net>2020-03-24 14:51:15 -0500
committerTimo Teräs <timo.teras@iki.fi>2021-04-11 13:58:10 +0300
commit2930b8f963061c919b84b0fca670fc2525ccd439 (patch)
tree3776f8b721171b497ebfdd61adeead2231bab097
parenta13d2c21d0b3ad90e8c069e7d1812c17fa351f4b (diff)
downloadapk-tools-2930b8f963061c919b84b0fca670fc2525ccd439.tar.gz
apk-tools-2930b8f963061c919b84b0fca670fc2525ccd439.tar.bz2
apk-tools-2930b8f963061c919b84b0fca670fc2525ccd439.tar.xz
apk-tools-2930b8f963061c919b84b0fca670fc2525ccd439.zip
libfetch: minor HTTP handling improvement
The recent TCP_CORK change missed this bit of code. This change should improve performance a bit when making HTTP requests by calling http_cmd only once instead of three times. (cherry picked from commit 09dbe46a7608f56f07914137834e7ddda15c4837)
-rw-r--r--libfetch/http.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libfetch/http.c b/libfetch/http.c
index 08b2361..418968a 100644
--- a/libfetch/http.c
+++ b/libfetch/http.c
@@ -711,11 +711,8 @@ http_connect(struct url *URL, struct url *purl, const char *flags, int *cached)
/* fetch_connect() has already set an error code */
return (NULL);
if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 && purl) {
- http_cmd(conn, "CONNECT %s:%d HTTP/1.1\r\n",
- URL->host, URL->port);
- http_cmd(conn, "Host: %s:%d\r\n",
- URL->host, URL->port);
- http_cmd(conn, "\r\n");
+ http_cmd(conn, "CONNECT %s:%d HTTP/1.1\r\nHost: %s:%d\r\n\r\n",
+ URL->host, URL->port, URL->host, URL->port);
if (http_get_reply(conn) != HTTP_OK) {
http_seterr(conn->err);
goto ouch;