diff options
8 files changed, 406 insertions, 25 deletions
diff --git a/VERSION.txt b/VERSION.txt index dd9ce6bd6a..58d9d82acd 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -51,6 +51,51 @@ jetty-8.1.9.v20130131 - 31 January 2013 + 399132 check parent dir of session store against file to be removed + JETTY-1533 handle URL with no path +jetty-7.6.9.v20130131 - 31 January 2013 + + 362226 HttpConnection "wait" call causes thread resource exhaustion + + 367638 throw exception for excess form keys + + 381521 Only set Vary header when content could be compressed + + 382237 support non java JSON classes + + 391248 fixing localhost checking in statistics servlet + + 391249 fix for invalid XML node dispatchedTimeMean in statistics servlet + + 391345 fix missing br tag in statistics servlet + + 391623 Add option to --stop to wait for target jetty to stop + + 392417 Prevent Cookie parsing interpreting unicode chars + + 392492 expect headers only examined for requests>=HTTP/1.1 + + 393075 1xx 204 and 304 ignore all headers suggesting content + + 393220 remove dead code from ServletHandler and log ServletExceptions in + warn instead of debug + + 393947 additional tests + + 393968 fix typo in javadoc + + 394514 Preserve URI parameters in sendRedirect + + 394541 remove continuation jar from distro, add as dep to test-jetty-webapp + + 394719 remove regex from classpath matching + + 394811 Make JAASLoginService log login failures to DEBUG instead of WARN. + Same for some other exceptions. + + 394829 Session can not be restored after SessionManager.setIdleSavePeriod + has saved the session + + 394839 Allow multipart mime with no boundary + + 395215 Multipart mime with just LF and no CRLF + + 395380 add ValidUrlRule to jetty-rewrite + + 395394 allow logging from boot classloader + + 396459 Log specific message for empty request body for multipart mime + requests + + 396500 HttpClient Exchange takes forever to complete when less content sent + than Content-Length + + 396574 add JETTY_HOME as a location for pid to be found + + 396886 MultiPartFilter strips bad escaping on filename="..." + + 397110 Accept %uXXXX encodings in URIs + + 397111 Tolerate empty or excessive whitespace preceeding MultiParts + + 397112 Requests with byte-range throws NPE if requested file has no mimetype + (eg no file extension) + + 397130 maxFormContentSize set in jetty.xml is ignored + + 397190 improve ValidUrlRule to iterate on codepoints + + 397321 Wrong condition in default start.config for annotations + + 397535 Support pluggable alias checking to support symbolic links + + 398337 UTF-16 percent encoding in UTF-16 form content + + 399132 check parent dir of session store against file to be removed + + JETTY-1533 handle URL with no path + jetty-8.1.8.v20121106 - 06 November 2012 + 371170 MongoSessionManager LastAccessTimeTest fails + 388675 Non utf8 encoded query strings not decoded to parameter map using diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml new file mode 100644 index 0000000000..3cdbb91d69 --- /dev/null +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -0,0 +1,126 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.eclipse.jetty.osgi</groupId> + <artifactId>jetty-osgi-project</artifactId> + <version>7.6.10-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jetty-osgi-boot-logback</artifactId> + <name>Jetty :: OSGi :: Boot Logback</name> + <description>Jetty OSGi Boot Logback bundle</description> + <properties> + <bundle-symbolic-name>${project.groupId}.boot.logback</bundle-symbolic-name> + </properties> + <dependencies> + <dependency> + <groupId>org.eclipse.jetty.osgi</groupId> + <artifactId>jetty-osgi-boot</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.eclipse.osgi</groupId> + <artifactId>org.eclipse.osgi</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-webapp</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.osgi</groupId> + <artifactId>org.eclipse.osgi.services</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>artifact-jar</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + <execution> + <id>test-jar</id> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + <configuration> + <archive> + <manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <executions> + <execution> + <id>bundle-manifest</id> + <phase>process-classes</phase> + <goals> + <goal>manifest</goal> + </goals> + </execution> + </executions> + <configuration> + <instructions> + <Bundle-SymbolicName>org.eclipse.jetty.osgi.boot.logback;singleton:=true</Bundle-SymbolicName> + <Bundle-Name>Jetty-OSGi-Logback Integration</Bundle-Name> + <Fragment-Host>org.eclipse.jetty.osgi.boot</Fragment-Host> + <Import-Package> +ch.qos.logback.access.jetty;version="[0.9,1.1)";resolution:=optional, +ch.qos.logback.access.jetty.v7;version="[0.9,1.1)";resolution:=optional, +ch.qos.logback.*;version="[0.9,1.1)", +org.osgi.framework.*, +org.slf4j.*, +*;resolution:=optional + </Import-Package> + <Export-Package> +!org.eclipse.jetty.osgi.boot.logback.internal.*, +org.eclipse.jetty.osgi.boot.logback.*;version="${parsedVersion.osgiVersion}" + </Export-Package> + <_nouses>true</_nouses> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <configuration> + <onlyAnalyze>org.eclipse.jetty.osgi.boot.logback.*</onlyAnalyze> + </configuration> + </plugin> + </plugins> + </build> + + +</project> diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml new file mode 100644 index 0000000000..71e1d0e92c --- /dev/null +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -0,0 +1,120 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.eclipse.jetty.osgi</groupId> + <artifactId>jetty-osgi-project</artifactId> + <version>7.6.10-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jetty-osgi-equinoxtools</artifactId> + <name>Jetty :: OSGi :: Example Equinox Tools</name> + <description>Jetty OSGi Example Equinox Tools</description> + <properties> + <bundle-symbolic-name>${project.groupId}.equinoxtools</bundle-symbolic-name> + </properties> + <dependencies> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-webapp</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-continuation</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-websocket</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.osgi</groupId> + <artifactId>org.eclipse.osgi</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.osgi</groupId> + <artifactId>org.eclipse.osgi.services</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <phase>process-resources</phase> + <configuration> + <tasks> + <copy todir="target/classes/equinoxconsole"> + <fileset dir="equinoxconsole" /> + </copy> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>artifact-jar</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + <execution> + <id>test-jar</id> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + <configuration> + <archive> + <manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <executions> + <execution> + <id>bundle-manifest</id> + <phase>process-classes</phase> + <goals> + <goal>manifest</goal> + </goals> + </execution> + </executions> + <configuration> + <instructions> + <Bundle-SymbolicName>org.eclipse.jetty.osgi.equinoxtools</Bundle-SymbolicName> + <Bundle-Name>Console</Bundle-Name> + <Bundle-Activator>org.eclipse.jetty.osgi.equinoxtools.WebEquinoxToolsActivator</Bundle-Activator> + <Export-Package>org.eclipse.jetty.osgi.equinoxtools;x-internal:=true;version="${parsedVersion.osgiVersion}", + org.eclipse.jetty.osgi.equinoxtools.console;x-internal:=true;version="${parsedVersion.osgiVersion}" + </Export-Package> + <_nouses>true</_nouses> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <configuration> + <onlyAnalyze>org.eclipse.jetty.osgi.equinoxtools.*</onlyAnalyze> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java b/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java index 6824efcdd3..8460db2830 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java @@ -336,10 +336,20 @@ public class UrlEncoded extends MultiMap implements Cloneable i++; if (i+4<end) buffer.getStringBuilder().append(Character.toChars((convertHexDigit(raw[++i])<<12) +(convertHexDigit(raw[++i])<<8) + (convertHexDigit(raw[++i])<<4) +convertHexDigit(raw[++i]))); + else + { + buffer.getStringBuilder().append(Utf8Appendable.REPLACEMENT); + i=end; + } } else buffer.append((byte)((convertHexDigit(raw[++i])<<4) + convertHexDigit(raw[++i]))); } + else + { + buffer.getStringBuilder().append(Utf8Appendable.REPLACEMENT); + i=end; + } break; default: @@ -356,13 +366,13 @@ public class UrlEncoded extends MultiMap implements Cloneable if (key != null) { - value = buffer.length()==0?"":buffer.toString(); + value = buffer.length()==0?"":buffer.toReplacedString(); buffer.reset(); map.add(key,value); } else if (buffer.length()>0) { - map.add(buffer.toString(),""); + map.add(buffer.toReplacedString(),""); } } } @@ -763,7 +773,10 @@ public class UrlEncoded extends MultiMap implements Cloneable buffer.getStringBuffer().append(unicode); } else + { i=length; + buffer.getStringBuffer().append(Utf8Appendable.REPLACEMENT); + } } else { @@ -773,13 +786,22 @@ public class UrlEncoded extends MultiMap implements Cloneable buffer.append(b); } } + catch(NotUtf8Exception e) + { + LOG.warn(e.toString()); + LOG.debug(e); + } catch(NumberFormatException nfe) { + LOG.debug(nfe); buffer.getStringBuffer().append(Utf8Appendable.REPLACEMENT); } } else + { + buffer.getStringBuffer().append(Utf8Appendable.REPLACEMENT); i=length; + } } else if (buffer!=null) buffer.getStringBuffer().append(c); @@ -792,7 +814,7 @@ public class UrlEncoded extends MultiMap implements Cloneable return encoded.substring(offset,offset+length); } - return buffer.toString(); + return buffer.toReplacedString(); } else { @@ -843,12 +865,20 @@ public class UrlEncoded extends MultiMap implements Cloneable { if ('u'==encoded.charAt(offset+i+1)) { - int o=offset+i+2; - i+=6; - String unicode = new String(Character.toChars(TypeUtil.parseInt(encoded,o,4,16))); - byte[] reencoded = unicode.getBytes(charset); - System.arraycopy(reencoded,0,ba,n,reencoded.length); - n+=reencoded.length; + if (i+6<length) + { + int o=offset+i+2; + i+=6; + String unicode = new String(Character.toChars(TypeUtil.parseInt(encoded,o,4,16))); + byte[] reencoded = unicode.getBytes(charset); + System.arraycopy(reencoded,0,ba,n,reencoded.length); + n+=reencoded.length; + } + else + { + ba[n++] = (byte)'?'; + i=length; + } } else { @@ -866,8 +896,8 @@ public class UrlEncoded extends MultiMap implements Cloneable } else { - ba[n++] = (byte)'%'; - i++; + ba[n++] = (byte)'?'; + i=length; } } else if (c=='+') diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8Appendable.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8Appendable.java index 94352e1afe..a78b19d8b2 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8Appendable.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8Appendable.java @@ -20,6 +20,9 @@ package org.eclipse.jetty.util; import java.io.IOException; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; + /* ------------------------------------------------------------ */ /** * Utf8 Appendable abstract base class @@ -46,6 +49,7 @@ import java.io.IOException; **/ public abstract class Utf8Appendable { + protected static final Logger LOG = Log.getLogger(Utf8Appendable.class); public static final char REPLACEMENT = '\ufffd'; private static final int UTF8_ACCEPT = 0; private static final int UTF8_REJECT = 12; @@ -192,4 +196,43 @@ public abstract class Utf8Appendable super("Not valid UTF8! "+reason); } } + + protected void checkState() + { + if (!isUtf8SequenceComplete()) + { + _codep=0; + _state = UTF8_ACCEPT; + try + { + _appendable.append(REPLACEMENT); + } + catch(IOException e) + { + throw new RuntimeException(e); + } + throw new NotUtf8Exception("incomplete UTF8 sequence"); + } + } + + public String toReplacedString() + { + if (!isUtf8SequenceComplete()) + { + _codep=0; + _state = UTF8_ACCEPT; + try + { + _appendable.append(REPLACEMENT); + } + catch(IOException e) + { + throw new RuntimeException(e); + } + Throwable th= new NotUtf8Exception("incomplete UTF8 sequence"); + LOG.warn(th.toString()); + LOG.debug(th); + } + return _appendable.toString(); + } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuffer.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuffer.java index 5dad5d80bd..5346820b55 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuffer.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuffer.java @@ -72,10 +72,4 @@ public class Utf8StringBuffer extends Utf8Appendable checkState(); return _buffer.toString(); } - - private void checkState() - { - if (!isUtf8SequenceComplete()) - throw new IllegalArgumentException("Tried to read incomplete UTF8 decoded String"); - } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuilder.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuilder.java index 3c9ef86a50..12963f24a6 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuilder.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuilder.java @@ -74,9 +74,5 @@ public class Utf8StringBuilder extends Utf8Appendable return _buffer.toString(); } - private void checkState() - { - if (!isUtf8SequenceComplete()) - throw new IllegalArgumentException("Tried to read incomplete UTF8 decoded String"); - } + } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java index d9b69a85fb..eca656d330 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java @@ -159,11 +159,38 @@ public class URLEncodedTest public void testBadEncoding() throws UnsupportedEncodingException { UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.decode("Name15=xx%zz", "UTF-8"); + url_encoded.decode("Name15=xx%zzyy", "UTF-8"); assertEquals("encoded param size",1, url_encoded.size()); - assertEquals("encoded get", "xx\ufffd", url_encoded.getString("Name15")); + assertEquals("encoded get", "xx\ufffdyy", url_encoded.getString("Name15")); + + byte[] bad="Name=%FF%FF%FF".getBytes("UTF-8"); + MultiMap<String> map = new MultiMap<String>(); + UrlEncoded.decodeUtf8To(bad,0,bad.length,map); + assertEquals("encoded param size",1, map.size()); + assertEquals("encoded get", "\ufffd\ufffd\ufffd", map.getString("Name")); + + url_encoded.clear(); + url_encoded.decode("Name=%FF%FF%FF", "UTF-8"); + assertEquals("encoded param size",1, url_encoded.size()); + assertEquals("encoded get", "\ufffd\ufffd\ufffd", url_encoded.getString("Name")); - assertEquals("xxx",UrlEncoded.decodeString("xxx%u123",0,5,"UTF-8")); + url_encoded.clear(); + url_encoded.decode("Name=%EF%EF%EF", "UTF-8"); + assertEquals("encoded param size",1, url_encoded.size()); + assertEquals("encoded get", "\ufffd\ufffd", url_encoded.getString("Name")); + + assertEquals("x",UrlEncoded.decodeString("x",0,1,"UTF-8")); + assertEquals("x\ufffd",UrlEncoded.decodeString("x%",0,2,"UTF-8")); + assertEquals("x\ufffd",UrlEncoded.decodeString("x%2",0,3,"UTF-8")); + assertEquals("x ",UrlEncoded.decodeString("x%20",0,4,"UTF-8")); + + assertEquals("xxx",UrlEncoded.decodeString("xxx",0,3,"UTF-8")); + assertEquals("xxx\ufffd",UrlEncoded.decodeString("xxx%",0,4,"UTF-8")); + assertEquals("xxx\ufffd",UrlEncoded.decodeString("xxx%u",0,5,"UTF-8")); + assertEquals("xxx\ufffd",UrlEncoded.decodeString("xxx%u1",0,6,"UTF-8")); + assertEquals("xxx\ufffd",UrlEncoded.decodeString("xxx%u12",0,7,"UTF-8")); + assertEquals("xxx\ufffd",UrlEncoded.decodeString("xxx%u123",0,8,"UTF-8")); + assertEquals("xxx\u1234",UrlEncoded.decodeString("xxx%u1234",0,9,"UTF-8")); } |