 +        h->name = (u_char *) "content-length";
 +        h->name_len = sizeof("content-length") - 1;
 +
-+        h->value = content_len;
++        tmp = ngx_pnalloc(r->pool, NGX_OFF_T_LEN);
++        if (tmp == NULL) {
++            return NGX_ERROR;
++        }
++
++        h->value = tmp;
 +        h->value_len =
-+            ngx_sprintf(content_len, "%O", r->headers_out.content_length_n) -
-+            content_len;
++            ngx_sprintf(tmp, "%O", r->headers_out.content_length_n) - tmp;
 +    }
 +
 +    /* Generate Last-Modified header. */
 +    if (r->headers_out.last_modified == NULL
 +        && r->headers_out.last_modified_time != -1)
 +    {
-+        h = ngx_array_push(headers);
++        h = ngx_array_push(out);
 +        if (h == NULL) {
 +            return NGX_ERROR;
 +        }
 +
-+        ngx_http_time(last_modified, r->headers_out.last_modified_time);
++        h->name = (u_char *) "last-modified";
++        h->name_len = sizeof("last-modified") - 1;
++
++        tmp = ngx_pnalloc(r->pool, sizeof("Wed, 31 Dec 1986 18:00:00 GMT") - 1);
++        if (tmp == NULL) {
++            return NGX_ERROR;
++        }
++
++        h->value = tmp;
++        h->value_len =
++            ngx_http_time(tmp, r->headers_out.last_modified_time) - tmp;
 +
 +        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, fc->log, 0,
 +                       "http3 output header: \"last-modified: %*.s\"",
-+                       sizeof(last_modified), last_modified);
-+
-+        h->name = (u_char *) "last-modified";
-+        h->name_len = sizeof("last-modified") - 1;
-+
-+        h->value = last_modified;
-+        h->value_len = sizeof(last_modified);
++                       h->value_len, h->value);
 +    }
 +
 +    /* Generate Location header. */

+    if (r->headers_out.content_length == NULL
+        && r->headers_out.content_length_n >= 0)
+    {
+        h = ngx_array_push(headers);
+        if (h == NULL) {
+            return NGX_ERROR;
+        }

+
+    ngx_http_v3_connection_t  *connection;
+
+    ngx_array_t               *headers;
+    ngx_array_t               *cookies;
+
+    ngx_http_v3_stream_t      *next;
