* fix HTTPS; this broke while migrating the request data to strbuf
authorWilfried Göesgens <willi@citadel.org>
Fri, 22 Aug 2008 17:07:26 +0000 (17:07 +0000)
committerWilfried Göesgens <willi@citadel.org>
Fri, 22 Aug 2008 17:07:26 +0000 (17:07 +0000)
webcit/crypto.c
webcit/webcit.h
webcit/webserver.c

index 1959c50484278bb2bb22bba61e5812b929af9635..972fbaa3a183e0d5bbb28790590e8326fb02751d 100644 (file)
@@ -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)) {
index 2058b0e7b09231fb5045e4d52a63e207cf4cb01b..92e5b610264e70502f29bc3988703e7bc00341d6 100644 (file)
@@ -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
index a550f49280dd0a5b46028806009e3bacd5a37d55..6f8105997d09603880aba78e7eaa95734c678998 100644 (file)
@@ -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);