Created
October 3, 2009 18:38
-
-
Save nihen/200797 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
From 638815a50913a983c67fe40efe83c00e86072be7 Mon Sep 17 00:00:00 2001 | |
From: Masahiro Chiba <[email protected]> | |
Date: Sun, 4 Oct 2009 03:37:45 +0900 | |
Subject: [PATCH] add sendfile impl | |
--- | |
lib/Plack/Server/Apache2.pm | 7 ++++++- | |
1 files changed, 6 insertions(+), 1 deletions(-) | |
diff --git a/lib/Plack/Server/Apache2.pm b/lib/Plack/Server/Apache2.pm | |
index f2d80d0..2c6595b 100644 | |
--- a/lib/Plack/Server/Apache2.pm | |
+++ b/lib/Plack/Server/Apache2.pm | |
@@ -58,7 +58,12 @@ sub handler { | |
$r->status($res->[0]); | |
# TODO $r->sendfile support? | |
- Plack::Util::foreach($res->[2], sub { $r->puts(@_) }); | |
+ if ( Plack::Util::is_real_fh($res->[2]) ) { | |
+ $r->sendfile(sprintf('/proc/%s/fd/%s', $$, fileno $res->[2])); | |
+ } | |
+ else { | |
+ Plack::Util::foreach($res->[2], sub { $r->puts(@_) }); | |
+ } | |
return Apache2::Const::OK; | |
} | |
-- | |
1.5.6.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment