thin 1.6.4 → 2.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of thin might be problematic. Click here for more details.

Files changed (107) hide show
  1. data/.gitignore +9 -0
  2. data/CHANGELOG +29 -94
  3. data/Gemfile +8 -0
  4. data/README.md +46 -148
  5. data/Rakefile +28 -18
  6. data/bin/thin +4 -4
  7. data/examples/async.ru +21 -0
  8. data/examples/thin.conf.rb +39 -0
  9. data/lib/thin.rb +2 -44
  10. data/lib/thin/async.rb +108 -0
  11. data/lib/thin/backends/prefork.rb +44 -0
  12. data/lib/thin/backends/single_process.rb +28 -0
  13. data/lib/thin/chunked_body.rb +28 -0
  14. data/lib/thin/configurator.rb +118 -0
  15. data/lib/thin/connection.rb +246 -172
  16. data/lib/thin/listener.rb +114 -0
  17. data/lib/thin/request.rb +94 -74
  18. data/lib/thin/response.rb +112 -45
  19. data/lib/thin/runner.rb +134 -194
  20. data/lib/thin/server.rb +203 -252
  21. data/lib/thin/system.rb +49 -0
  22. data/lib/thin/version.rb +14 -29
  23. data/man/index.txt +3 -0
  24. data/man/thin-conf.5.ronn +121 -0
  25. data/man/thin.1.ronn +105 -0
  26. data/site/.gitignore +2 -0
  27. data/site/README.md +21 -0
  28. data/site/Rakefile +20 -0
  29. data/site/config.ru +4 -0
  30. data/site/public/images/grid.png +0 -0
  31. data/site/public/javascripts/dd_belatedpng.js +13 -0
  32. data/site/public/javascripts/modernizr-1.6.min.js +30 -0
  33. data/site/public/man/thin-conf.5.html +220 -0
  34. data/site/public/man/thin.1.html +177 -0
  35. data/site/site/assets/javascripts/main.coffee +2 -0
  36. data/site/site/assets/stylesheets/_config.scss +55 -0
  37. data/site/site/assets/stylesheets/main.scss +24 -0
  38. data/site/site/helpers.rb +17 -0
  39. data/site/site/layouts/base.erb +55 -0
  40. data/site/site/layouts/default.erb +17 -0
  41. data/site/site/pages/about.md +5 -0
  42. data/site/site/pages/index.erb +10 -0
  43. data/site/site/partials/.gitkeep +0 -0
  44. data/test/fixtures/big.txt +1 -0
  45. data/test/fixtures/small.txt +1 -0
  46. data/test/fixtures/thin.conf.rb +15 -0
  47. data/test/integration/async_test.rb +35 -0
  48. data/test/integration/big_request_test.rb +30 -0
  49. data/test/integration/config.ru +57 -0
  50. data/test/integration/daemonize_test.rb +26 -0
  51. data/test/integration/env_test.rb +44 -0
  52. data/test/integration/error_test.rb +37 -0
  53. data/test/integration/file_sending_test.rb +24 -0
  54. data/test/integration/keep_alive_test.rb +35 -0
  55. data/test/integration/robustness_test.rb +37 -0
  56. data/test/integration/single_process_test.rb +15 -0
  57. data/test/integration/socket_family_test.rb +38 -0
  58. data/test/integration/worker_test.rb +22 -0
  59. data/test/test_helper.rb +195 -0
  60. data/test/unit/configurator_test.rb +43 -0
  61. data/test/unit/connection_test.rb +94 -0
  62. data/test/unit/listener_test.rb +74 -0
  63. data/test/unit/request_test.rb +74 -0
  64. data/test/unit/response_test.rb +90 -0
  65. data/test/unit/server_test.rb +29 -0
  66. data/test/unit/system_test.rb +17 -0
  67. data/thin.gemspec +26 -0
  68. data/v2.todo +21 -0
  69. metadata +134 -81
  70. checksums.yaml +0 -7
  71. data/example/adapter.rb +0 -32
  72. data/example/async_app.ru +0 -126
  73. data/example/async_chat.ru +0 -247
  74. data/example/async_tailer.ru +0 -100
  75. data/example/config.ru +0 -22
  76. data/example/monit_sockets +0 -20
  77. data/example/monit_unixsock +0 -20
  78. data/example/myapp.rb +0 -1
  79. data/example/ramaze.ru +0 -12
  80. data/example/thin.god +0 -80
  81. data/example/thin_solaris_smf.erb +0 -36
  82. data/example/thin_solaris_smf.readme.txt +0 -150
  83. data/example/vlad.rake +0 -72
  84. data/ext/thin_parser/common.rl +0 -59
  85. data/ext/thin_parser/ext_help.h +0 -14
  86. data/ext/thin_parser/extconf.rb +0 -6
  87. data/ext/thin_parser/parser.c +0 -1452
  88. data/ext/thin_parser/parser.h +0 -49
  89. data/ext/thin_parser/parser.rl +0 -157
  90. data/ext/thin_parser/thin.c +0 -435
  91. data/lib/rack/adapter/loader.rb +0 -75
  92. data/lib/rack/adapter/rails.rb +0 -178
  93. data/lib/thin/backends/base.rb +0 -167
  94. data/lib/thin/backends/swiftiply_client.rb +0 -56
  95. data/lib/thin/backends/tcp_server.rb +0 -29
  96. data/lib/thin/backends/unix_server.rb +0 -56
  97. data/lib/thin/command.rb +0 -53
  98. data/lib/thin/controllers/cluster.rb +0 -178
  99. data/lib/thin/controllers/controller.rb +0 -189
  100. data/lib/thin/controllers/service.rb +0 -76
  101. data/lib/thin/controllers/service.sh.erb +0 -39
  102. data/lib/thin/daemonizing.rb +0 -180
  103. data/lib/thin/headers.rb +0 -40
  104. data/lib/thin/logging.rb +0 -174
  105. data/lib/thin/stats.html.erb +0 -216
  106. data/lib/thin/stats.rb +0 -52
  107. data/lib/thin/statuses.rb +0 -44
