mongrel2 0.20.3 → 0.21.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,3 +1,48 @@
1
+ 2012-04-23 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * Rakefile:
4
+ Activate deveiate Hoe plugin
5
+ [4b74d9363949] [github/master, tip]
6
+
7
+ * lib/mongrel2/handler.rb:
8
+ Log the request at INFO, too.
9
+ [b6f11e532b29]
10
+
11
+ 2012-04-18 Michael Granger <ged@FaerieMUD.org>
12
+
13
+ * lib/mongrel2/config.rb:
14
+ Rename the defaults for Mongrel2::Config.
15
+
16
+ This was changed to conform with Configurability's defaults API. The
17
+ old name was aliased to the new for backward-compatibility.
18
+ [c3bd7b10d758]
19
+
20
+ 2012-04-12 Mahlon E. Smith <mahlon@martini.nu>
21
+
22
+ * lib/mongrel2/httprequest.rb, spec/mongrel2/httprequest_spec.rb:
23
+ Add a Mongrel2::HTTPRequest#remote_ip method. This should support
24
+ both the current Mongrel (1.7.5) and the future plan for appended X
25
+ -Forwarded-For headers.
26
+ [4a241cca71d5]
27
+
28
+ 2012-04-12 Michael Granger <ged@FaerieMUD.org>
29
+
30
+ * .hgtags:
31
+ Added tag v0.20.3 for changeset ea27cb7efdd5
32
+ [5e35f7001c58]
33
+
34
+ * .hgsigs:
35
+ Added signature for changeset e27a161d2009
36
+ [ea27cb7efdd5] [v0.20.3]
37
+
38
+ * History.rdoc, lib/mongrel2.rb:
39
+ Bump the patch version and update history.
40
+ [e27a161d2009]
41
+
42
+ * lib/mongrel2/testing.rb:
43
+ Fix a require in mongrel2/testing.
44
+ [081cc06dd255]
45
+
1
46
  2012-04-11 Michael Granger <ged@FaerieMUD.org>
2
47
 
3
48
  * lib/mongrel2/config.rb:
@@ -5,7 +50,7 @@
5
50
 
6
51
  This makes it possible to configure with a path again, and the
7
52
  Config class will choose the right adapter for you.
8
- [47450781e385] [tip]
53
+ [47450781e385]
9
54
 
10
55
  * README.rdoc:
11
56
  Move the "other implementations" section to the bottom of the
@@ -16,7 +61,7 @@
16
61
 
17
62
  * README.rdoc, Rakefile:
18
63
  Set docs to fivefish
19
- [551a2111a045] [github/master]
64
+ [551a2111a045]
20
65
 
21
66
  * .hgtags:
22
67
  Added tag v0.20.2 for changeset 2101ab88fa3c
@@ -150,7 +195,7 @@
150
195
  .database_initialized?, so add a new .without_sql_logging method for
151
196
  temporarily disabling SQL logging, and wrap that around the methods
152
197
  in quesion.
153
- [6b62343b4e5a]
198
+ [6b62343b4e5a] [github/master@default]
154
199
 
155
200
  * .rvm.gems, Rakefile:
156
201
  Add simplecov to dev dependencies
@@ -1,3 +1,13 @@
1
+ == v0.21.0 [2012-04-23] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Rename the defaults for Mongrel2::Config.
4
+ This was changed to conform with Configurability's defaults API. The
5
+ old name was aliased to the new for backward-compatibility.
6
+ - Add a Mongrel2::HTTPRequest#remote_ip method. This should support
7
+ both the current Mongrel (1.7.5) and the future plan for appended
8
+ X-Forwarded-For headers. [mahlon]
9
+
10
+
1
11
  == v0.20.3 [2012-04-12] Michael Granger <ged@FaerieMUD.org>
2
12
 
3
13
  - Fix a require in mongrel2/testing.
data/Rakefile CHANGED
@@ -14,6 +14,7 @@ end
14
14
 
15
15
  Hoe.plugin :mercurial
16
16
  Hoe.plugin :signing
17
+ Hoe.plugin :deveiate
17
18
 
18
19
  Hoe.plugins.delete :rubyforge
19
20
 
@@ -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.20.3'
17
+ VERSION = '0.21.0'
18
18
 
19
19
  # Version-control revision constant
20
- REVISION = %q$Revision: e27a161d2009 $
20
+ REVISION = %q$Revision: 0ecd9e4d21ee $
21
21
 
22
22
 
23
23
  require 'mongrel2/logging'
@@ -53,9 +53,10 @@ module Mongrel2
53
53
 
54
54
 
55
55
  # Configuration defaults
56
- DEFAULTS = {
56
+ CONFIG_DEFAULTS = {
57
57
  :configdb => Mongrel2::DEFAULT_CONFIG_URI,
58
58
  }
59
+ DEFAULTS = CONFIG_DEFAULTS
59
60
 
60
61
  # The Pathname of the data directory
61
62
  DATA_DIR = if Gem.datadir( 'mongrel2' )
@@ -105,11 +106,11 @@ module Mongrel2
105
106
  ### Configurability API -- called when the configuration is loaded with the
106
107
  ### 'mongrel2' section of the config file if there is one. This method can also be used
107
108
  ### without Configurability by passing an object that can be merged with
108
- ### Mongrel2::Config::DEFAULTS.
109
+ ### Mongrel2::Config::CONFIG_DEFAULTS.
109
110
  def self::configure( config=nil )
110
111
  return unless config
111
112
 
112
- config = DEFAULTS.merge( config )
113
+ config = CONFIG_DEFAULTS.merge( config )
113
114
 
114
115
  if dbspec = config[ :configdb ]
115
116
  # Assume it's a path to a sqlite database if it doesn't have a schema
@@ -161,6 +161,7 @@ class Mongrel2::Handler
161
161
  def start_accepting_requests
162
162
  until @conn.closed?
163
163
  req = @conn.receive
164
+ self.log.info( req.inspect )
164
165
  res = self.dispatch_request( req )
165
166
 
166
167
  if res
@@ -3,6 +3,7 @@
3
3
  require 'mongrel2/request' unless defined?( Mongrel2::Request )
4
4
  require 'mongrel2/mixins'
5
5
  require 'mongrel2/httpresponse'
6
+ require 'ipaddr'
6
7
 
7
8
 
8
9
  # The Mongrel2 HTTP Request class. Instances of this class represent an HTTP request from
@@ -78,6 +79,12 @@ class Mongrel2::HTTPRequest < Mongrel2::Request
78
79
  end
79
80
 
80
81
 
82
+ ### Fetch the original requestor IP address.
83
+ def remote_ip
84
+ ips = [ self.headers.x_forwarded_for ]
85
+ return IPAddr.new( ips.flatten.first )
86
+ end
87
+
81
88
 
82
89
  #########
83
90
  protected
@@ -112,6 +112,20 @@ describe Mongrel2::HTTPRequest do
112
112
  @req.content_encoding.should == 'identity'
113
113
  end
114
114
 
115
+ it "provides a convenience method for fetching the requestor's IP address" do
116
+ @req.headers.merge!(
117
+ 'X-Forwarded-For' => '127.0.0.1'
118
+ )
119
+ @req.remote_ip.to_s.should == '127.0.0.1'
120
+ end
121
+
122
+ it "fetching the requestor's IP address even when travelling via proxies" do
123
+ @req.headers.merge!(
124
+ 'X-Forwarded-For' => [ '127.0.0.1', '8.8.8.8', '4.4.4.4' ]
125
+ )
126
+ @req.remote_ip.to_s.should == '127.0.0.1'
127
+ end
128
+
115
129
  end
116
130
 
117
131
  end
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.20.3
4
+ version: 0.21.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,11 +36,11 @@ cert_chain:
36
36
  YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
37
37
  Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
38
38
  cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2012-04-12 00:00:00.000000000 Z
39
+ date: 2012-04-23 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: nokogiri
43
- requirement: &70167100219280 !ruby/object:Gem::Requirement
43
+ requirement: !ruby/object:Gem::Requirement
44
44
  none: false
45
45
  requirements:
46
46
  - - ~>
@@ -48,10 +48,15 @@ dependencies:
48
48
  version: '1.5'
49
49
  type: :runtime
50
50
  prerelease: false
51
- version_requirements: *70167100219280
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: '1.5'
52
57
  - !ruby/object:Gem::Dependency
53
58
  name: sequel
54
- requirement: &70167100229780 !ruby/object:Gem::Requirement
59
+ requirement: !ruby/object:Gem::Requirement
55
60
  none: false
56
61
  requirements:
57
62
  - - ~>
@@ -59,10 +64,15 @@ dependencies:
59
64
  version: '3.34'
60
65
  type: :runtime
61
66
  prerelease: false
62
- version_requirements: *70167100229780
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ version: '3.34'
63
73
  - !ruby/object:Gem::Dependency
64
74
  name: amalgalite
65
- requirement: &70167100223880 !ruby/object:Gem::Requirement
75
+ requirement: !ruby/object:Gem::Requirement
66
76
  none: false
67
77
  requirements:
68
78
  - - ~>
@@ -70,10 +80,15 @@ dependencies:
70
80
  version: '1.1'
71
81
  type: :runtime
72
82
  prerelease: false
73
- version_requirements: *70167100223880
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: '1.1'
74
89
  - !ruby/object:Gem::Dependency
75
90
  name: tnetstring
76
- requirement: &70167100236860 !ruby/object:Gem::Requirement
91
+ requirement: !ruby/object:Gem::Requirement
77
92
  none: false
78
93
  requirements:
79
94
  - - ~>
@@ -81,10 +96,15 @@ dependencies:
81
96
  version: '0.3'
82
97
  type: :runtime
83
98
  prerelease: false
84
- version_requirements: *70167100236860
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ~>
103
+ - !ruby/object:Gem::Version
104
+ version: '0.3'
85
105
  - !ruby/object:Gem::Dependency
86
106
  name: yajl-ruby
87
- requirement: &70167100234300 !ruby/object:Gem::Requirement
107
+ requirement: !ruby/object:Gem::Requirement
88
108
  none: false
89
109
  requirements:
90
110
  - - ~>
@@ -92,10 +112,15 @@ dependencies:
92
112
  version: '1.0'
93
113
  type: :runtime
94
114
  prerelease: false
95
- version_requirements: *70167100234300
115
+ version_requirements: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: '1.0'
96
121
  - !ruby/object:Gem::Dependency
97
122
  name: trollop
98
- requirement: &70167100232580 !ruby/object:Gem::Requirement
123
+ requirement: !ruby/object:Gem::Requirement
99
124
  none: false
100
125
  requirements:
101
126
  - - ~>
@@ -103,10 +128,15 @@ dependencies:
103
128
  version: '1.16'
104
129
  type: :runtime
105
130
  prerelease: false
106
- version_requirements: *70167100232580
131
+ version_requirements: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ~>
135
+ - !ruby/object:Gem::Version
136
+ version: '1.16'
107
137
  - !ruby/object:Gem::Dependency
108
138
  name: sysexits
109
- requirement: &70167100247420 !ruby/object:Gem::Requirement
139
+ requirement: !ruby/object:Gem::Requirement
110
140
  none: false
111
141
  requirements:
112
142
  - - ~>
@@ -114,10 +144,15 @@ dependencies:
114
144
  version: '1.0'
115
145
  type: :runtime
116
146
  prerelease: false
117
- version_requirements: *70167100247420
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: '1.0'
118
153
  - !ruby/object:Gem::Dependency
119
154
  name: zmq
120
- requirement: &70167100245260 !ruby/object:Gem::Requirement
155
+ requirement: !ruby/object:Gem::Requirement
121
156
  none: false
122
157
  requirements:
123
158
  - - ~>
@@ -125,10 +160,15 @@ dependencies:
125
160
  version: 2.1.4
126
161
  type: :runtime
127
162
  prerelease: false
128
- version_requirements: *70167100245260
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ none: false
165
+ requirements:
166
+ - - ~>
167
+ - !ruby/object:Gem::Version
168
+ version: 2.1.4
129
169
  - !ruby/object:Gem::Dependency
130
170
  name: hoe-mercurial
131
- requirement: &70167100243760 !ruby/object:Gem::Requirement
171
+ requirement: !ruby/object:Gem::Requirement
132
172
  none: false
133
173
  requirements:
134
174
  - - ~>
@@ -136,21 +176,31 @@ dependencies:
136
176
  version: 1.4.0
137
177
  type: :development
138
178
  prerelease: false
139
- version_requirements: *70167100243760
179
+ version_requirements: !ruby/object:Gem::Requirement
180
+ none: false
181
+ requirements:
182
+ - - ~>
183
+ - !ruby/object:Gem::Version
184
+ version: 1.4.0
140
185
  - !ruby/object:Gem::Dependency
141
186
  name: hoe-highline
142
- requirement: &70167100241960 !ruby/object:Gem::Requirement
187
+ requirement: !ruby/object:Gem::Requirement
143
188
  none: false
144
189
  requirements:
145
190
  - - ~>
146
191
  - !ruby/object:Gem::Version
147
- version: 0.1.0
192
+ version: 0.0.1
148
193
  type: :development
149
194
  prerelease: false
150
- version_requirements: *70167100241960
195
+ version_requirements: !ruby/object:Gem::Requirement
196
+ none: false
197
+ requirements:
198
+ - - ~>
199
+ - !ruby/object:Gem::Version
200
+ version: 0.0.1
151
201
  - !ruby/object:Gem::Dependency
152
202
  name: rdoc
153
- requirement: &70167100240180 !ruby/object:Gem::Requirement
203
+ requirement: !ruby/object:Gem::Requirement
154
204
  none: false
155
205
  requirements:
156
206
  - - ~>
@@ -158,10 +208,15 @@ dependencies:
158
208
  version: '3.10'
159
209
  type: :development
160
210
  prerelease: false
161
- version_requirements: *70167100240180
211
+ version_requirements: !ruby/object:Gem::Requirement
212
+ none: false
213
+ requirements:
214
+ - - ~>
215
+ - !ruby/object:Gem::Version
216
+ version: '3.10'
162
217
  - !ruby/object:Gem::Dependency
163
218
  name: configurability
164
- requirement: &70167100255100 !ruby/object:Gem::Requirement
219
+ requirement: !ruby/object:Gem::Requirement
165
220
  none: false
166
221
  requirements:
167
222
  - - ~>
@@ -169,10 +224,15 @@ dependencies:
169
224
  version: '1.0'
170
225
  type: :development
171
226
  prerelease: false
172
- version_requirements: *70167100255100
227
+ version_requirements: !ruby/object:Gem::Requirement
228
+ none: false
229
+ requirements:
230
+ - - ~>
231
+ - !ruby/object:Gem::Version
232
+ version: '1.0'
173
233
  - !ruby/object:Gem::Dependency
174
234
  name: simplecov
175
- requirement: &70167100253620 !ruby/object:Gem::Requirement
235
+ requirement: !ruby/object:Gem::Requirement
176
236
  none: false
177
237
  requirements:
178
238
  - - ~>
@@ -180,10 +240,15 @@ dependencies:
180
240
  version: '0.6'
181
241
  type: :development
182
242
  prerelease: false
183
- version_requirements: *70167100253620
243
+ version_requirements: !ruby/object:Gem::Requirement
244
+ none: false
245
+ requirements:
246
+ - - ~>
247
+ - !ruby/object:Gem::Version
248
+ version: '0.6'
184
249
  - !ruby/object:Gem::Dependency
185
250
  name: hoe-deveiate
186
- requirement: &70167100251720 !ruby/object:Gem::Requirement
251
+ requirement: !ruby/object:Gem::Requirement
187
252
  none: false
188
253
  requirements:
189
254
  - - ~>
@@ -191,10 +256,15 @@ dependencies:
191
256
  version: '0.1'
192
257
  type: :development
193
258
  prerelease: false
194
- version_requirements: *70167100251720
259
+ version_requirements: !ruby/object:Gem::Requirement
260
+ none: false
261
+ requirements:
262
+ - - ~>
263
+ - !ruby/object:Gem::Version
264
+ version: '0.1'
195
265
  - !ruby/object:Gem::Dependency
196
266
  name: hoe
197
- requirement: &70167100250340 !ruby/object:Gem::Requirement
267
+ requirement: !ruby/object:Gem::Requirement
198
268
  none: false
199
269
  requirements:
200
270
  - - ~>
@@ -202,7 +272,12 @@ dependencies:
202
272
  version: '3.0'
203
273
  type: :development
204
274
  prerelease: false
205
- version_requirements: *70167100250340
275
+ version_requirements: !ruby/object:Gem::Requirement
276
+ none: false
277
+ requirements:
278
+ - - ~>
279
+ - !ruby/object:Gem::Version
280
+ version: '3.0'
206
281
  description: ! 'Ruby-Mongrel2 is a complete Ruby (1.9-only) connector for
207
282
 
208
283
  Mongrel2[http://mongrel2.org/].
@@ -332,7 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
332
407
  version: '0'
333
408
  requirements: []
334
409
  rubyforge_project: mongrel2
335
- rubygems_version: 1.8.16
410
+ rubygems_version: 1.8.21
336
411
  signing_key:
337
412
  specification_version: 3
338
413
  summary: Ruby-Mongrel2 is a complete Ruby (1.9-only) connector for Mongrel2[http://mongrel2.org/]
metadata.gz.sig CHANGED
Binary file