From: reyk Date: Thu, 31 Jul 2014 18:07:11 +0000 (+0000) Subject: Only write the HTTP header for the first fastcgi chunk. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ac2cdcb6bb21f76a9633702a3b94826417c9d910;p=openbsd Only write the HTTP header for the first fastcgi chunk. --- diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index 2605a068621..d45783a6303 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/httpd/httpd.h @@ -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 @@ -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; diff --git a/usr.sbin/httpd/server_fcgi.c b/usr.sbin/httpd/server_fcgi.c index bc8d25176c7..01187df061f 100644 --- a/usr.sbin/httpd/server_fcgi.c +++ b/usr.sbin/httpd/server_fcgi.c @@ -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 @@ -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)); diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c index 4b29da4faa8..7849c61630e 100644 --- a/usr.sbin/httpd/server_http.c +++ b/usr.sbin/httpd/server_http.c @@ -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 @@ -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; }