mongrel2 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,8 +1,53 @@
1
+ 2012-02-17 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * .rvmrc:
4
+ Remove patchlevel from gemset spec
5
+ [fc0c896f4bb1] [github/master, tip]
6
+
7
+ 2012-02-15 Michael Granger <ged@FaerieMUD.org>
8
+
9
+ * README.rdoc, lib/mongrel2/config/filter.rb:
10
+ Flesh out docs for the Filter config class.
11
+ [67e37e22865a]
12
+
13
+ * examples/config.rb:
14
+ Merge with github/master
15
+ [d37994025a31]
16
+
17
+ 2012-02-06 Michael Granger <ged@FaerieMUD.org>
18
+
19
+ * bin/m2sh.rb, examples/admin.rb, examples/config.rb,
20
+ lib/mongrel2/config/dsl.rb, lib/mongrel2/config/server.rb:
21
+ Make the DSL declarations destructive.
22
+ [f2edffaa7e40]
23
+
24
+ 2012-02-15 Michael Granger <ged@FaerieMUD.org>
25
+
26
+ * .hgtags:
27
+ Added tag v0.11.0 for changeset a0e0b4af6b13
28
+ [b00b1f48853a]
29
+
30
+ * .hgsigs:
31
+ Added signature for changeset 5d438ea6037a
32
+ [a0e0b4af6b13] [v0.11.0]
33
+
34
+ * History.rdoc, lib/mongrel2.rb:
35
+ Bump the minor version and update History.
36
+ [5d438ea6037a]
37
+
38
+ * lib/mongrel2/httprequest.rb, spec/mongrel2/httprequest_spec.rb:
39
+ Add some more convenience methods to the HTTPRequest class
40
+ [3cd4a2a9ac08]
41
+
42
+ * DSL.rdoc, Manifest.txt, Rakefile, lib/mongrel2/config/dsl.rb:
43
+ Finish up the DSL documentation.
44
+ [a3e959af5272]
45
+
1
46
  2012-02-10 Michael Granger <ged@FaerieMUD.org>
2
47
 
3
48
  * examples/config.rb, lib/mongrel2/config/dsl.rb:
4
49
  Start work on detailed docs for the config DSL
5
- [fd35a1c88881] [tip]
50
+ [fd35a1c88881]
6
51
 
7
52
  2012-02-06 Michael Granger <ged@FaerieMUD.org>
8
53
 
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ == v0.12.0 [2012-02-17] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Add bodiless response predicate to Mongrel2::HTTPResponse.
4
+ - Add #put and #delete factory methods to the Mongrel2::RequestFactory.
5
+ - Flesh out docs for the Filter config class.
6
+
7
+
1
8
  == v0.11.0 [2012-02-15] Michael Granger <ged@FaerieMUD.org>
2
9
 
3
10
  - Make the DSL declarations replace existing records.
data/README.rdoc CHANGED
@@ -78,6 +78,7 @@ schema, etc.
78
78
  * Mongrel2::Config::Setting
79
79
  * Mongrel2::Config::Mimetype
80
80
  * Mongrel2::Config::Statistic
81
+ * Mongrel2::Config::Filter
81
82
  * Mongrel2::Config::Log
82
83
 
83
84
 
data/lib/mongrel2.rb CHANGED
@@ -14,10 +14,10 @@ module Mongrel2
14
14
  abort "\n\n>>> Mongrel2 requires Ruby 1.9.2 or later. <<<\n\n" if RUBY_VERSION < '1.9.2'
15
15
 
16
16
  # Library version constant
17
- VERSION = '0.11.0'
17
+ VERSION = '0.12.0'
18
18
 
19
19
  # Version-control revision constant
20
- REVISION = %q$Revision: 5d438ea6037a $
20
+ REVISION = %q$Revision: 7cd687a35c4c $
21
21
 
22
22
 
23
23
  require 'mongrel2/logging'
@@ -5,7 +5,29 @@ require 'tnetstring'
5
5
  require 'mongrel2' unless defined?( Mongrel2 )
6
6
  require 'mongrel2/config' unless defined?( Mongrel2::Config )
7
7
 
8
- # Mongrel2 Host configuration class
8
+ # Mongrel2 Filter configuration class
9
+ #
10
+ # # Using the config DSL:
11
+ # filter '/usr/local/lib/mongrel2/filters/null.so',
12
+ # extensions: ["*.html", "*.txt"],
13
+ # min_size: 1000
14
+ #
15
+ # # Which is the same as:
16
+ # Mongrel2::Config::Filter.create(
17
+ # mame: '/usr/local/lib/mongrel2/filters/null.so',
18
+ # settings: {
19
+ # extensions: ["*.html", "*.txt"],
20
+ # min_size: 1000
21
+ # }
22
+ #
23
+ # # Or:
24
+ # server.add_filter(
25
+ # mame: '/usr/local/lib/mongrel2/filters/null.so',
26
+ # settings: {
27
+ # extensions: ["*.html", "*.txt"],
28
+ # min_size: 1000
29
+ # })
30
+ #
9
31
  class Mongrel2::Config::Filter < Mongrel2::Config( :filter )
10
32
 
11
33
  ### As of Mongrel2/1.7.5:
@@ -153,6 +153,18 @@ module Mongrel2::Constants
153
153
  510 => "Not Extended"
154
154
  }
155
155
 
156
+ # A registry of HTTP status codes that don't allow an entity body
157
+ # in the response.
158
+ BODILESS_HTTP_RESPONSE_CODES = [
159
+ CONTINUE,
160
+ SWITCHING_PROTOCOLS,
161
+ PROCESSING,
162
+ NO_CONTENT,
163
+ RESET_CONTENT,
164
+ NOT_MODIFIED,
165
+ USE_PROXY,
166
+ ]
167
+
156
168
  end
157
169
 
158
170
 
@@ -80,6 +80,13 @@ class Mongrel2::HTTPResponse < Mongrel2::Response
80
80
  alias_method :is_handled?, :handled?
81
81
 
82
82
 
83
+ ### Returns true if the response status means the response
84
+ ### shouldn't have a body.
85
+ def bodiless?
86
+ return HTTP::BODILESS_HTTP_RESPONSE_CODES.include?( self.status )
87
+ end
88
+
89
+
83
90
  ### Return the numeric category of the response's status code (1-5)
84
91
  def status_category
85
92
  return 0 if self.status.nil?
@@ -133,6 +133,35 @@ module Mongrel2
133
133
  end
134
134
 
135
135
 
136
+ ### Create a new PUT Mongrel2::Request for the specified +uri+ with
137
+ ### the given +body+ and +headers+.
138
+ def put( uri, body='', headers={} )
139
+ raise "Request doesn't route through %p" % [ self.route ] unless
140
+ uri.start_with?( self.route )
141
+
142
+ headers = self.make_merged_headers( :PUT, uri, headers )
143
+ rclass = Mongrel2::Request.subclass_for_method( :PUT )
144
+
145
+ req = rclass.new( self.sender_id, self.conn_id.to_s, uri.to_s, headers )
146
+ req.body = body
147
+
148
+ return req
149
+ end
150
+
151
+
152
+ ### Create a new DELETE Mongrel2::Request for the specified +uri+ with
153
+ ### the given +headers+.
154
+ def delete( uri, headers={} )
155
+ raise "Request doesn't route through %p" % [ self.route ] unless
156
+ uri.start_with?( self.route )
157
+
158
+ headers = self.make_merged_headers( :DELETE, uri, headers )
159
+ rclass = Mongrel2::Request.subclass_for_method( :DELETE )
160
+
161
+ return rclass.new( self.sender_id, self.conn_id.to_s, uri.to_s, headers )
162
+ end
163
+
164
+
136
165
  #########
137
166
  protected
138
167
  #########
@@ -183,6 +183,18 @@ describe Mongrel2::HTTPResponse do
183
183
  end
184
184
 
185
185
 
186
+ it "knows that a 100 response shouldn't have a body" do
187
+ @response.status = HTTP::CONTINUE
188
+ @response.should be_bodiless()
189
+ end
190
+
191
+
192
+ it "knows that a 204 response shouldn't have a body" do
193
+ @response.status = HTTP::NO_CONTENT
194
+ @response.should be_bodiless()
195
+ end
196
+
197
+
186
198
  it "knows what the response content type is" do
