From 0e13d67991fe10019f7fb1fa848f1788a4679b53 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sat, 13 Jun 2009 15:00:34 +0000 Subject: do not try to send empty packs using TLS. This this has a special meaning and could result in clients closing connections. --- (limited to 'src/gnutls_io.c') diff --git a/src/gnutls_io.c b/src/gnutls_io.c index 4f8e486..65e128d 100644 --- a/src/gnutls_io.c +++ b/src/gnutls_io.c @@ -587,26 +587,29 @@ apr_status_t mgs_filter_output(ap_filter_t * f, if (!APR_STATUS_IS_EOF(status) && (status != APR_SUCCESS)) { break; } + + if (len > 0) { - do { - ret = gnutls_record_send(ctxt->session, data, len); - } - while(ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN); + do { + ret = gnutls_record_send(ctxt->session, data, len); + } + while(ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN); - if (ret < 0) { - /* error sending output */ - ap_log_error(APLOG_MARK, APLOG_INFO, ctxt->output_rc, + if (ret < 0) { + /* error sending output */ + ap_log_error(APLOG_MARK, APLOG_INFO, ctxt->output_rc, ctxt->c->base_server, "GnuTLS: Error writing data." " (%d) '%s'", (int)ret, gnutls_strerror(ret)); - if (ctxt->output_rc == APR_SUCCESS) { - ctxt->output_rc = APR_EGENERAL; + if (ctxt->output_rc == APR_SUCCESS) { + ctxt->output_rc = APR_EGENERAL; + } + } + else if (ret != len) { + /* Not able to send the entire bucket, + split it and send it again. */ + apr_bucket_split(bucket, ret); } - } - else if (ret != len) { - /* Not able to send the entire bucket, - split it and send it again. */ - apr_bucket_split(bucket, ret); } apr_bucket_delete(bucket); -- cgit v0.9.2