 +
 +        in->buf->pos += sent;
 +
++        /* Partial (or no) write, end now. */
++        if ((n == NGX_AGAIN) || (send - prev_send != sent)) {
++            blocked = 1;
++            break;
++        }
++
++        /* Buffer is fully written, switch to the next. */
 +        if (in->buf->pos == in->buf->last) {
 +            in = in->next;
-+        }
-+
-+        if (send - prev_send != sent) {
-+            blocked = 1;
-+            break;
 +        }
 +
 +        if (fin) {

+}
diff --git a/src/event/ngx_event_quic.h b/src/event/ngx_event_quic.h
new file mode 100644
index 00000000..b44a9632
--- /dev/null
+++ b/src/event/ngx_event_quic.h
@@ -0,0 +1,49 @@

     . auto/lib/zlib/conf
 fi
diff --git a/auto/lib/make b/auto/lib/make
index b64e32908..c8f34ae2e 100644
--- a/auto/lib/make
+++ b/auto/lib/make
@@ -11,6 +11,10 @@ if [ $OPENSSL != NONE -a $OPENSSL != NO -a $OPENSSL != YES ]; then
