mongrel2 0.42.0 → 0.43.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -1
- data.tar.gz.sig +0 -0
- data/History.rdoc +7 -0
- data/lib/mongrel2.rb +2 -2
- data/lib/mongrel2/config/route.rb +5 -0
- data/lib/mongrel2/request.rb +16 -6
- data/spec/mongrel2/request_spec.rb +33 -21
- metadata +5 -5
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12160066fe026f98304d28971ff0b2e226fd79e9
|
4
|
+
data.tar.gz: 0139d54e247c836355752a2e83f30d5242b963cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 920463a4faef21f95e5c59acb5d0711dbca704c3a58ca1d58fe7c2e441fab2066acf9e9845d807d28fce13e8ad6aae7f952ae841f33a0629ad02e937b0ebf7c9
|
7
|
+
data.tar.gz: 1b8f9649334fafabeac082c4756e300983ea3edbb3138a1e7f46beae032269045bd3606d4df00175dea17a0564ebb7f3665da1ca037b9653472e072e25db870a
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
'�����ѲH&ٔ���XUO$M<
|
2
|
+
�jB�wR*�q��̓�$cS���KbSj%��$��Ii<tx��։�m����RhҬC.®p�5�Xą6���&�!��(�:�����]��;~����!��E��K��2^ڊ�Q��>W��#��8������HA�O8�r���ח0 �+��=+��k+<��UȊHR=vS��y�^r�;#0��?I�8�O*��K�y�u�|zr�w$>��������:/�۸Z�3�_a��
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== v0.43.0 [2014-12-17] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
- Add a Mongrel2::Request#server_chroot
|
4
|
+
Used to qualify filesystem paths relative to Mongrel's chroot for
|
5
|
+
sendfile, async upload, etc.
|
6
|
+
|
7
|
+
|
1
8
|
== v0.42.0 [2014-08-27] Michael Granger <ged@FaerieMUD.org>
|
2
9
|
|
3
10
|
Add support for sending extended replies.
|
data/lib/mongrel2.rb
CHANGED
@@ -25,10 +25,10 @@ module Mongrel2
|
|
25
25
|
abort "\n\n>>> Mongrel2 requires Ruby 1.9.2 or later. <<<\n\n" if RUBY_VERSION < '1.9.2'
|
26
26
|
|
27
27
|
# Library version constant
|
28
|
-
VERSION = '0.
|
28
|
+
VERSION = '0.43.0'
|
29
29
|
|
30
30
|
# Version-control revision constant
|
31
|
-
REVISION = %q$Revision:
|
31
|
+
REVISION = %q$Revision: dfce5a80c5bf $
|
32
32
|
|
33
33
|
|
34
34
|
require 'mongrel2/constants'
|
@@ -5,6 +5,9 @@ require 'mongrel2/config' unless defined?( Mongrel2::Config )
|
|
5
5
|
|
6
6
|
# Mongrel2 Route configuration class
|
7
7
|
class Mongrel2::Config::Route < Mongrel2::Config( :route )
|
8
|
+
extend Loggability
|
9
|
+
|
10
|
+
log_to :mongrel2
|
8
11
|
|
9
12
|
### As of Mongrel2/1.8.0:
|
10
13
|
# CREATE TABLE route (id INTEGER PRIMARY KEY,
|
@@ -18,6 +21,8 @@ class Mongrel2::Config::Route < Mongrel2::Config( :route )
|
|
18
21
|
### Return the Route that corresponds to the given +request+.
|
19
22
|
def self::for_request( request )
|
20
23
|
pattern = request.headers.pattern
|
24
|
+
self.log.debug "Searching for the route for the path %p in %p" %
|
25
|
+
[ pattern, self.all ]
|
21
26
|
return self.filter( path: pattern ).first
|
22
27
|
end
|
23
28
|
|
data/lib/mongrel2/request.rb
CHANGED
@@ -190,12 +190,8 @@ class Mongrel2::Request
|
|
190
190
|
raise Mongrel2::UploadError, "invalid upload: upload headers don't match" unless
|
191
191
|
self.upload_headers_match?
|
192
192
|
|
193
|
-
route = Mongrel2::Config::Route.for_request( self ) or
|
194
|
-
raise Mongrel2::UploadError, "couldn't find the route config for %s" % [ self ]
|
195
|
-
server = route.host.server
|
196
|
-
|
197
193
|
relpath = Pathname( self.headers.x_mongrel2_upload_done )
|
198
|
-
chrooted =
|
194
|
+
chrooted = self.server_chroot + relpath
|
199
195
|
|
200
196
|
if chrooted.exist?
|
201
197
|
return chrooted
|
@@ -203,13 +199,27 @@ class Mongrel2::Request
|
|
203
199
|
return relpath
|
204
200
|
else
|
205
201
|
self.log.error "uploaded body %s not found: tried relative to cwd and server chroot (%s)" %
|
206
|
-
[ relpath,
|
202
|
+
[ relpath, chrooted ]
|
207
203
|
raise Mongrel2::UploadError,
|
208
204
|
"couldn't find the path to uploaded body."
|
209
205
|
end
|
210
206
|
end
|
211
207
|
|
212
208
|
|
209
|
+
### Return the chroot directory of the mongrel2 daemon that received this request as
|
210
|
+
### a Pathname.
|
211
|
+
def server_chroot
|
212
|
+
route = Mongrel2::Config::Route.for_request( self ) or
|
213
|
+
raise Mongrel2::UploadError, "couldn't find the route config for %s" % [ self ]
|
214
|
+
server = route.host.server
|
215
|
+
|
216
|
+
path = server.chroot
|
217
|
+
path = '/' if path.empty?
|
218
|
+
|
219
|
+
return Pathname( path )
|
220
|
+
end
|
221
|
+
|
222
|
+
|
213
223
|
### Returns +true+ if this request is an 'asynchronous upload started' notification.
|
214
224
|
def upload_started?
|
215
225
|
return self.headers.member?( :x_mongrel2_upload_start ) &&
|
@@ -19,12 +19,28 @@ require 'mongrel2/request'
|
|
19
19
|
describe Mongrel2::Request do
|
20
20
|
|
21
21
|
before( :all ) do
|
22
|
-
|
22
|
+
setup_config_db()
|
23
|
+
|
24
|
+
# Set up a test server config so the request can find the server's chroot
|
25
|
+
server 'specs' do
|
26
|
+
default_host 'localhost'
|
27
|
+
access_log 'access.log'
|
28
|
+
error_log 'error.log'
|
29
|
+
chroot Dir.tmpdir
|
30
|
+
pid_file '/var/run/mongrel2.pid'
|
31
|
+
port 8113
|
32
|
+
|
33
|
+
host 'localhost' do
|
34
|
+
route '/form', handler( 'tcp://127.0.0.1:9900', 'upload-handler' )
|
35
|
+
route TEST_JSON_PATH, handler( 'tcp://127.0.0.1:9902', 'json-handler' )
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
23
39
|
@factory = Mongrel2::RequestFactory.new( route: '/form' )
|
24
40
|
end
|
25
41
|
|
26
|
-
|
27
|
-
|
42
|
+
before( :each ) do
|
43
|
+
Mongrel2::Config::Server.first.update( chroot: Dir.tmpdir )
|
28
44
|
end
|
29
45
|
|
30
46
|
|
@@ -125,6 +141,19 @@ describe Mongrel2::Request do
|
|
125
141
|
expect( @req.remote_ip.to_s ).to eq( '127.0.0.1' )
|
126
142
|
end
|
127
143
|
|
144
|
+
it "can look up the chroot directory of the server the request is from" do
|
145
|
+
Mongrel2::Config::Server.first.update( chroot: '/usr/local/www' )
|
146
|
+
expect( @req.server_chroot ).to be_a( Pathname )
|
147
|
+
expect( @req.server_chroot.to_s ).to eq( '/usr/local/www' )
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
it "returns '/' as the chroot directory if the server isn't chrooted" do
|
152
|
+
Mongrel2::Config::Server.first.update( chroot: '' )
|
153
|
+
expect( @req.server_chroot ).to be_a( Pathname )
|
154
|
+
expect( @req.server_chroot.to_s ).to eq( '/' )
|
155
|
+
end
|
156
|
+
|
128
157
|
end
|
129
158
|
|
130
159
|
|
@@ -153,6 +182,7 @@ describe Mongrel2::Request do
|
|
153
182
|
|
154
183
|
end
|
155
184
|
|
185
|
+
|
156
186
|
describe "framework support" do
|
157
187
|
|
158
188
|
before( :all ) do
|
@@ -207,24 +237,6 @@ describe Mongrel2::Request do
|
|
207
237
|
|
208
238
|
describe "async upload support" do
|
209
239
|
|
210
|
-
before( :all ) do
|
211
|
-
setup_config_db()
|
212
|
-
|
213
|
-
# Set up a test server config so the request can find the server's chroot
|
214
|
-
server 'specs' do
|
215
|
-
default_host 'localhost'
|
216
|
-
access_log 'access.log'
|
217
|
-
error_log 'error.log'
|
218
|
-
chroot Dir.tmpdir
|
219
|
-
pid_file '/var/run/mongrel2.pid'
|
220
|
-
port 8113
|
221
|
-
|
222
|
-
host 'localhost' do
|
223
|
-
route '/form', handler( TEST_SEND_SPEC, 'upload-handler', TEST_RECV_SPEC )
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
240
|
before( :each ) do
|
229
241
|
@spoolfile = Tempfile.new( 'mongrel2.upload', Dir.tmpdir )
|
230
242
|
@spoolfile.print( File.read(__FILE__) )
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongrel2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.43.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
c7ZKPJcWBv0sm81+FCZXNACn2f9jfF8OQinxVs0O052KbGuEQaaiGIYeuuwQE2q6
|
31
31
|
ggcrPfcYeTwWlfZPu2LrBg==
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-
|
33
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: sequel
|
@@ -276,14 +276,14 @@ dependencies:
|
|
276
276
|
requirements:
|
277
277
|
- - "~>"
|
278
278
|
- !ruby/object:Gem::Version
|
279
|
-
version: '3.
|
279
|
+
version: '3.13'
|
280
280
|
type: :development
|
281
281
|
prerelease: false
|
282
282
|
version_requirements: !ruby/object:Gem::Requirement
|
283
283
|
requirements:
|
284
284
|
- - "~>"
|
285
285
|
- !ruby/object:Gem::Version
|
286
|
-
version: '3.
|
286
|
+
version: '3.13'
|
287
287
|
description: |-
|
288
288
|
Ruby-Mongrel2 is a complete Ruby connector for Mongrel2[http://mongrel2.org/].
|
289
289
|
|
@@ -412,7 +412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
412
412
|
version: '0'
|
413
413
|
requirements: []
|
414
414
|
rubyforge_project:
|
415
|
-
rubygems_version: 2.
|
415
|
+
rubygems_version: 2.4.5
|
416
416
|
signing_key:
|
417
417
|
specification_version: 4
|
418
418
|
summary: Ruby-Mongrel2 is a complete Ruby connector for Mongrel2[http://mongrel2.org/]
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
*��/E������b�yu�8=�J�>���`O���]��k�
|
2
|
+
eY�I&p#�wo�s�ոfx��`�nR���-��>wy"9`��9������ky&�>�BI�m��baVo�X���m��5[-����S
|