Merge remote-tracking branch 'origin/jetty-9.3.x' into jetty-9.4.x
This commit is contained in:
commit
c6436c34ad
|
@ -0,0 +1,3 @@
|
|||
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
||||
#org.eclipse.jetty.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.server.LEVEL=DEBUG
|
|
@ -21,12 +21,9 @@ package org.eclipse.jetty.server;
|
|||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.channels.IllegalSelectorException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -253,10 +250,7 @@ public class Response implements HttpServletResponse
|
|||
quoteOnlyOrAppend(buf,name,quote_name);
|
||||
|
||||
buf.append('=');
|
||||
|
||||
// Remember name= part to look for other matching set-cookie
|
||||
String name_equals=buf.toString();
|
||||
|
||||
|
||||
// Append the value
|
||||
boolean quote_value=isQuoteNeededForCookie(value);
|
||||
quoteOnlyOrAppend(buf,value,quote_value);
|
||||
|
@ -1103,15 +1097,14 @@ public class Response implements HttpServletResponse
|
|||
_fields.put(_mimeType.getContentTypeField());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBufferSize(int size)
|
||||
{
|
||||
if (isCommitted() || getContentCount() > 0)
|
||||
throw new IllegalStateException("cannot set buffer size on committed response");
|
||||
if (size <= 0)
|
||||
throw new IllegalStateException("cannot set buffer size when response is committed or written to");
|
||||
if (size < __MIN_BUFFER_SIZE)
|
||||
size = __MIN_BUFFER_SIZE;
|
||||
_out.setBufferSize(size);
|
||||
}
|
||||
|
|
|
@ -30,11 +30,16 @@ public class HostPort
|
|||
|
||||
public HostPort(String authority) throws IllegalArgumentException
|
||||
{
|
||||
if (authority==null || authority.length()==0)
|
||||
if (authority==null)
|
||||
throw new IllegalArgumentException("No Authority");
|
||||
try
|
||||
{
|
||||
if (authority.charAt(0)=='[')
|
||||
if (authority.isEmpty())
|
||||
{
|
||||
_host=authority;
|
||||
_port=0;
|
||||
}
|
||||
else if (authority.charAt(0)=='[')
|
||||
{
|
||||
// ipv6reference
|
||||
int close=authority.lastIndexOf(']');
|
||||
|
@ -78,7 +83,7 @@ public class HostPort
|
|||
{initCause(ex);}
|
||||
};
|
||||
}
|
||||
if(_host.isEmpty())
|
||||
if(_host==null)
|
||||
throw new IllegalArgumentException("Bad host");
|
||||
if(_port<0)
|
||||
throw new IllegalArgumentException("Bad port");
|
||||
|
|
|
@ -37,6 +37,8 @@ public class HostPortTest
|
|||
public static List<String[]> testCases()
|
||||
{
|
||||
String data[][] = new String[][] {
|
||||
{"","",null},
|
||||
{":80","","80"},
|
||||
{"host","host",null},
|
||||
{"host:80","host","80"},
|
||||
{"10.10.10.1","10.10.10.1",null},
|
||||
|
@ -46,8 +48,6 @@ public class HostPortTest
|
|||
|
||||
{null,null,null},
|
||||
{"host:",null,null},
|
||||
{"",null,null},
|
||||
{":80",null,"80"},
|
||||
{"127.0.0.1:",null,null},
|
||||
{"[0::0::0::0::1]:",null,null},
|
||||
{"host:xxx",null,null},
|
||||
|
@ -76,16 +76,18 @@ public class HostPortTest
|
|||
try
|
||||
{
|
||||
HostPort hostPort = new HostPort(_authority);
|
||||
assertThat(hostPort.getHost(),is(_expectedHost));
|
||||
assertThat(_authority,hostPort.getHost(),is(_expectedHost));
|
||||
|
||||
if (_expectedPort==null)
|
||||
assertThat(hostPort.getPort(),is(0));
|
||||
assertThat(_authority,hostPort.getPort(),is(0));
|
||||
else
|
||||
assertThat(hostPort.getPort(),is(Integer.valueOf(_expectedPort)));
|
||||
assertThat(_authority,hostPort.getPort(),is(Integer.valueOf(_expectedPort)));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
assertNull(_expectedHost);
|
||||
if (_expectedHost!=null)
|
||||
e.printStackTrace();
|
||||
assertNull(_authority,_expectedHost);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue