Merge remote-tracking branch 'origin/jetty-9.3.x' into jetty-9.4.x
This commit is contained in:
commit
81d98407a4
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.eclipse.jetty.http;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public class CompressedContentFormat
|
||||
{
|
||||
|
@ -25,7 +26,6 @@ public class CompressedContentFormat
|
|||
public static final CompressedContentFormat BR = new CompressedContentFormat("br", ".br");
|
||||
public static final CompressedContentFormat[] NONE = new CompressedContentFormat[0];
|
||||
|
||||
|
||||
public final String _encoding;
|
||||
public final String _extension;
|
||||
public final String _etag;
|
||||
|
@ -54,4 +54,16 @@ public class CompressedContentFormat
|
|||
|
||||
return _encoding.equalsIgnoreCase(ccf._encoding) && _extension.equalsIgnoreCase(ccf._extension);
|
||||
}
|
||||
|
||||
public static boolean tagEquals(String etag, String tag)
|
||||
{
|
||||
if (etag.equals(tag))
|
||||
return true;
|
||||
|
||||
int dashdash = tag.indexOf("--");
|
||||
|
||||
if (dashdash>0)
|
||||
return tag.charAt(0)== '"' && etag.charAt(0)=='"' && etag.regionMatches(1,tag,1,dashdash-2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,6 +77,15 @@ public class GZIPContentDecoderTest
|
|||
assertEquals(0,buffers.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompresedContentFormat() throws Exception
|
||||
{
|
||||
assertTrue(CompressedContentFormat.tagEquals("tag","tag"));
|
||||
assertTrue(CompressedContentFormat.tagEquals("\"tag\"","\"tag\""));
|
||||
assertTrue(CompressedContentFormat.tagEquals("\"tag\"","\"tag--gzip\""));
|
||||
assertFalse(CompressedContentFormat.tagEquals("Zag","Xag--gzip"));
|
||||
assertFalse(CompressedContentFormat.tagEquals("xtag","tag"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStreamNoBlocks() throws Exception
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
<New id="ThreadLimitHandler" class="org.eclipse.jetty.server.handler.ThreadLimitHandler">
|
||||
<Arg name="forwardedHeader"><Property name="jetty.threadlimit.forwardedHeader"/></Arg>
|
||||
<Set name="enabled"><Property name="jetty.threadlimit.enabled" default="true"/></Set>
|
||||
<Set name="blockForMs"><Property name="jetty.threadlimit.blockForMs" default="0"/></Set>
|
||||
<Set name="threadLimit"><Property name="jetty.threadlimit.threadLimit" default="10"/></Set>
|
||||
</New>
|
||||
</Arg>
|
||||
|
|
|
@ -20,9 +20,6 @@ etc/jetty-threadlimit.xml
|
|||
## Enabled by default?
|
||||
#jetty.threadlimit.enabled=true
|
||||
|
||||
## MS to block for waiting for available thread
|
||||
#jetty.threadlimit.blockForMs=0
|
||||
|
||||
## Thread limit per remote IP
|
||||
#jetty.threadlimit.threadLimit=10
|
||||
|
||||
|
|
|
@ -517,7 +517,7 @@ public class ResourceService
|
|||
QuotedCSV quoted = new QuotedCSV(true,ifm);
|
||||
for (String tag : quoted)
|
||||
{
|
||||
if (tagEquals(etag, tag))
|
||||
if (CompressedContentFormat.tagEquals(etag, tag))
|
||||
{
|
||||
match=true;
|
||||
break;
|
||||
|
@ -535,7 +535,7 @@ public class ResourceService
|
|||
if (ifnm!=null && etag!=null)
|
||||
{
|
||||
// Handle special case of exact match OR gzip exact match
|
||||
if (tagEquals(etag, ifnm) && ifnm.indexOf(',')<0)
|
||||
if (CompressedContentFormat.tagEquals(etag, ifnm) && ifnm.indexOf(',')<0)
|
||||
{
|
||||
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
|
||||
response.setHeader(HttpHeader.ETAG.asString(),ifnm);
|
||||
|
@ -546,7 +546,7 @@ public class ResourceService
|
|||
QuotedCSV quoted = new QuotedCSV(true,ifnm);
|
||||
for (String tag : quoted)
|
||||
{
|
||||
if (tagEquals(etag, tag))
|
||||
if (CompressedContentFormat.tagEquals(etag, tag))
|
||||
{
|
||||
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
|
||||
response.setHeader(HttpHeader.ETAG.asString(),tag);
|
||||
|
@ -602,21 +602,6 @@ public class ResourceService
|
|||
return true;
|
||||
}
|
||||
|
||||
protected boolean tagEquals(String etag, String tag)
|
||||
{
|
||||
if (etag.equals(tag))
|
||||
return true;
|
||||
if (tag.endsWith(GZIP._etagQuote)) {
|
||||
int i = tag.indexOf(GZIP._etagQuote);
|
||||
return etag.equals(tag.substring(0,i) + '"');
|
||||
}
|
||||
if (tag.endsWith(BR._etagQuote)) {
|
||||
int i = tag.indexOf(BR._etagQuote);
|
||||
return etag.equals(tag.substring(0,i) + '"');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
protected void sendDirectory(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
|
|
|
@ -45,7 +45,7 @@ function gitFindRemoteByUrl() {
|
|||
return 0
|
||||
}
|
||||
|
||||
GIT_REMOTE_URL="git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project.git"
|
||||
GIT_REMOTE_URL="github.com:eclipse/jetty.project.git"
|
||||
GIT_REMOTE_ID=$(gitFindRemoteByUrl "$GIT_REMOTE_URL")
|
||||
GIT_BRANCH_ID=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
|
||||
|
||||
|
|
Loading…
Reference in New Issue