jubilee 1.0.2 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG +17 -0
- data/Gemfile +19 -1
- data/Gemfile.lock +189 -31
- data/LICENSE.txt +20 -0
- data/README.md +44 -5
- data/ROADMAP +5 -0
- data/Rakefile +6 -5
- data/examples/chatapp/Gemfile +2 -1
- data/examples/chatapp/Gemfile.lock +8 -6
- data/examples/chatapp/README.md +5 -2
- data/examples/chatapp/app.rb +24 -0
- data/examples/chatapp/public/assets/javascripts/application.js +59 -6
- data/examples/chatapp/public/assets/stylesheets/application.css +25 -0
- data/examples/jubilee.conf.rb +0 -3
- data/jars/{hazelcast-2.6.jar → hazelcast-2.6.3.jar} +0 -0
- data/jars/{netty-all-4.0.4.Final.jar → netty-all-4.0.13.Final.jar} +0 -0
- data/jars/vertx-core-2.1M3-SNAPSHOT.jar +0 -0
- data/jars/vertx-hazelcast-2.1M3-SNAPSHOT.jar +0 -0
- data/java/src/jubilee/JubileeService.java +7 -7
- data/java/src/org/jruby/jubilee/Const.java +10 -35
- data/java/src/org/jruby/jubilee/RackApplication.java +77 -46
- data/java/src/org/jruby/jubilee/RackResponse.java +1 -3
- data/java/src/org/jruby/jubilee/RubyHttpServerResponse.java +88 -0
- data/java/src/org/jruby/jubilee/{Server.java → RubyServer.java} +17 -14
- data/java/src/org/jruby/jubilee/impl/RackEnvironment.java +157 -0
- data/java/src/org/jruby/jubilee/impl/RackEnvironmentHash.java +449 -0
- data/java/src/org/jruby/jubilee/impl/RubyIORackInput.java +5 -5
- data/java/src/org/jruby/jubilee/impl/{NullIO.java → RubyNullIO.java} +5 -9
- data/java/src/org/jruby/jubilee/utils/RubyHelper.java +37 -0
- data/jubilee.gemspec +101 -14
- data/lib/jubilee.rb +4 -3
- data/lib/jubilee/cli.rb +2 -1
- data/lib/jubilee/configuration.rb +4 -9
- data/lib/jubilee/const.rb +2 -2
- data/lib/jubilee/jubilee.jar +0 -0
- data/lib/jubilee/response.rb +9 -8
- data/lib/jubilee/server.rb +1 -1
- data/lib/jubilee/version.rb +8 -1
- data/lib/rack/chunked.rb +38 -0
- data/spec/apps/rack/basic/config.ru +50 -0
- data/spec/apps/rails4/basic/.gitignore +16 -0
- data/spec/apps/rails4/basic/Gemfile +41 -0
- data/spec/apps/rails4/basic/Gemfile.lock +127 -0
- data/spec/apps/rails4/basic/README.rdoc +28 -0
- data/spec/apps/rails4/basic/Rakefile +6 -0
- data/spec/apps/rails4/basic/app/assets/images/.keep +0 -0
- data/spec/apps/rails4/basic/app/assets/images/rails.png +0 -0
- data/spec/apps/rails4/basic/app/assets/javascripts/application.js +16 -0
- data/spec/apps/rails4/basic/app/assets/stylesheets/application.css +13 -0
- data/spec/apps/rails4/basic/app/controllers/application_controller.rb +5 -0
- data/spec/apps/rails4/basic/app/controllers/concerns/.keep +0 -0
- data/spec/apps/rails4/basic/app/controllers/reloader_controller.rb +11 -0
- data/spec/apps/rails4/basic/app/controllers/reloader_controller.rb.erb +11 -0
- data/spec/apps/rails4/basic/app/controllers/root_controller.rb +14 -0
- data/spec/apps/rails4/basic/app/helpers/application_helper.rb +2 -0
- data/spec/apps/rails4/basic/app/mailers/.keep +0 -0
- data/spec/apps/rails4/basic/app/models/.keep +0 -0
- data/spec/apps/rails4/basic/app/models/concerns/.keep +0 -0
- data/spec/apps/rails4/basic/app/views/layouts/application.html.erb +14 -0
- data/spec/apps/rails4/basic/app/views/reloader/index.html.erb +1 -0
- data/spec/apps/rails4/basic/app/views/root/index.html.erb +8 -0
- data/spec/apps/rails4/basic/app/views/root/streaming.html.erb +6 -0
- data/spec/apps/rails4/basic/bin/bundle +3 -0
- data/spec/apps/rails4/basic/bin/rails +4 -0
- data/spec/apps/rails4/basic/bin/rake +4 -0
- data/spec/apps/rails4/basic/config.ru +4 -0
- data/spec/apps/rails4/basic/config/application.rb +23 -0
- data/spec/apps/rails4/basic/config/boot.rb +4 -0
- data/spec/apps/rails4/basic/config/database.yml +20 -0
- data/spec/apps/rails4/basic/config/environment.rb +5 -0
- data/spec/apps/rails4/basic/config/environments/development.rb +29 -0
- data/spec/apps/rails4/basic/config/environments/production.rb +80 -0
- data/spec/apps/rails4/basic/config/environments/test.rb +36 -0
- data/spec/apps/rails4/basic/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/apps/rails4/basic/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/apps/rails4/basic/config/initializers/inflections.rb +16 -0
- data/spec/apps/rails4/basic/config/initializers/mime_types.rb +5 -0
- data/spec/apps/rails4/basic/config/initializers/secret_token.rb +12 -0
- data/spec/apps/rails4/basic/config/initializers/session_store.rb +2 -0
- data/spec/apps/rails4/basic/config/initializers/wrap_parameters.rb +14 -0
- data/spec/apps/rails4/basic/config/locales/en.yml +23 -0
- data/spec/apps/rails4/basic/config/routes.rb +5 -0
- data/spec/apps/rails4/basic/db/seeds.rb +7 -0
- data/spec/apps/rails4/basic/lib/assets/.keep +0 -0
- data/spec/apps/rails4/basic/lib/tasks/.keep +0 -0
- data/spec/apps/rails4/basic/public/404.html +58 -0
- data/spec/apps/rails4/basic/public/422.html +58 -0
- data/spec/apps/rails4/basic/public/500.html +57 -0
- data/spec/apps/rails4/basic/public/favicon.ico +0 -0
- data/spec/apps/rails4/basic/public/robots.txt +5 -0
- data/spec/apps/rails4/basic/public/some_page.html +7 -0
- data/spec/apps/rails4/basic/test/controllers/.keep +0 -0
- data/spec/apps/rails4/basic/test/fixtures/.keep +0 -0
- data/spec/apps/rails4/basic/test/helpers/.keep +0 -0
- data/spec/apps/rails4/basic/test/integration/.keep +0 -0
- data/spec/apps/rails4/basic/test/mailers/.keep +0 -0
- data/spec/apps/rails4/basic/test/models/.keep +0 -0
- data/spec/apps/rails4/basic/test/test_helper.rb +15 -0
- data/spec/apps/rails4/basic/vendor/assets/javascripts/.keep +0 -0
- data/spec/apps/rails4/basic/vendor/assets/stylesheets/.keep +0 -0
- data/spec/apps/sinatra/basic/Gemfile +4 -0
- data/spec/apps/sinatra/basic/Gemfile.lock +20 -0
- data/spec/apps/sinatra/basic/basic.rb +27 -0
- data/spec/apps/sinatra/basic/config.ru +7 -0
- data/spec/apps/sinatra/basic/public/some_page.html +7 -0
- data/spec/apps/sinatra/basic/views/index.erb +4 -0
- data/spec/apps/sinatra/basic/views/posted.haml +2 -0
- data/spec/apps/sinatra/basic/views/poster.haml +4 -0
- data/spec/apps/sinatra/basic/views/request_mapping.haml +4 -0
- data/spec/integration/basic_rack_spec.rb +89 -0
- data/spec/integration/basic_rails4_spec.rb +64 -0
- data/spec/integration/basic_sinatra_spec.rb +80 -0
- data/spec/spec_helper.rb +13 -0
- data/test/jubilee/test_cli.rb +1 -1
- data/test/jubilee/test_configuration.rb +18 -1
- data/test/jubilee/test_rack_server.rb +7 -7
- data/test/jubilee/test_response.rb +35 -36
- data/test/jubilee/test_server.rb +1 -1
- data/test/jubilee/test_upload.rb +14 -11
- data/test/test_helper.rb +1 -0
- metadata +97 -18
- data/VERSION +0 -1
- data/jars/vertx-core-2.1.0-SNAPSHOT.jar +0 -0
- data/java/src/org/jruby/jubilee/RackErrors.java +0 -44
- data/java/src/org/jruby/jubilee/impl/DefaultRackEnvironment.java +0 -99
- data/java/src/org/jruby/jubilee/impl/RubyIORackErrors.java +0 -68
@@ -45,7 +45,7 @@ class TestRackServer < MiniTest::Unit::TestCase
|
|
45
45
|
@simple = lambda { |env| [200, { "X-Header" => "Works" }, ["Hello"]] }
|
46
46
|
@checker = ErrorChecker.new ServerLint.new(@simple)
|
47
47
|
@host = "localhost"
|
48
|
-
@port =
|
48
|
+
@port = 8080
|
49
49
|
end
|
50
50
|
|
51
51
|
def teardown
|
@@ -58,7 +58,7 @@ class TestRackServer < MiniTest::Unit::TestCase
|
|
58
58
|
|
59
59
|
@server.start
|
60
60
|
|
61
|
-
hit(['http://127.0.0.1:
|
61
|
+
hit(['http://127.0.0.1:8080/test'])
|
62
62
|
|
63
63
|
if exc = @checker.exception
|
64
64
|
raise exc
|
@@ -74,7 +74,7 @@ class TestRackServer < MiniTest::Unit::TestCase
|
|
74
74
|
|
75
75
|
big = "x" * (1024 * 16)
|
76
76
|
|
77
|
-
Net::HTTP.post_form URI.parse('http://127.0.0.1:
|
77
|
+
Net::HTTP.post_form URI.parse('http://127.0.0.1:8080/test'),
|
78
78
|
{ "big" => big }
|
79
79
|
|
80
80
|
if exc = @checker.exception
|
@@ -87,7 +87,7 @@ class TestRackServer < MiniTest::Unit::TestCase
|
|
87
87
|
@server = Jubilee::Server.new (lambda { |env| input = env; @simple.call(env) })
|
88
88
|
@server.start
|
89
89
|
|
90
|
-
hit(['http://127.0.0.1:
|
90
|
+
hit(['http://127.0.0.1:8080/test/a/b/c'])
|
91
91
|
|
92
92
|
assert_equal "/test/a/b/c", input['PATH_INFO']
|
93
93
|
end
|
@@ -112,7 +112,7 @@ class TestRackServer < MiniTest::Unit::TestCase
|
|
112
112
|
@server = Jubilee::Server.new (lambda { |env| input = env; @simple.call(env) })
|
113
113
|
@server.start
|
114
114
|
|
115
|
-
hit(['http://127.0.0.1:
|
115
|
+
hit(['http://127.0.0.1:8080/test/a/b/c?foo=bar'])
|
116
116
|
|
117
117
|
assert_equal "foo=bar", input['QUERY_STRING']
|
118
118
|
end
|
@@ -125,11 +125,11 @@ class TestRackServer < MiniTest::Unit::TestCase
|
|
125
125
|
sleep 0.1
|
126
126
|
|
127
127
|
req = Net::HTTP::Post::Multipart.new("/", "foo" => "bar")
|
128
|
-
resp = Net::HTTP.start('localhost',
|
128
|
+
resp = Net::HTTP.start('localhost', 8080) do |http|
|
129
129
|
http.request req
|
130
130
|
end
|
131
131
|
|
132
|
-
#Net::HTTP.post_form URI.parse('http://127.0.0.1:
|
132
|
+
#Net::HTTP.post_form URI.parse('http://127.0.0.1:8080/test'), { "foo" => "bar" }
|
133
133
|
|
134
134
|
request = Rack::Request.new input
|
135
135
|
assert_equal "bar", request.params["foo"]
|
@@ -22,7 +22,7 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
@host = "127.0.0.1"
|
25
|
-
@port =
|
25
|
+
@port = 8080
|
26
26
|
|
27
27
|
@server = Jubilee::Server.new @simple
|
28
28
|
@server.start
|
@@ -45,14 +45,14 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def valid_response(size)
|
48
|
-
Regexp.new("HTTP/1.1 200 OK\r\nX-Header: Works\r\
|
48
|
+
Regexp.new("HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: #{size}\r\nConnection: keep-alive\r\nDate(.*?)\r\n\r\n", true)
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_one_with_content_length
|
52
52
|
@client << @valid_request
|
53
53
|
sz = @body[0].size.to_s
|
54
54
|
|
55
|
-
assert_match valid_response(sz), lines(
|
55
|
+
assert_match valid_response(sz), lines(7)
|
56
56
|
assert_equal "Hello", @client.read(5)
|
57
57
|
end
|
58
58
|
|
@@ -60,13 +60,13 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
60
60
|
@client << @valid_request
|
61
61
|
sz = @body[0].size.to_s
|
62
62
|
|
63
|
-
assert_match valid_response(sz), lines(
|
63
|
+
assert_match valid_response(sz), lines(7)
|
64
64
|
assert_equal "Hello", @client.read(5)
|
65
65
|
|
66
66
|
@client << @valid_request
|
67
67
|
sz = @body[0].size.to_s
|
68
68
|
|
69
|
-
assert_match valid_response(sz), lines(
|
69
|
+
assert_match valid_response(sz), lines(7)
|
70
70
|
assert_equal "Hello", @client.read(5)
|
71
71
|
end
|
72
72
|
|
@@ -74,33 +74,35 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
74
74
|
@client << @valid_post
|
75
75
|
sz = @body[0].size.to_s
|
76
76
|
|
77
|
-
assert_match valid_response(sz), lines(
|
77
|
+
assert_match valid_response(sz), lines(7)
|
78
78
|
assert_equal "Hello", @client.read(5)
|
79
79
|
|
80
80
|
@client << @valid_request
|
81
81
|
sz = @body[0].size.to_s
|
82
82
|
|
83
|
-
assert_match valid_response(sz), lines(
|
83
|
+
assert_match valid_response(sz), lines(7)
|
84
84
|
assert_equal "Hello", @client.read(5)
|
85
85
|
end
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
=begin
|
88
|
+
def test_no_body_then_get
|
89
|
+
@client << @valid_no_body
|
90
|
+
assert_match %r{HTTP/1.1 204 No Content\r\nX-Header: Works(.*?\r\n)*?Connection: keep-alive\r\n\r\n}, lines(6)
|
90
91
|
|
91
|
-
|
92
|
-
|
92
|
+
@client << @valid_request
|
93
|
+
sz = @body[0].size.to_s
|
93
94
|
|
94
|
-
|
95
|
-
|
96
|
-
|
95
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: #{sz}\r\nConnection: keep-alive\r\n\r\n}, lines(7)
|
96
|
+
assert_equal "Hello", @client.read(5)
|
97
|
+
end
|
98
|
+
=end
|
97
99
|
|
98
100
|
def test_chunked
|
99
101
|
@body << "Chunked"
|
100
102
|
|
101
103
|
@client << @valid_request
|
102
104
|
|
103
|
-
|
105
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\nServer(.*\r\n)*?Transfer-Encoding: chunked\r\nDate(.*?)\r\n\r\n5\r\nHello\r\n7\r\nChunked\r\n0\r\n\r\n}, lines(13)
|
104
106
|
end
|
105
107
|
|
106
108
|
def test_no_chunked_in_http10
|
@@ -108,7 +110,7 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
108
110
|
|
109
111
|
@client << @http10_request
|
110
112
|
|
111
|
-
|
113
|
+
assert_match %r{HTTP/1.0 200 OK\r\nX-Header: Works(.*?\r\n)*?Connection: close\r\nDate(.*?)\r\n\r\n}, lines(6)
|
112
114
|
assert_equal "HelloChunked", @client.read
|
113
115
|
end
|
114
116
|
|
@@ -118,25 +120,23 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
118
120
|
|
119
121
|
@client << @valid_request
|
120
122
|
|
121
|
-
|
123
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Transfer-Encoding: chunked\r\nDate(.*?)\r\n\r\n5\r\nHello\r\n#{str.size.to_s(16)}\r\n#{str}\r\n0\r\n\r\n}, lines(13)
|
122
124
|
|
123
125
|
end
|
124
126
|
|
125
|
-
=begin
|
126
127
|
def test_client11_close
|
127
128
|
@client << @close_request
|
128
129
|
sz = @body[0].size.to_s
|
129
130
|
|
130
|
-
|
131
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: #{sz}\r\nConnection: close\r\nDate(.*?)\r\n\r\n}, lines(7)
|
131
132
|
assert_equal "Hello", @client.read(5)
|
132
133
|
end
|
133
|
-
=end
|
134
134
|
|
135
135
|
def test_client10_close
|
136
136
|
@client << @http10_request
|
137
137
|
sz = @body[0].size.to_s
|
138
138
|
|
139
|
-
|
139
|
+
assert_match %r{HTTP/1.0 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: #{sz}\r\nConnection: close\r\nDate(.*?)\r\n\r\n}, lines(7)
|
140
140
|
assert_equal "Hello", @client.read(5)
|
141
141
|
end
|
142
142
|
|
@@ -144,7 +144,7 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
144
144
|
@client << @keep_request
|
145
145
|
sz = @body[0].size.to_s
|
146
146
|
|
147
|
-
|
147
|
+
assert_match %r{HTTP/1.0 200 OK\r\nX-Header: Works\r\nServer(.*?\r\n)*?Content-Length: #{sz}\r\nConnection: keep-alive\r\nDate(.*?)\r\n\r\n}, lines(7)
|
148
148
|
assert_equal "Hello", @client.read(5)
|
149
149
|
end
|
150
150
|
|
@@ -163,6 +163,7 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
163
163
|
@client.read_nonblock(1)
|
164
164
|
end
|
165
165
|
end
|
166
|
+
=end
|
166
167
|
|
167
168
|
def test_app_sets_content_length
|
168
169
|
@body = ["hello", " world"]
|
@@ -170,20 +171,19 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
170
171
|
|
171
172
|
@client << @valid_request
|
172
173
|
|
173
|
-
|
174
|
-
lines(4)
|
174
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: 11\r\nConnection: keep-alive\r\nDate(.*?)\r\n\r\n}, lines(7)
|
175
175
|
assert_equal "hello world", @client.read(11)
|
176
176
|
end
|
177
177
|
|
178
178
|
def test_allow_app_to_chunk_itself
|
179
|
-
skip "
|
179
|
+
skip "body should not be chunked before sent to jubilee"
|
180
180
|
@headers = {'Transfer-Encoding' => "chunked" }
|
181
181
|
|
182
182
|
@body = ["5\r\nhello\r\n0\r\n\r\n"]
|
183
183
|
|
184
184
|
@client << @valid_request
|
185
185
|
|
186
|
-
|
186
|
+
assert_match %r{HTTP/1.1 200 OK\r\n(.*?\r\n)*?Transfer-Encoding: chunked\r\nDate(.*?)\r\n\r\n5\r\nhello\r\n0\r\n}, lines(10)
|
187
187
|
end
|
188
188
|
|
189
189
|
|
@@ -197,10 +197,10 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
197
197
|
|
198
198
|
sz = @body[0].size.to_s
|
199
199
|
|
200
|
-
|
200
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: #{sz}\r\nConnection: keep-alive\r\nDate(.*?)\r\n\r\n}, lines(7)
|
201
201
|
assert_equal "Hello", @client.read(5)
|
202
202
|
|
203
|
-
|
203
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: #{sz}\r\nConnection: keep-alive\r\nDate(.*?)\r\n\r\n}, lines(7)
|
204
204
|
assert_equal "Hello", @client.read(5)
|
205
205
|
end
|
206
206
|
|
@@ -214,16 +214,14 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
214
214
|
|
215
215
|
sz = @body[0].size.to_s
|
216
216
|
|
217
|
-
|
217
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: #{sz}\r\nConnection: keep-alive\r\nDate(.*?)\r\n\r\n}, lines(7)
|
218
218
|
assert_equal "Hello", @client.read(5)
|
219
219
|
|
220
|
-
|
220
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: #{sz}\r\nConnection: keep-alive\r\nDate(.*?)\r\n\r\n}, lines(7)
|
221
221
|
assert_equal "Hello", @client.read(5)
|
222
222
|
|
223
|
-
#
|
224
|
-
#
|
225
|
-
# assert_kind_of Jubilee::NullIO, @inputs[0]
|
226
|
-
# assert_kind_of Jubilee::NullIO, @inputs[1]
|
223
|
+
#assert_kind_of Jubilee::NullIO, @inputs[0]
|
224
|
+
#assert_kind_of Jubilee::NullIO, @inputs[1]
|
227
225
|
end
|
228
226
|
|
229
227
|
def test_keepalive_doesnt_starve_clients
|
@@ -239,10 +237,11 @@ class TestResponse < MiniTest::Unit::TestCase
|
|
239
237
|
assert out, "select returned nil"
|
240
238
|
assert_equal c2, out.first.first
|
241
239
|
|
242
|
-
|
240
|
+
assert_match %r{HTTP/1.1 200 OK\r\nX-Header: Works\r\n(.*?\r\n)*?Content-Length: #{sz}\r\nConnection: keep-alive\r\nDate(.*?)\r\n\r\n}, lines(7, c2)
|
243
241
|
assert_equal "Hello", c2.read(5)
|
244
242
|
end
|
245
243
|
|
244
|
+
=begin
|
246
245
|
def test_client_shutdown_writes
|
247
246
|
bs = 15609315 * rand
|
248
247
|
sock = TCPSocket.new('127.0.0.1', @port)
|
data/test/jubilee/test_server.rb
CHANGED
data/test/jubilee/test_upload.rb
CHANGED
@@ -7,7 +7,7 @@ class TestUpload < MiniTest::Unit::TestCase
|
|
7
7
|
|
8
8
|
def setup
|
9
9
|
@addr = ENV['UNICORN_TEST_ADDR'] || '127.0.0.1'
|
10
|
-
@port =
|
10
|
+
@port = 8080
|
11
11
|
@hdr = {'Content-Type' => 'text/plain', 'Content-Length' => '0'}
|
12
12
|
@bs = 4096
|
13
13
|
@count = 256
|
@@ -24,7 +24,7 @@ class TestUpload < MiniTest::Unit::TestCase
|
|
24
24
|
i = 0
|
25
25
|
while buf = input.read(@bs)
|
26
26
|
sha1.update(buf)
|
27
|
-
i +=
|
27
|
+
i += buf.size
|
28
28
|
end
|
29
29
|
resp[:sha1] = sha1.hexdigest
|
30
30
|
|
@@ -39,7 +39,14 @@ class TestUpload < MiniTest::Unit::TestCase
|
|
39
39
|
if resp[:sha1] == sha1.hexdigest
|
40
40
|
resp[:sysread_read_byte_match] = true
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
|
+
if expect_size = env['HTTP_X_EXPECT_SIZE']
|
44
|
+
if expect_size.to_i == i
|
45
|
+
resp[:expect_size_match] = true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
resp[:size] = i
|
49
|
+
resp[:expect_size] = expect_size
|
43
50
|
|
44
51
|
[ 200, @hdr.merge({'X-Resp' => resp.inspect}), [] ]
|
45
52
|
end
|
@@ -67,6 +74,7 @@ class TestUpload < MiniTest::Unit::TestCase
|
|
67
74
|
|
68
75
|
def test_put_content_md5
|
69
76
|
start_server(@sha1_app)
|
77
|
+
skip "Vert.x doesn't hendle trailing headers"
|
70
78
|
md5 = Digest::MD5.new
|
71
79
|
sock = TCPSocket.new(@addr, @port)
|
72
80
|
sock.syswrite("PUT / HTTP/1.0\r\nTransfer-Encoding: chunked\r\n" \
|
@@ -86,7 +94,7 @@ class TestUpload < MiniTest::Unit::TestCase
|
|
86
94
|
assert_equal "HTTP/1.0 200 OK", read[0]
|
87
95
|
resp = eval(read.grep(/^X-Resp: /).first.sub!(/X-Resp: /, ''))
|
88
96
|
assert_equal @sha1.hexdigest, resp[:sha1]
|
89
|
-
|
97
|
+
assert_equal content_md5, resp[:content_md5]
|
90
98
|
end
|
91
99
|
|
92
100
|
def test_put_trickle_small
|
@@ -157,11 +165,6 @@ class TestUpload < MiniTest::Unit::TestCase
|
|
157
165
|
assert_equal length, tmp.read.to_i
|
158
166
|
end
|
159
167
|
|
160
|
-
# Despite reading numerous articles and inspecting the 1.9.1-p0 C
|
161
|
-
# source, Eric Wong will never trust that we're always handling
|
162
|
-
# encoding-aware IO objects correctly. Thus this test uses shell
|
163
|
-
# utilities that should always operate on files/sockets on a
|
164
|
-
# byte-level.
|
165
168
|
def test_uncomfortable_with_onenine_encodings
|
166
169
|
# POSIX doesn't require all of these to be present on a system
|
167
170
|
which('curl') or return
|
@@ -185,7 +188,7 @@ class TestUpload < MiniTest::Unit::TestCase
|
|
185
188
|
|
186
189
|
assert $?.success?, 'curl ran OK'
|
187
190
|
assert_match(%r!\b#{sha1}\b!, resp)
|
188
|
-
|
191
|
+
assert_match(/sysread_read_byte_match/, resp)
|
189
192
|
|
190
193
|
# small StringIO path
|
191
194
|
assert(system("dd", "if=#{@random.path}", "of=#{tmp.path}",
|
@@ -280,7 +283,7 @@ class TestUpload < MiniTest::Unit::TestCase
|
|
280
283
|
assert $?.success?, 'curl ran OK'
|
281
284
|
assert_match(%r!\b#{sha1}\b!, resp)
|
282
285
|
assert_match(/sysread_read_byte_match/, resp)
|
283
|
-
|
286
|
+
assert_match(/expect_size_match/, resp)
|
284
287
|
end
|
285
288
|
|
286
289
|
private
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jubilee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.1.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaiah Peng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -42,23 +42,24 @@ dependencies:
|
|
42
42
|
name: jeweler
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.8.7
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
|
-
- -
|
50
|
+
- - ~>
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: 1.8.7
|
53
53
|
prerelease: false
|
54
54
|
type: :development
|
55
|
-
description: Jubilee is a
|
55
|
+
description: Jubilee is a jruby webserver built upon Vertx.
|
56
56
|
email: issaria@gmail.com
|
57
57
|
executables:
|
58
58
|
- jubilee
|
59
59
|
- jubilee_d
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files:
|
62
|
+
- LICENSE.txt
|
62
63
|
- README.md
|
63
64
|
files:
|
64
65
|
- .ruby-version
|
@@ -68,9 +69,10 @@ files:
|
|
68
69
|
- Gemfile.lock
|
69
70
|
- Guardfile
|
70
71
|
- KNOWN_ISSUES
|
72
|
+
- LICENSE.txt
|
71
73
|
- README.md
|
74
|
+
- ROADMAP
|
72
75
|
- Rakefile
|
73
|
-
- VERSION
|
74
76
|
- bin/jubilee
|
75
77
|
- bin/jubilee_d
|
76
78
|
- examples/chatapp/Gemfile
|
@@ -88,25 +90,27 @@ files:
|
|
88
90
|
- examples/jubilee.conf.rb
|
89
91
|
- examples/jubilee/keystore.jks
|
90
92
|
- examples/jubilee/server-keystore.jks
|
91
|
-
- jars/hazelcast-2.6.jar
|
93
|
+
- jars/hazelcast-2.6.3.jar
|
92
94
|
- jars/jackson-annotations-2.2.2.jar
|
93
95
|
- jars/jackson-core-2.2.2.jar
|
94
96
|
- jars/jackson-databind-2.2.2.jar
|
95
|
-
- jars/netty-all-4.0.
|
96
|
-
- jars/vertx-core-2.
|
97
|
+
- jars/netty-all-4.0.13.Final.jar
|
98
|
+
- jars/vertx-core-2.1M3-SNAPSHOT.jar
|
99
|
+
- jars/vertx-hazelcast-2.1M3-SNAPSHOT.jar
|
97
100
|
- java/src/jubilee/JubileeService.java
|
98
101
|
- java/src/org/jruby/jubilee/Const.java
|
99
102
|
- java/src/org/jruby/jubilee/RackApplication.java
|
100
103
|
- java/src/org/jruby/jubilee/RackEnvironment.java
|
101
|
-
- java/src/org/jruby/jubilee/RackErrors.java
|
102
104
|
- java/src/org/jruby/jubilee/RackInput.java
|
103
105
|
- java/src/org/jruby/jubilee/RackResponse.java
|
104
|
-
- java/src/org/jruby/jubilee/
|
106
|
+
- java/src/org/jruby/jubilee/RubyHttpServerResponse.java
|
107
|
+
- java/src/org/jruby/jubilee/RubyServer.java
|
105
108
|
- java/src/org/jruby/jubilee/deploy/Starter.java
|
106
|
-
- java/src/org/jruby/jubilee/impl/
|
107
|
-
- java/src/org/jruby/jubilee/impl/
|
108
|
-
- java/src/org/jruby/jubilee/impl/RubyIORackErrors.java
|
109
|
+
- java/src/org/jruby/jubilee/impl/RackEnvironment.java
|
110
|
+
- java/src/org/jruby/jubilee/impl/RackEnvironmentHash.java
|
109
111
|
- java/src/org/jruby/jubilee/impl/RubyIORackInput.java
|
112
|
+
- java/src/org/jruby/jubilee/impl/RubyNullIO.java
|
113
|
+
- java/src/org/jruby/jubilee/utils/RubyHelper.java
|
110
114
|
- java/src/org/jruby/jubilee/vertx/JubileeVertx.java
|
111
115
|
- jubilee.gemspec
|
112
116
|
- lib/jubilee.rb
|
@@ -118,12 +122,87 @@ files:
|
|
118
122
|
- lib/jubilee/response.rb
|
119
123
|
- lib/jubilee/server.rb
|
120
124
|
- lib/jubilee/version.rb
|
125
|
+
- lib/rack/chunked.rb
|
121
126
|
- lib/rack/handler/jubilee.rb
|
122
127
|
- lib/vertx.rb
|
123
128
|
- lib/vertx/README.md
|
124
129
|
- lib/vertx/buffer.rb
|
125
130
|
- lib/vertx/event_bus.rb
|
126
131
|
- lib/vertx/shared_data.rb
|
132
|
+
- spec/apps/rack/basic/config.ru
|
133
|
+
- spec/apps/rails4/basic/.gitignore
|
134
|
+
- spec/apps/rails4/basic/Gemfile
|
135
|
+
- spec/apps/rails4/basic/Gemfile.lock
|
136
|
+
- spec/apps/rails4/basic/README.rdoc
|
137
|
+
- spec/apps/rails4/basic/Rakefile
|
138
|
+
- spec/apps/rails4/basic/app/assets/images/.keep
|
139
|
+
- spec/apps/rails4/basic/app/assets/images/rails.png
|
140
|
+
- spec/apps/rails4/basic/app/assets/javascripts/application.js
|
141
|
+
- spec/apps/rails4/basic/app/assets/stylesheets/application.css
|
142
|
+
- spec/apps/rails4/basic/app/controllers/application_controller.rb
|
143
|
+
- spec/apps/rails4/basic/app/controllers/concerns/.keep
|
144
|
+
- spec/apps/rails4/basic/app/controllers/reloader_controller.rb
|
145
|
+
- spec/apps/rails4/basic/app/controllers/reloader_controller.rb.erb
|
146
|
+
- spec/apps/rails4/basic/app/controllers/root_controller.rb
|
147
|
+
- spec/apps/rails4/basic/app/helpers/application_helper.rb
|
148
|
+
- spec/apps/rails4/basic/app/mailers/.keep
|
149
|
+
- spec/apps/rails4/basic/app/models/.keep
|
150
|
+
- spec/apps/rails4/basic/app/models/concerns/.keep
|
151
|
+
- spec/apps/rails4/basic/app/views/layouts/application.html.erb
|
152
|
+
- spec/apps/rails4/basic/app/views/reloader/index.html.erb
|
153
|
+
- spec/apps/rails4/basic/app/views/root/index.html.erb
|
154
|
+
- spec/apps/rails4/basic/app/views/root/streaming.html.erb
|
155
|
+
- spec/apps/rails4/basic/bin/bundle
|
156
|
+
- spec/apps/rails4/basic/bin/rails
|
157
|
+
- spec/apps/rails4/basic/bin/rake
|
158
|
+
- spec/apps/rails4/basic/config.ru
|
159
|
+
- spec/apps/rails4/basic/config/application.rb
|
160
|
+
- spec/apps/rails4/basic/config/boot.rb
|
161
|
+
- spec/apps/rails4/basic/config/database.yml
|
162
|
+
- spec/apps/rails4/basic/config/environment.rb
|
163
|
+
- spec/apps/rails4/basic/config/environments/development.rb
|
164
|
+
- spec/apps/rails4/basic/config/environments/production.rb
|
165
|
+
- spec/apps/rails4/basic/config/environments/test.rb
|
166
|
+
- spec/apps/rails4/basic/config/initializers/backtrace_silencers.rb
|
167
|
+
- spec/apps/rails4/basic/config/initializers/filter_parameter_logging.rb
|
168
|
+
- spec/apps/rails4/basic/config/initializers/inflections.rb
|
169
|
+
- spec/apps/rails4/basic/config/initializers/mime_types.rb
|
170
|
+
- spec/apps/rails4/basic/config/initializers/secret_token.rb
|
171
|
+
- spec/apps/rails4/basic/config/initializers/session_store.rb
|
172
|
+
- spec/apps/rails4/basic/config/initializers/wrap_parameters.rb
|
173
|
+
- spec/apps/rails4/basic/config/locales/en.yml
|
174
|
+
- spec/apps/rails4/basic/config/routes.rb
|
175
|
+
- spec/apps/rails4/basic/db/seeds.rb
|
176
|
+
- spec/apps/rails4/basic/lib/assets/.keep
|
177
|
+
- spec/apps/rails4/basic/lib/tasks/.keep
|
178
|
+
- spec/apps/rails4/basic/public/404.html
|
179
|
+
- spec/apps/rails4/basic/public/422.html
|
180
|
+
- spec/apps/rails4/basic/public/500.html
|
181
|
+
- spec/apps/rails4/basic/public/favicon.ico
|
182
|
+
- spec/apps/rails4/basic/public/robots.txt
|
183
|
+
- spec/apps/rails4/basic/public/some_page.html
|
184
|
+
- spec/apps/rails4/basic/test/controllers/.keep
|
185
|
+
- spec/apps/rails4/basic/test/fixtures/.keep
|
186
|
+
- spec/apps/rails4/basic/test/helpers/.keep
|
187
|
+
- spec/apps/rails4/basic/test/integration/.keep
|
188
|
+
- spec/apps/rails4/basic/test/mailers/.keep
|
189
|
+
- spec/apps/rails4/basic/test/models/.keep
|
190
|
+
- spec/apps/rails4/basic/test/test_helper.rb
|
191
|
+
- spec/apps/rails4/basic/vendor/assets/javascripts/.keep
|
192
|
+
- spec/apps/rails4/basic/vendor/assets/stylesheets/.keep
|
193
|
+
- spec/apps/sinatra/basic/Gemfile
|
194
|
+
- spec/apps/sinatra/basic/Gemfile.lock
|
195
|
+
- spec/apps/sinatra/basic/basic.rb
|
196
|
+
- spec/apps/sinatra/basic/config.ru
|
197
|
+
- spec/apps/sinatra/basic/public/some_page.html
|
198
|
+
- spec/apps/sinatra/basic/views/index.erb
|
199
|
+
- spec/apps/sinatra/basic/views/posted.haml
|
200
|
+
- spec/apps/sinatra/basic/views/poster.haml
|
201
|
+
- spec/apps/sinatra/basic/views/request_mapping.haml
|
202
|
+
- spec/integration/basic_rack_spec.rb
|
203
|
+
- spec/integration/basic_rails4_spec.rb
|
204
|
+
- spec/integration/basic_sinatra_spec.rb
|
205
|
+
- spec/spec_helper.rb
|
127
206
|
- test/.ruby-version
|
128
207
|
- test/config/app.rb
|
129
208
|
- test/jubilee/test_cli.rb
|
@@ -152,9 +231,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
231
|
version: '0'
|
153
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
233
|
requirements:
|
155
|
-
- - '
|
234
|
+
- - '>'
|
156
235
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
236
|
+
version: 1.3.1
|
158
237
|
requirements: []
|
159
238
|
rubyforge_project:
|
160
239
|
rubygems_version: 2.1.9
|