diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2015-01-13 08:54:02 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2015-01-13 08:54:02 +0000 |
commit | f797955ca2d342be7370a26bc3cd582685942ca6 (patch) | |
tree | bdbc63e04bd2b8d335b9692736d2712c5da04874 /usr.sbin | |
parent | 814ca14735c5f907dcbb9816a07e7e394ace64f7 (diff) |
Abort if fcgi_chunked is not true to avoid sending additional garbage
after the response.
Found by Erik Lax
ok florian@
Diffstat (limited to 'usr.sbin')
-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); |