Index: modules/ssl/ssl_engine_io.c
===================================================================
--- modules/ssl/ssl_engine_io.c	(revision 1727923)
+++ modules/ssl/ssl_engine_io.c	(working copy)
@@ -147,6 +147,9 @@ static int bio_filter_out_flush(BIO *bio)
     bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)(bio->ptr);
     apr_bucket *e;
 
+    ap_log_cerror(APLOG_MARK, APLOG_NOTICE, 0, outctx->c,
+                  "bio[%pp] out: FLUSH", bio);
+
     AP_DEBUG_ASSERT(APR_BRIGADE_EMPTY(outctx->bb));
 
     e = apr_bucket_flush_create(outctx->bb->bucket_alloc);
@@ -187,7 +190,6 @@ static int bio_filter_out_write(BIO *bio, const ch
 {
     bio_filter_out_ctx_t *outctx = (bio_filter_out_ctx_t *)(bio->ptr);
     apr_bucket *e;
-    int need_flush;
 
     /* Abort early if the client has initiated a renegotiation. */
     if (outctx->filter_ctx->config->reneg_state == RENEG_ABORT) {
@@ -216,15 +218,16 @@ static int bio_filter_out_write(BIO *bio, const ch
      * be expensive in cases where requests/reponses are pipelined,
      * so limit the performance impact to handshake time.
      */
-#if OPENSSL_VERSION_NUMBER < 0x0009080df
-     need_flush = !SSL_is_init_finished(outctx->filter_ctx->pssl);
-#else
-     need_flush = SSL_in_connect_init(outctx->filter_ctx->pssl);
-#endif
-    if (need_flush) {
+    if (!SSL_is_init_finished(outctx->filter_ctx->pssl)) {
+        ap_log_cerror(APLOG_MARK, APLOG_NOTICE, 0, outctx->c,
+                      "bio[%pp] out: flush %d bytes", bio, inl);
         e = apr_bucket_flush_create(outctx->bb->bucket_alloc);
         APR_BRIGADE_INSERT_TAIL(outctx->bb, e);
     }
+    else {
+        ap_log_cerror(APLOG_MARK, APLOG_NOTICE, 0, outctx->c,
+                      "bio[%pp] out: pass %d bytes", bio, inl);
+    }
 
     if (bio_filter_out_pass(outctx) < 0) {
         return -1;
@@ -499,6 +502,10 @@ static int bio_filter_in_read(BIO *bio, char *in,
 
     inctx->rc = brigade_consume(inctx->bb, block, in, &inl);
 
+    ap_log_cerror(APLOG_MARK, APLOG_NOTICE, inctx->rc,
+                  SSL_get_app_data(inctx->filter_ctx->pssl),
+                  "bio[%pp] in: read %" APR_SIZE_T_FMT "bytes", bio, inl);
+
     if (inctx->rc == APR_SUCCESS) {
         return (int)inl;
     }
@@ -1622,6 +1629,10 @@ static apr_status_t ssl_io_filter_output(ap_filter
         apr_bucket *bucket = APR_BRIGADE_FIRST(bb);
 
         if (APR_BUCKET_IS_METADATA(bucket)) {
+            ap_log_cerror(APLOG_MARK, APLOG_NOTICE, 0, f->c,
+                          "bio[%pp] out: METADATA %s",
+                          filter_ctx->pbioWrite,
+                          bucket->type->name);
             /* Pass through metadata buckets untouched.  EOC is
              * special; terminate the SSL layer first. */
             if (AP_BUCKET_IS_EOC(bucket)) {
@@ -1634,7 +1645,11 @@ static apr_status_t ssl_io_filter_output(ap_filter
              * outctx->bb as a true buffer and interleave these with
              * data buckets. */
             APR_BUCKET_REMOVE(bucket);
+#if 0
+            APR_BRIGADE_INSERT_TAIL(outctx->bb, bucket);
+#else
             APR_BRIGADE_INSERT_HEAD(outctx->bb, bucket);
+#endif
             status = ap_pass_brigade(f->next, outctx->bb);
             if (status == APR_SUCCESS && f->c->aborted)
                 status = APR_ECONNRESET;
