From 11ca0079e9270895e7abab684b6f43c4ac8703f9 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 20 Jul 2016 14:02:13 +1000 Subject: [PATCH 1/7] Only README.md #745 --- README.TXT | 22 ---------------------- README.md | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 23 deletions(-) delete mode 100644 README.TXT diff --git a/README.TXT b/README.TXT deleted file mode 100644 index 1a67c5b8eb6..00000000000 --- a/README.TXT +++ /dev/null @@ -1,22 +0,0 @@ -This is a source checkout of the Eclipse Jetty webserver. - -To build, use: - - mvn clean install - -The jetty distribution will be built in - - jetty-distribution/target/distribution - -The first build may take a long time as Maven downloads all the -dependencies. - -The tests do a lot of stress testing, and on some machines it is -necessary to set the file descriptor limit to greater than 2048 -for the tests to all pass successfully. - -Bypass tests by building with -Dmaven.test.skip=true but note -that this will not produce some test jars that are leveraged -in other places in the build. - -See also README.md diff --git a/README.md b/README.md index c63cccb80bb..9c3307787c1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,22 @@ Documentation Project documentation is located on our Eclipse website. - [http://www.eclipse.org/jetty/documentation](http://www.eclipse.org/jetty/documentation) -- README.TXT + +Building +======== + +To build, use: +```shell + mvn clean install +``` + +The jetty distribution will be built in `jetty-distribution/target/distribution` + +The first build may take a long time as Maven downloads all the dependencies. + +The tests do a lot of stress testing, and on some machines it is necessary to set the file descriptor limit to greater than 2048 for the tests to all pass successfully. + +Bypass tests by building with `mvn -Dmaven.test.skip=true install` but note that this will not produce some test jars that are leveraged in other places in the build. Professional Services ============ From b58cd5870befc8d49a1df1e3c474b58b8abd7e78 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 19 Jul 2016 21:08:44 -0700 Subject: [PATCH 2/7] Fixes #723 - improves MimeType resource loading and error reporting (#724) Signed-off-by: Joakim Erdfelt --- .../org/eclipse/jetty/http/MimeTypes.java | 85 +++++++++++++++---- 1 file changed, 69 insertions(+), 16 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java b/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java index dbdd4b83c67..46c87d00883 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java @@ -18,21 +18,24 @@ package org.eclipse.jetty.http; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; -import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; -import java.util.MissingResourceException; -import java.util.ResourceBundle; +import java.util.Properties; import java.util.Set; import org.eclipse.jetty.util.ArrayTrie; import org.eclipse.jetty.util.BufferUtil; +import org.eclipse.jetty.util.Loader; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.Trie; import org.eclipse.jetty.util.log.Log; @@ -200,16 +203,41 @@ public class MimeTypes try { - ResourceBundle mime = ResourceBundle.getBundle("org/eclipse/jetty/http/mime"); - Enumeration i = mime.getKeys(); - while(i.hasMoreElements()) + String resourceName = "org/eclipse/jetty/http/mime.properties"; + URL mimeTypesUrl = Loader.getResource(__dftMimeMap.getClass(), resourceName); + if (mimeTypesUrl == null) { - String ext = i.nextElement(); - String m = mime.getString(ext); - __dftMimeMap.put(StringUtil.asciiToLowerCase(ext),normalizeMimeType(m)); + LOG.warn("Missing mime-type resource: {}", resourceName); + } + else + { + int count = 0; + + try (InputStream in = mimeTypesUrl.openStream(); + InputStreamReader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) + { + Properties mime = new Properties(); + mime.load(reader); + + for (String ext : mime.stringPropertyNames()) + { + if (ext == null) + { + LOG.warn("Encountered null mime-type extension in resource: {}", mimeTypesUrl); + } + String m = mime.getProperty(ext); + __dftMimeMap.put(StringUtil.asciiToLowerCase(ext), normalizeMimeType(m)); + count++; + } + } + + if (count < 1) + { + LOG.warn("Empty mime types declaration at {}", mimeTypesUrl); + } } } - catch(MissingResourceException e) + catch(IOException e) { LOG.warn(e.toString()); LOG.debug(e); @@ -217,15 +245,40 @@ public class MimeTypes try { - ResourceBundle encoding = ResourceBundle.getBundle("org/eclipse/jetty/http/encoding"); - Enumeration i = encoding.getKeys(); - while(i.hasMoreElements()) + String resourceName = "org/eclipse/jetty/http/encoding.properties"; + URL mimeTypesUrl = Loader.getResource(__dftMimeMap.getClass(), resourceName); + if (mimeTypesUrl == null) { - String type = i.nextElement(); - __encodings.put(type,encoding.getString(type)); + LOG.warn("Missing mime-type resource: {}", resourceName); + } + else + { + int count = 0; + + try (InputStream in = mimeTypesUrl.openStream(); + InputStreamReader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) + { + Properties encoding = new Properties(); + encoding.load(reader); + + for (String type : encoding.stringPropertyNames()) + { + if (type == null) + { + LOG.warn("Encountered null encoding type in resource: {}", mimeTypesUrl); + } + __encodings.put(type, encoding.getProperty(type)); + count++; + } + } + + if (count < 1) + { + LOG.warn("Empty mime types declaration at {}", mimeTypesUrl); + } } } - catch(MissingResourceException e) + catch(IOException e) { LOG.warn(e.toString()); LOG.debug(e); From d6c73118be489b3b0025c08db4721e54fe2f071a Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 20 Jul 2016 14:19:13 +1000 Subject: [PATCH 3/7] less verbose #723 --- .../org/eclipse/jetty/http/MimeTypes.java | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java b/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java index 46c87d00883..5b11b9c71a9 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java @@ -211,27 +211,22 @@ public class MimeTypes } else { - int count = 0; - try (InputStream in = mimeTypesUrl.openStream(); InputStreamReader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) { Properties mime = new Properties(); mime.load(reader); - - for (String ext : mime.stringPropertyNames()) + mime.stringPropertyNames().stream() + .filter(x->x!=null) + .forEach(x-> + __dftMimeMap.put(StringUtil.asciiToLowerCase(x), normalizeMimeType(mime.getProperty(x)))); + + if (__dftMimeMap.size()t!=null) + .forEach(t->__encodings.put(t, encoding.getProperty(t))); - for (String type : encoding.stringPropertyNames()) + if (__encodings.size() Date: Wed, 20 Jul 2016 14:59:45 +1000 Subject: [PATCH 4/7] Removed --add #627 --- .../src/main/java/org/eclipse/jetty/start/StartArgs.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java index f0ba2346680..ec97afef1fb 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java @@ -966,7 +966,7 @@ public class StartArgs licenseCheckRequired = true; return; } - if (arg.startsWith("--add=") || arg.startsWith("--add-to-start=")) + if (arg.startsWith("--add-to-start=")) { startModules.addAll(Props.getValues(arg)); run = false; From 17e39ebb5cce7329f9d91dd4dea46a706119608b Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 20 Jul 2016 16:04:19 +1000 Subject: [PATCH 5/7] Fixes #723 - improves MimeType resource loading and error reporting (#724) fixed merge --- .../src/main/java/org/eclipse/jetty/http/MimeTypes.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java b/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java index 5b11b9c71a9..2314856fa70 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/MimeTypes.java @@ -204,7 +204,7 @@ public class MimeTypes try { String resourceName = "org/eclipse/jetty/http/mime.properties"; - URL mimeTypesUrl = Loader.getResource(__dftMimeMap.getClass(), resourceName); + URL mimeTypesUrl = Loader.getResource(resourceName); if (mimeTypesUrl == null) { LOG.warn("Missing mime-type resource: {}", resourceName); @@ -241,7 +241,7 @@ public class MimeTypes try { String resourceName = "org/eclipse/jetty/http/encoding.properties"; - URL mimeTypesUrl = Loader.getResource(__dftMimeMap.getClass(), resourceName); + URL mimeTypesUrl = Loader.getResource(resourceName); if (mimeTypesUrl == null) { LOG.warn("Missing mime-type resource: {}", resourceName); From 7e16731b9dac0d5b6ae5424a13c83fd4ef46dc4f Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 20 Jul 2016 16:59:28 +1000 Subject: [PATCH 6/7] fix #592 --- .../org/eclipse/jetty/http/HttpParser.java | 2 +- .../eclipse/jetty/http/HttpParserTest.java | 15 +++++++++++++ .../org/eclipse/jetty/server/Request.java | 14 +++++++------ .../jetty/server/HttpConnectionTest.java | 21 +++++++++++++++++++ .../jetty/server/PartialRFC2616Test.java | 2 +- .../jetty/test/rfcs/RFC2616BaseTest.java | 2 +- 6 files changed, 47 insertions(+), 9 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java index 12f74a50bbf..dd5348a46c5 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java @@ -907,7 +907,7 @@ public class HttpParser case HOST: _host=true; - if (!(_field instanceof HostPortHttpField)) + if (!(_field instanceof HostPortHttpField) && _valueString!=null && !_valueString.isEmpty()) { _field=new HostPortHttpField(_header,legacyString(_headerString,_header.asString()),_valueString); add_to_connection_trie=_connectionFields!=null; diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java index 0228896c619..d0cb4555515 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java @@ -1707,6 +1707,21 @@ public class HttpParserTest Assert.assertEquals(8888, _port); } + @Test + public void testEmptyHostPort() throws Exception + { + ByteBuffer buffer = BufferUtil.toBuffer( + "GET / HTTP/1.1\r\n" + + "Host:\r\n" + + "Connection: close\r\n" + + "\r\n"); + + HttpParser.RequestHandler handler = new Handler(); + HttpParser parser = new HttpParser(handler); + parser.parseNext(buffer); + Assert.assertEquals(null, _host); + Assert.assertEquals(null, _bad); + } @Test public void testCachedField() throws Exception { diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index d6668520da1..db54e19b2f1 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1360,12 +1360,14 @@ public class Request implements HttpServletRequest HttpField host = metadata==null?null:metadata.getFields().getField(HttpHeader.HOST); if (host!=null) { - // TODO is this needed now? - HostPortHttpField authority = (host instanceof HostPortHttpField) - ?((HostPortHttpField)host) - :new HostPortHttpField(host.getValue()); - metadata.getURI().setAuthority(authority.getHost(),authority.getPort()); - return authority.getHost(); + if (!(host instanceof HostPortHttpField) && host.getValue()!=null && !host.getValue().isEmpty()) + host=new HostPortHttpField(host.getValue()); + if (host instanceof HostPortHttpField) + { + HostPortHttpField authority = (HostPortHttpField)host; + metadata.getURI().setAuthority(authority.getHost(),authority.getPort()); + return authority.getHost(); + } } // Return host from connection diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java index 3b6d32cf9aa..05d99ea1d7f 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java @@ -392,6 +392,27 @@ public class HttpConnectionTest checkContains(response,0,"HTTP/1.1 400"); } + @Test + public void testNoHost() throws Exception + { + String response; + + response=connector.getResponse("GET / HTTP/1.1\r\n"+ + "\r\n"); + checkContains(response,0,"HTTP/1.1 400"); + } + + @Test + public void testEmptyHost() throws Exception + { + String response; + + response=connector.getResponse("GET / HTTP/1.1\r\n"+ + "Host:\r\n"+ + "\r\n"); + checkContains(response,0,"HTTP/1.1 200"); + } + @Test public void testBadURIencoding() throws Exception { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java b/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java index 58e93e8788d..e7d74c0fb40 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java @@ -553,7 +553,7 @@ public class PartialRFC2616Test offset=0; response=connector.getResponses("GET /R1 HTTP/1.1\n"+"Host:\n"+"Connection: close\n"+"\n"); - offset=checkContains(response,offset,"HTTP/1.1 400","400")+1; + offset=checkContains(response,offset,"HTTP/1.1 200","200")+1; } } diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java index d21758d27c8..fe6903357ba 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java @@ -1459,7 +1459,7 @@ public abstract class RFC2616BaseTest req4.append("\n"); HttpTester.Response response = http.request(req4); - assertEquals("14.23 HTTP/1.1 - Empty Host", HttpStatus.BAD_REQUEST_400, response.getStatus()); + assertEquals("14.23 HTTP/1.1 - Empty Host", HttpStatus.OK_200, response.getStatus()); } } From 0d74c3ec2c9019ab17dc54ed13e5cb130151a1aa Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 20 Jul 2016 13:05:43 +0200 Subject: [PATCH 7/7] Updated ALPN version for JDK 8u101 and 8u102. --- .../modules/protonego-impl/alpn-1.8.0_101.mod | 8 ++++++ .../modules/protonego-impl/alpn-1.8.0_102.mod | 8 ++++++ .../modules/protonego-impl/alpn-1.8.0_101.mod | 8 ++++++ .../modules/protonego-impl/alpn-1.8.0_102.mod | 8 ++++++ pom.xml | 26 ++++++++++++++++++- 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_101.mod create mode 100644 jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_102.mod create mode 100644 jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_101.mod create mode 100644 jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_102.mod diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_101.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_101.mod new file mode 100644 index 00000000000..a7f656bbda4 --- /dev/null +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_101.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.9.v20160720/alpn-boot-8.1.9.v20160720.jar|lib/alpn/alpn-boot-8.1.9.v20160720.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.9.v20160720.jar diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_102.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_102.mod new file mode 100644 index 00000000000..a7f656bbda4 --- /dev/null +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_102.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.9.v20160720/alpn-boot-8.1.9.v20160720.jar|lib/alpn/alpn-boot-8.1.9.v20160720.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.9.v20160720.jar diff --git a/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_101.mod b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_101.mod new file mode 100644 index 00000000000..a7f656bbda4 --- /dev/null +++ b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_101.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.9.v20160720/alpn-boot-8.1.9.v20160720.jar|lib/alpn/alpn-boot-8.1.9.v20160720.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.9.v20160720.jar diff --git a/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_102.mod b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_102.mod new file mode 100644 index 00000000000..a7f656bbda4 --- /dev/null +++ b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_102.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.9.v20160720/alpn-boot-8.1.9.v20160720.jar|lib/alpn/alpn-boot-8.1.9.v20160720.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.9.v20160720.jar diff --git a/pom.xml b/pom.xml index 8990dc1bce3..9d5df4e2992 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ 1.6.6 1.2 1.1.1.v20141010 - 1.1.2.v20150522 + 1.1.3.v20160715 undefined undefined @@ -1240,5 +1240,29 @@ 8.1.8.v20160420 + + 8u101 + + + java.version + 1.8.0_101 + + + + 8.1.9.v20160720 + + + + 8u102 + + + java.version + 1.8.0_102 + + + + 8.1.9.v20160720 + +