Class: Mongrel::HttpResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/never_block/servers/mongrel.rb

Instance Method Summary collapse

Instance Method Details

#close_connection_after_writingObject



195
196
197
# File 'lib/never_block/servers/mongrel.rb', line 195

def close_connection_after_writing
	@socket.close_connection_after_writing
end

#finishedObject



205
206
207
208
209
210
# File 'lib/never_block/servers/mongrel.rb', line 205

def finished
	send_status
	send_header
	send_body
	@socket.close_connection_after_writing
end

#send_file(path, small_file = false) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/never_block/servers/mongrel.rb', line 178

def send_file(path, small_file = false)
	File.open(path, "rb") do |f|
		while chunk = f.read(Const::CHUNK_SIZE) and chunk.length > 0
			begin
				write(chunk)
			rescue Object => exc
				break
			end
		end
	end
	@body_sent = true
end

#socket_error(details) ⇒ Object



199
200
201
202
203
# File 'lib/never_block/servers/mongrel.rb', line 199

def socket_error(details)
	@socket.close_connection
	done = true
	raise details
end

#write(data) ⇒ Object



191
192
193
# File 'lib/never_block/servers/mongrel.rb', line 191

def write(data)
	@socket.send_data data
end