Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 13 lines (12 sloc) 356 Bytes
# Simple Webserver in Ruby
# author: Anil Wadghule
require 'socket'
port = ARGV[0] || '3002'.to_i
server ='localhost', port)
while (sess = server.accept)
puts "Request: #{sess.gets}"
sess.print "HTTP/1.1 200/OK\r\nContent-type: text/html\r\n\r\n"
sess.print "<html><body><h1>#{}</h1></body></html>\r\n"
Something went wrong with that request. Please try again.