From 8edeacc39f5a5d86d18c6dbab9513e2864511ef1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Fri, 22 Aug 2008 17:07:26 +0000 Subject: [PATCH] * fix HTTPS; this broke while migrating the request data to strbuf --- webcit/crypto.c | 7 +++++-- webcit/webcit.h | 2 +- webcit/webserver.c | 12 +++--------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/webcit/crypto.c b/webcit/crypto.c index 1959c5048..972fbaa3a 100644 --- a/webcit/crypto.c +++ b/webcit/crypto.c @@ -457,15 +457,18 @@ void ssl_lock(int mode, int n, const char *file, int line) * \param buf chars to send to the client * \param nbytes how many chars */ -void client_write_ssl(const char *buf, int nbytes) +void client_write_ssl(const StrBuf *Buf) { + const char *buf; int retval; int nremain; + long nbytes; char junk[1]; if (THREADSSL == NULL) return; - nremain = nbytes; + nbytes = nremain = StrLength(Buf); + buf = ChrPtr(Buf); while (nremain > 0) { if (SSL_want_write(THREADSSL)) { diff --git a/webcit/webcit.h b/webcit/webcit.h index 2058b0e7b..92e5b6102 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -827,7 +827,7 @@ void ssl_lock(int mode, int n, const char *file, int line); int starttls(int sock); extern SSL_CTX *ssl_ctx; int client_read_ssl(char *buf, int bytes, int timeout); -void client_write_ssl(const char *buf, int nbytes); +void client_write_ssl(const StrBuf *Buf); #endif #ifdef HAVE_ZLIB diff --git a/webcit/webserver.c b/webcit/webserver.c index a550f4928..6f8105997 100644 --- a/webcit/webserver.c +++ b/webcit/webserver.c @@ -275,7 +275,8 @@ long end_burst(void) #ifdef HAVE_OPENSSL if (is_https) { - client_write_ssl(ptr, StrLength(WCC->HBuf)); + client_write_ssl(WCC->HBuf); + client_write_ssl(WCC->WBuf); return (count); } #endif @@ -289,7 +290,7 @@ long end_burst(void) #endif fdflags = fcntl(WC->http_sock, F_GETFL); - while (ptr < eptr) { + while (ptr < eptr) { if ((fdflags & O_NONBLOCK) == O_NONBLOCK) { FD_ZERO(&wset); FD_SET(WCC->http_sock, &wset); @@ -313,13 +314,6 @@ long end_burst(void) count = StrLength(WCC->WBuf); eptr = ptr + count; -#ifdef HAVE_OPENSSL - if (is_https) { - client_write_ssl(ptr, StrLength(WCC->HBuf)); - return (count); - } -#endif - #ifdef HTTP_TRACING write(2, "\033[34m", 5); -- 2.30.2