Only in shttpsrv-p: CVS diff -c shttpsrv-1.0.4/conf.rb shttpsrv-p/conf.rb *** shttpsrv-1.0.4/conf.rb Tue Sep 29 13:58:28 1998 --- shttpsrv-p/conf.rb Thu Dec 10 01:07:59 1998 *************** *** 28,33 **** --- 28,45 ---- ["/img/", ServerRoot+"/img/"] ] + # servlet alias + # format : [virtual, require, module] + ServletAlias = [ + ['/rb/testserv/', 'testserv.rb', 'TestServ'], + # requrie 'testserv.rb' + # TestServ.service(param) + # TestServ.service_ssi(param, file) + ['counter', 'testserv.rb', 'Counter'], # SSI + ['modified', 'testserv.rb', 'Modified'], # SSI + ['/tinyyahoo/', 'tinyyahoo.rb', 'TinyYahoo'] + ] + # directory aliases for executable scripts ScriptAlias = [ ["/cgi-bin/", ServerRoot+"/cgi-bin/"], *************** *** 88,94 **** #LogFile = "shttpsrv.log" # set it FALSE, if the machine stands alone (recieve no DNS service) ! #Offline = TRUE # HTTP PROXY # To activate proxy function --- 100,106 ---- #LogFile = "shttpsrv.log" # set it FALSE, if the machine stands alone (recieve no DNS service) ! Offline = TRUE # HTTP PROXY # To activate proxy function Common subdirectories: shttpsrv-1.0.4/omake and shttpsrv-p/omake Common subdirectories: shttpsrv-1.0.4/sample and shttpsrv-p/sample diff -c shttpsrv-1.0.4/shttpsrv.rb shttpsrv-p/shttpsrv.rb *** shttpsrv-1.0.4/shttpsrv.rb Tue Sep 29 13:52:25 1998 --- shttpsrv-p/shttpsrv.rb Thu Dec 10 01:08:00 1998 *************** *** 223,228 **** --- 223,239 ---- nil end + def set_servlet + for servlet_dir in ServletAlias + if @target =~ /^#{servlet_dir[0]}(.*)/ + if servlet_dir.size == 3 + return [servlet_dir, $1] + end + end + end + nil + end + def ssi?(fname) return nil unless defined? SSIhtml SSIhtml.each do |ext| *************** *** 601,606 **** --- 612,678 ---- [heads, body] end + def do_servlet(t) + servlet_dir, param = t + req = "require '#{servlet_dir[1]}'" + servlet = servlet_dir[2] + script = "#{servlet}.service(param)" + heads, data = [], '' + begin + $m.synchronize do + eval(req) + end + data = eval(script) + cgimsg = Rfc822h.new(data) + location = cgimsg['Location'] + heads1, body = cgimsg.header, cgimsg.body + if location + if location =~ /http:\/\// + heads << "HTTP/1.0 302 Found" + else + throw(:aloc, location) + end + else + heads << "HTTP/1.0 200 Script output follows" + end + heads << "Content-length: #{body.length}" + heads << ("Date: " + strdate()) + rescue + print "Error(Servlet): #$!\n" + print $@.join("\n"), "\n" if $debug + heads1, body = [], "