Issue #1503 Optionally strip IPv6. Default true
This commit is contained in:
parent
e55f528643
commit
ad76aa6c65
|
@ -63,7 +63,7 @@ import javax.servlet.http.HttpUpgradeHandler;
|
||||||
import javax.servlet.http.MappingMatch;
|
import javax.servlet.http.MappingMatch;
|
||||||
import javax.servlet.http.Part;
|
import javax.servlet.http.Part;
|
||||||
import javax.servlet.http.PushBuilder;
|
import javax.servlet.http.PushBuilder;
|
||||||
import javax.servlet.http.ServletMapping;
|
import javax.servlet.http.HttpServletMapping;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.BadMessageException;
|
import org.eclipse.jetty.http.BadMessageException;
|
||||||
import org.eclipse.jetty.http.HostPortHttpField;
|
import org.eclipse.jetty.http.HostPortHttpField;
|
||||||
|
@ -2452,9 +2452,9 @@ public class Request implements HttpServletRequest
|
||||||
return _pathSpec;
|
return _pathSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO replace with overriden version from API
|
// TODO replace with overriden version from API
|
||||||
public ServletMapping getMapping()
|
public HttpServletMapping getMapping()
|
||||||
{
|
{
|
||||||
final PathSpec pathSpec = _pathSpec;
|
final PathSpec pathSpec = _pathSpec;
|
||||||
final MappingMatch match;
|
final MappingMatch match;
|
||||||
|
@ -2496,7 +2496,7 @@ public class Request implements HttpServletRequest
|
||||||
mapping = _servletPath;
|
mapping = _servletPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ServletMapping()
|
return new HttpServletMapping()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getMatchValue()
|
public String getMatchValue()
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class Response implements HttpServletResponse
|
||||||
private OutputType _outputType = OutputType.NONE;
|
private OutputType _outputType = OutputType.NONE;
|
||||||
private ResponseWriter _writer;
|
private ResponseWriter _writer;
|
||||||
private long _contentLength = -1;
|
private long _contentLength = -1;
|
||||||
private Supplier<HttpFields> trailers;
|
private Supplier<HttpFields> _trailers;
|
||||||
|
|
||||||
private enum EncodingFrom { NOT_SET, INFERRED, SET_LOCALE, SET_CONTENT_TYPE, SET_CHARACTER_ENCODING }
|
private enum EncodingFrom { NOT_SET, INFERRED, SET_LOCALE, SET_CONTENT_TYPE, SET_CHARACTER_ENCODING }
|
||||||
private static final EnumSet<EncodingFrom> __localeOverride = EnumSet.of(EncodingFrom.NOT_SET,EncodingFrom.INFERRED);
|
private static final EnumSet<EncodingFrom> __localeOverride = EnumSet.of(EncodingFrom.NOT_SET,EncodingFrom.INFERRED);
|
||||||
|
@ -1316,34 +1316,27 @@ public class Response implements HttpServletResponse
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setTrailerHttpFields(Supplier<HttpFields> trailers)
|
public void setTrailerHttpFields(Supplier<HttpFields> trailers)
|
||||||
{
|
{
|
||||||
this.trailers = trailers;
|
this._trailers = trailers;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: @Override
|
@Override
|
||||||
public void setTrailerFields(Supplier<Map<String,String>> trailers)
|
public void setTrailerFields(Supplier<Map<String,String>> trailers)
|
||||||
{
|
{
|
||||||
// TODO new for 4.0 - avoid transient supplier?
|
// TODO new for 4.0 - avoid transient supplier?
|
||||||
this.trailers = new Supplier<HttpFields>()
|
this._trailers = new HttpFieldsSupplier(trailers);
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public HttpFields get()
|
|
||||||
{
|
|
||||||
Map<String,String> t = trailers.get();
|
|
||||||
if (t==null)
|
|
||||||
return null;
|
|
||||||
HttpFields fields = new HttpFields();
|
|
||||||
for (Map.Entry<String,String> e : t.entrySet())
|
|
||||||
{
|
|
||||||
fields.add(e.getKey(),e.getValue());
|
|
||||||
}
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Supplier<HttpFields> getTrailers()
|
public Supplier<HttpFields> getTrailers()
|
||||||
{
|
{
|
||||||
return trailers;
|
return _trailers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Supplier<Map<String,String>> getTrailerFields()
|
||||||
|
{
|
||||||
|
if (_trailers instanceof HttpFieldsSupplier)
|
||||||
|
((HttpFieldsSupplier)_trailers).getSupplier();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MetaData.Response newResponseMetaData()
|
protected MetaData.Response newResponseMetaData()
|
||||||
|
@ -1511,4 +1504,33 @@ public class Response implements HttpServletResponse
|
||||||
response.setHeader(HttpHeader.ETAG.asString(),et);
|
response.setHeader(HttpHeader.ETAG.asString(),et);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class HttpFieldsSupplier implements Supplier<HttpFields>
|
||||||
|
{
|
||||||
|
private final Supplier<Map<String, String>> _supplier;
|
||||||
|
|
||||||
|
public HttpFieldsSupplier(Supplier<Map<String, String>> trailers)
|
||||||
|
{
|
||||||
|
_supplier = trailers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpFields get()
|
||||||
|
{
|
||||||
|
Map<String,String> t = _supplier.get();
|
||||||
|
if (t==null)
|
||||||
|
return null;
|
||||||
|
HttpFields fields = new HttpFields();
|
||||||
|
for (Map.Entry<String,String> e : t.entrySet())
|
||||||
|
{
|
||||||
|
fields.add(e.getKey(),e.getValue());
|
||||||
|
}
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Supplier<Map<String, String>> getSupplier()
|
||||||
|
{
|
||||||
|
return _supplier;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,11 @@ package org.eclipse.jetty.util;
|
||||||
* <p>Parse a string in the form "host:port", handling IPv4 an IPv6 hosts</p>
|
* <p>Parse a string in the form "host:port", handling IPv4 an IPv6 hosts</p>
|
||||||
*
|
*
|
||||||
* <p>The System property "org.eclipse.jetty.util.HostPort.STRIP_IPV6" can be set to a boolean
|
* <p>The System property "org.eclipse.jetty.util.HostPort.STRIP_IPV6" can be set to a boolean
|
||||||
* value to control of the square brackets are stripped off IPv6 addresses (default false).</p>
|
* value to control of the square brackets are stripped off IPv6 addresses (default true).</p>
|
||||||
*/
|
*/
|
||||||
public class HostPort
|
public class HostPort
|
||||||
{
|
{
|
||||||
private final static boolean STRIP_IPV6 = Boolean.parseBoolean(System.getProperty("org.eclipse.jetty.util.HostPort.STRIP_IPV6","false"));
|
private final static boolean STRIP_IPV6 = Boolean.parseBoolean(System.getProperty("org.eclipse.jetty.util.HostPort.STRIP_IPV6","true"));
|
||||||
|
|
||||||
private final String _host;
|
private final String _host;
|
||||||
private final int _port;
|
private final int _port;
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class LocalFuzzer implements AutoCloseable
|
||||||
prefix = "Frame[" + i + "]";
|
prefix = "Frame[" + i + "]";
|
||||||
|
|
||||||
WebSocketFrame expected = expect.get(i);
|
WebSocketFrame expected = expect.get(i);
|
||||||
WebSocketFrame actual = framesQueue.poll(3, TimeUnit.SECONDS);
|
WebSocketFrame actual = framesQueue.poll(10, TimeUnit.SECONDS);
|
||||||
assertThat(prefix + ".poll", actual, notNullValue());
|
assertThat(prefix + ".poll", actual, notNullValue());
|
||||||
|
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
|
@ -365,4 +365,4 @@ public class LocalFuzzer implements AutoCloseable
|
||||||
|
|
||||||
LocalConnector.LocalEndPoint newLocalConnection();
|
LocalConnector.LocalEndPoint newLocalConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,7 +271,19 @@ public class WebSocketCloseTest
|
||||||
assertThat("No frames as output", framesQueue.size(), Matchers.is(0));
|
assertThat("No frames as output", framesQueue.size(), Matchers.is(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws Exception on test failure
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testFastFailFastClose() throws Exception
|
||||||
|
{
|
||||||
|
fastFail();
|
||||||
|
fastClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test session open session cleanup (bug #474936)
|
* Test session open session cleanup (bug #474936)
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,7 +26,7 @@ org.eclipse.jetty.LEVEL=WARN
|
||||||
# org.eclipse.jetty.io.WriteFlusher.LEVEL=DEBUG
|
# org.eclipse.jetty.io.WriteFlusher.LEVEL=DEBUG
|
||||||
# org.eclipse.jetty.io.FillInterest.LEVEL=DEBUG
|
# org.eclipse.jetty.io.FillInterest.LEVEL=DEBUG
|
||||||
# org.eclipse.jetty.client.LEVEL=DEBUG
|
# org.eclipse.jetty.client.LEVEL=DEBUG
|
||||||
# org.eclipse.jetty.websocket.LEVEL=DEBUG
|
org.eclipse.jetty.websocket.LEVEL=DEBUG
|
||||||
# org.eclipse.jetty.websocket.LEVEL=INFO
|
# org.eclipse.jetty.websocket.LEVEL=INFO
|
||||||
# org.eclipse.jetty.websocket.jsr356.messages.LEVEL=DEBUG
|
# org.eclipse.jetty.websocket.jsr356.messages.LEVEL=DEBUG
|
||||||
# org.eclipse.jetty.websocket.tests.LEVEL=DEBUG
|
# org.eclipse.jetty.websocket.tests.LEVEL=DEBUG
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -22,7 +22,7 @@
|
||||||
<jetty-test-policy-version>1.2</jetty-test-policy-version>
|
<jetty-test-policy-version>1.2</jetty-test-policy-version>
|
||||||
<alpn.api.version>1.1.3.v20160715</alpn.api.version>
|
<alpn.api.version>1.1.3.v20160715</alpn.api.version>
|
||||||
<jsp.version>8.5.9.1</jsp.version>
|
<jsp.version>8.5.9.1</jsp.version>
|
||||||
<servlet.api.version>4.0.0-b05</servlet.api.version>
|
<servlet.api.version>4.0.0-b07</servlet.api.version>
|
||||||
<!-- default values are unsupported, but required to be defined for reactor sanity reasons -->
|
<!-- default values are unsupported, but required to be defined for reactor sanity reasons -->
|
||||||
<alpn.version>undefined</alpn.version>
|
<alpn.version>undefined</alpn.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
Loading…
Reference in New Issue