diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-08-06 21:08:48 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-08-06 21:08:48 +0000 |
commit | 5e6ebf2888ce12584ed74b77cc408a7b0da3b66e (patch) | |
tree | 97fd90cfcc5374aef29574c6111cda0903ac820f /usr.sbin | |
parent | e014a07919fd1914a381f5e5be5b2040e1177d7e (diff) |
Write STDERR from the CGI to the web server error log as intended.
OK florian@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/httpd/server_fcgi.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/httpd/server_fcgi.c b/usr.sbin/httpd/server_fcgi.c index 3d16a6c7793..eaa7590872f 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.26 2014/08/06 20:56:23 florian Exp $ */ +/* $OpenBSD: server_fcgi.c,v 1.27 2014/08/06 21:08:47 reyk Exp $ */ /* * Copyright (c) 2014 Florian Obser <florian@openbsd.org> @@ -440,6 +440,7 @@ server_fcgi_read(struct bufferevent *bev, void *arg) struct client *clt = (struct client *) arg; struct fcgi_record_header *h; size_t len; + char *ptr; do { len = bufferevent_read(bev, &buf, clt->clt_fcgi_toread); @@ -476,6 +477,16 @@ server_fcgi_read(struct bufferevent *bev, void *arg) /* fallthrough if content_len == 0 */ case FCGI_READ_CONTENT: + if (clt->clt_fcgi_type == FCGI_STDERR && len) { + if ((ptr = get_string( + EVBUFFER_DATA(clt->clt_srvevb), + EVBUFFER_LENGTH(clt->clt_srvevb))) + != NULL) { + server_sendlog(clt->clt_srv_conf, + IMSG_LOG_ERROR, "%s", ptr); + free(ptr); + } + } if (clt->clt_fcgi_type == FCGI_STDOUT && EVBUFFER_LENGTH(clt->clt_srvevb) > 0) { if (++clt->clt_chunk == 1) |