ca8514
diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c
ca8514
index 0958135..018b667 100644
ca8514
--- a/modules/ssl/ssl_engine_io.c
ca8514
+++ b/modules/ssl/ssl_engine_io.c
ca8514
@@ -200,6 +200,8 @@ static int bio_filter_out_write(BIO *bio, const char *in, int inl)
bdaebd
     apr_bucket *e;
bdaebd
     int need_flush;
bdaebd
 
bdaebd
+    BIO_clear_retry_flags(bio);
bdaebd
+
ca8514
 #ifndef SSL_OP_NO_RENEGOTIATION
bdaebd
     /* Abort early if the client has initiated a renegotiation. */
bdaebd
     if (outctx->filter_ctx->config->reneg_state == RENEG_ABORT) {
ca8514
@@ -208,12 +210,6 @@ static int bio_filter_out_write(BIO *bio, const char *in, int inl)
bdaebd
     }
ca8514
 #endif
bdaebd
 
bdaebd
-    /* when handshaking we'll have a small number of bytes.
bdaebd
-     * max size SSL will pass us here is about 16k.
bdaebd
-     * (16413 bytes to be exact)
bdaebd
-     */
bdaebd
-    BIO_clear_retry_flags(bio);
bdaebd
-
bdaebd
     /* Use a transient bucket for the output data - any downstream
bdaebd
      * filter must setaside if necessary. */
bdaebd
     e = apr_bucket_transient_create(in, inl, outctx->bb->bucket_alloc);
ca8514
@@ -460,6 +456,8 @@ static int bio_filter_in_read(BIO *bio, char *in, int inlen)
bdaebd
     if (!in)
bdaebd
         return 0;
bdaebd
 
bdaebd
+    BIO_clear_retry_flags(bio);
bdaebd
+
ca8514
 #ifndef SSL_OP_NO_RENEGOTIATION
bdaebd
     /* Abort early if the client has initiated a renegotiation. */
bdaebd
     if (inctx->filter_ctx->config->reneg_state == RENEG_ABORT) {
ca8514
@@ -468,8 +466,6 @@ static int bio_filter_in_read(BIO *bio, char *in, int inlen)
bdaebd
     }
ca8514
 #endif
bdaebd
 
bdaebd
-    BIO_clear_retry_flags(bio);
bdaebd
-
bdaebd
     if (!inctx->bb) {
bdaebd
         inctx->rc = APR_EOF;
bdaebd
         return -1;