06b0009211c47fc85787ac3d9bb8a55652c13556
galt
  Thu Jul 20 11:39:39 2023 -0700
HTTP/1.1 without persistent connections. Addresses complaints that byterange headers should not be used with old HTTP/1.0, or that HTTP/1.0 should no longer be used. fixes #31774

diff --git src/htslib/knetfile.c src/htslib/knetfile.c
index 4ec04fc..bb948b0 100644
--- src/htslib/knetfile.c
+++ src/htslib/knetfile.c
@@ -424,32 +424,33 @@
 		fp->path = strdup(fn);
 	}
 	fp->type = KNF_TYPE_HTTP;
 	fp->ctrl_fd = fp->fd = -1;
 	fp->seek_offset = 0;
 	return fp;
 }
 
 int khttp_connect_file(knetFile *fp)
 {
 	int ret, l = 0;
 	char *buf, *p;
 	if (fp->fd != -1) netclose(fp->fd);
 	fp->fd = socket_connect(fp->host, fp->port);
 	buf = (char*)calloc(0x10000, 1); // FIXME: I am lazy... But in principle, 64KB should be large enough.
-	l += sprintf(buf + l, "GET %s HTTP/1.0\r\nHost: %s\r\n", fp->path, fp->http_host);
+	l += sprintf(buf + l, "GET %s HTTP/1.1\r\nHost: %s\r\n", fp->path, fp->http_host);
 	l += sprintf(buf + l, "Range: bytes=%lld-\r\n", (long long)fp->offset);
+	l += sprintf(buf + l, "Connection: close\r\n");
 	l += sprintf(buf + l, "\r\n");
 	if ( netwrite(fp->fd, buf, l) != l ) { free(buf); return -1; }
 	l = 0;
 	while (netread(fp->fd, buf + l, 1)) { // read HTTP header; FIXME: bad efficiency
 		if (buf[l] == '\n' && l >= 3)
 			if (strncmp(buf + l - 3, "\r\n\r\n", 4) == 0) break;
 		++l;
 	}
 	buf[l] = 0;
 	if (l < 14) { // prematured header
 		free(buf);
 		netclose(fp->fd);
 		fp->fd = -1;
 		return -1;
 	}