diff options
author | 2015-01-13 08:54:01 +0000 | |
---|---|---|
committer | 2015-01-13 08:54:01 +0000 | |
commit | 33b95b443dcd221e396255deb4b61dd67a867221 (patch) | |
tree | fb43e5367cc21f6d0121142bedf4598384d0a558 | |
parent | sync (diff) | |
download | wireguard-openbsd-33b95b443dcd221e396255deb4b61dd67a867221.tar.xz wireguard-openbsd-33b95b443dcd221e396255deb4b61dd67a867221.zip |
Abort if fcgi_chunked is not true to avoid sending additional garbage
after the response.
Found by Erik Lax
ok florian@
-rw-r--r-- | usr.sbin/httpd/server_fcgi.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.sbin/httpd/server_fcgi.c b/usr.sbin/httpd/server_fcgi.c index a6055cd157e..012e2eaaea8 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.44 2015/01/04 22:23:58 chrisz Exp $ */ +/* $OpenBSD: server_fcgi.c,v 1.45 2015/01/13 08:54:01 reyk Exp $ */ /* * Copyright (c) 2014 Florian Obser <florian@openbsd.org> @@ -674,16 +674,15 @@ server_fcgi_writechunk(struct client *clt) } else len = EVBUFFER_LENGTH(evb); - /* If len is 0, make sure to write the end marker only once */ - if (len == 0 && clt->clt_fcgi_end++) - return (0); - if (clt->clt_fcgi_chunked) { + /* If len is 0, make sure to write the end marker only once */ + if (len == 0 && clt->clt_fcgi_end++) + return (0); if (server_bufferevent_printf(clt, "%zx\r\n", len) == -1 || server_bufferevent_write_chunk(clt, evb, len) == -1 || server_bufferevent_print(clt, "\r\n") == -1) return (-1); - } else + } else if (len) return (server_bufferevent_write_buffer(clt, evb)); return (0); |