Write everything from scratch

 #! /usr/bin/ruby
 # -*- coding: euc-jp -*-
 # リクエスト解析
 method = ENV['REQUEST_METHOD']
  if method == 'GET' then
  data = ENV['QUERY_STRING']
 elsif method == 'POST' then
  data = STDIN.read(ENV['CONTENT_LENGTH'].to_i)
 end
 # エスケープ文字解決 / 計算実行
 data =~ /exp=(.*)$/
 exp = $1.sub(/%(..)/){ [$1].pack('H*') 
 result = eval(exp)
 # 結果を出力
 print "Content-type: text/plain\r\n\r\n"
 print "#{result}\r\n"