mongrel2 0.40.0 → 0.41.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/.simplecov +14 -0
- data/ChangeLog +37 -3
- data/History.rdoc +10 -0
- data/Manifest.txt +2 -0
- data/Rakefile +8 -8
- data/lib/mongrel2.rb +4 -3
- data/lib/mongrel2/config.rb +6 -0
- data/lib/mongrel2/connection.rb +4 -4
- data/lib/mongrel2/control.rb +2 -2
- data/lib/mongrel2/handler.rb +45 -4
- data/lib/mongrel2/xmlrequest.rb +4 -4
- data/spec/helpers.rb +1 -13
- data/spec/mongrel2/config/dsl_spec.rb +10 -10
- data/spec/mongrel2/config/server_spec.rb +2 -2
- data/spec/mongrel2/config_spec.rb +5 -5
- data/spec/mongrel2/connection_spec.rb +12 -12
- data/spec/mongrel2/control_spec.rb +2 -2
- data/spec/mongrel2/handler_spec.rb +15 -15
- data/spec/mongrel2/httpresponse_spec.rb +1 -1
- data/spec/mongrel2/table_spec.rb +3 -3
- data/spec/mongrel2/xmlrequest_spec.rb +39 -0
- metadata +22 -20
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e6d36ed1c0911195e57b4f2b9d9f850a020bfc
|
4
|
+
data.tar.gz: 1c3e75b1dd52df44b0a449ed8d118cefff39b9d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4986951f6ed2d88f6b41b5ab75f26e1f683416742881efd6a6308f37f27fe27419916ef97fede3b456aac9c5522f6f0bb6596429417ae0fb4d92521ca56a64c0
|
7
|
+
data.tar.gz: fefccfdcd4c937c29a545443639084e83db3691f9c4cfc3352caabca2ff6b9d4eeb4bdef72ebcf4e1b636f5db56bfa00cbf940b003d45a918152f7c41f04555c
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
���p���{��wXw?�q:
|
2
|
+
���Xܜ��A�����gn���j�-.�P�c}y��E;�^����u�B#WT���.�!�D��C�ZW���f2�ْ��+V�R#��&�]KT���x~C4���lO_%�B@y�"q��hC��%��D�4�L����mn@�Y$(��ؾj�������j�;���%A�����o{�Q���/<*+�wɝcB�T�FY�G6���fr��� Q�ox&<�6�iWHА���
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.simplecov
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#encoding: utf-8
|
3
|
+
|
4
|
+
$stderr.puts "\n\n>>> Enabling coverage report.\n\n"
|
5
|
+
|
6
|
+
SimpleCov.start do
|
7
|
+
add_filter 'spec'
|
8
|
+
add_group "Config Classes" do |file|
|
9
|
+
file.filename =~ %r{lib/mongrel2/config(\.rb|/.*)$}
|
10
|
+
end
|
11
|
+
add_group "Needing tests" do |file|
|
12
|
+
file.covered_percent < 90
|
13
|
+
end
|
14
|
+
end
|
data/ChangeLog
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
2014-01-15 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* .rvm.gems, .simplecov, Manifest.txt, Rakefile,
|
4
|
+
lib/mongrel2/config.rb, lib/mongrel2/handler.rb, spec/helpers.rb,
|
5
|
+
spec/mongrel2/config/dsl_spec.rb,
|
6
|
+
spec/mongrel2/config/server_spec.rb, spec/mongrel2/config_spec.rb,
|
7
|
+
spec/mongrel2/handler_spec.rb, spec/mongrel2/httpresponse_spec.rb,
|
8
|
+
spec/mongrel2/table_spec.rb:
|
9
|
+
Config introspection and cleanup.
|
10
|
+
|
11
|
+
- Add Mongrel2::Config.mimetypes for fetching Mongrel2's mime-types
|
12
|
+
table.
|
13
|
+
- Add more config introspection to the Mongrel2::Handler class.
|
14
|
+
- Fix spec syntax deprecated in RSpec 3.
|
15
|
+
[d0e689f9de52] [tip]
|
16
|
+
|
17
|
+
* lib/mongrel2/xmlrequest.rb, spec/mongrel2/xmlrequest_spec.rb:
|
18
|
+
Use LibXML instead of Nokogiri for XML request type
|
19
|
+
[243c94859e5f]
|
20
|
+
|
21
|
+
2013-11-08 Michael Granger <ged@FaerieMUD.org>
|
22
|
+
|
23
|
+
* .hgtags:
|
24
|
+
Added tag v0.40.0 for changeset aadd49593b0f
|
25
|
+
[91e4453b14ca]
|
26
|
+
|
27
|
+
* .hgsigs:
|
28
|
+
Added signature for changeset 1d6f5f4d6b60
|
29
|
+
[aadd49593b0f] [v0.40.0]
|
30
|
+
|
31
|
+
* History.rdoc, lib/mongrel2.rb:
|
32
|
+
Bump minor version, update history.
|
33
|
+
[1d6f5f4d6b60]
|
34
|
+
|
1
35
|
2013-10-31 Michael Granger <ged@FaerieMUD.org>
|
2
36
|
|
3
37
|
* .rvm.gems, Gemfile, Rakefile, lib/mongrel2.rb,
|
@@ -5,7 +39,7 @@
|
|
5
39
|
spec/mongrel2/connection_spec.rb, spec/mongrel2/control_spec.rb,
|
6
40
|
spec/mongrel2/handler_spec.rb:
|
7
41
|
Revert d55e67969b87: move back to the zmq library
|
8
|
-
[a463a301914c]
|
42
|
+
[a463a301914c]
|
9
43
|
|
10
44
|
2013-10-11 Michael Granger <ged@FaerieMUD.org>
|
11
45
|
|
@@ -83,7 +117,7 @@
|
|
83
117
|
spec/mongrel2/config/dsl_spec.rb,
|
84
118
|
spec/mongrel2/config/xrequest_spec.rb:
|
85
119
|
Add support for 1.8.1's "X-Requests"
|
86
|
-
[ce2c1f560e76]
|
120
|
+
[ce2c1f560e76] [github/master]
|
87
121
|
|
88
122
|
* .hgtags:
|
89
123
|
Added tag v0.38.0 for changeset 94a931fa3c89
|
@@ -712,7 +746,7 @@
|
|
712
746
|
examples/config.rb, lib/mongrel2/config.rb,
|
713
747
|
lib/mongrel2/httprequest.rb, spec/mongrel2/config_spec.rb:
|
714
748
|
Change Config.settings to a Table, small fixups for async upload.
|
715
|
-
[e2384875455d]
|
749
|
+
[e2384875455d] [github/master@default]
|
716
750
|
|
717
751
|
* .tm_properties, data/mongrel2/bootstrap.html, examples/.env,
|
718
752
|
examples/Procfile, examples/async-upload.rb, examples/config.rb,
|
data/History.rdoc
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== v0.41.0 [2014-02-02] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
- Convert back to rbczmq for modern mongrel2s
|
4
|
+
- Config introspection and cleanup.
|
5
|
+
- Add Mongrel2::Config.mimetypes for fetching Mongrel2's mime-types
|
6
|
+
table.
|
7
|
+
- Add more config introspection to the Mongrel2::Handler class.
|
8
|
+
- Use LibXML instead of Nokogiri for XML request type
|
9
|
+
|
10
|
+
|
1
11
|
== v0.40.0 [2013-10-31] Michael Granger <ged@FaerieMUD.org>
|
2
12
|
|
3
13
|
- Move back to the zmq library, as rbczmq was too unstable.
|
data/Manifest.txt
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
.autotest
|
2
2
|
.gemtest
|
3
|
+
.simplecov
|
3
4
|
ChangeLog
|
4
5
|
DSL.rdoc
|
5
6
|
History.rdoc
|
@@ -79,4 +80,5 @@ spec/mongrel2/request_spec.rb
|
|
79
80
|
spec/mongrel2/response_spec.rb
|
80
81
|
spec/mongrel2/table_spec.rb
|
81
82
|
spec/mongrel2/websocket_spec.rb
|
83
|
+
spec/mongrel2/xmlrequest_spec.rb
|
82
84
|
spec/mongrel2_spec.rb
|
data/Rakefile
CHANGED
@@ -27,15 +27,15 @@ hoespec = Hoe.spec 'mongrel2' do
|
|
27
27
|
|
28
28
|
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
29
29
|
|
30
|
-
self.dependency '
|
31
|
-
self.dependency '
|
32
|
-
self.dependency '
|
33
|
-
self.dependency '
|
34
|
-
self.dependency '
|
35
|
-
self.dependency '
|
36
|
-
self.dependency 'zmq', '~> 2.1'
|
30
|
+
self.dependency 'sequel', '~> 4.2'
|
31
|
+
self.dependency 'tnetstring', '~> 0.3'
|
32
|
+
self.dependency 'yajl-ruby', '~> 1.0'
|
33
|
+
self.dependency 'trollop', '~> 2.0'
|
34
|
+
self.dependency 'sysexits', '~> 1.1'
|
35
|
+
self.dependency 'rbczmq', '~> 1.7'
|
37
36
|
self.dependency 'loggability','~> 0.5'
|
38
|
-
self.dependency 'sqlite3',
|
37
|
+
self.dependency 'sqlite3', '~> 1.3'
|
38
|
+
self.dependency 'libxml-ruby', '~> 2.7'
|
39
39
|
|
40
40
|
self.dependency 'amalgalite', '~> 1.3', :developer
|
41
41
|
self.dependency 'configurability', '~> 2.0', :developer
|
data/lib/mongrel2.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#encoding: utf-8
|
3
3
|
|
4
|
-
|
4
|
+
# Ensure this is used instead of 'zmq' if it's also installed
|
5
|
+
gem 'rbczmq'
|
5
6
|
|
6
7
|
require 'loggability'
|
7
8
|
require 'zmq'
|
@@ -24,10 +25,10 @@ module Mongrel2
|
|
24
25
|
abort "\n\n>>> Mongrel2 requires Ruby 1.9.2 or later. <<<\n\n" if RUBY_VERSION < '1.9.2'
|
25
26
|
|
26
27
|
# Library version constant
|
27
|
-
VERSION = '0.
|
28
|
+
VERSION = '0.41.0'
|
28
29
|
|
29
30
|
# Version-control revision constant
|
30
|
-
REVISION = %q$Revision:
|
31
|
+
REVISION = %q$Revision: 2915d3c8a0e3 $
|
31
32
|
|
32
33
|
|
33
34
|
require 'mongrel2/constants'
|
data/lib/mongrel2/config.rb
CHANGED
@@ -154,6 +154,12 @@ module Mongrel2
|
|
154
154
|
end
|
155
155
|
|
156
156
|
|
157
|
+
### Return a Hash of current mimetypes from the config database keyed by extension.
|
158
|
+
def self::mimetypes
|
159
|
+
return Mongrel2::Config::Mimetype.to_hash( :extension, :mimetype )
|
160
|
+
end
|
161
|
+
|
162
|
+
|
157
163
|
### Return the contents of the configuration schema SQL file.
|
158
164
|
def self::load_config_schema
|
159
165
|
return CONFIG_SQL.read
|
data/lib/mongrel2/connection.rb
CHANGED
@@ -70,13 +70,13 @@ class Mongrel2::Connection
|
|
70
70
|
self.log.debug "0mq Context is: %p" % [ ctx ]
|
71
71
|
|
72
72
|
self.log.info "Connecting PULL request socket (%s)" % [ self.sub_addr ]
|
73
|
-
@request_sock = ctx.socket(
|
74
|
-
@request_sock.
|
73
|
+
@request_sock = ctx.socket( :PULL )
|
74
|
+
@request_sock.linger = 0
|
75
75
|
@request_sock.connect( self.sub_addr )
|
76
76
|
|
77
77
|
self.log.info "Connecting PUB response socket (%s)" % [ self.pub_addr ]
|
78
|
-
@response_sock = ctx.socket(
|
79
|
-
@response_sock.
|
78
|
+
@response_sock = ctx.socket( :PUB )
|
79
|
+
@response_sock.linger = 0
|
80
80
|
@response_sock.connect( self.pub_addr )
|
81
81
|
end
|
82
82
|
|
data/lib/mongrel2/control.rb
CHANGED
@@ -28,8 +28,8 @@ class Mongrel2::Control
|
|
28
28
|
def initialize( port=DEFAULT_PORT )
|
29
29
|
check_port( port )
|
30
30
|
@ctx = Mongrel2.zmq_context
|
31
|
-
@socket = @ctx.socket(
|
32
|
-
@socket.
|
31
|
+
@socket = @ctx.socket( :REQ )
|
32
|
+
@socket.linger = 0
|
33
33
|
@socket.connect( port.to_s )
|
34
34
|
end
|
35
35
|
|
data/lib/mongrel2/handler.rb
CHANGED
@@ -101,10 +101,18 @@ class Mongrel2::Handler
|
|
101
101
|
### Create an instance of the handler using the config from the database with
|
102
102
|
### the given +appid+ and run it.
|
103
103
|
def self::run( appid )
|
104
|
-
self.
|
104
|
+
app = self.app_instance_for( appid )
|
105
|
+
self.log.info "Running application %p: %p" % [ appid, app ]
|
106
|
+
app.run
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
### Return an instance of the handler configured for the handler in the currently-loaded
|
111
|
+
### Mongrel2 config that corresponds to +appid+.
|
112
|
+
def self::app_instance_for( appid )
|
105
113
|
send_spec, recv_spec = self.connection_info_for( appid )
|
106
114
|
self.log.info " config specs: %s <-> %s" % [ send_spec, recv_spec ]
|
107
|
-
new( appid, send_spec, recv_spec )
|
115
|
+
return new( appid, send_spec, recv_spec )
|
108
116
|
end
|
109
117
|
|
110
118
|
|
@@ -161,9 +169,42 @@ class Mongrel2::Handler
|
|
161
169
|
|
162
170
|
|
163
171
|
### Return the Mongrel2::Config::Handler that corresponds to this app's
|
164
|
-
### appid.
|
172
|
+
### appid, and its connection's send_spec and recv_spec.
|
165
173
|
def handler_config
|
166
|
-
return
|
174
|
+
return self.configured_handlers.where(
|
175
|
+
send_spec: self.conn.sub_addr,
|
176
|
+
recv_spec: self.conn.pub_addr
|
177
|
+
).first
|
178
|
+
end
|
179
|
+
|
180
|
+
|
181
|
+
### Return the Mongrel2::Config::Handlers that corresponds to this app's
|
182
|
+
### appid.
|
183
|
+
def configured_handlers
|
184
|
+
return Mongrel2::Config::Handler.by_send_ident( self.app_id )
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
### Return the Mongre2::Config::Routes for this Handler.
|
189
|
+
def configured_routes
|
190
|
+
handlers = self.configured_handlers
|
191
|
+
return Mongrel2::Config::Route.where( target_id: handlers.select(:id) )
|
192
|
+
end
|
193
|
+
|
194
|
+
|
195
|
+
### Return the Mongrel2::Config::Hosts that have routes that point to this
|
196
|
+
### Handler.
|
197
|
+
def configured_hosts
|
198
|
+
routes = self.configured_routes
|
199
|
+
return Mongrel2::Config::Host.where( id: routes.select(:host_id) )
|
200
|
+
end
|
201
|
+
|
202
|
+
|
203
|
+
### Return the Mongrel2::Config::Servers that have hosts that have routes that
|
204
|
+
### point to this Handler.
|
205
|
+
def configured_servers
|
206
|
+
hosts = self.configured_hosts
|
207
|
+
return Mongrel2::Config::Server.where( id: hosts.select(:server_id) )
|
167
208
|
end
|
168
209
|
|
169
210
|
|
data/lib/mongrel2/xmlrequest.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'libxml'
|
4
4
|
require 'loggability'
|
5
5
|
|
6
6
|
require 'mongrel2/request' unless defined?( Mongrel2::Request )
|
@@ -22,7 +22,7 @@ class Mongrel2::XMLRequest < Mongrel2::Request
|
|
22
22
|
def initialize( sender_id, conn_id, path, headers, body, raw=nil )
|
23
23
|
super
|
24
24
|
self.log.debug "Parsing XML request body"
|
25
|
-
@
|
25
|
+
@reader = LibXML::XML::Reader.string( body )
|
26
26
|
end
|
27
27
|
|
28
28
|
|
@@ -30,8 +30,8 @@ class Mongrel2::XMLRequest < Mongrel2::Request
|
|
30
30
|
public
|
31
31
|
######
|
32
32
|
|
33
|
-
# The parsed request data (a
|
34
|
-
attr_reader :
|
33
|
+
# The parsed request data (a LibXML::Reader object)
|
34
|
+
attr_reader :reader
|
35
35
|
|
36
36
|
|
37
37
|
end # class Mongrel2::XMLRequest
|
data/spec/helpers.rb
CHANGED
@@ -5,19 +5,7 @@ require_relative 'constants'
|
|
5
5
|
require_relative 'matchers'
|
6
6
|
|
7
7
|
# SimpleCov test coverage reporting; enable this using the :coverage rake task
|
8
|
-
if ENV['COVERAGE']
|
9
|
-
$stderr.puts "\n\n>>> Enabling coverage report.\n\n"
|
10
|
-
require 'simplecov'
|
11
|
-
SimpleCov.start do
|
12
|
-
add_filter 'spec'
|
13
|
-
add_group "Config Classes" do |file|
|
14
|
-
file.filename =~ %r{lib/mongrel2/config(\.rb|/.*)$}
|
15
|
-
end
|
16
|
-
add_group "Needing tests" do |file|
|
17
|
-
file.covered_percent < 90
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
8
|
+
require 'simplecov' if ENV['COVERAGE']
|
21
9
|
|
22
10
|
begin
|
23
11
|
require 'configurability'
|
@@ -71,7 +71,7 @@ describe Mongrel2::Config::DSL do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
expect( result ).to be_a( Mongrel2::Config::Server )
|
74
|
-
expect( result.hosts ).to
|
74
|
+
expect( result.hosts.size ).to eq( 1 )
|
75
75
|
host = result.hosts.first
|
76
76
|
|
77
77
|
expect( host ).to be_a( Mongrel2::Config::Host )
|
@@ -109,13 +109,13 @@ describe Mongrel2::Config::DSL do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
expect( result ).to be_a( Mongrel2::Config::Server )
|
112
|
-
expect( result.hosts ).to
|
112
|
+
expect( result.hosts.size ).to eq( 2 )
|
113
113
|
host1, host2 = result.hosts
|
114
114
|
|
115
115
|
expect( host1 ).to be_a( Mongrel2::Config::Host )
|
116
116
|
expect( host1.name ).to eq( 'brillianttaste' )
|
117
117
|
expect( host1.matching ).to eq( '*.brillianttasteinthefoodmouth.com' )
|
118
|
-
expect( host1.routes ).to
|
118
|
+
expect( host1.routes.size ).to eq( 6 )
|
119
119
|
expect( host1.routes ).to all_be_a( Mongrel2::Config::Route )
|
120
120
|
|
121
121
|
expect( host1.routes[0].path ).to eq( '/images' )
|
@@ -151,7 +151,7 @@ describe Mongrel2::Config::DSL do
|
|
151
151
|
|
152
152
|
expect( host2 ).to be_a( Mongrel2::Config::Host )
|
153
153
|
expect( host2.name ).to eq( 'deveiate.org' )
|
154
|
-
expect( host2.routes ).to
|
154
|
+
expect( host2.routes.size ).to eq( 1 )
|
155
155
|
expect( host2.routes.first ).to be_a( Mongrel2::Config::Route )
|
156
156
|
end
|
157
157
|
|
@@ -176,7 +176,7 @@ describe Mongrel2::Config::DSL do
|
|
176
176
|
)
|
177
177
|
|
178
178
|
expect( result ).to be_an( Array )
|
179
|
-
expect( result ).to
|
179
|
+
expect( result.size ).to eq( 3 )
|
180
180
|
expect( result ).to all_be_a( Mongrel2::Config::Setting )
|
181
181
|
expect( result[0].key ).to eq( 'zeromq.threads' )
|
182
182
|
expect( result[0].value ).to eq( '8' )
|
@@ -204,7 +204,7 @@ describe Mongrel2::Config::DSL do
|
|
204
204
|
)
|
205
205
|
|
206
206
|
expect( result ).to be_an( Array )
|
207
|
-
expect( result ).to
|
207
|
+
expect( result.size ).to eq( 2 )
|
208
208
|
expect( result ).to all_be_a( Mongrel2::Config::Mimetype )
|
209
209
|
expect( result[0].extension ).to eq( '.md' )
|
210
210
|
expect( result[0].mimetype ).to eq( 'text/x-markdown' )
|
@@ -228,7 +228,7 @@ describe Mongrel2::Config::DSL do
|
|
228
228
|
filter '/usr/lib/mongrel2/null.so'
|
229
229
|
end
|
230
230
|
|
231
|
-
expect( result.filters ).to
|
231
|
+
expect( result.filters.size ).to eq( 1 )
|
232
232
|
expect( result.filters.first ).to be_a( Mongrel2::Config::Filter )
|
233
233
|
expect( result.filters.first.settings ).to eq( {} )
|
234
234
|
end
|
@@ -240,7 +240,7 @@ describe Mongrel2::Config::DSL do
|
|
240
240
|
min_size: 1000
|
241
241
|
end
|
242
242
|
|
243
|
-
expect( result.filters ).to
|
243
|
+
expect( result.filters.size ).to eq( 1 )
|
244
244
|
expect( result.filters.first ).to be_a( Mongrel2::Config::Filter )
|
245
245
|
expect( result.filters.first.settings ).
|
246
246
|
to eq({ 'extensions' => ["*.html", "*.txt"], 'min_size' => 1000 })
|
@@ -255,7 +255,7 @@ describe Mongrel2::Config::DSL do
|
|
255
255
|
xrequest '/usr/lib/mongrel2/null.so'
|
256
256
|
end
|
257
257
|
|
258
|
-
expect( result.xrequests ).to
|
258
|
+
expect( result.xrequests.size ).to eq( 1 )
|
259
259
|
expect( result.xrequests.first ).to be_a( Mongrel2::Config::XRequest )
|
260
260
|
expect( result.xrequests.first.settings ).to eq( {} )
|
261
261
|
end
|
@@ -267,7 +267,7 @@ describe Mongrel2::Config::DSL do
|
|
267
267
|
min_size: 1000
|
268
268
|
end
|
269
269
|
|
270
|
-
expect( result.xrequests ).to
|
270
|
+
expect( result.xrequests.size ).to eq( 1 )
|
271
271
|
expect( result.xrequests.first ).to be_a( Mongrel2::Config::XRequest )
|
272
272
|
expect( result.xrequests.first.settings ).
|
273
273
|
to eq({ 'extensions' => ["*.html", "*.txt"], 'min_size' => 1000 })
|
@@ -107,9 +107,9 @@ describe Mongrel2::Config::Server do
|
|
107
107
|
end
|
108
108
|
|
109
109
|
it "has a predicate that understands the use_ssl value" do
|
110
|
-
expect( @server.use_ssl ).to
|
110
|
+
expect( @server.use_ssl ).to be_falsey()
|
111
111
|
@server.use_ssl = true
|
112
|
-
expect( @server.use_ssl ).to
|
112
|
+
expect( @server.use_ssl ).to be_truthy()
|
113
113
|
end
|
114
114
|
|
115
115
|
end
|
@@ -45,7 +45,7 @@ describe Mongrel2::Config do
|
|
45
45
|
Mongrel2::Config.init_database
|
46
46
|
Mongrel2::Config::Server.truncate
|
47
47
|
|
48
|
-
|
48
|
+
Mongrel2::Config::Server.create(
|
49
49
|
uuid: TEST_UUID,
|
50
50
|
access_log: '/log/access.log',
|
51
51
|
error_log: '/log/error.log',
|
@@ -53,7 +53,7 @@ describe Mongrel2::Config do
|
|
53
53
|
default_host: 'localhost',
|
54
54
|
port: 8275
|
55
55
|
)
|
56
|
-
expect( Mongrel2::Config.servers ).to
|
56
|
+
expect( Mongrel2::Config.servers.size ).to eq( 1 )
|
57
57
|
expect( Mongrel2::Config.servers.first.uuid ).to eq( TEST_UUID )
|
58
58
|
end
|
59
59
|
|
@@ -62,7 +62,7 @@ describe Mongrel2::Config do
|
|
62
62
|
Mongrel2::Config::Setting.dataset.truncate
|
63
63
|
Mongrel2::Config::Setting.create( key: 'control_port', value: 'ipc://var/run/control.sock' )
|
64
64
|
expect( Mongrel2::Config.settings ).to respond_to( :[] )
|
65
|
-
expect( Mongrel2::Config.settings ).to
|
65
|
+
expect( Mongrel2::Config.settings.size ).to eq( 1 )
|
66
66
|
expect( Mongrel2::Config.settings[ :control_port ] ).to eq( 'ipc://var/run/control.sock' )
|
67
67
|
end
|
68
68
|
|
@@ -72,9 +72,9 @@ describe Mongrel2::Config do
|
|
72
72
|
|
73
73
|
it "knows whether or not its database has been initialized" do
|
74
74
|
Mongrel2::Config.db = Mongrel2::Config.in_memory_db
|
75
|
-
expect( Mongrel2::Config.database_initialized? ).to
|
75
|
+
expect( Mongrel2::Config.database_initialized? ).to be_falsey()
|
76
76
|
Mongrel2::Config.init_database!
|
77
|
-
expect( Mongrel2::Config.database_initialized? ).to
|
77
|
+
expect( Mongrel2::Config.database_initialized? ).to be_truthy()
|
78
78
|
end
|
79
79
|
|
80
80
|
it "doesn't re-initialize the database if the non-bang version of init_database is used" do
|
@@ -43,12 +43,12 @@ describe Mongrel2::Connection do
|
|
43
43
|
request_sock = double( "request socket" )
|
44
44
|
response_sock = double( "response socket" )
|
45
45
|
|
46
|
-
expect( @ctx ).to receive( :socket ).with(
|
47
|
-
expect( request_sock ).to receive( :
|
46
|
+
expect( @ctx ).to receive( :socket ).with( :PULL ).and_return( request_sock )
|
47
|
+
expect( request_sock ).to receive( :linger= ).with( 0 )
|
48
48
|
expect( request_sock ).to receive( :connect ).with( TEST_SEND_SPEC )
|
49
49
|
|
50
|
-
expect( @ctx ).to receive( :socket ).with(
|
51
|
-
expect( response_sock ).to receive( :
|
50
|
+
expect( @ctx ).to receive( :socket ).with( :PUB ).and_return( response_sock )
|
51
|
+
expect( response_sock ).to receive( :linger= ).with( 0 )
|
52
52
|
expect( response_sock ).to_not receive( :identity= )
|
53
53
|
expect( response_sock ).to receive( :connect ).with( TEST_RECV_SPEC )
|
54
54
|
|
@@ -63,11 +63,11 @@ describe Mongrel2::Connection do
|
|
63
63
|
context "after a connection has been established" do
|
64
64
|
|
65
65
|
before( :each ) do
|
66
|
-
@request_sock = double( "request socket", :
|
67
|
-
@response_sock = double( "response socket", :
|
66
|
+
@request_sock = double( "request socket", :linger= => nil, :connect => nil )
|
67
|
+
@response_sock = double( "response socket", :linger= => nil, :connect => nil )
|
68
68
|
|
69
|
-
allow( @ctx ).to receive( :socket ).with(
|
70
|
-
allow( @ctx ).to receive( :socket ).with(
|
69
|
+
allow( @ctx ).to receive( :socket ).with( :PULL ).and_return( @request_sock )
|
70
|
+
allow( @ctx ).to receive( :socket ).with( :PUB ).and_return( @response_sock )
|
71
71
|
|
72
72
|
@conn.connect
|
73
73
|
end
|
@@ -92,10 +92,10 @@ describe Mongrel2::Connection do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
it "doesn't keep its request and response sockets when duped" do
|
95
|
-
request_sock2 = double( "request socket", :
|
96
|
-
response_sock2 = double( "response socket", :
|
97
|
-
allow( @ctx ).to receive( :socket ).with(
|
98
|
-
allow( @ctx ).to receive( :socket ).with(
|
95
|
+
request_sock2 = double( "request socket", :linger= => nil, :connect => nil )
|
96
|
+
response_sock2 = double( "response socket", :linger= => nil, :connect => nil )
|
97
|
+
allow( @ctx ).to receive( :socket ).with( :PULL ).and_return( request_sock2 )
|
98
|
+
allow( @ctx ).to receive( :socket ).with( :PUB ).and_return( response_sock2 )
|
99
99
|
|
100
100
|
duplicate = @conn.dup
|
101
101
|
|
@@ -18,8 +18,8 @@ describe Mongrel2::Control do
|
|
18
18
|
|
19
19
|
before( :each ) do
|
20
20
|
@ctx = double( "ZMQ::Context" )
|
21
|
-
@socket = double( "ZMQ REQ socket", :connect => nil, :
|
22
|
-
allow( @ctx ).to receive( :socket ).with(
|
21
|
+
@socket = double( "ZMQ REQ socket", :connect => nil, :linger= => nil )
|
22
|
+
allow( @ctx ).to receive( :socket ).with( :REQ ).and_return( @socket )
|
23
23
|
|
24
24
|
Mongrel2.instance_variable_set( :@zmq_ctx, @ctx )
|
25
25
|
|
@@ -47,11 +47,11 @@ describe Mongrel2::Handler do
|
|
47
47
|
# Ensure 0MQ never actually gets called
|
48
48
|
before( :each ) do
|
49
49
|
@ctx = double( '0mq context', close: nil )
|
50
|
-
@request_sock = double( "request socket", :
|
51
|
-
@response_sock = double( "response socket", :
|
50
|
+
@request_sock = double( "request socket", :linger= => nil, :connect => nil, :close => nil )
|
51
|
+
@response_sock = double( "response socket", :linger= => nil, :connect => nil, :close => nil )
|
52
52
|
|
53
|
-
allow( @ctx ).to receive( :socket ).with(
|
54
|
-
allow( @ctx ).to receive( :socket ).with(
|
53
|
+
allow( @ctx ).to receive( :socket ).with( :PULL ).and_return( @request_sock )
|
54
|
+
allow( @ctx ).to receive( :socket ).with( :PUB ).and_return( @response_sock )
|
55
55
|
|
56
56
|
allow( ZMQ ).to receive( :select ).and_return([ [@request_sock], [], [] ])
|
57
57
|
|
@@ -132,7 +132,7 @@ describe Mongrel2::Handler do
|
|
132
132
|
|
133
133
|
res = OneShotHandler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
134
134
|
|
135
|
-
expect( res.transactions ).to
|
135
|
+
expect( res.transactions.size ).to eq( 1 )
|
136
136
|
request, response = res.transactions.first
|
137
137
|
expect( request ).to be_a( Mongrel2::HTTPRequest )
|
138
138
|
expect( response ).to be_a( Mongrel2::HTTPResponse )
|
@@ -145,7 +145,7 @@ describe Mongrel2::Handler do
|
|
145
145
|
|
146
146
|
res = OneShotHandler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
147
147
|
|
148
|
-
expect( res.transactions ).to
|
148
|
+
expect( res.transactions.size ).to eq( 1 )
|
149
149
|
request, response = res.transactions.first
|
150
150
|
expect( request ).to be_a( Mongrel2::JSONRequest )
|
151
151
|
expect( response ).to be_nil()
|
@@ -163,7 +163,7 @@ describe Mongrel2::Handler do
|
|
163
163
|
|
164
164
|
res = json_handler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
165
165
|
|
166
|
-
expect( res.transactions ).to
|
166
|
+
expect( res.transactions.size ).to eq( 1 )
|
167
167
|
request, response = res.transactions.first
|
168
168
|
expect( request ).to be_a( Mongrel2::JSONRequest )
|
169
169
|
expect( response ).to be_a( Mongrel2::Response )
|
@@ -175,7 +175,7 @@ describe Mongrel2::Handler do
|
|
175
175
|
|
176
176
|
res = OneShotHandler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
177
177
|
|
178
|
-
expect( res.transactions ).to
|
178
|
+
expect( res.transactions.size ).to eq( 1 )
|
179
179
|
request, response = res.transactions.first
|
180
180
|
expect( request ).to be_a( Mongrel2::XMLRequest )
|
181
181
|
expect( response ).to be_nil()
|
@@ -193,7 +193,7 @@ describe Mongrel2::Handler do
|
|
193
193
|
|
194
194
|
res = xml_handler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
195
195
|
|
196
|
-
expect( res.transactions ).to
|
196
|
+
expect( res.transactions.size ).to eq( 1 )
|
197
197
|
request, response = res.transactions.first
|
198
198
|
expect( request ).to be_a( Mongrel2::XMLRequest )
|
199
199
|
expect( response ).to be_a( Mongrel2::Response )
|
@@ -211,7 +211,7 @@ describe Mongrel2::Handler do
|
|
211
211
|
|
212
212
|
res = ws_handler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
213
213
|
|
214
|
-
expect( res.transactions ).to
|
214
|
+
expect( res.transactions.size ).to eq( 1 )
|
215
215
|
request, response = res.transactions.first
|
216
216
|
expect( request ).to be_a( Mongrel2::WebSocket::ClientHandshake )
|
217
217
|
expect( response ).to be_a( Mongrel2::WebSocket::ServerHandshake )
|
@@ -229,7 +229,7 @@ describe Mongrel2::Handler do
|
|
229
229
|
|
230
230
|
res = ws_handler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
231
231
|
|
232
|
-
expect( res.transactions ).to
|
232
|
+
expect( res.transactions.size ).to eq( 1 )
|
233
233
|
request, response = res.transactions.first
|
234
234
|
expect( request ).to be_a( Mongrel2::WebSocket::Frame )
|
235
235
|
expect( response ).to be_a( Mongrel2::WebSocket::Frame )
|
@@ -243,7 +243,7 @@ describe Mongrel2::Handler do
|
|
243
243
|
|
244
244
|
res = OneShotHandler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
245
245
|
|
246
|
-
expect( res.transactions ).to
|
246
|
+
expect( res.transactions.size ).to eq( 1 )
|
247
247
|
request, response = res.transactions.first
|
248
248
|
expect( request ).to be_a( Mongrel2::HTTPRequest )
|
249
249
|
expect( response ).to be_a( Mongrel2::HTTPResponse )
|
@@ -256,7 +256,7 @@ describe Mongrel2::Handler do
|
|
256
256
|
|
257
257
|
res = OneShotHandler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
258
258
|
|
259
|
-
expect( res.transactions ).to
|
259
|
+
expect( res.transactions.size ).to eq( 1 )
|
260
260
|
request, response = res.transactions.first
|
261
261
|
expect( request ).to be_a( Mongrel2::JSONRequest )
|
262
262
|
expect( response ).to be_nil()
|
@@ -274,7 +274,7 @@ describe Mongrel2::Handler do
|
|
274
274
|
|
275
275
|
res = disconnect_handler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
276
276
|
|
277
|
-
expect( res.transactions ).to
|
277
|
+
expect( res.transactions.size ).to eq( 1 )
|
278
278
|
request, response = res.transactions.first
|
279
279
|
expect( request ).to be_a( Mongrel2::JSONRequest )
|
280
280
|
expect( response ).to be_nil()
|
@@ -287,7 +287,7 @@ describe Mongrel2::Handler do
|
|
287
287
|
|
288
288
|
res = OneShotHandler.new( TEST_UUID, TEST_SEND_SPEC, TEST_RECV_SPEC ).run
|
289
289
|
|
290
|
-
expect( res.transactions ).to
|
290
|
+
expect( res.transactions.size ).to eq( 1 )
|
291
291
|
request, response = res.transactions.first
|
292
292
|
expect( response ).to be_nil()
|
293
293
|
end
|
@@ -85,7 +85,7 @@ describe Mongrel2::HTTPResponse do
|
|
85
85
|
expect( @response ).to_not be_handled()
|
86
86
|
expect( @response.body ).to be_a( StringIO )
|
87
87
|
expect( @response.body.size ).to eq( 0 )
|
88
|
-
expect( @response.headers ).to
|
88
|
+
expect( @response.headers.size ).to eq( 1 )
|
89
89
|
end
|
90
90
|
|
91
91
|
it "sets its status line to 200 OK if the body is set and the status hasn't yet been set" do
|
data/spec/mongrel2/table_spec.rb
CHANGED
@@ -63,7 +63,7 @@ describe Mongrel2::Table do
|
|
63
63
|
it "should create an array value and append when appending to an existing key" do
|
64
64
|
@table[:indian_meal] = 'pork sausage'
|
65
65
|
@table.append( 'Indian-MEAL' => 'pinecones' )
|
66
|
-
expect( @table['Indian-Meal'] ).to
|
66
|
+
expect( @table['Indian-Meal'].size ).to eq( 2 )
|
67
67
|
expect( @table['Indian-Meal'] ).to include('pinecones')
|
68
68
|
expect( @table['Indian-Meal'] ).to include('pork sausage')
|
69
69
|
end
|
@@ -74,7 +74,7 @@ describe Mongrel2::Table do
|
|
74
74
|
|
75
75
|
table = Mongrel2::Table.new({ :bob => :dan, 'Bob' => :dan_too })
|
76
76
|
|
77
|
-
expect( table[:bob] ).to
|
77
|
+
expect( table[:bob].size ).to eq( 2 )
|
78
78
|
expect( table['Bob'] ).to include( :dan )
|
79
79
|
expect( table['bob'] ).to include( :dan_too )
|
80
80
|
end
|
@@ -156,7 +156,7 @@ describe Mongrel2::Table do
|
|
156
156
|
values << [ header, value ]
|
157
157
|
end
|
158
158
|
|
159
|
-
expect( values.flatten ).to
|
159
|
+
expect( values.flatten.size ).to eq( 8 )
|
160
160
|
expect( values.transpose[0] ).to include( 'Thai-Food', 'With-Absinthe', 'A-Number-Of-Some-Sort' )
|
161
161
|
expect( values.transpose[1] ).to include( 'normally good', 'seldom hot enough', 'questionable', '2' )
|
162
162
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../helpers'
|
4
|
+
|
5
|
+
require 'rspec'
|
6
|
+
|
7
|
+
require 'tnetstring'
|
8
|
+
require 'tmpdir'
|
9
|
+
require 'tempfile'
|
10
|
+
|
11
|
+
require 'mongrel2'
|
12
|
+
require 'mongrel2/xmlrequest'
|
13
|
+
|
14
|
+
|
15
|
+
#####################################################################
|
16
|
+
### C O N T E X T S
|
17
|
+
#####################################################################
|
18
|
+
|
19
|
+
describe Mongrel2::XMLRequest do
|
20
|
+
|
21
|
+
let( :factory ) { Mongrel2::RequestFactory.new(route: '/form') }
|
22
|
+
|
23
|
+
|
24
|
+
it "can parse an XML request message" do
|
25
|
+
|
26
|
+
message = make_xml_request()
|
27
|
+
req = Mongrel2::Request.parse( message )
|
28
|
+
|
29
|
+
expect( req ).to be_a( Mongrel2::XMLRequest )
|
30
|
+
expect( req.sender_id ).to eq( TEST_UUID )
|
31
|
+
expect( req.conn_id ).to eq( TEST_ID )
|
32
|
+
|
33
|
+
expect( req.headers ).to be_a( Mongrel2::Table )
|
34
|
+
expect( req.headers['pattern'] ).to eq( TEST_XML_HEADERS['PATH'] )
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
end
|
39
|
+
|
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.41.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -30,22 +30,8 @@ cert_chain:
|
|
30
30
|
6mKCwjpegytE0oifXfF8k75A9105cBnNiMZOe1tXiqYc/exCgWvbggurzDOcRkZu
|
31
31
|
/YSusaiDXHKU2O3Akc3htA==
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2014-02-02 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: nokogiri
|
37
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '1.5'
|
42
|
-
type: :runtime
|
43
|
-
prerelease: false
|
44
|
-
version_requirements: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ~>
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '1.5'
|
49
35
|
- !ruby/object:Gem::Dependency
|
50
36
|
name: sequel
|
51
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,19 +103,19 @@ dependencies:
|
|
117
103
|
- !ruby/object:Gem::Version
|
118
104
|
version: '1.1'
|
119
105
|
- !ruby/object:Gem::Dependency
|
120
|
-
name:
|
106
|
+
name: rbczmq
|
121
107
|
requirement: !ruby/object:Gem::Requirement
|
122
108
|
requirements:
|
123
109
|
- - ~>
|
124
110
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
111
|
+
version: '1.7'
|
126
112
|
type: :runtime
|
127
113
|
prerelease: false
|
128
114
|
version_requirements: !ruby/object:Gem::Requirement
|
129
115
|
requirements:
|
130
116
|
- - ~>
|
131
117
|
- !ruby/object:Gem::Version
|
132
|
-
version: '
|
118
|
+
version: '1.7'
|
133
119
|
- !ruby/object:Gem::Dependency
|
134
120
|
name: loggability
|
135
121
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,6 +144,20 @@ dependencies:
|
|
158
144
|
- - ~>
|
159
145
|
- !ruby/object:Gem::Version
|
160
146
|
version: '1.3'
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
name: libxml-ruby
|
149
|
+
requirement: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ~>
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '2.7'
|
154
|
+
type: :runtime
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ~>
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '2.7'
|
161
161
|
- !ruby/object:Gem::Dependency
|
162
162
|
name: hoe-mercurial
|
163
163
|
requirement: !ruby/object:Gem::Requirement
|
@@ -305,6 +305,7 @@ extra_rdoc_files:
|
|
305
305
|
files:
|
306
306
|
- .autotest
|
307
307
|
- .gemtest
|
308
|
+
- .simplecov
|
308
309
|
- ChangeLog
|
309
310
|
- DSL.rdoc
|
310
311
|
- History.rdoc
|
@@ -384,6 +385,7 @@ files:
|
|
384
385
|
- spec/mongrel2/response_spec.rb
|
385
386
|
- spec/mongrel2/table_spec.rb
|
386
387
|
- spec/mongrel2/websocket_spec.rb
|
388
|
+
- spec/mongrel2/xmlrequest_spec.rb
|
387
389
|
- spec/mongrel2_spec.rb
|
388
390
|
homepage: https://bitbucket.org/ged/ruby-mongrel2
|
389
391
|
licenses:
|
@@ -409,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
409
411
|
version: '0'
|
410
412
|
requirements: []
|
411
413
|
rubyforge_project: mongrel2
|
412
|
-
rubygems_version: 2.1
|
414
|
+
rubygems_version: 2.2.1
|
413
415
|
signing_key:
|
414
416
|
specification_version: 4
|
415
417
|
summary: Ruby-Mongrel2 is a complete Ruby connector for Mongrel2[http://mongrel2.org/]
|
metadata.gz.sig
CHANGED
Binary file
|