Method: Excon::Middleware::Hijack#response_call
- Defined in:
- lib/excon/middlewares/hijack.rb
#response_call(datum) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/excon/middlewares/hijack.rb', line 28 def response_call(datum) if datum[:hijack_block] # Need to process the response headers here rather than in # Excon::Middleware::ResponseParser as the response parser will # block trying to read the body. socket = datum[:connection].send(:socket) # c.f. Excon::Response.parse until match = /^HTTP\/\d+\.\d+\s(\d{3})\s/.match(socket.readline); end status = match[1].to_i datum[:response] = build_response(status, socket) Excon::Response.parse_headers(socket, datum) datum[:hijack_block].call socket.instance_variable_get(:@socket) end @stack.response_call(datum) end |