srv 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/srv.rb +1 -17
- data/lib/srv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f0c771b0f116f53d4f297f656ab350f78717ad3
|
4
|
+
data.tar.gz: 1a8eeb3e944d76703ce2de375f1a591d421bf172
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc1f9fcaab30e300b4db26506a0e32299c6f3861ccb45993b5b6fb7b687b0ef81978406d0d0201da7ffb4e090e0828763a2f0e39cbfad412356e58d90041ad49
|
7
|
+
data.tar.gz: d3d6df86c222f16090fe76ee29939b86fae51689f60f8a25100a0b74ab4ab8902bedc5908e8ca2a68a526ae12dd8568adf6ad7cd0e4ffd50710312e9a5538e4a
|
data/lib/srv.rb
CHANGED
@@ -8,7 +8,7 @@ module Srv
|
|
8
8
|
root = Dir.pwd
|
9
9
|
puts ">>> serving contents of directory: #{root}"
|
10
10
|
|
11
|
-
@rack_server = Rack::Server.new(:app =>
|
11
|
+
@rack_server = Rack::Server.new(:app => Rack::Directory.new(root),
|
12
12
|
:Port => port,
|
13
13
|
:AccessLog => [])
|
14
14
|
end
|
@@ -17,20 +17,4 @@ module Srv
|
|
17
17
|
@rack_server.start
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
21
|
-
class DirectoryWithIndex < Rack::Directory
|
22
|
-
def list_directory(path_info, path, script_name)
|
23
|
-
index, = Dir.glob(File.join(path, "index.htm*"))
|
24
|
-
if index
|
25
|
-
index_path_info = path_info
|
26
|
-
index_path_info += "/" unless path_info[-1] == "/"
|
27
|
-
index_path_info += File.basename index
|
28
|
-
altered_env = @env.dup
|
29
|
-
altered_env["PATH_INFO"] = index_path_info
|
30
|
-
@app.call(altered_env)
|
31
|
-
else
|
32
|
-
super(path_info, path, script_name)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
20
|
end
|
data/lib/srv/version.rb
CHANGED