public
Fork of KirinDave/fuzed
Description: A new revision of Fuzed, the Erlang-based frontend for web apps.
Clone URL: git://github.com/mojombo/fuzed.git
Search Repo:
do not munge PATH_INFO and cleanup rails node
mojombo (author)
Sun May 11 17:30:40 -0700 2008
commit  e9db1600a675c78c970ecde8da2fc3ec8f83f3e2
tree    5073e5ef005b3b2dfac2612b3fe5c32e975fbed3
parent  7a31d04b79501e964321222077a5bd630cf5bebe
...
 
 
 
1
2
3
...
9
10
11
12
13
 
14
15
16
17
18
19
 
20
21
22
23
24
 
25
26
27
28
 
 
 
 
29
30
31
...
59
60
61
62
 
63
64
65
...
183
184
185
186
187
 
...
1
2
3
4
5
6
...
12
13
14
 
 
15
16
17
18
19
20
21
22
23
24
25
 
 
26
27
28
29
30
31
32
33
34
35
36
37
...
65
66
67
 
68
69
70
71
...
189
190
191
 
192
193
0
@@ -1,3 +1,6 @@
0
+TESTMODE = false
0
+LOG = true
0
+
0
 # core
0
 require 'stringio'
0
 require 'logger'
0
@@ -9,23 +12,26 @@ require 'rails_adapter'
0
 # gems
0
 require 'rack'
0
 
0
-TESTMODE = false
0
-
0
+# get rails root dir
0
 if TESTMODE
0
   rails_root = File.join(File.dirname(__FILE__), *%w[.. test app])
0
 else
0
   rails_root = ARGV[0] || File.join(File.dirname(__FILE__), *%w[.. test app])
0
 end
0
 
0
+# load Rails
0
 require File.join(rails_root, 'config/boot')
0
 require RAILS_ROOT + "/config/environment"
0
 
0
-LOG = true
0
-
0
+# initialize logging info
0
 $total_avg = [0, 0]
0
 $rails_avg = [0, 0]
0
 $logger = Logger.new(RAILS_ROOT + "/log/fuzed.#{Process.pid}.log")
0
 
0
+# Log the given message
0
+# +msg+ is the message to log
0
+#
0
+# Returns nothing
0
 def log(msg)
0
   $logger << msg + "\n"
0
 end
0
@@ -59,7 +65,7 @@ def service(request)
0
   env = {}
0
   env['REQUEST_METHOD'] = method.to_s
0
   env['QUERY_STRING'] = query
0
- env["PATH_INFO"] = path == '/' ? '' : path
0
+ env["PATH_INFO"] = path
0
   env = headers.inject(env) { |a, x| a[translate[x[0]] || x[0].to_s] = x[1]; a }
0
   env.delete_if { |k, v| v.nil? }
0
   
0
@@ -183,4 +189,4 @@ if TESTMODE
0
   p service(req)
0
   p service(req)
0
   exit!
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.