jubilee 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - jruby-19mode # JRuby in 1.9 mode
4
+
5
+ script: "rake test"
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ Release 0.4.0
2
+ =============
3
+
4
+ Upgrade to vert.x 2.1.0
5
+
1
6
  Release 0.2.2
2
7
  =============
3
8
 
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
- gem 'rack', '~> 1.4.1'
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rack', '>= 1.4.1'
2
4
  #gem 'rack', path: "../../ruby/rack"
3
- gem 'spoon'
5
+ gem 'spoon', '~> 0.0.4'
4
6
 
5
7
  group :development do
6
8
  gem 'jeweler'
data/Gemfile.lock CHANGED
@@ -1,7 +1,21 @@
1
1
  GEM
2
+ remote: https://rubygems.org/
2
3
  specs:
4
+ addressable (2.3.5)
5
+ builder (3.2.2)
3
6
  coderay (1.0.8)
4
- git (1.2.5)
7
+ faraday (0.8.7)
8
+ multipart-post (~> 1.1)
9
+ ffi (1.9.0)
10
+ ffi (1.9.0-java)
11
+ git (1.2.6)
12
+ github_api (0.10.1)
13
+ addressable
14
+ faraday (~> 0.8.1)
15
+ hashie (>= 1.2)
16
+ multi_json (~> 1.4)
17
+ nokogiri (~> 1.5.2)
18
+ oauth2
5
19
  guard (1.5.4)
6
20
  listen (>= 0.4.2)
7
21
  lumberjack (>= 1.0.2)
@@ -9,28 +23,53 @@ GEM
9
23
  thor (>= 0.14.6)
10
24
  guard-minitest (0.5.0)
11
25
  guard (>= 0.4)
12
- jeweler (1.8.4)
26
+ hashie (2.0.5)
27
+ highline (1.6.19)
28
+ httpauth (0.2.0)
29
+ jeweler (1.8.7)
30
+ builder
13
31
  bundler (~> 1.0)
14
32
  git (>= 1.2.5)
33
+ github_api (= 0.10.1)
34
+ highline (>= 1.6.15)
35
+ nokogiri (= 1.5.10)
15
36
  rake
16
37
  rdoc
17
- json (1.7.5-java)
38
+ json (1.8.0-java)
39
+ jwt (0.1.8)
40
+ multi_json (>= 1.5)
18
41
  listen (0.5.3)
19
42
  lumberjack (1.0.2)
20
43
  method_source (0.8.1)
44
+ multi_json (1.8.0)
45
+ multi_xml (0.5.5)
21
46
  multipart-post (1.1.5)
47
+ nokogiri (1.5.10-java)
48
+ oauth2 (0.9.2)
49
+ faraday (~> 0.8)
50
+ httpauth (~> 0.2)
51
+ jwt (~> 0.1.4)
52
+ multi_json (~> 1.0)
53
+ multi_xml (~> 0.5)
54
+ rack (~> 1.2)
55
+ pry (0.9.10)
56
+ coderay (~> 1.0.5)
57
+ method_source (~> 0.8)
58
+ slop (~> 3.3.1)
22
59
  pry (0.9.10-java)
23
60
  coderay (~> 1.0.5)
24
61
  method_source (~> 0.8)
25
62
  slop (~> 3.3.1)
26
63
  spoon (~> 0.0)
27
64
  rack (1.4.5)
28
- rake (10.0.3)
65
+ rake (10.1.0)
66
+ rcov (0.9.11)
29
67
  rcov (0.9.11-java)
30
- rdoc (3.12)
68
+ rdoc (4.0.1)
31
69
  json (~> 1.4)
32
70
  slop (3.3.3)
33
- spoon (0.0.1)
71
+ spoon (0.0.4)
72
+ ffi
34
73
  thor (0.16.0)
35
74
 
36
75
  PLATFORMS
@@ -42,6 +81,6 @@ DEPENDENCIES
42
81
  jeweler
43
82
  multipart-post
44
83
  pry
45
- rack (~> 1.4.1)
84
+ rack (>= 1.4.1)
46
85
  rcov