187
199
  @response.headers['Content-Type'] = 'text/erotica'
188
200
  @response.content_type.should == 'text/erotica'
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.11.0
4
+ version: 0.12.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,50 +9,38 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
- - ! '-----BEGIN CERTIFICATE-----
13
-
14
- MIIDLDCCAhSgAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQwwCgYDVQQDDANnZWQx
15
-
16
- FzAVBgoJkiaJk/IsZAEZFgdfYWVyaWVfMRMwEQYKCZImiZPyLGQBGRYDb3JnMB4X
17
-
18
- DTEwMDkxNjE0NDg1MVoXDTExMDkxNjE0NDg1MVowPDEMMAoGA1UEAwwDZ2VkMRcw
19
-
20
- FQYKCZImiZPyLGQBGRYHX2FlcmllXzETMBEGCgmSJomT8ixkARkWA29yZzCCASIw
21
-
22
- DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALy//BFxC1f/cPSnwtJBWoFiFrir
23
-
24
- h7RicI+joq/ocVXQqI4TDWPyF/8tqkvt+rD99X9qs2YeR8CU/YiIpLWrQOYST70J
25
-
26
- vDn7Uvhb2muFVqq6+vobeTkILBEO6pionWDG8jSbo3qKm1RjKJDwg9p4wNKhPuu8
27
-
28
- KGue/BFb67KflqyApPmPeb3Vdd9clspzqeFqp7cUBMEpFS6LWxy4Gk+qvFFJBJLB
29
-
30
- BUHE/LZVJMVzfpC5Uq+QmY7B+FH/QqNndn3tOHgsPadLTNimuB1sCuL1a4z3Pepd
31
-
32
- TeLBEFmEao5Dk3K/Q8o8vlbIB/jBDTUx6Djbgxw77909x6gI9doU4LD5XMcCAwEA
33
-
34
- AaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJeoGkOr9l4B
35
-
36
- +saMkW/ZXT4UeSvVMA0GCSqGSIb3DQEBBQUAA4IBAQBG2KObvYI2eHyyBUJSJ3jN
37
-
38
- vEnU3d60znAXbrSd2qb3r1lY1EPDD3bcy0MggCfGdg3Xu54z21oqyIdk8uGtWBPL
39
-
40
- HIa9EgfFGSUEgvcIvaYqiN4jTUtidfEFw+Ltjs8AP9gWgSIYS6Gr38V0WGFFNzIH
41
-
42
- aOD2wmu9oo/RffW4hS/8GuvfMzcw7CQ355wFR4KB/nyze+EsZ1Y5DerCAagMVuDQ
43
-
44
- U0BLmWDFzPGGWlPeQCrYHCr+AcJz+NRnaHCKLZdSKj/RHuTOt+gblRex8FAh8NeA
45
-
46
- cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
47
-
48
- -----END CERTIFICATE-----
49
-
50
- '
51
- date: 2012-02-16 00:00:00.000000000 Z
12
+ - !binary |-
13
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURMRENDQWhTZ0F3SUJB
14
+ Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREE4TV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pOCnZF
31
+ blUzZDYwem5BWGJyU2QycWIzcjFsWTFFUEREM2JjeTBNZ2dDZkdkZzNYdTU0
32
+ ejIxb3F5SWRrOHVHdFdCUEwKSElhOUVnZkZHU1VFZ3ZjSXZhWXFpTjRqVFV0
33
+ aWRmRUZ3K0x0anM4QVA5Z1dnU0lZUzZHcjM4VjBXR0ZGTnpJSAphT0Qyd211
34
+ OW9vL1JmZlc0aFMvOEd1dmZNemN3N0NRMzU1d0ZSNEtCL255emUrRXNaMVk1
35
+ RGVyQ0FhZ01WdURRClUwQkxtV0RGelBHR1dsUGVRQ3JZSENyK0FjSnorTlJu
36
+ YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
37
+ Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
38
+ cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
+ date: 2012-02-18 00:00:00.000000000 Z
52
40
  dependencies:
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: nokogiri
55
- requirement: &70337700771620 !ruby/object:Gem::Requirement
43
+ requirement: &70186557497160 !ruby/object:Gem::Requirement
56
44
  none: false
57
45
  requirements:
58
46
  - - ~>
@@ -60,10 +48,10 @@ dependencies:
60
48
  version: '1.5'
61
49
  type: :runtime
62
50
  prerelease: false
63
- version_requirements: *70337700771620
51
+ version_requirements: *70186557497160
64
52
  - !ruby/object:Gem::Dependency
65
53
  name: sequel
66
- requirement: &70337700771160 !ruby/object:Gem::Requirement
54
+ requirement: &70186557496640 !ruby/object:Gem::Requirement
67
55
  none: false
68
56
  requirements:
69
57
  - - ~>
@@ -71,10 +59,10 @@ dependencies:
71
59
  version: '3.31'
72
60
  type: :runtime
73
61
  prerelease: false
74
- version_requirements: *70337700771160
62
+ version_requirements: *70186557496640
75
63
  - !ruby/object:Gem::Dependency
76
64
  name: amalgalite
77
- requirement: &70337700770600 !ruby/object:Gem::Requirement
65
+ requirement: &70186557496120 !ruby/object:Gem::Requirement
78
66
  none: false
79
67
  requirements:
80
68
  - - ~>
@@ -82,10 +70,10 @@ dependencies:
82
70
  version: '1.1'
83
71
  type: :runtime
84
72
  prerelease: false
85
- version_requirements: *70337700770600
73
+ version_requirements: *70186557496120
86
74
  - !ruby/object:Gem::Dependency
87
75
  name: tnetstring
88
- requirement: &70337700770060 !ruby/object:Gem::Requirement
76
+ requirement: &70186557495600 !ruby/object:Gem::Requirement
89
77
  none: false
90
78
  requirements:
91
79
  - - ~>
@@ -93,10 +81,10 @@ dependencies:
93
81
  version: '0.3'
94
82
  type: :runtime
95
83
  prerelease: false
96
- version_requirements: *70337700770060
84
+ version_requirements: *70186557495600
97
85
  - !ruby/object:Gem::Dependency
98
86
  name: yajl-ruby
99
- requirement: &70337700769520 !ruby/object:Gem::Requirement
87
+ requirement: &70186557495180 !ruby/object:Gem::Requirement
100
88
  none: false
101
89
  requirements:
102
90
  - - ~>
@@ -104,10 +92,10 @@ dependencies:
104
92
  version: '1.0'
105
93
  type: :runtime
106
94
  prerelease: false
107
- version_requirements: *70337700769520
95
+ version_requirements: *70186557495180
108
96
  - !ruby/object:Gem::Dependency
109
97
  name: trollop
110
- requirement: &70337700769020 !ruby/object:Gem::Requirement
98
+ requirement: &70186557494640 !ruby/object:Gem::Requirement
111
99
  none: false
112
100
  requirements:
113
101
  - - ~>
@@ -115,10 +103,10 @@ dependencies:
115
103
  version: '1.16'
116
104
  type: :runtime
117
105
  prerelease: false
118
- version_requirements: *70337700769020
106
+ version_requirements: *70186557494640
119
107
  - !ruby/object:Gem::Dependency
120
108
  name: sysexits
121
- requirement: &70337700768500 !ruby/object:Gem::Requirement
109
+ requirement: &70186557494140 !ruby/object:Gem::Requirement
122
110
  none: false
123
111
  requirements:
124
112
  - - ~>
@@ -126,10 +114,10 @@ dependencies:
126
114
  version: '1.0'
127
115
  type: :runtime
128
116
  prerelease: false
129
- version_requirements: *70337700768500
117
+ version_requirements: *70186557494140
130
118
  - !ruby/object:Gem::Dependency
131
119
  name: zmq
132
- requirement: &70337700767980 !ruby/object:Gem::Requirement
120
+ requirement: &70186557493620 !ruby/object:Gem::Requirement
133
121
  none: false
134
122
  requirements:
135
123
  - - ~>
@@ -137,10 +125,10 @@ dependencies:
137
125
  version: 2.1.4
138
126
  type: :runtime
139
127
  prerelease: false
140
- version_requirements: *70337700767980
128
+ version_requirements: *70186557493620
141
129
  - !ruby/object:Gem::Dependency
142
130
  name: hoe-mercurial
143
- requirement: &70337700767500 !ruby/object:Gem::Requirement
131
+ requirement: &70186557493100 !ruby/object:Gem::Requirement
144
132
  none: false
145
133
  requirements:
146
134
  - - ~>
@@ -148,10 +136,10 @@ dependencies:
148
136
  version: 1.3.1
149
137
  type: :development
150
138
  prerelease: false
151
- version_requirements: *70337700767500
139
+ version_requirements: *70186557493100
152
140
  - !ruby/object:Gem::Dependency
153
141
  name: hoe-highline
154
- requirement: &70337700766940 !ruby/object:Gem::Requirement
142
+ requirement: &70186557492580 !ruby/object:Gem::Requirement
155
143
  none: false
156
144
  requirements:
157
145
  - - ~>
@@ -159,10 +147,10 @@ dependencies:
159
147
  version: 0.0.1
160
148
  type: :development
161
149
  prerelease: false
162
- version_requirements: *70337700766940
150
+ version_requirements: *70186557492580
163
151
  - !ruby/object:Gem::Dependency
164
152
  name: configurability
165
- requirement: &70337700766400 !ruby/object:Gem::Requirement
153
+ requirement: &70186557491940 !ruby/object:Gem::Requirement
166
154
  none: false
167
155
  requirements:
168
156
  - - ~>
@@ -170,10 +158,10 @@ dependencies:
170
158
  version: '1.0'
171
159
  type: :development
172
160
  prerelease: false
173
- version_requirements: *70337700766400
161
+ version_requirements: *70186557491940
174
162
  - !ruby/object:Gem::Dependency
175
163
  name: rspec
176
- requirement: &70337700765860 !ruby/object:Gem::Requirement
164
+ requirement: &70186557490880 !ruby/object:Gem::Requirement
177
165
  none: false
178
166
  requirements:
179
167
  - - ~>
@@ -181,10 +169,10 @@ dependencies:
181
169
  version: '2.8'
182
170
  type: :development
183
171
  prerelease: false
184
- version_requirements: *70337700765860
172
+ version_requirements: *70186557490880
185
173
  - !ruby/object:Gem::Dependency
186
174
  name: rdoc
187
- requirement: &70337700765360 !ruby/object:Gem::Requirement
175
+ requirement: &70186557506660 !ruby/object:Gem::Requirement
188
176
  none: false
189
177
  requirements:
190
178
  - - ~>
@@ -192,10 +180,10 @@ dependencies:
192
180
  version: '3.10'
193
181
  type: :development
194
182
  prerelease: false
195
- version_requirements: *70337700765360
183
+ version_requirements: *70186557506660
196
184
  - !ruby/object:Gem::Dependency
197
185
  name: hoe
198
- requirement: &70337700764820 !ruby/object:Gem::Requirement
186
+ requirement: &70186557506040 !ruby/object:Gem::Requirement
199
187
  none: false
200
188
  requirements:
201
189
  - - ~>
@@ -203,7 +191,7 @@ dependencies:
203
191
  version: '2.13'
204
192
  type: :development
205
193
  prerelease: false
206
- version_requirements: *70337700764820
194
+ version_requirements: *70186557506040
207
195
  description: ! "Ruby-Mongrel2 is a complete Ruby (1.9-only) connector for \nMongrel2[http://mongrel2.org/].\n\nThis
208
196
  library includes configuration-database ORM classes, a Ruby\nimplementation of the
209
197
  'm2sh' tool, a configuration DSL for generating config\ndatabases in pure Ruby,
@@ -329,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
317
  version: '0'
330
318
  requirements: []
331
319
  rubyforge_project: mongrel2
332
- rubygems_version: 1.8.10
320
+ rubygems_version: 1.8.16
333
321
  signing_key:
334
322
  specification_version: 3
335
323
  summary: Ruby-Mongrel2 is a complete Ruby (1.9-only) connector for Mongrel2[http://mongrel2.org/]
metadata.gz.sig CHANGED
Binary file