From b8013bc11a0b7e0271f370cba49d741e26b7fa88 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Sun, 25 Nov 2018 20:02:24 +0900 Subject: [PATCH 1/2] Fix #2 : File dl of over 2GB failing over SSL Not sure if this breaks the "STATE_WRITE_RANGES" case. --- ssl.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ssl.c b/ssl.c index 9a3051c..830f955 100644 --- a/ssl.c +++ b/ssl.c @@ -69,12 +69,6 @@ int ssl_blk_write(struct REQUEST *req, int offset, int len) int rc; char buf[4096]; - if (lseek(req->bfd, offset, SEEK_SET) == -1) { - if (debug) - perror("lseek"); - return -1; - } - if (len > sizeof(buf)) len = sizeof(buf); rc = read(req->bfd, buf, len); From 4f1783339ff5b1d1eeb6729d6f857d5f63c42e3a Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 26 Nov 2018 10:59:09 +0900 Subject: [PATCH 2/2] Fix broken resume dl introduced in prev commit --- httpd.h | 2 +- ssl.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/httpd.h b/httpd.h index d607860..36f2a1b 100644 --- a/httpd.h +++ b/httpd.h @@ -192,7 +192,7 @@ static void inline close_on_exec(int fd) #ifdef USE_SSL extern int ssl_read(struct REQUEST *req, char *buf, int len); extern int ssl_write(struct REQUEST *req, char *buf, int len); -extern int ssl_blk_write(struct REQUEST *req, int offset, int len); +extern int ssl_blk_write(struct REQUEST *req, off_t offset, size_t len); extern void init_ssl(void); extern void open_ssl_session(struct REQUEST *req); #endif diff --git a/ssl.c b/ssl.c index 830f955..9c4e2fb 100644 --- a/ssl.c +++ b/ssl.c @@ -64,11 +64,16 @@ int ssl_write(struct REQUEST *req, char *buf, int len) return rc; } -int ssl_blk_write(struct REQUEST *req, int offset, int len) +int ssl_blk_write(struct REQUEST *req, off_t offset, size_t len) { int rc; char buf[4096]; + if (lseek(req->bfd, offset, SEEK_SET) == -1) { + if (debug) perror("lseek"); + return -1; + } + if (len > sizeof(buf)) len = sizeof(buf); rc = read(req->bfd, buf, len);