summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/url.c')
-rw-r--r--mdk-stage1/url.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mdk-stage1/url.c b/mdk-stage1/url.c
index 9781d281d..0f919812b 100644
--- a/mdk-stage1/url.c
+++ b/mdk-stage1/url.c
@@ -408,7 +408,7 @@ int ftp_end_data_command(int sock)
}
-int http_download_file(char * hostname, char * remotename)
+int http_download_file(char * hostname, char * remotename, int * size)
{
char * buf;
struct timeval timeout;
@@ -420,6 +420,7 @@ int http_download_file(char * hostname, char * remotename)
int rc;
struct sockaddr_in destPort;
fd_set readSet;
+ char * header_content_length = "Content-Length: ";
if ((rc = get_host_address(hostname, &serverAddress))) return rc;
@@ -508,6 +509,11 @@ int http_download_file(char * hostname, char * remotename)
*end = ' ';
}
}
-
+
+ if ((buf = strstr(headers, header_content_length)))
+ *size = charstar_to_int(buf + strlen(header_content_length));
+ else
+ *size = 0;
+
return sock;
}