From: Viktor M. <mih...@us...> - 2005-07-08 09:11:38
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12690 Modified Files: httpAdapter.c httpComm.c Log Message: Bugs fixed: 1234676. Added buffered BIO for SSL write operations. Index: httpComm.c =================================================================== RCS file: /cvsroot/sblim/sfcb/httpComm.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- httpComm.c 7 Jul 2005 13:06:31 -0000 1.7 +++ httpComm.c 8 Jul 2005 09:11:28 -0000 1.8 @@ -80,13 +80,11 @@ #endif #if defined USE_SSL - if (to.ssl) { + if (to.bio) { + rc = BIO_write(to.bio, data, count); + } else if (to.ssl) { rc = SSL_write(to.ssl, data, count); - } - else if (to.bio) { - rc = BIO_write(to.bio, data, count); - } - else + } else #endif if (to.file == NULL) { rc = write(to.socket,data,count); @@ -109,12 +107,8 @@ #if defined USE_SSL if (from.ssl) { - rc = SSL_read(from.ssl, data, count); - } - else if (from.bio) { - rc = BIO_read(from.bio, data, count); - } - else + rc = SSL_read(from.ssl, data, count); + } else #endif rc = read(from.socket,data,count); @@ -123,7 +117,12 @@ void commFlush(CommHndl hndl) { - if (hndl.file) { - fflush(hndl.file); - } +#if defined USE_SSL + if (hndl.bio) { + BIO_flush(hndl.bio); + } else +#endif + if (hndl.file) { + fflush(hndl.file); + } } Index: httpAdapter.c =================================================================== RCS file: /cvsroot/sblim/sfcb/httpAdapter.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- httpAdapter.c 7 Jul 2005 13:06:31 -0000 1.16 +++ httpAdapter.c 8 Jul 2005 09:11:28 -0000 1.17 @@ -803,13 +803,21 @@ } if (sfcbSSLMode) { #if defined USE_SSL - conn_fd.bio=BIO_new(BIO_s_socket()); - BIO_set_fd(conn_fd.bio,connFd,BIO_CLOSE); + BIO *sslb; + BIO *sb=BIO_new_socket(connFd,BIO_NOCLOSE); if (!(conn_fd.ssl = SSL_new(ctx))) intSSLerror("Error creating SSL object"); - SSL_set_bio(conn_fd.ssl, conn_fd.bio, conn_fd.bio); + SSL_set_bio(conn_fd.ssl, sb, sb); if (SSL_accept(conn_fd.ssl) <= 0) intSSLerror("Error accepting SSL connection"); + sslb = BIO_new(BIO_f_ssl()); + BIO_set_ssl(sslb,conn_fd.ssl,BIO_CLOSE); + conn_fd.bio=BIO_new(BIO_f_buffer()); + BIO_push(conn_fd.bio,sslb); + if (BIO_set_write_buffer_size(conn_fd.bio,SOCKBUFSZ)) { + } else { + conn_fd.bio=NULL; + } #endif } else { #if defined USE_SSL |