mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
client.rb - remove JRuby specific 'finish' code (#2412)
Remove JRuby specific methods: #jruby_start_try_to_finish #eagerly_finish
This commit is contained in:
parent
9ca9ddefb9
commit
8f9396f439
2 changed files with 6 additions and 58 deletions
|
@ -7,6 +7,7 @@
|
|||
* Cleanup daemonization in rc.d script (#2409)
|
||||
|
||||
* Refactor
|
||||
* client.rb - remove JRuby specific 'finish' code (#2412)
|
||||
* Consolidate fast_write calls in Server, extract early_hints assembly (#2405)
|
||||
* Remove upstart from docs (#2408)
|
||||
* Consolidate option handling in Server, Server small refactors, doc changes (#2389)
|
||||
|
|
|
@ -188,64 +188,11 @@ module Puma
|
|||
false
|
||||
end
|
||||
|
||||
if IS_JRUBY
|
||||
def jruby_start_try_to_finish
|
||||
return read_body unless @read_header
|
||||
|
||||
begin
|
||||
data = @io.sysread_nonblock(CHUNK_SIZE)
|
||||
rescue OpenSSL::SSL::SSLError => e
|
||||
return false if e.kind_of? IO::WaitReadable
|
||||
raise e
|
||||
end
|
||||
|
||||
# No data means a closed socket
|
||||
unless data
|
||||
@buffer = nil
|
||||
set_ready
|
||||
raise EOFError
|
||||
end
|
||||
|
||||
if @buffer
|
||||
@buffer << data
|
||||
else
|
||||
@buffer = data
|
||||
end
|
||||
|
||||
@parsed_bytes = @parser.execute(@env, @buffer, @parsed_bytes)
|
||||
|
||||
if @parser.finished?
|
||||
return setup_body
|
||||
elsif @parsed_bytes >= MAX_HEADER
|
||||
raise HttpParserError,
|
||||
"HEADER is longer than allowed, aborting client early."
|
||||
end
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
def eagerly_finish
|
||||
return true if @ready
|
||||
|
||||
if @io.kind_of? OpenSSL::SSL::SSLSocket
|
||||
return true if jruby_start_try_to_finish
|
||||
end
|
||||
|
||||
return false unless IO.select([@to_io], nil, nil, 0)
|
||||
try_to_finish
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
def eagerly_finish
|
||||
return true if @ready
|
||||
return false unless IO.select([@to_io], nil, nil, 0)
|
||||
try_to_finish
|
||||
end
|
||||
|
||||
# For documentation, see https://github.com/puma/puma/issues/1754
|
||||
send(:alias_method, :jruby_eagerly_finish, :eagerly_finish)
|
||||
end # IS_JRUBY
|
||||
def eagerly_finish
|
||||
return true if @ready
|
||||
return false unless IO.select([@to_io], nil, nil, 0)
|
||||
try_to_finish
|
||||
end
|
||||
|
||||
def finish(timeout)
|
||||
return true if @ready
|
||||
|
|
Loading…
Reference in a new issue