thin 1.6.4 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -0
- data/README.md +1 -1
- data/ext/thin_parser/parser.c +0 -5
- data/ext/thin_parser/parser.rl +0 -5
- data/lib/thin/backends/tcp_server.rb +10 -5
- data/lib/thin/connection.rb +1 -1
- data/lib/thin/request.rb +2 -2
- data/lib/thin/server.rb +11 -11
- data/lib/thin/version.rb +3 -3
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4541fb4ab6d2f90d8ca0053e41103ba2faed4f83
|
4
|
+
data.tar.gz: 0e68ce58e93e07f3bd93a51ab180bc1c64b2757c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be8f1c6914e4f6ae498718595841ee682bc7c41590e0c8128ff2f5233621932e242542502bd4881b24b617b37503c98bb619fdd8c2dec0a0cc5a6b2c3a7de561
|
7
|
+
data.tar.gz: 5f86ca62b6088e2a778fa8d9b777e7e60ceeea6bd7dfc21a6420e04ded91b03f03dc11c9a988099e11cab9d30e2a809330129b6ae74e974815348c55398c9989
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 1.7.0 Dunder Mifflin
|
2
|
+
* Rack 2 support
|
3
|
+
* Ensure Response body.close is called in the same thread
|
4
|
+
Fixes issues with ActiveRecord connection management [#307]
|
5
|
+
* Fix TCP/IP Backend reports incorrect port when asked to bind to 0 [meschbach]
|
6
|
+
* Work with ruby 2.3's --enable-frozen-string-literal [jeremyevans]
|
7
|
+
|
1
8
|
== 1.6.4 Gob Bluth
|
2
9
|
* Increase REQUEST_PATH to 2048 symbols [X2rdas]
|
3
10
|
* Fix warning in logger [tenderlove]
|
data/README.md
CHANGED
@@ -64,7 +64,7 @@ Thin is quite flexible in that many options can be specified at the command line
|
|
64
64
|
|
65
65
|
### Configuration files
|
66
66
|
|
67
|
-
You can create configuration files in yaml format and feed them to thin using `thin -C config.yml`. Here is an example config file:
|
67
|
+
You can create configuration files in yaml format and feed them to thin using `thin start -C config.yml`. Here is an example config file:
|
68
68
|
|
69
69
|
```yaml
|
70
70
|
---
|
data/ext/thin_parser/parser.c
CHANGED
@@ -1437,11 +1437,6 @@ int thin_http_parser_is_finished(http_parser *parser) {
|
|
1437
1437
|
|
1438
1438
|
int thin_http_parser_finish(http_parser *parser)
|
1439
1439
|
{
|
1440
|
-
int cs = parser->cs;
|
1441
|
-
|
1442
|
-
|
1443
|
-
parser->cs = cs;
|
1444
|
-
|
1445
1440
|
if (thin_http_parser_has_error(parser) ) {
|
1446
1441
|
return -1;
|
1447
1442
|
} else if (thin_http_parser_is_finished(parser) ) {
|
data/ext/thin_parser/parser.rl
CHANGED
@@ -142,11 +142,6 @@ int thin_http_parser_is_finished(http_parser *parser) {
|
|
142
142
|
|
143
143
|
int thin_http_parser_finish(http_parser *parser)
|
144
144
|
{
|
145
|
-
int cs = parser->cs;
|
146
|
-
|
147
|
-
|
148
|
-
parser->cs = cs;
|
149
|
-
|
150
145
|
if (thin_http_parser_has_error(parser) ) {
|
151
146
|
return -1;
|
152
147
|
} else if (thin_http_parser_is_finished(parser) ) {
|
@@ -4,26 +4,31 @@ module Thin
|
|
4
4
|
class TcpServer < Base
|
5
5
|
# Address and port on which the server is listening for connections.
|
6
6
|
attr_accessor :host, :port
|
7
|
-
|
7
|
+
|
8
8
|
def initialize(host, port)
|
9
9
|
@host = host
|
10
10
|
@port = port
|
11
11
|
super()
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
# Connect the server
|
15
15
|
def connect
|
16
16
|
@signature = EventMachine.start_server(@host, @port, Connection, &method(:initialize_connection))
|
17
|
+
binary_name = EventMachine.get_sockname( @signature )
|
18
|
+
port_name = Socket.unpack_sockaddr_in( binary_name )
|
19
|
+
@port = port_name[0]
|
20
|
+
@host = port_name[1]
|
21
|
+
@signature
|
17
22
|
end
|
18
|
-
|
23
|
+
|
19
24
|
# Stops the server
|
20
25
|
def disconnect
|
21
26
|
EventMachine.stop_server(@signature)
|
22
27
|
end
|
23
|
-
|
28
|
+
|
24
29
|
def to_s
|
25
30
|
"#{@host}:#{@port}"
|
26
31
|
end
|
27
32
|
end
|
28
33
|
end
|
29
|
-
end
|
34
|
+
end
|
data/lib/thin/connection.rb
CHANGED
data/lib/thin/request.rb
CHANGED
@@ -13,7 +13,7 @@ module Thin
|
|
13
13
|
BODY_TMPFILE = 'thin-body'.freeze
|
14
14
|
MAX_HEADER = 1024 * (80 + 32)
|
15
15
|
|
16
|
-
INITIAL_BODY =
|
16
|
+
INITIAL_BODY = String.new
|
17
17
|
# Force external_encoding of request's body to ASCII_8BIT
|
18
18
|
INITIAL_BODY.encode!(Encoding::ASCII_8BIT) if INITIAL_BODY.respond_to?(:encode!) && defined?(Encoding::ASCII_8BIT)
|
19
19
|
|
@@ -52,7 +52,7 @@ module Thin
|
|
52
52
|
|
53
53
|
def initialize
|
54
54
|
@parser = Thin::HttpParser.new
|
55
|
-
@data =
|
55
|
+
@data = String.new
|
56
56
|
@nparsed = 0
|
57
57
|
@body = StringIO.new(INITIAL_BODY.dup)
|
58
58
|
@env = {
|
data/lib/thin/server.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Thin
|
2
|
-
# The
|
3
|
-
# It
|
4
|
-
# and
|
2
|
+
# The utterly famous Thin HTTP server.
|
3
|
+
# It listens for incoming requests through a given +backend+
|
4
|
+
# and forwards all requests to +app+.
|
5
5
|
#
|
6
6
|
# == TCP server
|
7
|
-
# Create a new TCP server
|
7
|
+
# Create a new TCP server bound to <tt>host:port</tt> by specifiying +host+
|
8
8
|
# and +port+ as the first 2 arguments.
|
9
9
|
#
|
10
10
|
# Thin::Server.start('0.0.0.0', 3000, app)
|
@@ -18,12 +18,12 @@ module Thin
|
|
18
18
|
#
|
19
19
|
# == Using a custom backend
|
20
20
|
# You can implement your own way to connect the server to its client by creating your
|
21
|
-
# own Backend class and
|
21
|
+
# own Backend class and passing it as the :backend option.
|
22
22
|
#
|
23
23
|
# Thin::Server.start('galaxy://faraway', 1345, app, :backend => Thin::Backends::MyFancyBackend)
|
24
24
|
#
|
25
25
|
# == Rack application (+app+)
|
26
|
-
# All requests will be processed through +app
|
26
|
+
# All requests will be processed through +app+, which must be a valid Rack adapter.
|
27
27
|
# A valid Rack adapter (application) must respond to <tt>call(env#Hash)</tt> and
|
28
28
|
# return an array of <tt>[status, headers, body]</tt>.
|
29
29
|
#
|
@@ -76,10 +76,10 @@ module Thin
|
|
76
76
|
# Maximum number of file or socket descriptors that the server may open.
|
77
77
|
def_delegators :backend, :maximum_connections, :maximum_connections=
|
78
78
|
|
79
|
-
# Maximum number of
|
80
|
-
# Most
|
81
|
-
# when the timeout
|
82
|
-
#
|
79
|
+
# Maximum number of connections that can be persistent at the same time.
|
80
|
+
# Most browsers never close the connection so most of the time they are closed
|
81
|
+
# when the timeout occurs. If we don't control the number of persistent connections,
|
82
|
+
# it would be very easy to overflow the server for a DoS attack.
|
83
83
|
def_delegators :backend, :maximum_persistent_connections, :maximum_persistent_connections=
|
84
84
|
|
85
85
|
# Allow using threads in the backend.
|
@@ -166,7 +166,7 @@ module Thin
|
|
166
166
|
# == Gracefull shutdown
|
167
167
|
# Stops the server after processing all current connections.
|
168
168
|
# As soon as this method is called, the server stops accepting
|
169
|
-
# new requests and
|
169
|
+
# new requests and waits for all current connections to finish.
|
170
170
|
# Calling twice is the equivalent of calling <tt>stop!</tt>.
|
171
171
|
def stop
|
172
172
|
if running?
|
data/lib/thin/version.rb
CHANGED
@@ -5,12 +5,12 @@ module Thin
|
|
5
5
|
|
6
6
|
module VERSION #:nodoc:
|
7
7
|
MAJOR = 1
|
8
|
-
MINOR =
|
9
|
-
TINY =
|
8
|
+
MINOR = 7
|
9
|
+
TINY = 0
|
10
10
|
|
11
11
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
12
12
|
|
13
|
-
CODENAME = "
|
13
|
+
CODENAME = "Dunder Mifflin".freeze
|
14
14
|
|
15
15
|
RACK = [1, 0].freeze # Rack protocol version
|
16
16
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc-Andre Cournoyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '1'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
29
|
+
version: '1'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: eventmachine
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|