ronin-web 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +25 -0
- data/Manifest.txt +36 -4
- data/README.txt +67 -64
- data/Rakefile +12 -3
- data/bin/ronin-web +1 -1
- data/lib/ronin/network/helpers/web.rb +221 -0
- data/lib/ronin/web.rb +1 -2
- data/lib/ronin/web/extensions.rb +0 -2
- data/lib/ronin/web/extensions/nokogiri.rb +0 -23
- data/lib/ronin/web/proxy.rb +3 -103
- data/lib/ronin/web/proxy/app.rb +31 -0
- data/lib/ronin/web/proxy/base.rb +41 -0
- data/lib/ronin/web/proxy/web.rb +42 -0
- data/lib/ronin/web/server.rb +3 -530
- data/lib/ronin/web/server/app.rb +31 -0
- data/lib/ronin/web/server/base.rb +334 -0
- data/lib/ronin/web/server/files.rb +92 -0
- data/lib/ronin/web/server/helpers.rb +25 -0
- data/lib/ronin/web/server/helpers/files.rb +126 -0
- data/lib/ronin/web/server/helpers/hosts.rb +72 -0
- data/lib/ronin/web/server/helpers/proxy.rb +153 -0
- data/lib/ronin/web/server/helpers/rendering.rb +36 -0
- data/lib/ronin/web/server/hosts.rb +86 -0
- data/lib/ronin/web/server/proxy.rb +116 -0
- data/lib/ronin/web/server/web.rb +62 -0
- data/lib/ronin/web/spider.rb +53 -26
- data/lib/ronin/web/version.rb +1 -3
- data/lib/ronin/web/web.rb +253 -95
- data/spec/spec_helper.rb +1 -1
- data/spec/web/proxy/base_spec.rb +9 -0
- data/spec/web/server/base_spec.rb +86 -0
- data/spec/web/server/classes/files/dir/file.txt +1 -0
- data/spec/web/server/classes/files/dir/index.html +1 -0
- data/spec/web/server/classes/files/dir2/file2.txt +1 -0
- data/spec/web/server/classes/files/dir3/page.xml +4 -0
- data/spec/web/server/classes/files/file.txt +1 -0
- data/spec/web/server/classes/files_app.rb +27 -0
- data/spec/web/server/classes/hosts_app.rb +40 -0
- data/spec/web/server/classes/proxy_app.rb +45 -0
- data/spec/web/server/classes/public1/static1.txt +1 -0
- data/spec/web/server/classes/public2/static2.txt +1 -0
- data/spec/web/server/classes/sub_app.rb +13 -0
- data/spec/web/server/classes/test_app.rb +20 -0
- data/spec/web/server/files_spec.rb +74 -0
- data/spec/web/server/helpers/server.rb +42 -0
- data/spec/web/server/hosts_spec.rb +55 -0
- data/spec/web/server/proxy_spec.rb +49 -0
- data/tasks/spec.rb +1 -0
- data/tasks/yard.rb +13 -0
- metadata +76 -17
- metadata.gz.sig +0 -0
- data/TODO.txt +0 -7
- data/lib/ronin/sessions/web.rb +0 -80
- data/lib/ronin/web/fingerprint.rb +0 -76
- data/spec/web/server_spec.rb +0 -142
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'ronin/web/server/helpers/proxy'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'web/server/helpers/server'
|
5
|
+
require 'web/server/classes/proxy_app'
|
6
|
+
|
7
|
+
describe Web::Server::Helpers::Proxy do
|
8
|
+
include Helpers::Web::Server
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
self.app = ProxyApp
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should allow the proxying of requests for certain routes" do
|
15
|
+
get_host '/', 'www.example.com'
|
16
|
+
|
17
|
+
last_response.should be_ok
|
18
|
+
last_response.body.should =~ /RFC\s+2606/
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should allow overriding the headers of proxied requests" do
|
22
|
+
get '/reddit/erlang'
|
23
|
+
|
24
|
+
last_response.should be_ok
|
25
|
+
last_response.body.should =~ /Erlang/
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should allow modification of proxied responses" do
|
29
|
+
get_host '/r/erlang', 'www.reddit.com'
|
30
|
+
|
31
|
+
last_response.should be_ok
|
32
|
+
last_response.body.should_not =~ /erlang/i
|
33
|
+
last_response.body.should =~ /Fixed Gear Bicycle/
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should allow modification of proxied HTML documents" do
|
37
|
+
get_host '/r/ruby', 'www.reddit.com'
|
38
|
+
|
39
|
+
last_response.should be_ok
|
40
|
+
last_response.body.should_not =~ /rails/i
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should allow modification of proxied XML documents" do
|
44
|
+
get_host '/rss.php', 'milw0rm.com'
|
45
|
+
|
46
|
+
last_response.should be_ok
|
47
|
+
last_response.body.should_not =~ /(XSS|SQLi|SQL\s+Injection)/i
|
48
|
+
end
|
49
|
+
end
|
data/tasks/spec.rb
CHANGED
data/tasks/yard.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
pDj+ws7QjtH/Qcrr1l9jfN0ehDs=
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2009-
|
33
|
+
date: 2009-09-25 00:00:00 -07:00
|
34
34
|
default_executable:
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.9.
|
44
|
+
version: 0.9.3
|
45
45
|
version:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: spidr
|
@@ -54,14 +54,14 @@ dependencies:
|
|
54
54
|
version: 0.1.9
|
55
55
|
version:
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: sinatra
|
58
58
|
type: :runtime
|
59
59
|
version_requirement:
|
60
60
|
version_requirements: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
64
|
+
version: 0.9.4
|
65
65
|
version:
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
67
|
name: ronin
|
@@ -71,7 +71,37 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
74
|
+
version: 0.3.0
|
75
|
+
version:
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: rspec
|
78
|
+
type: :development
|
79
|
+
version_requirement:
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.2.8
|
85
|
+
version:
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: test-unit
|
88
|
+
type: :development
|
89
|
+
version_requirement:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.2.3
|
95
|
+
version:
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rack-test
|
98
|
+
type: :development
|
99
|
+
version_requirement:
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.4.1
|
75
105
|
version:
|
76
106
|
- !ruby/object:Gem::Dependency
|
77
107
|
name: hoe
|
@@ -81,15 +111,15 @@ dependencies:
|
|
81
111
|
requirements:
|
82
112
|
- - ">="
|
83
113
|
- !ruby/object:Gem::Version
|
84
|
-
version: 2.3.
|
114
|
+
version: 2.3.3
|
85
115
|
version:
|
86
116
|
description: |-
|
87
117
|
Ronin Web is a Ruby library for Ronin that provides support for web
|
88
118
|
scraping and spidering functionality.
|
89
119
|
|
90
|
-
Ronin is a Ruby platform
|
91
|
-
|
92
|
-
|
120
|
+
Ronin is a Ruby platform for exploit development and security research.
|
121
|
+
Ronin allows for the rapid development and distribution of code, exploits
|
122
|
+
or payloads over many common Source-Code-Management (SCM) systems.
|
93
123
|
email:
|
94
124
|
- postmodern.mod3@gmail.com
|
95
125
|
executables:
|
@@ -100,15 +130,12 @@ extra_rdoc_files:
|
|
100
130
|
- History.txt
|
101
131
|
- Manifest.txt
|
102
132
|
- README.txt
|
103
|
-
- TODO.txt
|
104
133
|
files:
|
105
134
|
- History.txt
|
106
135
|
- Manifest.txt
|
107
136
|
- README.txt
|
108
|
-
- TODO.txt
|
109
137
|
- Rakefile
|
110
138
|
- bin/ronin-web
|
111
|
-
- lib/ronin/sessions/web.rb
|
112
139
|
- lib/ronin/web.rb
|
113
140
|
- lib/ronin/web/extensions.rb
|
114
141
|
- lib/ronin/web/extensions/nokogiri.rb
|
@@ -118,20 +145,52 @@ files:
|
|
118
145
|
- lib/ronin/web/extensions/nokogiri/xml/attr.rb
|
119
146
|
- lib/ronin/web/extensions/nokogiri/xml/element.rb
|
120
147
|
- lib/ronin/web/extensions/nokogiri/xml/document.rb
|
121
|
-
- lib/ronin/web/fingerprint.rb
|
122
148
|
- lib/ronin/web/server.rb
|
149
|
+
- lib/ronin/web/server/helpers.rb
|
150
|
+
- lib/ronin/web/server/helpers/rendering.rb
|
151
|
+
- lib/ronin/web/server/helpers/files.rb
|
152
|
+
- lib/ronin/web/server/helpers/hosts.rb
|
153
|
+
- lib/ronin/web/server/helpers/proxy.rb
|
154
|
+
- lib/ronin/web/server/base.rb
|
155
|
+
- lib/ronin/web/server/files.rb
|
156
|
+
- lib/ronin/web/server/hosts.rb
|
157
|
+
- lib/ronin/web/server/proxy.rb
|
158
|
+
- lib/ronin/web/server/app.rb
|
159
|
+
- lib/ronin/web/server/web.rb
|
123
160
|
- lib/ronin/web/proxy.rb
|
161
|
+
- lib/ronin/web/proxy/base.rb
|
162
|
+
- lib/ronin/web/proxy/app.rb
|
163
|
+
- lib/ronin/web/proxy/web.rb
|
124
164
|
- lib/ronin/web/spider.rb
|
125
165
|
- lib/ronin/web/web.rb
|
126
166
|
- lib/ronin/web/version.rb
|
167
|
+
- lib/ronin/network/helpers/web.rb
|
127
168
|
- tasks/spec.rb
|
169
|
+
- tasks/yard.rb
|
128
170
|
- spec/spec_helper.rb
|
129
171
|
- spec/web/helpers/server.rb
|
130
172
|
- spec/web/helpers/root/index.html
|
131
173
|
- spec/web/helpers/root/test.txt
|
132
174
|
- spec/web/extensions/nokogiri_spec.rb
|
133
|
-
- spec/web/
|
134
|
-
|
175
|
+
- spec/web/server/classes/public1/static1.txt
|
176
|
+
- spec/web/server/classes/public2/static2.txt
|
177
|
+
- spec/web/server/classes/files/dir/file.txt
|
178
|
+
- spec/web/server/classes/files/dir/index.html
|
179
|
+
- spec/web/server/classes/files/dir2/file2.txt
|
180
|
+
- spec/web/server/classes/files/dir3/page.xml
|
181
|
+
- spec/web/server/classes/files/file.txt
|
182
|
+
- spec/web/server/classes/sub_app.rb
|
183
|
+
- spec/web/server/classes/test_app.rb
|
184
|
+
- spec/web/server/classes/files_app.rb
|
185
|
+
- spec/web/server/classes/hosts_app.rb
|
186
|
+
- spec/web/server/classes/proxy_app.rb
|
187
|
+
- spec/web/server/helpers/server.rb
|
188
|
+
- spec/web/server/base_spec.rb
|
189
|
+
- spec/web/server/files_spec.rb
|
190
|
+
- spec/web/server/hosts_spec.rb
|
191
|
+
- spec/web/server/proxy_spec.rb
|
192
|
+
- spec/web/proxy/base_spec.rb
|
193
|
+
has_rdoc: yard
|
135
194
|
homepage: http://ronin.rubyforge.org/web/
|
136
195
|
licenses: []
|
137
196
|
|
@@ -156,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
215
|
requirements: []
|
157
216
|
|
158
217
|
rubyforge_project: ronin
|
159
|
-
rubygems_version: 1.3.
|
218
|
+
rubygems_version: 1.3.5
|
160
219
|
signing_key:
|
161
220
|
specification_version: 3
|
162
221
|
summary: Ronin Web is a Ruby library for Ronin that provides support for web scraping and spidering functionality
|
metadata.gz.sig
CHANGED
Binary file
|
data/TODO.txt
DELETED
data/lib/ronin/sessions/web.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
#
|
2
|
-
#--
|
3
|
-
# Ronin Web - A Ruby library for Ronin that provides support for web
|
4
|
-
# scraping and spidering functionality.
|
5
|
-
#
|
6
|
-
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
|
-
#
|
8
|
-
# This program is free software; you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU General Public License as published by
|
10
|
-
# the Free Software Foundation; either version 2 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# This program is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with this program; if not, write to the Free Software
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
|
-
#
|
23
|
-
|
24
|
-
require 'ronin/sessions/session'
|
25
|
-
require 'ronin/web/web'
|
26
|
-
|
27
|
-
module Ronin
|
28
|
-
module Sessions
|
29
|
-
module Web
|
30
|
-
include Session
|
31
|
-
|
32
|
-
setup_session do
|
33
|
-
parameter :web_proxy,
|
34
|
-
:default => lambda { Ronin::Web.proxy },
|
35
|
-
:description => 'Web Proxy'
|
36
|
-
|
37
|
-
parameter :web_user_agent,
|
38
|
-
:default => lambda { Ronin::Web.user_agent },
|
39
|
-
:description => 'Web User-Agent'
|
40
|
-
end
|
41
|
-
|
42
|
-
protected
|
43
|
-
|
44
|
-
def web_agent(options={},&block)
|
45
|
-
options[:proxy] ||= @web_proxy
|
46
|
-
options[:user_agent] ||= @web_user_agent
|
47
|
-
|
48
|
-
return Ronin::Web.agent(options,&block)
|
49
|
-
end
|
50
|
-
|
51
|
-
def web_get(uri,options={},&block)
|
52
|
-
page = web_agent(options).get(uri)
|
53
|
-
|
54
|
-
block.call(page) if block
|
55
|
-
return page
|
56
|
-
end
|
57
|
-
|
58
|
-
def web_get_body(uri,options={},&block)
|
59
|
-
body = web_agent(options).get(uri).body
|
60
|
-
|
61
|
-
block.call(body) if block
|
62
|
-
return body
|
63
|
-
end
|
64
|
-
|
65
|
-
def web_post(uri,options={},&block)
|
66
|
-
page = web_agent(options).post(uri)
|
67
|
-
|
68
|
-
block.call(page) if block
|
69
|
-
return page
|
70
|
-
end
|
71
|
-
|
72
|
-
def web_post_body(uri,options={},&block)
|
73
|
-
body = web_agent(options).post(uri).body
|
74
|
-
|
75
|
-
block.call(body) if block
|
76
|
-
return body
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
#
|
2
|
-
#--
|
3
|
-
# Ronin Web - A Ruby library for Ronin that provides support for web
|
4
|
-
# scraping and spidering functionality.
|
5
|
-
#
|
6
|
-
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
|
-
#
|
8
|
-
# This program is free software; you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU General Public License as published by
|
10
|
-
# the Free Software Foundation; either version 2 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# This program is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with this program; if not, write to the Free Software
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
|
-
#
|
23
|
-
|
24
|
-
module Ronin
|
25
|
-
module Web
|
26
|
-
module Fingerprint
|
27
|
-
#
|
28
|
-
# The Hash of web application identities and their associated
|
29
|
-
# fingerprint tests.
|
30
|
-
#
|
31
|
-
def Fingerprint.tests
|
32
|
-
@@ronin_web_fingerprints ||= Hash.new do |hash,key|
|
33
|
-
hash[key] ||= []
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
#
|
38
|
-
# Adds a test for the web application identity with the specified
|
39
|
-
# _name_ and _block_. When the _block_ is called, it will be passed
|
40
|
-
# the URL of the unknown web application.
|
41
|
-
#
|
42
|
-
# Fingerprint.test_for('app') do |url|
|
43
|
-
# url.path.include?('/app/')
|
44
|
-
# end
|
45
|
-
#
|
46
|
-
def Fingerprint.test_for(name,&block)
|
47
|
-
Fingerprint.tests[name.to_sym] << block
|
48
|
-
return nil
|
49
|
-
end
|
50
|
-
|
51
|
-
#
|
52
|
-
# Identifies the web application represented by the specified _url_,
|
53
|
-
# returning the name of identified web application. If the
|
54
|
-
# web application cannot be identified, +nil+ will be returned.
|
55
|
-
#
|
56
|
-
def Fingerprint.identify(url)
|
57
|
-
unless url.kind_of?(URI)
|
58
|
-
url = URI(url.to_s)
|
59
|
-
end
|
60
|
-
|
61
|
-
matches = []
|
62
|
-
|
63
|
-
Fingerprint.tests.each do |name,blocks|
|
64
|
-
blocks.each do |block|
|
65
|
-
if block.call(url)
|
66
|
-
matches << name
|
67
|
-
break
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
return matches
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
data/spec/web/server_spec.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
require 'ronin/web/server'
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'web/helpers/server'
|
5
|
-
|
6
|
-
describe Web::Server do
|
7
|
-
before(:all) do
|
8
|
-
@server = Web::Server.new do |server|
|
9
|
-
server.default do |env|
|
10
|
-
server.response('This is default.')
|
11
|
-
end
|
12
|
-
|
13
|
-
server.bind('/test/bind.xml') do |env|
|
14
|
-
server.response('<secret/>', :content_type => 'text/xml')
|
15
|
-
end
|
16
|
-
|
17
|
-
server.paths_like(/path_patterns\/secret\./) do |env|
|
18
|
-
server.response('No secrets here.')
|
19
|
-
end
|
20
|
-
|
21
|
-
server.map('/test/map') do |env|
|
22
|
-
server.response('mapped')
|
23
|
-
end
|
24
|
-
|
25
|
-
server.file('/test/file.txt',File.join(WEB_SERVER_ROOT,'test.txt'))
|
26
|
-
|
27
|
-
server.directory('/test/directory/',WEB_SERVER_ROOT)
|
28
|
-
end
|
29
|
-
|
30
|
-
@vhost = Web::Server.new do |vhost|
|
31
|
-
vhost.bind('/test/virtual_host.xml') do |env|
|
32
|
-
vhost.response('<virtual/>', :content_type => 'text/xml')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
@server.host('virtual.host.com') do |vhost|
|
37
|
-
vhost.bind('/test/virtual_host.xml') do |env|
|
38
|
-
vhost.response('<virtual/>', :content_type => 'text/xml')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
@server.hosts_like(/^virtual[0-9]\./) do |vhost|
|
43
|
-
vhost.bind('/test/virtual_host_patterns.xml') do |env|
|
44
|
-
vhost.response('<virtual-patterns/>', :content_type => 'text/xml')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should have a default host to listen on" do
|
50
|
-
Web::Server.default_host.should_not be_nil
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should have a default port to listen on" do
|
54
|
-
Web::Server.default_port.should_not be_nil
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should have built-in content types" do
|
58
|
-
Web::Server.content_types.should_not be_empty
|
59
|
-
end
|
60
|
-
|
61
|
-
it "should map file extensions to content-types" do
|
62
|
-
@server.content_type('html').should == 'text/html'
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should have a default content-type for unknown files" do
|
66
|
-
@server.content_type('lol').should == 'application/x-unknown-content-type'
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should find the index file for a directory" do
|
70
|
-
dir = WEB_SERVER_ROOT
|
71
|
-
|
72
|
-
@server.index_of(dir).should == File.join(dir,'index.html')
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should have a default response for un-matched paths" do
|
76
|
-
path = '/test/default'
|
77
|
-
|
78
|
-
get_path(@server,path).body.should == ['This is default.']
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should bind a path to a certain response" do
|
82
|
-
path = '/test/bind.xml'
|
83
|
-
|
84
|
-
get_path(@server,path).body.should == ['<secret/>']
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should match paths with patterns" do
|
88
|
-
path = '/test/path_patterns/secret.pdf'
|
89
|
-
|
90
|
-
get_path(@server,path).body.should == ['No secrets here.']
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should match paths to sub-directories" do
|
94
|
-
path = '/test/map/impossible.html'
|
95
|
-
|
96
|
-
get_path(@server,path).body.should == ['mapped']
|
97
|
-
end
|
98
|
-
|
99
|
-
it "should return a response for a file" do
|
100
|
-
path = '/test/file.txt'
|
101
|
-
|
102
|
-
get_path(@server,path).body.should == ["This is a test.\n"]
|
103
|
-
end
|
104
|
-
|
105
|
-
it "should return files from bound directories" do
|
106
|
-
path = '/test/directory/test.txt'
|
107
|
-
|
108
|
-
get_path(@server,path).body.should == ["This is a test.\n"]
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should return the index file for a bound directory" do
|
112
|
-
path = '/test/directory/'
|
113
|
-
|
114
|
-
get_path(@server,path).body.should == ["Index of files.\n"]
|
115
|
-
end
|
116
|
-
|
117
|
-
it "should match virtual hosts" do
|
118
|
-
url = 'http://virtual.host.com/test/virtual_host.xml'
|
119
|
-
|
120
|
-
get_url(@server,url).body.should == ['<virtual/>']
|
121
|
-
end
|
122
|
-
|
123
|
-
it "should match virtual hosts with patterns" do
|
124
|
-
url = 'http://virtual0.host.com/test/virtual_host_patterns.xml'
|
125
|
-
|
126
|
-
get_url(@server,url).body.should == ['<virtual-patterns/>']
|
127
|
-
end
|
128
|
-
|
129
|
-
it "should provide access to servers via their host-names" do
|
130
|
-
virtual_host = @server.vhost('virtual.host.com')
|
131
|
-
url = 'http://virtual.host.com/test/virtual_host.xml'
|
132
|
-
|
133
|
-
get_url(virtual_host,url).body.should == ['<virtual/>']
|
134
|
-
end
|
135
|
-
|
136
|
-
it "should provide access to servers via their host-names that match virtual host patterns" do
|
137
|
-
virtual_host = @server.vhost('virtual1.host.com')
|
138
|
-
url = 'http://virtual0.host.com/test/virtual_host_patterns.xml'
|
139
|
-
|
140
|
-
get_url(virtual_host,url).body.should == ['<virtual-patterns/>']
|
141
|
-
end
|
142
|
-
end
|