Only write the HTTP header for the first fastcgi chunk.
authorreyk <reyk@openbsd.org>
Thu, 31 Jul 2014 18:07:11 +0000 (18:07 +0000)
committerreyk <reyk@openbsd.org>
Thu, 31 Jul 2014 18:07:11 +0000 (18:07 +0000)
usr.sbin/httpd/httpd.h
usr.sbin/httpd/server_fcgi.c
usr.sbin/httpd/server_http.c

index 2605a06..d45783a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: httpd.h,v 1.25 2014/07/31 17:55:09 reyk Exp $ */
+/*     $OpenBSD: httpd.h,v 1.26 2014/07/31 18:07:11 reyk Exp $ */
 
 /*
  * Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -261,6 +261,7 @@ struct client {
        int                      clt_persist;
        int                      clt_line;
        int                      clt_done;
+       int                      clt_chunk;
        int                      clt_inflight;
 
        struct evbuffer         *clt_log;
index bc8d251..01187df 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: server_fcgi.c,v 1.4 2014/07/31 17:55:09 reyk Exp $    */
+/*     $OpenBSD: server_fcgi.c,v 1.5 2014/07/31 18:07:11 reyk Exp $    */
 
 /*
  * Copyright (c) 2014 Florian Obser <florian@openbsd.org>
@@ -230,7 +230,8 @@ server_fcgi_read(struct bufferevent *bev, void *arg)
                DPRINTF("%s", (char *) &buf +
                     sizeof(struct fcgi_record_header));
 
-               server_fcgi_header(clt, 200);
+               if (++clt->clt_chunk == 1)
+                       server_fcgi_header(clt, 200);
                server_bufferevent_write(clt, (char *)&buf +
                    sizeof(struct fcgi_record_header),
                    len - sizeof(struct fcgi_record_header));
index 4b29da4..7849c61 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: server_http.c,v 1.24 2014/07/31 17:55:09 reyk Exp $   */
+/*     $OpenBSD: server_http.c,v 1.25 2014/07/31 18:07:11 reyk Exp $   */
 
 /*
  * Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -513,6 +513,7 @@ server_reset_http(struct client *clt)
        clt->clt_headerlen = 0;
        clt->clt_line = 0;
        clt->clt_done = 0;
+       clt->clt_chunk = 0;
        clt->clt_bev->readcb = server_read_http;
        clt->clt_srv_conf = &srv->srv_conf;
 }