data/v2.todo ADDED
@@ -0,0 +1,21 @@
1
+ x prefork
2
+ x listen on UNIX sockets
3
+ x Config
4
+ x Async
5
+ x Preload app
6
+ x Fast file serving with streaming
7
+ x Keep-alive
8
+ x Limit # of keep-alive requests
9
+ - Pipelining?
10
+ x Transfer-Encoding: chunked
11
+ - Use Logger
12
+ - Rotate logs on USR1 signal
13
+ - Zero downtime restart on USR2 signal
14
+ x Threading
15
+ - Change user:group after bind
16
+ - SSL
17
+ - Graceful stop
18
+ - Daemonizing
19
+
20
+ Optimizations:
21
+ - Stock 200 OK response (store in frozen const)
metadata CHANGED
@@ -1,148 +1,201 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.4
4
+ version: 2.0.0.pre
5
+ prerelease: 6
5
6
  platform: ruby
6
7
  authors:
7
8
  - Marc-Andre Cournoyer
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-09-19 00:00:00.000000000 Z
12
+ date: 2012-08-10 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- name: rack
15
+ name: eventmachine-le
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - "~>"
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
- version: '1.0'
21
+ version: 1.1.0
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - "~>"
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
- version: '1.0'
29
+ version: 1.1.0
27
30
  - !ruby/object:Gem::Dependency
28
- name: eventmachine
31
+ name: http_parser.rb
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
34
- - - ">="
35
+ - - ~>
35
36
  - !ruby/object:Gem::Version
36
- version: 1.0.4
37
+ version: 0.5.3
37
38
  type: :runtime
38
39
  prerelease: false
39
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
40
42
  requirements:
41
- - - "~>"
43
+ - - ~>
42
44
  - !ruby/object:Gem::Version
43
- version: '1.0'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 1.0.4
45
+ version: 0.5.3
47
46
  - !ruby/object:Gem::Dependency
48
- name: daemons
47
+ name: preforker
49
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
50
  requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '1.0'
54
- - - ">="
51
+ - - ~>
55
52
  - !ruby/object:Gem::Version
56
- version: 1.0.9
53
+ version: 0.1.1
57
54
  type: :runtime
58
55
  prerelease: false
59
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
60
58
  requirements:
61
- - - "~>"
59
+ - - ~>
62
60
  - !ruby/object:Gem::Version
63
- version: '1.0'
64
- - - ">="
61
+ version: 0.1.1
62
+ - !ruby/object:Gem::Dependency
63
+ name: rack
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
65
68
  - !ruby/object:Gem::Version
66
- version: 1.0.9
67
- description: A thin and fast web server
68
- email: macournoyer@gmail.com
69
+ version: '1.4'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.4'
78
+ description: Thin is a Rack based, high performance web server
79
+ email:
80
+ - thin@macournoyer.com
69
81
  executables:
