lib/pitchfork/http_parser.rb in pitchfork-0.12.0 vs lib/pitchfork/http_parser.rb in pitchfork-0.13.0
- old
+ new
@@ -1,6 +1,7 @@
# -*- encoding: binary -*-
+# frozen_string_literal: true
# :enddoc:
# no stable API here
module Pitchfork
class HttpParser
@@ -17,14 +18,14 @@
# this is not in the Rack spec, but some apps may rely on it
"SERVER_SOFTWARE" => "Pitchfork #{Pitchfork::Const::UNICORN_VERSION}"
}
- NULL_IO = StringIO.new("")
+ NULL_IO = StringIO.new.binmode
# :stopdoc:
- HTTP_RESPONSE_START = [ 'HTTP'.freeze, '/1.1 '.freeze ]
+ HTTP_RESPONSE_START = [ 'HTTP', '/1.1 ' ]
EMPTY_ARRAY = [].freeze
@@input_class = Pitchfork::TeeInput
@@check_client_connection = false
@@tcpi_inspect_ok = Socket.const_defined?(:TCP_INFO)
@@ -102,11 +103,11 @@
hijacked!
env['rack.hijack_io'] = env['pitchfork.socket']
end
def hijacked?
- env.include?('rack.hijack_io'.freeze)
+ env.include?('rack.hijack_io')
end
if Raindrops.const_defined?(:TCP_Info)
TCPI = Raindrops::TCP_Info.allocate
@@ -197,14 +198,14 @@
vals.each do |val|
val.strip!
val.downcase!
end
- if vals.pop == 'chunked'.freeze
- return true unless vals.include?('chunked'.freeze)
+ if vals.pop == 'chunked'
+ return true unless vals.include?('chunked')
raise Pitchfork::HttpParserError, 'double chunked', []
end
- return false unless vals.include?('chunked'.freeze)
+ return false unless vals.include?('chunked')
raise Pitchfork::HttpParserError, 'chunked not last', []
end
end
end