mongrel2 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +5 -0
- data/Rakefile +0 -18
- data/examples/config.rb +0 -0
- data/examples/request-dumper.rb +4 -3
- data/lib/mongrel2/constants.rb +0 -3
- data/lib/mongrel2/httpresponse.rb +8 -4
- data/lib/mongrel2.rb +2 -2
- data/spec/mongrel2/httpresponse_spec.rb +19 -2
- data.tar.gz.sig +0 -0
- metadata +26 -26
- metadata.gz.sig +0 -0
data/History.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -46,28 +46,10 @@ ENV['VERSION'] ||= hoespec.spec.version.to_s
|
|
46
46
|
# Ensure the specs pass before checking in
|
47
47
|
task 'hg:precheckin' => :spec
|
48
48
|
|
49
|
-
### Make the ChangeLog update if the repo has changed since it was last built
|
50
|
-
file '.hg/branch'
|
51
|
-
file 'ChangeLog' => '.hg/branch' do |task|
|
52
|
-
$stderr.puts "Updating the changelog..."
|
53
|
-
abort "Can't create the ChangeLog without hoe-mercurial (gem install hoe-mercurial)" unless
|
54
|
-
defined?( MercurialHelpers )
|
55
|
-
|
56
|
-
content = MercurialHelpers.make_changelog()
|
57
|
-
File.open( task.name, 'w', 0644 ) do |fh|
|
58
|
-
fh.print( content )
|
59
|
-
end
|
60
|
-
end
|
61
49
|
|
62
50
|
# Rebuild the ChangeLog immediately before release
|
63
51
|
task :prerelease => 'ChangeLog'
|
64
52
|
|
65
|
-
if Rake::Task.task_defined?( '.gemtest' )
|
66
|
-
Rake::Task['.gemtest'].clear
|
67
|
-
task '.gemtest' do
|
68
|
-
$stderr.puts "Not including a .gemtest until I'm confident the test suite is idempotent."
|
69
|
-
end
|
70
|
-
end
|
71
53
|
|
72
54
|
desc "Build a coverage report"
|
73
55
|
task :coverage do
|
data/examples/config.rb
CHANGED
File without changes
|
data/examples/request-dumper.rb
CHANGED
@@ -34,12 +34,13 @@ class RequestDumper < Mongrel2::Handler
|
|
34
34
|
return response
|
35
35
|
end
|
36
36
|
|
37
|
-
end # class
|
37
|
+
end # class RequestDumper
|
38
38
|
|
39
|
-
Mongrel2.log.level = Logger::INFO
|
39
|
+
Mongrel2.log.level = $DEBUG ? Logger::DEBUG : Logger::INFO
|
40
|
+
Inversion.log.level = Logger::INFO
|
40
41
|
|
41
42
|
# Point to the config database, which will cause the handler to use
|
42
43
|
# its ID to look up its own socket info.
|
43
|
-
Mongrel2::Config.configure( :configdb => '
|
44
|
+
Mongrel2::Config.configure( :configdb => 'config.sqlite' )
|
44
45
|
RequestDumper.run( 'request-dumper' )
|
45
46
|
|
data/lib/mongrel2/constants.rb
CHANGED
@@ -34,9 +34,11 @@ class Mongrel2::HTTPResponse < Mongrel2::Response
|
|
34
34
|
|
35
35
|
super( sender_id, conn_id, body )
|
36
36
|
|
37
|
-
@headers = Mongrel2::Table.new
|
37
|
+
@headers = Mongrel2::Table.new
|
38
38
|
@status = nil
|
39
39
|
self.reset
|
40
|
+
|
41
|
+
@headers.merge!( headers )
|
40
42
|
end
|
41
43
|
|
42
44
|
|
@@ -138,10 +140,12 @@ class Mongrel2::HTTPResponse < Mongrel2::Response
|
|
138
140
|
|
139
141
|
### Return the current response header as a valid HTTP string.
|
140
142
|
def header_data
|
141
|
-
|
142
|
-
|
143
|
+
headers = self.headers.dup
|
144
|
+
|
145
|
+
headers[:date] ||= Time.now.httpdate
|
146
|
+
headers[:content_length] ||= self.get_content_length
|
143
147
|
|
144
|
-
return
|
148
|
+
return headers.to_s
|
145
149
|
end
|
146
150
|
|
147
151
|
|
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.1.
|
17
|
+
VERSION = '0.1.2'
|
18
18
|
|
19
19
|
# Version-control revision constant
|
20
|
-
REVISION = %q$Revision:
|
20
|
+
REVISION = %q$Revision: 4212c8770654 $
|
21
21
|
|
22
22
|
|
23
23
|
require 'mongrel2/logging'
|
@@ -30,7 +30,7 @@ describe Mongrel2::HTTPResponse do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
before( :each ) do
|
33
|
-
@response = Mongrel2::HTTPResponse.new( TEST_UUID, 299 )
|
33
|
+
@response = Mongrel2::HTTPResponse.new( TEST_UUID, 299, :content_type => 'text/html' )
|
34
34
|
end
|
35
35
|
|
36
36
|
after( :all ) do
|
@@ -42,15 +42,27 @@ describe Mongrel2::HTTPResponse do
|
|
42
42
|
@response.headers.should be_a( Mongrel2::Table )
|
43
43
|
end
|
44
44
|
|
45
|
+
it "allows headers to be set when the response is created" do
|
46
|
+
@response.headers.content_type.should == 'text/html'
|
47
|
+
end
|
48
|
+
|
45
49
|
it "is a status 200 response if not set otherwise" do
|
46
50
|
@response.status_line.should == 'HTTP/1.1 200 OK'
|
47
51
|
end
|
48
52
|
|
49
53
|
it "sets Date and Content-length headers automatically if they haven't been set" do
|
50
|
-
@response
|
54
|
+
@response << "Some stuff."
|
55
|
+
|
56
|
+
@response.header_data.should =~ /Content-length: 11/i
|
51
57
|
@response.header_data.should =~ /Date: #{HTTP_DATE}/i
|
52
58
|
end
|
53
59
|
|
60
|
+
it "re-calculates the automatically-added headers when re-rendered" do
|
61
|
+
@response.header_data.should =~ /Content-length: 0/i
|
62
|
+
@response << "More data!"
|
63
|
+
@response.header_data.should =~ /Content-length: 10/i
|
64
|
+
end
|
65
|
+
|
54
66
|
it "doesn't have a body" do
|
55
67
|
@response.body.should be_empty()
|
56
68
|
end
|
@@ -228,5 +240,10 @@ describe Mongrel2::HTTPResponse do
|
|
228
240
|
@response.should be_keepalive()
|
229
241
|
end
|
230
242
|
|
243
|
+
it "has a puts method for appending objects to the body" do
|
244
|
+
@response.puts( :something_to_sable )
|
245
|
+
@response.body.should == "something_to_sable\n"
|
246
|
+
end
|
247
|
+
|
231
248
|
end
|
232
249
|
|
data.tar.gz.sig
CHANGED
Binary 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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -48,11 +48,11 @@ cert_chain:
|
|
48
48
|
-----END CERTIFICATE-----
|
49
49
|
|
50
50
|
'
|
51
|
-
date: 2011-09-
|
51
|
+
date: 2011-09-16 00:00:00.000000000Z
|
52
52
|
dependencies:
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: nokogiri
|
55
|
-
requirement: &
|
55
|
+
requirement: &2170501340 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
58
58
|
- - ~>
|
@@ -60,10 +60,10 @@ dependencies:
|
|
60
60
|
version: '1.5'
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
|
-
version_requirements: *
|
63
|
+
version_requirements: *2170501340
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: sequel
|
66
|
-
requirement: &
|
66
|
+
requirement: &2170500720 !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
68
68
|
requirements:
|
69
69
|
- - ~>
|
@@ -71,10 +71,10 @@ dependencies:
|
|
71
71
|
version: '3.26'
|
72
72
|
type: :runtime
|
73
73
|
prerelease: false
|
74
|
-
version_requirements: *
|
74
|
+
version_requirements: *2170500720
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: amalgalite
|
77
|
-
requirement: &
|
77
|
+
requirement: &2170500140 !ruby/object:Gem::Requirement
|
78
78
|
none: false
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
@@ -82,10 +82,10 @@ dependencies:
|
|
82
82
|
version: '1.1'
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
|
-
version_requirements: *
|
85
|
+
version_requirements: *2170500140
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: tnetstring
|
88
|
-
requirement: &
|
88
|
+
requirement: &2170499500 !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
@@ -93,10 +93,10 @@ dependencies:
|
|
93
93
|
version: '0.3'
|
94
94
|
type: :runtime
|
95
95
|
prerelease: false
|
96
|
-
version_requirements: *
|
96
|
+
version_requirements: *2170499500
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: yajl-ruby
|
99
|
-
requirement: &
|
99
|
+
requirement: &2170499000 !ruby/object:Gem::Requirement
|
100
100
|
none: false
|
101
101
|
requirements:
|
102
102
|
- - ~>
|
@@ -104,10 +104,10 @@ dependencies:
|
|
104
104
|
version: '0.8'
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
|
-
version_requirements: *
|
107
|
+
version_requirements: *2170499000
|
108
108
|
- !ruby/object:Gem::Dependency
|
109
109
|
name: zmq
|
110
|
-
requirement: &
|
110
|
+
requirement: &2170498380 !ruby/object:Gem::Requirement
|
111
111
|
none: false
|
112
112
|
requirements:
|
113
113
|
- - ~>
|
@@ -115,21 +115,21 @@ dependencies:
|
|
115
115
|
version: 2.1.4
|
116
116
|
type: :runtime
|
117
117
|
prerelease: false
|
118
|
-
version_requirements: *
|
118
|
+
version_requirements: *2170498380
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: hoe-mercurial
|
121
|
-
requirement: &
|
121
|
+
requirement: &2170497820 !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
123
123
|
requirements:
|
124
124
|
- - ~>
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 1.2.
|
126
|
+
version: 1.2.1
|
127
127
|
type: :development
|
128
128
|
prerelease: false
|
129
|
-
version_requirements: *
|
129
|
+
version_requirements: *2170497820
|
130
130
|
- !ruby/object:Gem::Dependency
|
131
131
|
name: hoe-highline
|
132
|
-
requirement: &
|
132
|
+
requirement: &2170497200 !ruby/object:Gem::Requirement
|
133
133
|
none: false
|
134
134
|
requirements:
|
135
135
|
- - ~>
|
@@ -137,10 +137,10 @@ dependencies:
|
|
137
137
|
version: 0.0.1
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
|
-
version_requirements: *
|
140
|
+
version_requirements: *2170497200
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: configurability
|
143
|
-
requirement: &
|
143
|
+
requirement: &2170496520 !ruby/object:Gem::Requirement
|
144
144
|
none: false
|
145
145
|
requirements:
|
146
146
|
- - ~>
|
@@ -148,10 +148,10 @@ dependencies:
|
|
148
148
|
version: '1.0'
|
149
149
|
type: :development
|
150
150
|
prerelease: false
|
151
|
-
version_requirements: *
|
151
|
+
version_requirements: *2170496520
|
152
152
|
- !ruby/object:Gem::Dependency
|
153
153
|
name: rspec
|
154
|
-
requirement: &
|
154
|
+
requirement: &2170495900 !ruby/object:Gem::Requirement
|
155
155
|
none: false
|
156
156
|
requirements:
|
157
157
|
- - ~>
|
@@ -159,18 +159,18 @@ dependencies:
|
|
159
159
|
version: '2.4'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
|
-
version_requirements: *
|
162
|
+
version_requirements: *2170495900
|
163
163
|
- !ruby/object:Gem::Dependency
|
164
164
|
name: hoe
|
165
|
-
requirement: &
|
165
|
+
requirement: &2170495420 !ruby/object:Gem::Requirement
|
166
166
|
none: false
|
167
167
|
requirements:
|
168
168
|
- - ~>
|
169
169
|
- !ruby/object:Gem::Version
|
170
|
-
version: '2.
|
170
|
+
version: '2.11'
|
171
171
|
type: :development
|
172
172
|
prerelease: false
|
173
|
-
version_requirements: *
|
173
|
+
version_requirements: *2170495420
|
174
174
|
description: ! "A complete Ruby connector for Mongrel2[http://mongrel2.org/].\n\nThis
|
175
175
|
library includes configuration-database ORM classes, a Ruby\nimplementation of the
|
176
176
|
'm2sh' tool, a configuration DSL for generating config\ndatabases in pure Ruby,
|
metadata.gz.sig
CHANGED
Binary file
|