Send browser images

B

born in USSR

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.
 
B

born in USSR

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

but it doesn't work.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top