diff options
author | dmann <darrinmann@gmail.com> | 2009-08-11 13:56:50 -0700 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2009-08-12 00:43:42 +0200 |
commit | 38f205e975d3e540cc81a71a639f4bebc3c2a293 (patch) | |
tree | 7c70084ce4d0f5074964b9f7aac3d73d5ccbe476 | |
parent | 503130e322cb9390cba028a0ef58c1e24848ff21 (diff) | |
download | rack-38f205e975d3e540cc81a71a639f4bebc3c2a293.tar.gz |
Checking that the FCGI::Stream class exists, before trying to override the read method. The FCGI::Stream class does not exist in the pure ruby version of the FCGI module. FCGI will use pure ruby if:
1. FCGI_PURE_RUBY = true 2. The C version of FCGI doesn't load (lib not found or the like) Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
-rw-r--r-- | lib/rack/handler/fastcgi.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/rack/handler/fastcgi.rb b/lib/rack/handler/fastcgi.rb index 11e1fcaa..1739d659 100644 --- a/lib/rack/handler/fastcgi.rb +++ b/lib/rack/handler/fastcgi.rb @@ -3,13 +3,15 @@ require 'socket' require 'rack/content_length' require 'rack/rewindable_input' -class FCGI::Stream - alias _rack_read_without_buffer read +if defined? FCGI::Stream + class FCGI::Stream + alias _rack_read_without_buffer read - def read(n, buffer=nil) - buf = _rack_read_without_buffer n - buffer.replace(buf.to_s) if buffer - buf + def read(n, buffer=nil) + buf = _rack_read_without_buffer n + buffer.replace(buf.to_s) if buffer + buf + end end end |