about summary refs log tree commit homepage
path: root/lib/yahns/proxy_pass.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-01 23:53:33 +0000
committerEric Wong <e@80x24.org>2016-06-01 23:53:33 +0000
commita3e3ab48a5a73e7d55bfcb271e5f2a1b666a4f8c (patch)
tree63eb4f47c6b6cf07d0ee52fd110409228268397b /lib/yahns/proxy_pass.rb
parent0f40562e710445dc0b793dba8962d235ba3bd954 (diff)
downloadyahns-a3e3ab48a5a73e7d55bfcb271e5f2a1b666a4f8c.tar.gz
This will allow us to add extra options at the response
layer without taking up extra env hash keys.
Diffstat (limited to 'lib/yahns/proxy_pass.rb')
-rw-r--r--lib/yahns/proxy_pass.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/yahns/proxy_pass.rb b/lib/yahns/proxy_pass.rb
index a30089d..ed37da5 100644
--- a/lib/yahns/proxy_pass.rb
+++ b/lib/yahns/proxy_pass.rb
@@ -10,6 +10,8 @@ require_relative 'proxy_http_response'
 require_relative 'req_res'
 
 class Yahns::ProxyPass # :nodoc:
+  attr_reader :proxy_buffering, :response_headers
+
   def initialize(dest, opts = {})
     case dest
     when %r{\Aunix:([^:]+)(?::(/.*))?\z}
@@ -23,6 +25,8 @@ class Yahns::ProxyPass # :nodoc:
       raise ArgumentError, "destination must be an HTTP URL or unix: path"
     end
     @response_headers = opts[:response_headers] || {}
+    @proxy_buffering = opts[:proxy_buffering]
+    @proxy_buffering = true if @proxy_buffering.nil? # allow false
 
     # It's wrong to send the backend Server tag through.  Let users say
     # { "Server => "yahns" } if they want to advertise for us, but don't
@@ -85,7 +89,7 @@ class Yahns::ProxyPass # :nodoc:
     ctype = env["CONTENT_TYPE"] and req << "Content-Type: #{ctype}\r\n"
     clen = env["CONTENT_LENGTH"] and req << "Content-Length: #{clen}\r\n"
     input = chunked || (clen && clen.to_i > 0) ? env['rack.input'] : nil
-    env['yahns.proxy_pass.response_headers'] = @response_headers
+    env['yahns.proxy_pass'] = self
 
     # finally, prepare to emit the headers
     rr.req_start(c, req << "\r\n".freeze, input, chunked)