servedir 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +30 -0
- data/bin/servedir +10 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -10,6 +10,18 @@ Ruby 1.8.7, Ruby 1.9.3 and JRuby.
|
|
10
10
|
This program will not try to open ports on the NAT gateway: it expects ports
|
11
11
|
to be already configured in the proper way.
|
12
12
|
|
13
|
+
|
14
|
+
Installation
|
15
|
+
------------
|
16
|
+
|
17
|
+
`servedir` do not require installation, it is a single standalone executable
|
18
|
+
script.
|
19
|
+
|
20
|
+
However, if desired, it is possible to install `servedir` via RubyGems:
|
21
|
+
|
22
|
+
$ gem install servedir
|
23
|
+
|
24
|
+
|
13
25
|
Usage
|
14
26
|
-----
|
15
27
|
|
@@ -45,12 +57,30 @@ From another computer:
|
|
45
57
|
at localhost:13428
|
46
58
|
|
47
59
|
|
60
|
+
Private files
|
61
|
+
-------------
|
62
|
+
|
63
|
+
It is possible to block access to private files and also hide them from the
|
64
|
+
directory listing. The list of private files must resides a file named
|
65
|
+
`.private` in the served directory; each line must be either a file name or a
|
66
|
+
glob pattern.
|
67
|
+
|
68
|
+
|
48
69
|
Authors
|
49
70
|
-------
|
50
71
|
|
51
72
|
* Gioele Barabucci <http://svario.it/gioele>
|
52
73
|
|
53
74
|
|
75
|
+
Acknowledgements
|
76
|
+
----------------
|
77
|
+
|
78
|
+
The external IP is retrieved via the [whatismyip.com](http://whatismyip.com)
|
79
|
+
automation service. Please read and follow the
|
80
|
+
[rules concerning automated retrieval](http://www.whatismyip.com/faq/automation.asp);
|
81
|
+
do not abuse their service.
|
82
|
+
|
83
|
+
|
54
84
|
License
|
55
85
|
-------
|
56
86
|
|
data/bin/servedir
CHANGED
@@ -7,6 +7,7 @@ require 'open-uri'
|
|
7
7
|
require 'webrick'
|
8
8
|
|
9
9
|
IP_DISCO_SERVICE = 'http://automation.whatismyip.com/n09230945.asp'
|
10
|
+
PRIVATE_LIST_FILE = '.private'
|
10
11
|
MAX_PORT = 2**16
|
11
12
|
|
12
13
|
def check_args(dir, port)
|
@@ -41,8 +42,17 @@ def start_server(dir, port)
|
|
41
42
|
config = {
|
42
43
|
:DocumentRoot => dir,
|
43
44
|
:Port => port,
|
45
|
+
:DocumentRootOptions => { :FancyIndexing => true },
|
44
46
|
}
|
45
47
|
|
48
|
+
private_list_file = File.join(dir, PRIVATE_LIST_FILE)
|
49
|
+
if File.exist?(private_list_file)
|
50
|
+
patterns = File.readlines(private_list_file).map(&:strip)
|
51
|
+
ignored_files = patterns
|
52
|
+
ignored_files << PRIVATE_LIST_FILE
|
53
|
+
config[:DocumentRootOptions][:NondisclosureName] = ignored_files
|
54
|
+
end
|
55
|
+
|
46
56
|
server = WEBrick::HTTPServer.new(config)
|
47
57
|
|
48
58
|
['INT', 'TERM'].each { |signal|
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servedir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 2
|
9
|
+
version: "0.2"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Gioele Barabucci
|
@@ -62,7 +62,7 @@ rubyforge_project:
|
|
62
62
|
rubygems_version: 1.8.16
|
63
63
|
signing_key:
|
64
64
|
specification_version: 3
|
65
|
-
summary:
|
65
|
+
summary: serve a directory over HTTP from behind NAT
|
66
66
|
test_files: []
|
67
67
|
|
68
68
|
has_rdoc:
|