diff options
Diffstat (limited to 'lib/yahns/http_client.rb')
-rw-r--r-- | lib/yahns/http_client.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/yahns/http_client.rb b/lib/yahns/http_client.rb index 198c130..e95bb47 100644 --- a/lib/yahns/http_client.rb +++ b/lib/yahns/http_client.rb @@ -45,9 +45,17 @@ class Yahns::HttpClient < Kgio::Socket # :nodoc: end while true end + # used only with "input_buffering true" def mkinput_preread + k = self.class + len = @hs.content_length + mbs = k.client_max_body_size + if mbs && len && len > mbs + raise Unicorn::RequestEntityTooLargeError, + "Content-Length:#{len} too large (>#{mbs})", [] + end @state = :body - @input = self.class.tmpio_for(@hs.content_length) + @input = k.tmpio_for(len) rbuf = Thread.current[:yahns_rbuf] @hs.filter_body(rbuf, @hs.buf) @input.write(rbuf) |