network.c, url.c: disable keep-alive and close http socket after downloading

With default Connection: keep-alive and without closing read socket after
downloading stage2 propagator hangs until socket not closed on server side.
This commit is contained in:
Evgeny Sinelnikov 2019-08-29 19:56:37 +04:00
parent 0d3ff4dabd
commit 111d828c45
2 changed files with 5 additions and 3 deletions

View File

@ -1034,7 +1034,9 @@ enum return_type http_prepare(void)
log_message("HTTP: size of download %d bytes", size);
if (load_ramdisk_fd(fd, size) != RETURN_OK)
results = load_ramdisk_fd(fd, size);
close(fd);
if (results != RETURN_OK)
return RETURN_ERROR;
method_name = strdup("http");

4
url.c
View File

@ -424,8 +424,8 @@ int http_download_file(char * hostname, char * remotename, int * size)
return FTPERR_FAILED_CONNECT;
}
buf = alloca(strlen(remotename) + strlen(hostname) + 20);
sprintf(buf, "GET %s HTTP/1.1\r\nHost: %s\r\n\r\n", remotename, hostname);
buf = alloca(strlen(remotename) + strlen(hostname) + 48);
sprintf(buf, "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n", remotename, hostname);
rc = write(sock, buf, strlen(buf));
/* This is fun; read the response a character at a time until we: