mongrel2 0.52.2 → 0.53.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 +0 -0
- data.tar.gz.sig +0 -0
- data/ChangeLog +128 -2
- data/History.rdoc +10 -0
- data/Manifest.txt +1 -0
- data/Rakefile +1 -1
- data/lib/mongrel2.rb +3 -3
- data/lib/mongrel2/config.rb +2 -1
- data/lib/mongrel2/config/directory.rb +2 -1
- data/lib/mongrel2/config/dsl.rb +2 -1
- data/lib/mongrel2/config/filter.rb +2 -1
- data/lib/mongrel2/config/handler.rb +2 -1
- data/lib/mongrel2/config/host.rb +2 -1
- data/lib/mongrel2/config/log.rb +2 -1
- data/lib/mongrel2/config/mimetype.rb +2 -1
- data/lib/mongrel2/config/proxy.rb +2 -1
- data/lib/mongrel2/config/route.rb +2 -1
- data/lib/mongrel2/config/server.rb +2 -1
- data/lib/mongrel2/config/setting.rb +2 -1
- data/lib/mongrel2/config/statistic.rb +2 -1
- data/lib/mongrel2/config/xrequest.rb +2 -1
- data/lib/mongrel2/connection.rb +1 -1
- data/lib/mongrel2/constants.rb +2 -1
- data/lib/mongrel2/control.rb +2 -1
- data/lib/mongrel2/exceptions.rb +2 -1
- data/lib/mongrel2/handler.rb +9 -8
- data/lib/mongrel2/httprequest.rb +2 -1
- data/lib/mongrel2/httpresponse.rb +2 -1
- data/lib/mongrel2/jsonrequest.rb +2 -1
- data/lib/mongrel2/request.rb +16 -9
- data/lib/mongrel2/response.rb +14 -6
- data/lib/mongrel2/table.rb +24 -3
- data/lib/mongrel2/testing.rb +12 -25
- data/lib/mongrel2/websocket.rb +230 -148
- data/lib/mongrel2/xmlrequest.rb +2 -1
- data/spec/constants.rb +3 -2
- data/spec/helpers.rb +2 -1
- data/spec/matchers.rb +2 -1
- data/spec/mongrel2/config/directory_spec.rb +2 -1
- data/spec/mongrel2/config/dsl_spec.rb +2 -1
- data/spec/mongrel2/config/filter_spec.rb +2 -1
- data/spec/mongrel2/config/handler_spec.rb +2 -1
- data/spec/mongrel2/config/host_spec.rb +2 -1
- data/spec/mongrel2/config/log_spec.rb +2 -1
- data/spec/mongrel2/config/proxy_spec.rb +2 -1
- data/spec/mongrel2/config/route_spec.rb +2 -1
- data/spec/mongrel2/config/server_spec.rb +2 -1
- data/spec/mongrel2/config/setting_spec.rb +2 -1
- data/spec/mongrel2/config/statistic_spec.rb +2 -1
- data/spec/mongrel2/config/xrequest_spec.rb +2 -1
- data/spec/mongrel2/config_spec.rb +2 -1
- data/spec/mongrel2/connection_spec.rb +2 -1
- data/spec/mongrel2/constants_spec.rb +2 -1
- data/spec/mongrel2/control_spec.rb +2 -1
- data/spec/mongrel2/handler_spec.rb +4 -3
- data/spec/mongrel2/httprequest_spec.rb +2 -1
- data/spec/mongrel2/httpresponse_spec.rb +2 -1
- data/spec/mongrel2/request_spec.rb +7 -1
- data/spec/mongrel2/response_spec.rb +9 -1
- data/spec/mongrel2/table_spec.rb +4 -3
- data/spec/mongrel2/testing_spec.rb +142 -0
- data/spec/mongrel2/websocket_spec.rb +300 -136
- data/spec/mongrel2/xmlrequest_spec.rb +2 -1
- data/spec/mongrel2_spec.rb +2 -1
- metadata +6 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d437852dd09b80cd9925ec41dbc8b29d9d2d0d758e30cd5acab9d378167fd1bd
|
4
|
+
data.tar.gz: 1de4e99640b27b825d1540e28d99ec0d9338f1cf6907ed34217cb10c87f6163d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 398bf47544d029215eb81829999ea3fd3438e03576cb1be8abbc9e5a842bb95044e29faf000d5e863e9b2f3ef5f69d1d15b33a647d1c13d9e1f3ad191f5f902a
|
7
|
+
data.tar.gz: 39d7771ea0811fccb299d61cf960ee6d50e708012e099b7eec10dcf20290ecdb7b7bd01cb5db6eefc4bbe787d14a5eee7ad810963d13f43a5757d6b332f77d6f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
@@ -1,8 +1,134 @@
|
|
1
|
+
2019-06-26 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
@ * History.rdoc, Rakefile, lib/mongrel2.rb:
|
4
|
+
| Bump the minor version, update history, bump minimum Ruby version to
|
5
|
+
| 2.4.x
|
6
|
+
| [cfedd3805c13] [tip]
|
7
|
+
|
|
8
|
+
o * Manifest.txt, lib/mongrel2/table.rb, lib/mongrel2/testing.rb,
|
9
|
+
| spec/mongrel2/testing_spec.rb:
|
10
|
+
| Fix a few bugs in the testing facilities
|
11
|
+
| [c7c8575f9d60]
|
12
|
+
|
|
13
|
+
2019-05-07 Michael Granger <ged@FaerieMUD.org>
|
14
|
+
|
15
|
+
o * lib/mongrel2.rb, lib/mongrel2/config.rb,
|
16
|
+
| lib/mongrel2/config/directory.rb, lib/mongrel2/config/dsl.rb,
|
17
|
+
| lib/mongrel2/config/filter.rb, lib/mongrel2/config/handler.rb,
|
18
|
+
| lib/mongrel2/config/host.rb, lib/mongrel2/config/log.rb,
|
19
|
+
| lib/mongrel2/config/mimetype.rb, lib/mongrel2/config/proxy.rb,
|
20
|
+
| lib/mongrel2/config/route.rb, lib/mongrel2/config/server.rb,
|
21
|
+
| lib/mongrel2/config/setting.rb, lib/mongrel2/config/statistic.rb,
|
22
|
+
| lib/mongrel2/config/xrequest.rb, lib/mongrel2/connection.rb,
|
23
|
+
| lib/mongrel2/constants.rb, lib/mongrel2/control.rb,
|
24
|
+
| lib/mongrel2/exceptions.rb, lib/mongrel2/handler.rb,
|
25
|
+
| lib/mongrel2/httprequest.rb, lib/mongrel2/httpresponse.rb,
|
26
|
+
| lib/mongrel2/jsonrequest.rb, lib/mongrel2/request.rb,
|
27
|
+
| lib/mongrel2/response.rb, lib/mongrel2/table.rb,
|
28
|
+
| lib/mongrel2/testing.rb, lib/mongrel2/websocket.rb,
|
29
|
+
| lib/mongrel2/xmlrequest.rb, spec/constants.rb, spec/helpers.rb,
|
30
|
+
| spec/matchers.rb, spec/mongrel2/config/directory_spec.rb,
|
31
|
+
| spec/mongrel2/config/dsl_spec.rb,
|
32
|
+
| spec/mongrel2/config/filter_spec.rb,
|
33
|
+
| spec/mongrel2/config/handler_spec.rb,
|
34
|
+
| spec/mongrel2/config/host_spec.rb, spec/mongrel2/config/log_spec.rb,
|
35
|
+
| spec/mongrel2/config/proxy_spec.rb,
|
36
|
+
| spec/mongrel2/config/route_spec.rb,
|
37
|
+
| spec/mongrel2/config/server_spec.rb,
|
38
|
+
| spec/mongrel2/config/setting_spec.rb,
|
39
|
+
| spec/mongrel2/config/statistic_spec.rb,
|
40
|
+
| spec/mongrel2/config/xrequest_spec.rb, spec/mongrel2/config_spec.rb,
|
41
|
+
| spec/mongrel2/connection_spec.rb, spec/mongrel2/constants_spec.rb,
|
42
|
+
| spec/mongrel2/control_spec.rb, spec/mongrel2/handler_spec.rb,
|
43
|
+
| spec/mongrel2/httprequest_spec.rb,
|
44
|
+
| spec/mongrel2/httpresponse_spec.rb, spec/mongrel2/request_spec.rb,
|
45
|
+
| spec/mongrel2/response_spec.rb, spec/mongrel2/table_spec.rb,
|
46
|
+
| spec/mongrel2/websocket_spec.rb, spec/mongrel2/xmlrequest_spec.rb,
|
47
|
+
| spec/mongrel2_spec.rb:
|
48
|
+
| Modify to run with frozen string literals
|
49
|
+
| [71e4f3d21a77]
|
50
|
+
|
|
51
|
+
2019-05-06 Michael Granger <ged@FaerieMUD.org>
|
52
|
+
|
53
|
+
o * lib/mongrel2/websocket.rb:
|
54
|
+
| Remove FrameMethod from WebSocket::ServerHandshake
|
55
|
+
| [e51f83280d48]
|
56
|
+
|
|
57
|
+
2019-05-03 Michael Granger <ged@FaerieMUD.org>
|
58
|
+
|
59
|
+
o * lib/mongrel2/testing.rb, lib/mongrel2/websocket.rb:
|
60
|
+
| Make WebSocket::Request#response more consistent with other kinds of
|
61
|
+
| requests.
|
62
|
+
| [ec5b4a929376]
|
63
|
+
|
|
64
|
+
o * lib/mongrel2/request.rb, lib/mongrel2/response.rb,
|
65
|
+
| lib/mongrel2/websocket.rb, spec/mongrel2/request_spec.rb,
|
66
|
+
| spec/mongrel2/response_spec.rb:
|
67
|
+
| Add a #socket_id method to Mongrel2::Request and ::Response.
|
68
|
+
| [68b1868529c1]
|
69
|
+
|
|
70
|
+
o * examples/ws-echo.rb, experiments/ws-chunks.rb,
|
71
|
+
| lib/mongrel2/handler.rb, lib/mongrel2/testing.rb,
|
72
|
+
| lib/mongrel2/websocket.rb, spec/constants.rb,
|
73
|
+
| spec/mongrel2/handler_spec.rb, spec/mongrel2/websocket_spec.rb:
|
74
|
+
| Rewrite websocket functionality
|
75
|
+
|
|
76
|
+
| This is a rewrite meant to make it easier to use websockets from
|
77
|
+
| within handlers. To that end, this:
|
78
|
+
|
|
79
|
+
| - Makes request/response and the frame different classes to make it
|
80
|
+
| easier to build frames manually.
|
81
|
+
| - Make use of iterators for composability
|
82
|
+
| - Add a convenience method for building a fragmented stream of frames
|
83
|
+
| from an IO-like object.
|
84
|
+
| [643069fd2f50]
|
85
|
+
|
|
86
|
+
2019-05-01 Michael Granger <ged@FaerieMUD.org>
|
87
|
+
|
88
|
+
o * lib/mongrel2/request.rb:
|
89
|
+
| Fix a typo in method docs
|
90
|
+
| [0aca6acfe8d0]
|
91
|
+
|
|
92
|
+
2019-04-24 Michael Granger <ged@FaerieMUD.org>
|
93
|
+
|
94
|
+
o * .hgtags:
|
95
|
+
| Added tag v0.52.2 for changeset 6ca17e3a8916
|
96
|
+
| [ed7b89588792]
|
97
|
+
|
|
98
|
+
o * .hgsigs:
|
99
|
+
| Added signature for changeset 1e1a3c278751
|
100
|
+
| [6ca17e3a8916] [v0.52.2]
|
101
|
+
|
|
102
|
+
o * History.rdoc, lib/mongrel2.rb:
|
103
|
+
| Bump the patch version, update history.
|
104
|
+
| [1e1a3c278751]
|
105
|
+
|
|
106
|
+
o * spec/mongrel2/config/directory_spec.rb,
|
107
|
+
| spec/mongrel2/config/dsl_spec.rb,
|
108
|
+
| spec/mongrel2/config/handler_spec.rb,
|
109
|
+
| spec/mongrel2/config/log_spec.rb,
|
110
|
+
| spec/mongrel2/config/route_spec.rb,
|
111
|
+
| spec/mongrel2/config/server_spec.rb, spec/mongrel2/config_spec.rb,
|
112
|
+
| spec/mongrel2/control_spec.rb, spec/mongrel2/handler_spec.rb,
|
113
|
+
| spec/mongrel2/httprequest_spec.rb,
|
114
|
+
| spec/mongrel2/httpresponse_spec.rb, spec/mongrel2/request_spec.rb,
|
115
|
+
| spec/mongrel2/response_spec.rb, spec/mongrel2/table_spec.rb,
|
116
|
+
| spec/mongrel2/websocket_spec.rb, spec/mongrel2_spec.rb:
|
117
|
+
| Make whitespace consistent in specs.
|
118
|
+
| [4632293da126]
|
119
|
+
|
|
120
|
+
2019-02-20 Michael Granger <ged@FaerieMUD.org>
|
121
|
+
|
122
|
+
o * .ruby-version, lib/mongrel2/handler.rb,
|
123
|
+
| spec/mongrel2/connection_spec.rb, spec/mongrel2/handler_spec.rb:
|
124
|
+
| Bump Ruby to 2.6, fix a few specs
|
125
|
+
| [3ff8014ca87c]
|
126
|
+
|
|
1
127
|
2018-07-31 Michael Granger <ged@FaerieMUD.org>
|
2
128
|
|
3
|
-
|
129
|
+
o * lib/mongrel2/connection.rb:
|
4
130
|
| Don't set linger on the Connection sockets until they're closing
|
5
|
-
| [3da3c8480391]
|
131
|
+
| [3da3c8480391]
|
6
132
|
|
|
7
133
|
o * lib/mongrel2/handler.rb:
|
8
134
|
| Defer creation of the reactor in the handler until it's #run
|
data/History.rdoc
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== v0.53.0 [2019-05-07] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Enhancements:
|
4
|
+
|
5
|
+
- Modify to run with frozen string literals (Ruby >= 2.6).
|
6
|
+
- Add a #socket_id method to Mongrel2::Request and ::Response.
|
7
|
+
- Rewrite websocket functionality to make it easier to write servers
|
8
|
+
that use it.
|
9
|
+
|
10
|
+
|
1
11
|
== v0.52.2 [2019-04-24] Michael Granger <ged@FaerieMUD.org>
|
2
12
|
|
3
13
|
Bugfixes:
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -42,7 +42,7 @@ hoespec = Hoe.spec 'mongrel2' do
|
|
42
42
|
self.dependency 'hoe-deveiate', '~> 0.8', :developer
|
43
43
|
self.dependency 'rdoc-generator-fivefish', '~> 0', :development
|
44
44
|
|
45
|
-
self.require_ruby_version( '>=2.
|
45
|
+
self.require_ruby_version( '>=2.4.0' )
|
46
46
|
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
47
47
|
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
48
48
|
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
data/lib/mongrel2.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'loggability'
|
5
5
|
require 'cztop'
|
@@ -19,10 +19,10 @@ module Mongrel2
|
|
19
19
|
log_as :mongrel2
|
20
20
|
|
21
21
|
|
22
|
-
abort "\n\n>>> Mongrel2 requires Ruby 2.
|
22
|
+
abort "\n\n>>> Mongrel2 requires Ruby 2.4 or later. <<<\n\n" if RUBY_VERSION < '2.4.0'
|
23
23
|
|
24
24
|
# Library version constant
|
25
|
-
VERSION = '0.
|
25
|
+
VERSION = '0.53.0'
|
26
26
|
|
27
27
|
# Version-control revision constant
|
28
28
|
REVISION = %q$Revision$
|
data/lib/mongrel2/config.rb
CHANGED
data/lib/mongrel2/config/dsl.rb
CHANGED
data/lib/mongrel2/config/host.rb
CHANGED
data/lib/mongrel2/config/log.rb
CHANGED
data/lib/mongrel2/connection.rb
CHANGED
data/lib/mongrel2/constants.rb
CHANGED
data/lib/mongrel2/control.rb
CHANGED
data/lib/mongrel2/exceptions.rb
CHANGED
data/lib/mongrel2/handler.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'cztop'
|
5
5
|
require 'cztop/reactor'
|
@@ -24,7 +24,7 @@ require 'mongrel2/websocket'
|
|
24
24
|
# A dumb, dead-simple example that just returns a plaintext 'Hello'
|
25
25
|
# document with a timestamp.
|
26
26
|
#
|
27
|
-
#
|
27
|
+
# # -*- ruby -*-
|
28
28
|
#
|
29
29
|
# require 'mongrel2/handler'
|
30
30
|
#
|
@@ -305,7 +305,7 @@ class Mongrel2::Handler
|
|
305
305
|
case request
|
306
306
|
when Mongrel2::WebSocket::ClientHandshake
|
307
307
|
return self.handle_websocket_handshake( request )
|
308
|
-
when Mongrel2::WebSocket::
|
308
|
+
when Mongrel2::WebSocket::Request
|
309
309
|
return self.handle_websocket( request )
|
310
310
|
when Mongrel2::HTTPRequest
|
311
311
|
return self.handle( request )
|
@@ -409,10 +409,11 @@ class Mongrel2::Handler
|
|
409
409
|
### a new request via the regular callback when the upload completes whose entity body
|
410
410
|
### is open to the spooled file.
|
411
411
|
def handle_async_upload_start( request )
|
412
|
-
explanation =
|
413
|
-
|
414
|
-
|
415
|
-
|
412
|
+
explanation = <<~END_MESSAGE % [ request.content_length ]
|
413
|
+
If you wish to handle requests like this, either set your server's
|
414
|
+
'limits.content_length' setting to a higher value than %d, or override
|
415
|
+
#handle_async_upload_start.
|
416
|
+
END_MESSAGE
|
416
417
|
|
417
418
|
self.log.warn "Async upload from %s dropped." % [ request.remote_ip ]
|
418
419
|
self.log.info( explanation )
|
data/lib/mongrel2/httprequest.rb
CHANGED
data/lib/mongrel2/jsonrequest.rb
CHANGED
data/lib/mongrel2/request.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'ipaddr'
|
5
5
|
require 'stringio'
|
@@ -109,7 +109,7 @@ class Mongrel2::Request
|
|
109
109
|
#################################################################
|
110
110
|
|
111
111
|
### Create a new Request object with the given +sender_id+, +conn_id+, +path+, +headers+,
|
112
|
-
### and +body+. The optional +
|
112
|
+
### and +body+. The optional +raw+ is for the raw request content, which can be useful
|
113
113
|
### later for debugging.
|
114
114
|
def initialize( sender_id, conn_id, path, headers, body='', raw=nil )
|
115
115
|
|
@@ -152,7 +152,7 @@ class Mongrel2::Request
|
|
152
152
|
### Set the request's entity body to +newbody+. If +newbody+ is a String-ish object
|
153
153
|
### (i.e., it responds to #to_str), it will be wrapped in a StringIO in 'r+' mode).
|
154
154
|
def body=( newbody )
|
155
|
-
newbody = StringIO.new( newbody, 'a+' ) if newbody.respond_to?( :to_str )
|
155
|
+
newbody = StringIO.new( newbody.dup, 'a+' ) if newbody.respond_to?( :to_str )
|
156
156
|
@body = newbody
|
157
157
|
end
|
158
158
|
|
@@ -258,15 +258,22 @@ class Mongrel2::Request
|
|
258
258
|
# :section: Introspection Methods
|
259
259
|
#
|
260
260
|
|
261
|
+
### Returns a string containing the request's sender and connection IDs
|
262
|
+
### separated by a colon.
|
263
|
+
def socket_id
|
264
|
+
return "%s:%d" % [ self.sender_id, self.conn_id ]
|
265
|
+
end
|
266
|
+
|
267
|
+
|
268
|
+
|
261
269
|
### Returns a string containing a human-readable representation of the Request,
|
262
270
|
### suitable for debugging.
|
263
271
|
def inspect
|
264
|
-
return "#<%p:0x%016x %s (%s
|
272
|
+
return "#<%p:0x%016x %s (%s)>" % [
|
265
273
|
self.class,
|
266
274
|
self.object_id * 2,
|
267
275
|
self.inspect_details,
|
268
|
-
self.
|
269
|
-
self.conn_id
|
276
|
+
self.socket_id
|
270
277
|
]
|
271
278
|
end
|
272
279
|
|
@@ -295,8 +302,8 @@ class Mongrel2::Request
|
|
295
302
|
body.is_a?( String )
|
296
303
|
|
297
304
|
# Get the object as a String, set the encoding
|
298
|
-
str = body
|
299
|
-
str.force_encoding( enc ) if enc && str.encoding == Encoding::ASCII_8BIT
|
305
|
+
str = String.new( body, encoding: enc )
|
306
|
+
# str.force_encoding( enc ) if enc && str.encoding == Encoding::ASCII_8BIT
|
300
307
|
|
301
308
|
return StringIO.new( str, 'r+' )
|
302
309
|
else
|