Send browser images

How can web-server written on Ruby, send *.ico, *.jpg, *.bmp etc files
to browser.
I try:

...
server=TCPServer.new(80)
session=server.accept
request=session.gets

str=nil
File.open(page,"rb") do |sd|
    if str==nil then str=sd.sysread(1) else str+=sd.sysread(1) end
end

session.puts str
...

but it doesn't work.

···

--
Posted via http://www.ruby-forum.com/.

born in USSR wrote:

How can web-server written on Ruby, send *.ico, *.jpg, *.bmp etc files
to browser.
I try:

...
server=TCPServer.new(80)
session=server.accept
request=session.gets

str=nil
File.open(page,"rb") do |sd|
    if str==nil then str=sd.sysread(1) else str+=sd.sysread(1) end
end

session.puts str
...

but it doesn't work.

sorry, my question is very stupid, i understand that i read not full
file.

···

--
Posted via http://www.ruby-forum.com/.