47
- spoon
86
+ spoon (~> 0.0.4)
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/isaiah/jubilee.png?branch=master)](https://travis-ci.org/isaiah/jubilee)
2
+
1
3
  Jubilee
2
4
  =========
3
5
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -1,13 +1,12 @@
1
1
  package jubilee;
2
2
 
3
3
  import org.jruby.Ruby;
4
+ import org.jruby.jubilee.Server;
4
5
  import org.jruby.jubilee.impl.NullIO;
5
6
  import org.jruby.jubilee.impl.RubyIORackErrors;
6
7
  import org.jruby.jubilee.impl.RubyIORackInput;
7
8
  import org.jruby.runtime.load.BasicLibraryService;
8
9
 
9
- import org.jruby.jubilee.Server;
10
-
11
10
  import java.io.IOException;
12
11
 
13
12
  public class JubileeService implements BasicLibraryService {
@@ -14,135 +14,139 @@ import java.util.Map;
14
14
  */
15
15
  public final class Const {
16
16
 
17
- public static final String JUBILEE_VERSION = "Jubilee 0.1.0";
18
- public static final String HTTP_11 = "HTTP/1.1";
19
- public static final String HTTP_10 = "HTTP/1.0";
20
-
21
- public static final String SERVER_SOFTWARE = "SERVER_SOFTWARE";
22
- public static final String SERVER_PROTOCOL = "SERVER_PROTOCOL";
23
- public static final String GATEWAY_INTERFACE = "GATEWAY_INTERFACE";
24
- public static final String SERVER_NAME = "SERVER_NAME";
25
- public static final String SERVER_PORT = "SERVER_PORT";
26
-
27
- public static final String CGI_VER = "CGI/1.2";
28
-
29
- public static final String RACK_INPUT = "rack.input";
30
-
31
- public static final String REQUEST_METHOD = "REQUEST_METHOD";
32
- public static final String GET = "GET";
33
- public static final String POST = "POST";
34
- public static final String REQUEST_PATH = "REQUEST_PATH";
35
- public static final String REQUEST_URI = "REQUEST_URI";
36
- public static final String PATH_INFO = "PATH_INFO";
37
- public static final String QUERY_STRING = "QUERY_STRING";
38
- public static final String LOCALHOST = "localhost";
39
- public static final String PORT_80 = "80";
40
-
41
- public static final String REMOTE_ADDR = "REMOTE_ADDR";
42
- public static final String HTTP_HOST = "HTTP_HOST";
43
- public static final String HTTP_USER_AGENT = "HTTP_USER_AGENT";
44
- public static final String HTTP_ACCEPT = "HTTP_ACCEPT";
45
- public static final String HTTP_COOKIE = "HTTP_COOKIE";
46
- public static final String HTTP_ACCEPT_LANGUAGE = "HTTP_ACCEPT_LANGUAGE";
47
- public static final String HTTP_ACCEPT_ENCODING = "HTTP_ACCEPT_ENCODING";
48
- public static final String HTTP_CONNECTION = "HTTP_CONNECTION";
49
- public static final String HTTP_CONTENT_TYPE = "CONTENT_TYPE";
50
- public static final String HTTP_CONTENT_LENGTH = "CONTENT_LENGTH";
51
-
52
- public static class Rack {
53
- public static final String HTTP_DATE = "HTTP_DATE";
54
- public static final String HTTP_EXPECT = "HTTP_EXPECT";
55
- public static final String HTTP_IF_MATCH = "HTTP_IF_MATCH";
56
- public static final String HTTP_IF_MODIFIED_SINCE = "HTTP_IF_MODIFIED_SINCE";
57
- public static final String HTTP_IF_NONE_MATCH = "HTTP_IF_NONE_MATCH";
58
- public static final String HTTP_IF_RANGE = "HTTP_IF_RANGE";
59
- public static final String HTTP_IF_UNMODIFIED_SINCE = "HTTP_IF_UNMODIFIED_SINCE";
60
- public static final String HTTP_RANGE = "HTTP_RANGE";
61
- public static final String HTTP_PRAGMA = "HTTP_PRAGMA";
62
- public static final String HTTP_MAX_FORWARDS = "HTTP_MAX_FORWARDS";
63
- public static final String HTTP_REFERER = "HTTP_REFERER";
64
- public static final String HTTP_VIA = "HTTP_VIA";
65
- public static final String HTTP_WARNING = "HTTP_WARNING";
66
-
67
- public static final String HTTP_X_REQUESTED_WITH = "HTTP_X_REQUESTED_WITH"; // xhr
68
- public static final String HTTP_DNT = "HTTP_DNT"; // do-not-track
69
- public static final String HTTP_X_FORWARDED_FOR = "HTTP_X_FORWARDED_FOR"; // original ip
70
- }
71
-
72
- public static class Vertx {
73
- // all lower case since vertx has converted them
74
- public static final String COOKIE = "cookie";
75
- public static final String USER_AGENT = "user-agent";
76
- public static final String ACCEPT = "accept";
77
- public static final String ACCEPT_LANGUAGE = "accept-language";
78
- public static final String ACCEPT_ENCODING = "accept-encoding";
79
- public static final String CONNECTION = "connection";
80
- public static final String CONTENT_TYPE = "content-type";
81
- public static final String CONTENT_LENGTH = "content-length";
82
- public static final String HOST = "host";
83
-
84
- public static final String DATE = "date";
85
- public static final String EXPECT = "expect";
86
- public static final String IF_MATCH = "if-match";
87
- public static final String IF_MODIFIED_SINCE = "if-modified-since";
88
- public static final String IF_NONE_MATCH = "if-none-match";
89
- public static final String IF_RANGE = "if-range";
90
- public static final String IF_UNMODIFIED_SINCE = "if-unmodified-since";
91
- public static final String RANGE = "range";
92
- public static final String PRAGMA = "pragma";
93
- public static final String MAX_FORWARDS = "max-forwards";
94
- public static final String REFERER = "referer";
95
- public static final String VIA = "via";
96
- public static final String WARNING = "warning";
97
-
98
- // Non-standard request headers http://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Common_non-standard_request_headers
99
- public static final String X_REQUESTED_WITH = "x-requested-with"; // xhr
100
- public static final String DNT = "dnt"; // do-not-track
101
- public static final String X_FORWARDED_FOR = "x-forwarded-for"; // original ip
102
- }
103
-
104
- public static Map<String, String> ADDITIONAL_HEADERS = new HashMap<String, String>();
105
-
106
- static {
107
- ADDITIONAL_HEADERS.put(Vertx.DATE, Rack.HTTP_DATE);
108
- ADDITIONAL_HEADERS.put(Vertx.EXPECT, Rack.HTTP_EXPECT);
109
- ADDITIONAL_HEADERS.put(Vertx.IF_MATCH, Rack.HTTP_IF_MATCH);
110
- ADDITIONAL_HEADERS.put(Vertx.IF_MODIFIED_SINCE, Rack.HTTP_IF_MODIFIED_SINCE);
111
- ADDITIONAL_HEADERS.put(Vertx.IF_NONE_MATCH, Rack.HTTP_IF_NONE_MATCH);
112
- ADDITIONAL_HEADERS.put(Vertx.IF_RANGE, Rack.HTTP_IF_RANGE);
113
- ADDITIONAL_HEADERS.put(Vertx.IF_UNMODIFIED_SINCE, Rack.HTTP_IF_UNMODIFIED_SINCE);
114
- ADDITIONAL_HEADERS.put(Vertx.RANGE, Rack.HTTP_RANGE);
115
- ADDITIONAL_HEADERS.put(Vertx.PRAGMA, Rack.HTTP_PRAGMA);
116
- ADDITIONAL_HEADERS.put(Vertx.MAX_FORWARDS, Rack.HTTP_MAX_FORWARDS);
117
- ADDITIONAL_HEADERS.put(Vertx.REFERER, Rack.HTTP_REFERER);
118
- ADDITIONAL_HEADERS.put(Vertx.VIA, Rack.HTTP_VIA);
119
- ADDITIONAL_HEADERS.put(Vertx.WARNING, Rack.HTTP_WARNING);
120
- ADDITIONAL_HEADERS.put(Vertx.X_REQUESTED_WITH, Rack.HTTP_X_REQUESTED_WITH);
121
- ADDITIONAL_HEADERS.put(Vertx.DNT, Rack.HTTP_DNT);
122
- ADDITIONAL_HEADERS.put(Vertx.X_FORWARDED_FOR, Rack.HTTP_X_FORWARDED_FOR);
123
- }
124
-
125
- public static RubyArray RackVersion(Ruby runtime) {
126
- RubyArray version = RubyArray.newArray(runtime, 2);
127
- version.add("1");
128
- version.add("4");
129
- return version;
130
- }
131
-
132
- public static final String HTTP = "http";
133
- public static final String HTTPS = "https";
134
- public static final String URL_SCHEME = "rack.url_scheme";
135
- public static final String RACK_VERSION = "rack.version";
136
- public static final String RACK_ERRORS = "rack.errors";
137
- public static final String RACK_MULTITHREAD = "rack.multithread";
138
- public static final String RACK_MULTIPROCESS = "rack.multiprocess";
139
- public static final String RACK_RUNONCE = "rack.run_once";
140
- public static final String SCRIPT_NAME = "SCRIPT_NAME";
141
-
142
- private Const() {
143
- }
144
-
145
- // Internal
146
- public static final String END_OF_BODY = "__EOF__";
147
- public static final byte EOL = '\n';
17
+ public static final String JUBILEE_VERSION = "Jubilee 0.1.0";
18
+ public static final String HTTP_11 = "HTTP/1.1";
19
+ public static final String HTTP_10 = "HTTP/1.0";
20
+
21
+ public static final String SERVER_SOFTWARE = "SERVER_SOFTWARE";
22
+ public static final String SERVER_PROTOCOL = "SERVER_PROTOCOL";
23
+ public static final String GATEWAY_INTERFACE = "GATEWAY_INTERFACE";
24
+ public static final String SERVER_NAME = "SERVER_NAME";
25
+ public static final String SERVER_PORT = "SERVER_PORT";
26
+
27
+ public static final String CGI_VER = "CGI/1.2";
28
+
29
+ public static final String RACK_INPUT = "rack.input";
30
+
31
+ public static final String REQUEST_METHOD = "REQUEST_METHOD";
32
+ public static final String GET = "GET";
33
+ public static final String POST = "POST";
34
+ public static final String REQUEST_PATH = "REQUEST_PATH";
35
+ public static final String REQUEST_URI = "REQUEST_URI";
36
+ public static final String PATH_INFO = "PATH_INFO";
37
+ public static final String QUERY_STRING = "QUERY_STRING";
38
+ public static final String LOCALHOST = "localhost";
39
+ public static final String PORT_80 = "80";
40
+
41
+ public static final String REMOTE_ADDR = "REMOTE_ADDR";
42
+ public static final String HTTP_HOST = "HTTP_HOST";
43
+ public static final String HTTP_USER_AGENT = "HTTP_USER_AGENT";
44
+ public static final String HTTP_ACCEPT = "HTTP_ACCEPT";
45
+ public static final String HTTP_COOKIE = "HTTP_COOKIE";
46
+ public static final String HTTP_ACCEPT_LANGUAGE = "HTTP_ACCEPT_LANGUAGE";
47
+ public static final String HTTP_ACCEPT_ENCODING = "HTTP_ACCEPT_ENCODING";
48
+ public static final String HTTP_CONNECTION = "HTTP_CONNECTION";
49
+ public static final String HTTP_CONTENT_TYPE = "CONTENT_TYPE";
50
+ public static final String HTTP_CONTENT_LENGTH = "CONTENT_LENGTH";
51
+
52
+ public static class Rack {
53
+ public static final String HTTP_DATE = "HTTP_DATE";
54
+ public static final String HTTP_EXPECT = "HTTP_EXPECT";
55
+ public static final String HTTP_IF_MATCH = "HTTP_IF_MATCH";
56
+ public static final String HTTP_IF_MODIFIED_SINCE = "HTTP_IF_MODIFIED_SINCE";
57
+ public static final String HTTP_IF_NONE_MATCH = "HTTP_IF_NONE_MATCH";
58
+ public static final String HTTP_IF_RANGE = "HTTP_IF_RANGE";
59
+ public static final String HTTP_IF_UNMODIFIED_SINCE = "HTTP_IF_UNMODIFIED_SINCE";
60
+ public static final String HTTP_RANGE = "HTTP_RANGE";
61
+ public static final String HTTP_PRAGMA = "HTTP_PRAGMA";
62
+ public static final String HTTP_MAX_FORWARDS = "HTTP_MAX_FORWARDS";
63
+ public static final String HTTP_REFERER = "HTTP_REFERER";
64
+ public static final String HTTP_VIA = "HTTP_VIA";
65
+ public static final String HTTP_WARNING = "HTTP_WARNING";
66
+
67
+ public static final String HTTP_X_REQUESTED_WITH = "HTTP_X_REQUESTED_WITH"; // xhr
68
+ public static final String HTTP_DNT = "HTTP_DNT"; // do-not-track
69
+ public static final String HTTP_X_FORWARDED_FOR = "HTTP_X_FORWARDED_FOR"; // original ip
70
+
71
+ public static final String HTTP_CONTENT_MD5 = "HTTP_CONTENT_MD5";
72
+ }
73
+
74
+ public static class Vertx {
75
+ // all lower case since vertx has converted them
76
+ public static final String COOKIE = "cookie";
77
+ public static final String USER_AGENT = "user-agent";
78
+ public static final String ACCEPT = "accept";
79
+ public static final String ACCEPT_LANGUAGE = "accept-language";
80
+ public static final String ACCEPT_ENCODING = "accept-encoding";
81
+ public static final String CONNECTION = "connection";
82
+ public static final String CONTENT_TYPE = "content-type";
83
+ public static final String CONTENT_LENGTH = "content-length";
84
+ public static final String CONTENT_MD5 = "content-md5";
85
+ public static final String HOST = "host";
86
+
87
+ public static final String DATE = "date";
88
+ public static final String EXPECT = "expect";
89
+ public static final String IF_MATCH = "if-match";
90
+ public static final String IF_MODIFIED_SINCE = "if-modified-since";
91
+ public static final String IF_NONE_MATCH = "if-none-match";
92
+ public static final String IF_RANGE = "if-range";
93
+ public static final String IF_UNMODIFIED_SINCE = "if-unmodified-since";
94
+ public static final String RANGE = "range";
95
+ public static final String PRAGMA = "pragma";
96
+ public static final String MAX_FORWARDS = "max-forwards";
97
+ public static final String REFERER = "referer";
98
+ public static final String VIA = "via";
99
+ public static final String WARNING = "warning";
100
+
101
+ // Non-standard request headers http://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Common_non-standard_request_headers
102
+ public static final String X_REQUESTED_WITH = "x-requested-with"; // xhr
103
+ public static final String DNT = "dnt"; // do-not-track
104
+ public static final String X_FORWARDED_FOR = "x-forwarded-for"; // original ip
105
+ }
106
+
107
+ public static Map<String, String> ADDITIONAL_HEADERS = new HashMap<String, String>();
108
+
109
+ static {
110
+ ADDITIONAL_HEADERS.put(Vertx.DATE, Rack.HTTP_DATE);
111
+ ADDITIONAL_HEADERS.put(Vertx.EXPECT, Rack.HTTP_EXPECT);
112
+ ADDITIONAL_HEADERS.put(Vertx.IF_MATCH, Rack.HTTP_IF_MATCH);
113
+ ADDITIONAL_HEADERS.put(Vertx.IF_MODIFIED_SINCE, Rack.HTTP_IF_MODIFIED_SINCE);
114
+ ADDITIONAL_HEADERS.put(Vertx.IF_NONE_MATCH, Rack.HTTP_IF_NONE_MATCH);
115
+ ADDITIONAL_HEADERS.put(Vertx.IF_RANGE, Rack.HTTP_IF_RANGE);
116
+ ADDITIONAL_HEADERS.put(Vertx.IF_UNMODIFIED_SINCE, Rack.HTTP_IF_UNMODIFIED_SINCE);
117
+ ADDITIONAL_HEADERS.put(Vertx.RANGE, Rack.HTTP_RANGE);
118
+ ADDITIONAL_HEADERS.put(Vertx.PRAGMA, Rack.HTTP_PRAGMA);
119
+ ADDITIONAL_HEADERS.put(Vertx.MAX_FORWARDS, Rack.HTTP_MAX_FORWARDS);
120
+ ADDITIONAL_HEADERS.put(Vertx.REFERER, Rack.HTTP_REFERER);
121
+ ADDITIONAL_HEADERS.put(Vertx.VIA, Rack.HTTP_VIA);
122
+ ADDITIONAL_HEADERS.put(Vertx.WARNING, Rack.HTTP_WARNING);
123
+ ADDITIONAL_HEADERS.put(Vertx.X_REQUESTED_WITH, Rack.HTTP_X_REQUESTED_WITH);
124
+ ADDITIONAL_HEADERS.put(Vertx.DNT, Rack.HTTP_DNT);
125
+ ADDITIONAL_HEADERS.put(Vertx.X_FORWARDED_FOR, Rack.HTTP_X_FORWARDED_FOR);
126
+ ADDITIONAL_HEADERS.put(Vertx.CONTENT_MD5, Rack.HTTP_CONTENT_MD5);
127
+ }
128
+
129
+ public static RubyArray RackVersion(Ruby runtime) {
130
+ RubyArray version = RubyArray.newArray(runtime, 2);
131
+ version.add("1");
132
+ version.add("4");
133
+ return version;
134
+ }
135
+
136
+ public static final String HTTP = "http";
137
+ public static final String HTTPS = "https";
138
+ public static final String URL_SCHEME = "rack.url_scheme";
139
+ public static final String RACK_VERSION = "rack.version";
140
+ public static final String RACK_ERRORS = "rack.errors";
141
+ public static final String RACK_MULTITHREAD = "rack.multithread";
142
+ public static final String RACK_MULTIPROCESS = "rack.multiprocess";
143
+ public static final String RACK_RUNONCE = "rack.run_once";
144
+ public static final String SCRIPT_NAME = "SCRIPT_NAME";
145
+
146
+ private Const() {
147
+ }
148
+
149
+ // Internal
150
+ public static final String END_OF_BODY = "__EOF__";
151
+ public static final byte EOL = '\n';
148
152
  }
@@ -1,5 +1,7 @@
1
1
  package org.jruby.jubilee;
2
2
 
3
+ import io.netty.buffer.ByteBuf;
4
+ import io.netty.buffer.Unpooled;
3
5
  import org.jruby.Ruby;
4
6
  import org.jruby.javasupport.JavaEmbedUtils;
5
7
  import org.jruby.jubilee.impl.DefaultRackEnvironment;
@@ -10,7 +12,9 @@ import org.vertx.java.core.VoidHandler;
10
12
  import org.vertx.java.core.buffer.Buffer;
11
13
  import org.vertx.java.core.http.HttpServerRequest;
12
14
 
13
- import java.util.concurrent.*;
15
+ import java.util.concurrent.ExecutorService;
16
+ import java.util.concurrent.Executors;
17
+ import java.util.concurrent.atomic.AtomicBoolean;
14
18
 
15
19
  /**
16
20
  * Created with IntelliJ IDEA.
@@ -24,27 +28,27 @@ public class RackApplication {
24
28
 
25
29
  private ExecutorService exec;
26
30
 
27
- public RackApplication(IRubyObject app, boolean ssl) {
31
+ public RackApplication(IRubyObject app, boolean ssl, int numberOfWorkers) {
28
32
  this.app = app;
29
33
  this.ssl = ssl;
30
- exec = Executors.newCachedThreadPool();
34
+ exec = Executors.newFixedThreadPool(numberOfWorkers);
31
35
  }
32
36
 
33
37
  public void call(final HttpServerRequest request) {
34
- final Buffer bodyBuf = new Buffer(0);
38
+ final ByteBuf bodyBuf = Unpooled.unreleasableBuffer(Unpooled.buffer(0, Integer.MAX_VALUE));
35
39
  final Ruby runtime = app.getRuntime();
36
- final CountDownLatch bodyLatch = new CountDownLatch(1);
40
+ final AtomicBoolean eof = new AtomicBoolean(false);
37
41
  request.dataHandler(new Handler<Buffer>() {
38
42
  @Override
39
43
  public void handle(Buffer buffer) {
40
- bodyBuf.appendBuffer(buffer);
44
+ bodyBuf.writeBytes(buffer.getBytes());
41
45
  }
42
46
  });
43
47
  // TODO optimize by use NullIO when there is no body here.
44
48
  Runnable task = new Runnable() {
45
49
  @Override
46
50
  public void run() {
47
- RackInput input = new RubyIORackInput(runtime, bodyBuf, bodyLatch);
51
+ RackInput input = new RubyIORackInput(runtime, request, bodyBuf, eof);
48
52
  RackEnvironment env = new DefaultRackEnvironment(runtime, request, input, ssl);
49
53
  IRubyObject result = app.callMethod(runtime.getCurrentContext(), "call", env.getEnv());
50
54
  RackResponse response = (RackResponse) JavaEmbedUtils.rubyToJava(runtime, result, RackResponse.class);
@@ -55,7 +59,7 @@ public class RackApplication {
55
59
  request.endHandler(new VoidHandler() {
56
60
  @Override
57
61
  protected void handle() {
58
- bodyLatch.countDown();
62
+ eof.set(true);
59
63
  }
60
64
  });
61
65
  }