93b69d0872dab89b3ab88455a0d51c2c6500a13b galt Tue Aug 8 11:46:46 2023 -0700 Roll-back using HTTP/1.1 to HTTP/1.0 in knetfile.c. refs #31859 diff --git src/htslib/knetfile.c src/htslib/knetfile.c index bb948b0..ebd1cf7 100644 --- src/htslib/knetfile.c +++ src/htslib/knetfile.c @@ -424,33 +424,32 @@ 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.1\r\nHost: %s\r\n", fp->path, fp->http_host); + l += sprintf(buf + l, "GET %s HTTP/1.0\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; }