Created
August 23, 2012 07:01
-
-
Save SaitoWu/3433666 to your computer and use it in GitHub Desktop.
ruby web server
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
# unicorn | |
# tee_input.rb 36L | |
@tmp = @len && @len <= @@client_body_buffer_size ? | |
StringIO.new("") : Unicorn::TmpIO.new | |
# Puma | |
# client.rb 106L | |
if remain > MAX_BODY | |
@body = Tempfile.new(Const::PUMA_TMP_BASE) | |
@body.binmode | |
else | |
# The body[0,0] trick is to get an empty string in the same | |
# encoding as body. | |
@body = StringIO.new body[0,0] | |
end | |
# Thin | |
# request.rb 76L | |
if @parser.finished? # Header finished, can only be some more body | |
body << data | |
else # Parse more header using the super parser | |
@data << data | |
raise InvalidRequest, 'Header longer than allowed' if @data.size > MAX_HEADER | |
@nparsed = @parser.execute(@env, @data, @nparsed) | |
# Transfert to a tempfile if body is very big | |
move_body_to_tempfile if @parser.finished? && content_length > MAX_BODY | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment