Class: TestHttpClient::EmptyContent

Inherits:
EventMachine::Connection show all
Defined in:
lib/ext/eventmachine-0.12.10/tests/test_httpclient.rb

Overview

Test a server that returns a page with a zero content-length. This caused an early version of the HTTP client not to generate a response, causing this test to hang. Observe, there was no problem with responses lacking a content-length, just when the content-length was zero.

Instance Attribute Summary

Attributes inherited from EventMachine::Connection

#signature

Instance Method Summary collapse

Methods inherited from EventMachine::Connection

#associate_callback_target, #close_connection, #close_connection_after_writing, #comm_inactivity_timeout, #comm_inactivity_timeout=, #connection_completed, #detach, #error?, #get_outbound_data_size, #get_peer_cert, #get_peername, #get_pid, #get_sock_opt, #get_sockname, #get_status, new, #notify_readable=, #notify_readable?, #notify_writable=, #notify_writable?, #pause, #paused?, #pending_connect_timeout, #pending_connect_timeout=, #post_init, #proxy_incoming_to, #proxy_target_unbound, #reconnect, #resume, #send_data, #send_datagram, #send_file_data, #set_comm_inactivity_timeout, #set_pending_connect_timeout, #ssl_handshake_completed, #ssl_verify_peer, #start_tls, #stop_proxying, #stream_file_data, #unbind

Constructor Details

#initialize(*args) ⇒ EmptyContent

Returns a new instance of EmptyContent.



93
94
95
# File 'lib/ext/eventmachine-0.12.10/tests/test_httpclient.rb', line 93

def initialize *args
  super
end

Instance Method Details

#receive_data(data) ⇒ Object



96
97
98
99
# File 'lib/ext/eventmachine-0.12.10/tests/test_httpclient.rb', line 96

def receive_data data
  send_data "HTTP/1.0 404 ...\r\nContent-length: 0\r\n\r\n"
  close_connection_after_writing
end