client: flush buffered SSL output when tearing down client ustream
[project/uhttpd.git] / client.c
index 05044ed9d38dc3755a80a9cd8e2c7cc2cbf631c9..04d26f11af9a0c8501b66c2dcebb48d2ab04c5e1 100644 (file)
--- a/client.c
+++ b/client.c
@@ -553,6 +553,12 @@ void uh_client_notify_state(struct client *cl)
 
                if (!s->eof || s->w.data_bytes)
                        return;
+
+               if (cl->tls && cl->ssl.conn && cl->ssl.conn->w.data_bytes) {
+                       cl->ssl.conn->eof = s->eof;
+                       if (!ustream_write_pending(cl->ssl.conn))
+                               return;
+               }
        }
 
        return client_close(cl);