Skip to content

Commit 5c060ae

Browse files
committed
Merge branch '1.1-stable'
* 1.1-stable: (27 commits) update for next development snapshot prepare for 1.1.18 note that ErrorApp::ShowStatus is not public API + delay rack loading setup and integration spec with a Rails 4.1 stub make back-ported ShowStatus compatible and use it instead of Rack::ShowStatus back-port Rack::ShowStatus to be used with out ErrorApp (contains XSS fix see #190) missed Gemfile.lock for rack ~> 1.5.2 context-loader rackup script resolution should work also when rackup.path configured search config.ru on context-classloader if not found otherwise introduce a new layout where the whole application + gems are packed under WEB-INF/classes update to rack ~> 1.5.2 (for JRuby-Rack 1.1.x) [travis-ci] more JRuby 1.6.8 excludes + allow failures (still useful for spec regressions) do not care about "OpenSSL::Random requires the jruby-openssl gem" on 1.6.8 [travis-ci ] make sure 1.1 is kept backwards (JRuby 1.6.x) compatible fix compatibility for newly added (servlet-env) specs with all (supported) rack versions [travis-ci] fix jruby excludes (using explicit jruby-1.7.x version number now) use Rack::Utils.best_q_match in ErrorApp if available, also accepts_html? is private API re-arrange JRuby::Rack::ErrorApp internals even more compatibility with rack's parse_nested_query logic for "pure" servlet-env improved rack-compatibility for our "pure" servlet-env request env parsing impl ...
2 parents 205763c + 0320907 commit 5c060ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+918
-102
lines changed

.travis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ before_install:
4141
- ((echo $BUNDLE_GEMFILE | grep rails23) && jruby --1.9 -S gem update --system 1.8.29) || true
4242
matrix:
4343
allow_failures:
44-
#- rvm: jruby-head
4544
#- gemfile: gemfiles/rails41.gemfile
4645
exclude:
4746
## avoid jruby-head with JDK6 :
@@ -123,6 +122,14 @@ matrix:
123122
gemfile: gemfiles/rails41.gemfile
124123
env: JRUBY_OPTS="--1.8 $JRUBY_OPTS"
125124
jdk: oraclejdk7
125+
- rvm: jruby-1.7.16
126+
gemfile: gemfiles/rails41.gemfile
127+
env: JRUBY_OPTS="--1.8 $JRUBY_OPTS"
128+
jdk: openjdk6
129+
- rvm: jruby-1.7.16
130+
gemfile: gemfiles/rails41.gemfile
131+
env: JRUBY_OPTS="--1.8 $JRUBY_OPTS"
132+
jdk: oraclejdk7
126133
- rvm: jruby-1.7.16
127134
gemfile: gemfiles/rails41.gemfile
128135
env: JRUBY_OPTS="--1.8 $JRUBY_OPTS"

History.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 1.1.18 (13/01/15)
2+
3+
- back-port Rack::ShowStatus to be used with out ErrorApp (contains XSS fix #190)
4+
- search rackup (config.ru) on context-classloader if not found elsewhere
5+
- introduce a new ClassPathLayout where the whole app + gems are on CP (#191)
6+
- update to (vendored) rack ~> 1.5.2 (for JRuby-Rack 1.1.x)
7+
- use Rack::Utils.best_q_match in ErrorApp if available
8+
- improved rack-compatibility for our "pure" servlet-env request env parsing
9+
* raise a TypeError just like rack does when it detects invalid parameters
10+
* compatibility with rack's parse_nested_query logic
11+
112
## 1.1.17 (30/12/14)
213

314
This release changes deployment from codehaus.org to oss.sonatype.org for artifacts.

gemfiles/rails40.gemfile.lock

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actionmailer (4.0.8)
5-
actionpack (= 4.0.8)
6-
mail (~> 2.5.4)
7-
actionpack (4.0.8)
8-
activesupport (= 4.0.8)
4+
actionmailer (4.0.13)
5+
actionpack (= 4.0.13)
6+
mail (~> 2.5, >= 2.5.4)
7+
actionpack (4.0.13)
8+
activesupport (= 4.0.13)
99
builder (~> 3.1.0)
1010
erubis (~> 2.7.0)
1111
rack (~> 1.5.2)
1212
rack-test (~> 0.6.2)
13-
activemodel (4.0.8)
14-
activesupport (= 4.0.8)
13+
activemodel (4.0.13)
14+
activesupport (= 4.0.13)
1515
builder (~> 3.1.0)
16-
activerecord (4.0.8)
17-
activemodel (= 4.0.8)
16+
activerecord (4.0.13)
17+
activemodel (= 4.0.13)
1818
activerecord-deprecated_finders (~> 1.0.2)
19-
activesupport (= 4.0.8)
19+
activesupport (= 4.0.13)
2020
arel (~> 4.0.0)
2121
activerecord-deprecated_finders (1.0.3)
22-
activesupport (4.0.8)
22+
activesupport (4.0.13)
2323
i18n (~> 0.6, >= 0.6.9)
2424
minitest (~> 4.2)
2525
multi_json (~> 1.3)
@@ -30,28 +30,26 @@ GEM
3030
diff-lcs (1.2.5)
3131
erubis (2.7.0)
3232
hike (1.2.3)
33-
i18n (0.6.11)
34-
mail (2.5.4)
35-
mime-types (~> 1.16)
36-
treetop (~> 1.4.8)
37-
mime-types (1.25.1)
33+
i18n (0.7.0)
34+
mail (2.6.3)
35+
mime-types (>= 1.16, < 3)
36+
mime-types (2.4.3)
3837
minitest (4.7.5)
3938
multi_json (1.10.1)
40-
polyglot (0.3.5)
4139
rack (1.5.2)
42-
rack-test (0.6.2)
40+
rack-test (0.6.3)
4341
rack (>= 1.0)
44-
rails (4.0.8)
45-
actionmailer (= 4.0.8)
46-
actionpack (= 4.0.8)
47-
activerecord (= 4.0.8)
48-
activesupport (= 4.0.8)
42+
rails (4.0.13)
43+
actionmailer (= 4.0.13)
44+
actionpack (= 4.0.13)
45+
activerecord (= 4.0.13)
46+
activesupport (= 4.0.13)
4947
bundler (>= 1.3.0, < 2.0)
50-
railties (= 4.0.8)
48+
railties (= 4.0.13)
5149
sprockets-rails (~> 2.0)
52-
railties (4.0.8)
53-
actionpack (= 4.0.8)
54-
activesupport (= 4.0.8)
50+
railties (4.0.13)
51+
actionpack (= 4.0.13)
52+
activesupport (= 4.0.13)
5553
rake (>= 0.8.7)
5654
thor (>= 0.18.1, < 2.0)
5755
rake (10.3.2)
@@ -63,22 +61,19 @@ GEM
6361
rspec-expectations (2.14.5)
6462
diff-lcs (>= 1.1.3, < 2.0)
6563
rspec-mocks (2.14.6)
66-
sprockets (2.12.1)
64+
sprockets (2.12.3)
6765
hike (~> 1.2)
6866
multi_json (~> 1.0)
6967
rack (~> 1.0)
7068
tilt (~> 1.1, != 1.3.0)
71-
sprockets-rails (2.1.3)
69+
sprockets-rails (2.2.2)
7270
actionpack (>= 3.0)
7371
activesupport (>= 3.0)
74-
sprockets (~> 2.8)
72+
sprockets (>= 2.8, < 4.0)
7573
thor (0.19.1)
7674
thread_safe (0.3.4-java)
7775
tilt (1.4.1)
78-
treetop (1.4.15)
79-
polyglot
80-
polyglot (>= 0.3.1)
81-
tzinfo (0.3.41)
76+
tzinfo (0.3.42)
8277

8378
PLATFORMS
8479
java

gemfiles/rails41.gemfile.lock

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actionmailer (4.1.4)
5-
actionpack (= 4.1.4)
6-
actionview (= 4.1.4)
7-
mail (~> 2.5.4)
8-
actionpack (4.1.4)
9-
actionview (= 4.1.4)
10-
activesupport (= 4.1.4)
4+
actionmailer (4.1.9)
5+
actionpack (= 4.1.9)
6+
actionview (= 4.1.9)
7+
mail (~> 2.5, >= 2.5.4)
8+
actionpack (4.1.9)
9+
actionview (= 4.1.9)
10+
activesupport (= 4.1.9)
1111
rack (~> 1.5.2)
1212
rack-test (~> 0.6.2)
13-
actionview (4.1.4)
14-
activesupport (= 4.1.4)
13+
actionview (4.1.9)
14+
activesupport (= 4.1.9)
1515
builder (~> 3.1)
1616
erubis (~> 2.7.0)
17-
activemodel (4.1.4)
18-
activesupport (= 4.1.4)
17+
activemodel (4.1.9)
18+
activesupport (= 4.1.9)
1919
builder (~> 3.1)
20-
activerecord (4.1.4)
21-
activemodel (= 4.1.4)
22-
activesupport (= 4.1.4)
20+
activerecord (4.1.9)
21+
activemodel (= 4.1.9)
22+
activesupport (= 4.1.9)
2323
arel (~> 5.0.0)
24-
activesupport (4.1.4)
24+
activesupport (4.1.9)
2525
i18n (~> 0.6, >= 0.6.9)
2626
json (~> 1.7, >= 1.7.7)
2727
minitest (~> 5.1)
@@ -32,31 +32,29 @@ GEM
3232
diff-lcs (1.2.5)
3333
erubis (2.7.0)
3434
hike (1.2.3)
35-
i18n (0.6.11)
36-
json (1.8.1-java)
37-
mail (2.5.4)
38-
mime-types (~> 1.16)
39-
treetop (~> 1.4.8)
40-
mime-types (1.25.1)
41-
minitest (5.4.0)
35+
i18n (0.7.0)
36+
json (1.8.2-java)
37+
mail (2.6.3)
38+
mime-types (>= 1.16, < 3)
39+
mime-types (2.4.3)
40+
minitest (5.5.1)
4241
multi_json (1.10.1)
43-
polyglot (0.3.5)
4442
rack (1.5.2)
45-
rack-test (0.6.2)
43+
rack-test (0.6.3)
4644
rack (>= 1.0)
47-
rails (4.1.4)
48-
actionmailer (= 4.1.4)
49-
actionpack (= 4.1.4)
50-
actionview (= 4.1.4)
51-
activemodel (= 4.1.4)
52-
activerecord (= 4.1.4)
53-
activesupport (= 4.1.4)
45+
rails (4.1.9)
46+
actionmailer (= 4.1.9)
47+
actionpack (= 4.1.9)
48+
actionview (= 4.1.9)
49+
activemodel (= 4.1.9)
50+
activerecord (= 4.1.9)
51+
activesupport (= 4.1.9)
5452
bundler (>= 1.3.0, < 2.0)
55-
railties (= 4.1.4)
53+
railties (= 4.1.9)
5654
sprockets-rails (~> 2.0)
57-
railties (4.1.4)
58-
actionpack (= 4.1.4)
59-
activesupport (= 4.1.4)
55+
railties (4.1.9)
56+
actionpack (= 4.1.9)
57+
activesupport (= 4.1.9)
6058
rake (>= 0.8.7)
6159
thor (>= 0.18.1, < 2.0)
6260
rake (10.3.2)
@@ -68,21 +66,18 @@ GEM
6866
rspec-expectations (2.14.5)
6967
diff-lcs (>= 1.1.3, < 2.0)
7068
rspec-mocks (2.14.6)
71-
sprockets (2.12.1)
69+
sprockets (2.12.3)
7270
hike (~> 1.2)
7371
multi_json (~> 1.0)
7472
rack (~> 1.0)
7573
tilt (~> 1.1, != 1.3.0)
76-
sprockets-rails (2.1.3)
74+
sprockets-rails (2.2.2)
7775
actionpack (>= 3.0)
7876
activesupport (>= 3.0)
79-
sprockets (~> 2.8)
77+
sprockets (>= 2.8, < 4.0)
8078
thor (0.19.1)
8179
thread_safe (0.3.4-java)
8280
tilt (1.4.1)
83-
treetop (1.4.15)
84-
polyglot
85-
polyglot (>= 0.3.1)
8681
tzinfo (1.2.2)
8782
thread_safe (~> 0.1)
8883

src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77

88
package org.jruby.rack;
99

10-
import java.io.IOException;
10+
1111
import java.io.File;
12+
import java.io.IOException;
13+
import java.io.InputStream;
1214
import java.lang.reflect.InvocationTargetException;
1315
import java.lang.reflect.Method;
1416
import java.net.URISyntaxException;
1517
import java.net.URL;
16-
import java.util.Iterator;
1718
import java.util.Map;
1819
import java.util.Set;
1920

@@ -195,7 +196,7 @@ public IRubyObject createErrorApplicationObject(final Ruby runtime) {
195196
}
196197
if (errorApp == null) {
197198
errorApp = "require 'jruby/rack/error_app' \n" +
198-
"use Rack::ShowStatus \n" +
199+
"use JRuby::Rack::ErrorApp::ShowStatus \n" +
199200
"run JRuby::Rack::ErrorApp.new";
200201
}
201202
runtime.evalScriptlet("load 'jruby/rack/boot/rack.rb'");
@@ -510,23 +511,34 @@ private String findConfigRuPathInSubDirectories(final String path, int level) {
510511

511512
if (level > 0) {
512513
level--;
513-
for ( Iterator<String> i = entries.iterator(); i.hasNext(); ) {
514-
String subpath = i.next();
515-
if (subpath.endsWith("/")) {
514+
for ( String subpath : entries ) {
515+
final int len = subpath.length();
516+
if ( len > 0 && subpath.charAt(len - 1) == '/' ) {
516517
subpath = findConfigRuPathInSubDirectories(subpath, level);
517-
if (subpath != null) {
518-
return subpath;
519-
}
518+
if ( subpath != null ) return subpath;
520519
}
521520
}
522521
}
523522
}
524523
return null;
525524
}
526525

527-
private String resolveRackupScript() throws RackInitializationException {
528-
rackupLocation = "<web.xml>";
526+
private static String getContextLoaderScript(final String name, final boolean silent)
527+
throws IOException {
528+
try { // still try context-loader for resolving rackup :
529+
final ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
530+
InputStream is = contextLoader.getResourceAsStream(name);
531+
return IOHelpers.inputStreamToString(is);
532+
}
533+
catch (IOException e) {
534+
if ( silent ) return null; throw e;
535+
}
536+
catch (RuntimeException e) {
537+
if ( silent ) return null; throw e;
538+
}
539+
}
529540

541+
private String resolveRackupScript() throws RackInitializationException {
530542
String rackup = rackContext.getConfig().getRackup();
531543
if (rackup == null) {
532544
rackup = rackContext.getConfig().getRackupPath();
@@ -543,16 +555,39 @@ private String resolveRackupScript() throws RackInitializationException {
543555
}
544556

545557
if (rackup != null) {
546-
rackupLocation = rackContext.getRealPath(rackup);
558+
InputStream is;
547559
try {
548-
rackup = IOHelpers.inputStreamToString(rackContext.getResourceAsStream(rackup));
560+
is = rackContext.getResourceAsStream(rackup);
561+
rackupLocation = rackContext.getRealPath(rackup);
562+
return this.rackupScript = IOHelpers.inputStreamToString(is);
563+
}
564+
catch (IOException e) {
565+
try { // last - try context-loader for resolving rackup :
566+
if ( (rackup = getContextLoaderScript(rackup, true)) != null ) {
567+
return this.rackupScript = rackup;
568+
}
569+
}
570+
catch (IOException ex) { /* won't happen */ }
571+
572+
rackContext.log(RackLogger.ERROR, "failed to read rackup from '"+ rackup + "' (" + e + ")");
573+
throw new RackInitializationException("failed to read rackup input", e);
574+
}
575+
}
576+
else {
577+
rackup = "config.ru";
578+
try {
579+
rackup = getContextLoaderScript(rackup, false);
580+
rackupLocation = "uri:classloader://config.ru";
549581
}
550582
catch (IOException e) {
551583
rackContext.log(ERROR, "failed to read rackup from '"+ rackup + "' (" + e + ")");
552584
throw new RackInitializationException("failed to read rackup input", e);
553585
}
554586
}
555587
}
588+
else {
589+
rackupLocation = "<web.xml>";
590+
}
556591

557592
return this.rackupScript = rackup;
558593
}

0 commit comments

Comments
 (0)