aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2023-11-16 00:28:57 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2023-11-16 00:55:33 +0000
commit1d183746afadc01c24c55876cbf1f1b4c12491d2 (patch)
tree312cac51fa936ee7ca751573f8313967601a3961
parent90362e5bc290dd15fba5d2d7dc463f7328321ff1 (diff)
main/fcgiwrap: backport support for NO_BUFFERING3.13-stable
upstream: https://github.com/gnosek/fcgiwrap/issues/36 (cherry picked from commit 955c2f7f33145e05a65ed9cdb0191b1443331190) (cherry picked from commit 765e5cb605ea4018cdc600925c777c5678370f03) (cherry picked from commit 57963978da1971fa0583739b14b680ddc911c14d)
-rw-r--r--main/fcgiwrap/APKBUILD10
-rw-r--r--main/fcgiwrap/no-buffering.patch58
2 files changed, 65 insertions, 3 deletions
diff --git a/main/fcgiwrap/APKBUILD b/main/fcgiwrap/APKBUILD
index ec5214f2acd..d96a516a190 100644
--- a/main/fcgiwrap/APKBUILD
+++ b/main/fcgiwrap/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=fcgiwrap
pkgver=1.1.0
-pkgrel=5
+pkgrel=6
pkgdesc="Simple server for running CGI applications over FastCGI"
url="https://github.com/gnosek/fcgiwrap"
arch="all"
@@ -13,6 +13,7 @@ install="$pkgname.pre-install"
makedepends="$depends_dev autoconf libtool automake fcgi-dev"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/gnosek/fcgiwrap/archive/$pkgver.tar.gz
+ no-buffering.patch
$pkgname.initd
$pkgname.confd"
@@ -36,6 +37,9 @@ package() {
install -Dm644 $srcdir/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}
-sha512sums="b8d35762d1d3c94a67602290b0092f0c38cffbbcd3dbc16597abf8b92172909b04450c238de2e430e841a17dd47fdd48d6a001f77539966980ef1af61e447ddc fcgiwrap-1.1.0.tar.gz
+sha512sums="
+b8d35762d1d3c94a67602290b0092f0c38cffbbcd3dbc16597abf8b92172909b04450c238de2e430e841a17dd47fdd48d6a001f77539966980ef1af61e447ddc fcgiwrap-1.1.0.tar.gz
+72ba8a0d044c86cc41358002b1cbb94e77dc81e56669032b474b94d7cde80e6cc5d041a064d79ed98b7db8aee9ffcc8830df88491f14afa251781487a57fd429 no-buffering.patch
e6111da1089df43f8656e598edf4e658cd2d70e6066833a2c7a465229723e1edce144cf214bd8f771298d54948b8128012c4ce4d509c9d9307a54e8ef90ff2d8 fcgiwrap.initd
-893e9afa92c20c9d0dab68fffc806a1be1f2e28a7e73bbb497316386a9ee083be4bad68a90f660e489311a9812a512b50fb0edb8b9c49b12f6cd266ba53b01a6 fcgiwrap.confd"
+893e9afa92c20c9d0dab68fffc806a1be1f2e28a7e73bbb497316386a9ee083be4bad68a90f660e489311a9812a512b50fb0edb8b9c49b12f6cd266ba53b01a6 fcgiwrap.confd
+"
diff --git a/main/fcgiwrap/no-buffering.patch b/main/fcgiwrap/no-buffering.patch
new file mode 100644
index 00000000000..3d5f0038ee9
--- /dev/null
+++ b/main/fcgiwrap/no-buffering.patch
@@ -0,0 +1,58 @@
+From eb54c65446693366aedfe72f002c6bb4e1a5d748 Mon Sep 17 00:00:00 2001
+From: Richard Stanway <r.stanway@gmail.com>
+Date: Thu, 24 Mar 2016 21:34:17 -0500
+Subject: [PATCH] Add environment variable NO_BUFFERING to disable output
+ buffering
+
+Fixes #36
+---
+ fcgiwrap.8 | 4 ++++
+ fcgiwrap.c | 6 ++++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/fcgiwrap.8 b/fcgiwrap.8
+index bf02c26..892b594 100644
+--- a/fcgiwrap.8
++++ b/fcgiwrap.8
+@@ -65,6 +65,10 @@
+ SCRIPT_FILENAME
+ .RS
+ complete path to CGI script. When set, overrides DOCUMENT_ROOT and SCRIPT_NAME
++.RE
++NO_BUFFERING
++.RS
++When set (e.g., to ""), disables output buffering.
+
+ .SH EXAMPLE
+ The fastest way to see \fBfcgiwrap\fP do something is to launch it at the command line
+diff --git a/fcgiwrap.c b/fcgiwrap.c
+index b44d8aa..42e3ec9 100644
+--- a/fcgiwrap.c
++++ b/fcgiwrap.c
+@@ -191,6 +191,7 @@ struct fcgi_context {
+ int fd_stderr;
+ unsigned int reply_state;
+ pid_t cgi_pid;
++ int unbuffered;
+ };
+
+ static void fcgi_finish(struct fcgi_context *fc, const char* msg)
+@@ -256,6 +257,10 @@ static const char * fcgi_pass_fd(struct fcgi_context *fc, int *fdp, FCGI_FILE *f
+ return "writing CGI reply";
+ }
+ }
++
++ if (fc->unbuffered && FCGI_fflush(ffp)) {
++ return "flushing CGI reply";
++ }
+ } else {
+ if (nread < 0) {
+ return "reading CGI reply";
+@@ -590,6 +595,7 @@ static void handle_fcgi_request(void)
+ fc.fd_stderr = pipe_err[0];
+ fc.reply_state = REPLY_STATE_INIT;
+ fc.cgi_pid = pid;
++ fc.unbuffered = !!getenv("NO_BUFFERING");
+
+ fcgi_pass(&fc);
+ }