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