Skip to content

Instantly share code, notes, and snippets.

@noisan
Last active May 22, 2017 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noisan/eeedcde5ad5b565cd953 to your computer and use it in GitHub Desktop.
Save noisan/eeedcde5ad5b565cd953 to your computer and use it in GitHub Desktop.
Quick patch for mod_proxy_fcgi to work with `flush()` (Apache httpd-2.4.10)
--- modules/proxy/mod_proxy_fcgi.c.orig 2014-06-26 09:24:44.000000000 +0900
+++ modules/proxy/mod_proxy_fcgi.c 2014-09-09 18:19:28.102859189 +0900
@@ -690,6 +690,21 @@
break;
}
}
+
+ if (type == AP_FCGI_STDOUT) {
+ APR_BRIGADE_INSERT_TAIL(ob, apr_bucket_flush_create(c->bucket_alloc));
+
+ rv = apr_poll(&pfd, 1, &n, 0);
+ if ((rv != APR_SUCCESS) && (pfd.rtnevents & APR_POLLIN)) {
+ /* flush the current chunk if the next chunk has not arrived */
+ rv = ap_pass_brigade(r->output_filters, ob);
+ if (rv != APR_SUCCESS) {
+ *err = "passing brigade to output filters";
+ break;
+ }
+ apr_brigade_cleanup(ob);
+ }
+ }
}
}
@cyraid
Copy link

cyraid commented May 22, 2017

Has this been implemented? Because mod_proxy_fcgi currently does not work with flush() (from PHP). It is driving me batty as I'm trying to use mod_proxy_fcgi as mod_fastcgi is no longer available in Ubuntu 17.04, and my original code just does not work now..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment