-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main/fcgiwrap: backport support for NO_BUFFERING
upstream: gnosek/fcgiwrap#36 (cherry picked from commit 955c2f7) (cherry picked from commit 765e5cb)
- Loading branch information
Showing
2 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# Maintainer: Natanael Copa <[email protected]> | ||
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 | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
From eb54c65446693366aedfe72f002c6bb4e1a5d748 Mon Sep 17 00:00:00 2001 | ||
From: Richard Stanway <[email protected]> | ||
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); | ||
} |