70
82
  - thin
71
- extensions:
72
- - ext/thin_parser/extconf.rb
83
+ extensions: []
73
84
  extra_rdoc_files: []
74
85
  files:
86
+ - .gitignore
75
87
  - CHANGELOG
88
+ - Gemfile
76
89
  - README.md
77
90
  - Rakefile
78
91
  - bin/thin
79
- - example/adapter.rb
80
- - example/async_app.ru
81
- - example/async_chat.ru
82
- - example/async_tailer.ru
83
- - example/config.ru
84
- - example/monit_sockets
85
- - example/monit_unixsock
86
- - example/myapp.rb
87
- - example/ramaze.ru
88
- - example/thin.god
89
- - example/thin_solaris_smf.erb
90
- - example/thin_solaris_smf.readme.txt
91
- - example/vlad.rake
92
- - ext/thin_parser/common.rl
93
- - ext/thin_parser/ext_help.h
94
- - ext/thin_parser/extconf.rb
95
- - ext/thin_parser/parser.c
96
- - ext/thin_parser/parser.h
97
- - ext/thin_parser/parser.rl
98
- - ext/thin_parser/thin.c
99
- - lib/rack/adapter/loader.rb
100
- - lib/rack/adapter/rails.rb
92
+ - examples/async.ru
93
+ - examples/thin.conf.rb
101
94
  - lib/thin.rb
102
- - lib/thin/backends/base.rb
103
- - lib/thin/backends/swiftiply_client.rb
104
- - lib/thin/backends/tcp_server.rb
105
- - lib/thin/backends/unix_server.rb
106
- - lib/thin/command.rb
95
+ - lib/thin/async.rb
96
+ - lib/thin/backends/prefork.rb
97
+ - lib/thin/backends/single_process.rb
98
+ - lib/thin/chunked_body.rb
99
+ - lib/thin/configurator.rb
107
100
  - lib/thin/connection.rb
108
- - lib/thin/controllers/cluster.rb
109
- - lib/thin/controllers/controller.rb
110
- - lib/thin/controllers/service.rb
111
- - lib/thin/controllers/service.sh.erb
112
- - lib/thin/daemonizing.rb
113
- - lib/thin/headers.rb
114
- - lib/thin/logging.rb
101
+ - lib/thin/listener.rb
115
102
  - lib/thin/request.rb
116
103
  - lib/thin/response.rb
117
104
  - lib/thin/runner.rb
118
105
  - lib/thin/server.rb
119
- - lib/thin/stats.html.erb
120
- - lib/thin/stats.rb
121
- - lib/thin/statuses.rb
106
+ - lib/thin/system.rb
122
107
  - lib/thin/version.rb
123
- homepage: http://code.macournoyer.com/thin/
124
- licenses:
125
- - GPLv2+
126
- - Ruby 1.8
127
- metadata: {}
108
+ - man/index.txt
109
+ - man/thin-conf.5.ronn
110
+ - man/thin.1.ronn
111
+ - site/.gitignore
112
+ - site/README.md
113
+ - site/Rakefile
114
+ - site/config.ru
115
+ - site/public/images/grid.png
116
+ - site/public/javascripts/dd_belatedpng.js
117
+ - site/public/javascripts/modernizr-1.6.min.js
118
+ - site/public/man/thin-conf.5.html
119
+ - site/public/man/thin.1.html
120
+ - site/site/assets/javascripts/main.coffee
121
+ - site/site/assets/stylesheets/_config.scss
122
+ - site/site/assets/stylesheets/main.scss
123
+ - site/site/helpers.rb
124
+ - site/site/layouts/base.erb
125
+ - site/site/layouts/default.erb
126
+ - site/site/pages/about.md
127
+ - site/site/pages/index.erb
128
+ - site/site/partials/.gitkeep
129
+ - test/fixtures/big.txt
130
+ - test/fixtures/small.txt
131
+ - test/fixtures/thin.conf.rb
132
+ - test/integration/async_test.rb
133
+ - test/integration/big_request_test.rb
134
+ - test/integration/config.ru
135
+ - test/integration/daemonize_test.rb
136
+ - test/integration/env_test.rb
137
+ - test/integration/error_test.rb
138
+ - test/integration/file_sending_test.rb
139
+ - test/integration/keep_alive_test.rb
140
+ - test/integration/robustness_test.rb
141
+ - test/integration/single_process_test.rb
142
+ - test/integration/socket_family_test.rb
143
+ - test/integration/worker_test.rb
144
+ - test/test_helper.rb
145
+ - test/unit/configurator_test.rb
146
+ - test/unit/connection_test.rb
147
+ - test/unit/listener_test.rb
148
+ - test/unit/request_test.rb
149
+ - test/unit/response_test.rb
150
+ - test/unit/server_test.rb
151
+ - test/unit/system_test.rb
152
+ - thin.gemspec
153
+ - v2.todo
154
+ homepage: http://code.macournoyer.com/thin
155
+ licenses: []
128
156
  post_install_message:
129
157
  rdoc_options: []
130
158
  require_paths:
131
159
  - lib
132
160
  required_ruby_version: !ruby/object:Gem::Requirement
161
+ none: false
133
162
  requirements:
134
- - - ">="
163
+ - - ! '>='
135
164
  - !ruby/object:Gem::Version
136
- version: 1.8.5
165
+ version: '0'
137
166
  required_rubygems_version: !ruby/object:Gem::Requirement
167
+ none: false
138
168
  requirements:
139
- - - ">="
169
+ - - ! '>'
140
170
  - !ruby/object:Gem::Version
141
- version: '0'
171
+ version: 1.3.1
142
172
  requirements: []
143
173
  rubyforge_project: thin
144
- rubygems_version: 2.2.2
174
+ rubygems_version: 1.8.24
145
175
  signing_key:
146
- specification_version: 4
176
+ specification_version: 3
147
177
  summary: A thin and fast web server
148
- test_files: []
178
+ test_files:
179
+ - test/fixtures/big.txt
180
+ - test/fixtures/small.txt
181
+ - test/fixtures/thin.conf.rb
182
+ - test/integration/async_test.rb
183
+ - test/integration/big_request_test.rb
184
+ - test/integration/config.ru
185
+ - test/integration/daemonize_test.rb
186
+ - test/integration/env_test.rb
187
+ - test/integration/error_test.rb
188
+ - test/integration/file_sending_test.rb
189
+ - test/integration/keep_alive_test.rb
190
+ - test/integration/robustness_test.rb
191
+ - test/integration/single_process_test.rb
192
+ - test/integration/socket_family_test.rb
193
+ - test/integration/worker_test.rb
194
+ - test/test_helper.rb
195
+ - test/unit/configurator_test.rb
196
+ - test/unit/connection_test.rb
197
+ - test/unit/listener_test.rb
198
+ - test/unit/request_test.rb
199
+ - test/unit/response_test.rb
200
+ - test/unit/server_test.rb
201
+ - test/unit/system_test.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 59e48abc41d2a88e89281a8902c419f1eecfb5ac
4
- data.tar.gz: 2a10974b8d31419469cee3940e9a206f8217f4de
5
- SHA512:
6
- metadata.gz: 19c24955dc648213173e227df391a325c4de88b48d59c37929977b5524e9cdc834717430cfb6b294fa9d0b59f4205776a2918a64db4f3985fe5d5c6ea0b62708
7
- data.tar.gz: 98e01afb757f4e7258b73799bee4a83daf05786edf771025da785b354d12be70444aae73f222d9c19859f9574e1a4002b3fbea934e178b841a5dbb8fbd08a8fa
@@ -1,32 +0,0 @@
1
- # Run with: ruby adapter.rb
2
- # Then browse to http://localhost:3000/test
3
- # and http://localhost:3000/files/adapter.rb
4
- require 'thin'
5
-
6
- class SimpleAdapter
7
- def call(env)
8
- body = ["hello!"]
9
- [
10
- 200,
11
- { 'Content-Type' => 'text/plain' },
12
- body
13
- ]
14
- end
15
- end
16
-
17
- Thin::Server.start('0.0.0.0', 3000) do
18
- use Rack::CommonLogger
19
- map '/test' do
20
- run SimpleAdapter.new
21
- end
22
- map '/files' do
23
- run Rack::File.new('.')
24
- end
25
- end
26
-
27
- # You could also start the server like this:
28
- #
29
- # app = Rack::URLMap.new('/test' => SimpleAdapter.new,
30
- # '/files' => Rack::File.new('.'))
31
- # Thin::Server.start('0.0.0.0', 3000, app)
32
- #
@@ -1,126 +0,0 @@
1
- #!/usr/bin/env rackup -s thin
2
- #
3
- # async_app.ru
4
- # raggi/thin
5
- #
6
- # A second demo app for async rack + thin app processing!
7
- # Now using http status code 100 instead.
8
- #
9
- # Created by James Tucker on 2008-06-17.
10
- # Copyright 2008 James Tucker <raggi@rubyforge.org>.
11
- #
12
- #--
13
- # Benchmark Results:
14
- #
15
- # raggi@mbk:~$ ab -c 100 -n 500 http://127.0.0.1:3000/
16
- # This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
17
- # Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
18
- # Copyright 2006 The Apache Software Foundation, http://www.apache.org/
19
- #
20
- # Benchmarking 127.0.0.1 (be patient)
21
- # Completed 100 requests
22
- # Completed 200 requests
23
- # Completed 300 requests
24
- # Completed 400 requests
25
- # Finished 500 requests
26
- #
27
- #
28
- # Server Software: thin
29
- # Server Hostname: 127.0.0.1
30
- # Server Port: 3000
31
- #
32
- # Document Path: /
33
- # Document Length: 12 bytes
34
- #
35
- # Concurrency Level: 100
36
- # Time taken for tests: 5.263089 seconds
37
- # Complete requests: 500
38
- # Failed requests: 0
39
- # Write errors: 0
40
- # Total transferred: 47000 bytes
41
- # HTML transferred: 6000 bytes
42
- # Requests per second: 95.00 [#/sec] (mean)
43
- # Time per request: 1052.618 [ms] (mean)
44
- # Time per request: 10.526 [ms] (mean, across all concurrent requests)
45
- # Transfer rate: 8.55 [Kbytes/sec] received
46
- #
47
- # Connection Times (ms)
48
- # min mean[+/-sd] median max
49
- # Connect: 0 3 2.2 3 8
50
- # Processing: 1042 1046 3.1 1046 1053
51
- # Waiting: 1037 1042 3.6 1041 1050
52
- # Total: 1045 1049 3.1 1049 1057
53
- #
54
- # Percentage of the requests served within a certain time (ms)
55
- # 50% 1049
56
- # 66% 1051
57
- # 75% 1053
58
- # 80% 1053
59
- # 90% 1054
60
- # 95% 1054
61
- # 98% 1056
62
- # 99% 1057
63
- # 100% 1057 (longest request)
64
-
65
- class DeferrableBody
66
- include EventMachine::Deferrable
67
-
68
- def call(body)
69
- body.each do |chunk|
70
- @body_callback.call(chunk)
71
- end
72
- end
73
-
74
- def each &blk
75
- @body_callback = blk
76
- end
77
-
78
- end
79
-
80
- class AsyncApp
81
-
82
- # This is a template async response. N.B. Can't use string for body on 1.9
83
- AsyncResponse = [-1, {}, []].freeze
84
-
85
- def call(env)
86
-
87
- body = DeferrableBody.new
88
-
89
- # Get the headers out there asap, let the client know we're alive...
90
- EventMachine::next_tick { env['async.callback'].call [200, {'Content-Type' => 'text/plain'}, body] }
91
-
92
- # Semi-emulate a long db request, instead of a timer, in reality we'd be
93
- # waiting for the response data. Whilst this happens, other connections
94
- # can be serviced.
95
- # This could be any callback based thing though, a deferrable waiting on
96
- # IO data, a db request, an http request, an smtp send, whatever.
97
- EventMachine::add_timer(1) {
98
- body.call ["Woah, async!\n"]
99
-
100
- EventMachine::next_tick {
101
- # This could actually happen any time, you could spawn off to new
102
- # threads, pause as a good looking lady walks by, whatever.
103
- # Just shows off how we can defer chunks of data in the body, you can
104
- # even call this many times.
105
- body.call ["Cheers then!"]
106
- body.succeed
107
- }
108
- }
109
-
110
- # throw :async # Still works for supporting non-async frameworks...
111
-
112
- AsyncResponse # May end up in Rack :-)
113
- end
114
-
115
- end
116
-
117
- # The additions to env for async.connection and async.callback absolutely
118
- # destroy the speed of the request if Lint is doing it's checks on env.
119
- # It is also important to note that an async response will not pass through
120
- # any further middleware, as the async response notification has been passed
121
- # right up to the webserver, and the callback goes directly there too.
122
- # Middleware could possibly catch :async, and also provide a different
123
- # async.connection and async.callback.
124
-
125
- # use Rack::Lint
126
- run AsyncApp.new