Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project
This commit is contained in:
commit
b57bf3b600
17
VERSION.txt
17
VERSION.txt
|
@ -1,5 +1,20 @@
|
|||
jetty-7.6.0-SNAPSHOT
|
||||
|
||||
jetty-7.6.0.RC4 - 13 January 2012
|
||||
+ 365048 jetty Http client does not send proxy authentication when requesting
|
||||
a Https-resource through a web-proxy.
|
||||
+ 366774 removed XSS vulnerbility
|
||||
+ 367099 Upgrade jetty-websocket for RFC 6455 - Addendum.
|
||||
+ 367716 simplified maxIdleTime logic
|
||||
+ 368035 WebSocketClientFactory does not invoke super.doStop().
|
||||
+ 368060 do not encode sendRedirect URLs
|
||||
+ 368114 Protect against non-Strings in System properties for Log
|
||||
+ 368189 WebSocketClientFactory should not manage external thread pool.
|
||||
+ 368215 Remove debug from jaspi
|
||||
+ 368240 Improve AggregateLifeCycle handling of shared lifecycles
|
||||
+ 368291 Change warning to info for NoSuchFieldException on
|
||||
BeanELResolver.properties
|
||||
|
||||
jetty-7.6.0.RC3 - 05 January 2012
|
||||
+ 367433 added tests to investigate
|
||||
+ 367435 improved D00 test harness
|
||||
|
@ -8,7 +23,7 @@ jetty-7.6.0.RC3 - 05 January 2012
|
|||
stopped.
|
||||
+ 367591 corrected configuration.xml version to 7.6
|
||||
+ 367635 Added support for start.d directory
|
||||
+ 637638 limit number of form parameters to avoid DOS
|
||||
+ 367638 limit number of form parameters to avoid DOS
|
||||
+ JETTY-1467 close half closed when idle
|
||||
|
||||
jetty-7.6.0.RC2 - 22 December 2011
|
||||
|
|
|
@ -163,10 +163,6 @@
|
|||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -237,11 +233,6 @@
|
|||
<artifactId>mail</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jaspic_1.0_spec</artifactId>
|
||||
|
|
|
@ -147,10 +147,6 @@
|
|||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -221,11 +217,6 @@
|
|||
<artifactId>mail</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jaspic_1.0_spec</artifactId>
|
||||
|
|
|
@ -96,10 +96,6 @@
|
|||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -117,10 +113,5 @@
|
|||
<artifactId>mail</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
<Set name="contextPath">/foo</Set>
|
||||
<Set name="war">
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
<jetty-orbit-url>http://download.eclipse.org/jetty/orbit</jetty-orbit-url>
|
||||
<assembly-directory>target/distribution</assembly-directory>
|
||||
<eclipse-ecj-version>3.6</eclipse-ecj-version>
|
||||
<orbit-javax-activation-version>${javax-activation-version}.0.v201005080500</orbit-javax-activation-version>
|
||||
<orbit-javax-annotation-version>1.0.0.v20100513-0750</orbit-javax-annotation-version>
|
||||
<orbit-javax-el-version>2.1.0.v201004190952</orbit-javax-el-version>
|
||||
<orbit-javax-mail-glassfish-version>${javax-mail-version}.v201005082020</orbit-javax-mail-glassfish-version>
|
||||
|
@ -69,7 +68,6 @@
|
|||
<mkdir dir="${orbit-cache}" />
|
||||
<get dest="${orbit-cache}" verbose="true" skipexisting="true">
|
||||
<url url="${jetty-orbit-url}/javax.servlet_${orbit-javax-servlet-version}.jar" />
|
||||
<url url="${jetty-orbit-url}/javax.activation_${orbit-javax-activation-version}.jar" />
|
||||
<url url="${jetty-orbit-url}/javax.annotation_${orbit-javax-annotation-version}.jar" />
|
||||
<url url="${jetty-orbit-url}/javax.mail.glassfish_${orbit-javax-mail-glassfish-version}.jar" />
|
||||
<url url="${jetty-orbit-url}/javax.el_${orbit-javax-el-version}.jar" />
|
||||
|
|
|
@ -63,8 +63,8 @@ public class HttpParser implements Parser
|
|||
private Buffer _body; // Buffer for large content
|
||||
private Buffer _buffer; // The current buffer in use (either _header or _content)
|
||||
private CachedBuffer _cached;
|
||||
private View.CaseInsensitive _tok0; // Saved token: header name, request method or response version
|
||||
private View.CaseInsensitive _tok1; // Saved token: header value, request URI or response code
|
||||
private final View.CaseInsensitive _tok0; // Saved token: header name, request method or response version
|
||||
private final View.CaseInsensitive _tok1; // Saved token: header value, request URI or response code
|
||||
private String _multiLineValue;
|
||||
private int _responseStatus; // If >0 then we are parsing a response
|
||||
private boolean _forceContentBuffer;
|
||||
|
@ -93,13 +93,8 @@ public class HttpParser implements Parser
|
|||
_buffer=buffer;
|
||||
_handler=handler;
|
||||
|
||||
if (buffer != null)
|
||||
{
|
||||
_tok0=new View.CaseInsensitive(buffer);
|
||||
_tok1=new View.CaseInsensitive(buffer);
|
||||
_tok0.setPutIndex(_tok0.getIndex());
|
||||
_tok1.setPutIndex(_tok1.getIndex());
|
||||
}
|
||||
_tok0=new View.CaseInsensitive(_header);
|
||||
_tok1=new View.CaseInsensitive(_header);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
@ -114,6 +109,8 @@ public class HttpParser implements Parser
|
|||
_buffers=buffers;
|
||||
_endp=endp;
|
||||
_handler=handler;
|
||||
_tok0=new View.CaseInsensitive();
|
||||
_tok1=new View.CaseInsensitive();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
@ -256,17 +253,7 @@ public class HttpParser implements Parser
|
|||
return 0;
|
||||
|
||||
if (_buffer==null)
|
||||
{
|
||||
if (_header == null)
|
||||
{
|
||||
_header=_buffers.getHeader();
|
||||
}
|
||||
_buffer=_header;
|
||||
_tok0=new View.CaseInsensitive(_header);
|
||||
_tok1=new View.CaseInsensitive(_header);
|
||||
_tok0.setPutIndex(_tok0.getIndex());
|
||||
_tok1.setPutIndex(_tok1.getIndex());
|
||||
}
|
||||
_buffer=getHeaderBuffer();
|
||||
|
||||
|
||||
if (_state == STATE_CONTENT && _contentPosition == _contentLength)
|
||||
|
@ -1013,11 +1000,7 @@ public class HttpParser implements Parser
|
|||
{
|
||||
// Do we have a buffer?
|
||||
if (_buffer==null)
|
||||
{
|
||||
_buffer=_header=getHeaderBuffer();
|
||||
_tok0=new View.CaseInsensitive(_buffer);
|
||||
_tok1=new View.CaseInsensitive(_buffer);
|
||||
}
|
||||
_buffer=getHeaderBuffer();
|
||||
|
||||
// Is there unconsumed content in body buffer
|
||||
if (_state>STATE_END && _buffer==_header && _header!=null && !_header.hasContent() && _body!=null && _body.hasContent())
|
||||
|
@ -1086,9 +1069,7 @@ public class HttpParser implements Parser
|
|||
// This is probably a pipelined header of the next request, so we need to
|
||||
// copy it to the header buffer.
|
||||
if (_header==null)
|
||||
{
|
||||
_header=_buffers.getHeader();
|
||||
}
|
||||
getHeaderBuffer();
|
||||
else
|
||||
{
|
||||
_header.setMarkIndex(-1);
|
||||
|
@ -1165,6 +1146,8 @@ public class HttpParser implements Parser
|
|||
if (_header == null)
|
||||
{
|
||||
_header=_buffers.getHeader();
|
||||
_tok0.update(_header);
|
||||
_tok1.update(_header);
|
||||
}
|
||||
return _header;
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
|||
/* ------------------------------------------------------------ */
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(this)).append("\n");
|
||||
AggregateLifeCycle.dumpObject(out,this);
|
||||
AggregateLifeCycle.dump(out,indent,TypeUtil.asList(_selectSet));
|
||||
}
|
||||
|
||||
|
@ -985,9 +985,8 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
|||
public String toString()
|
||||
{
|
||||
Selector selector=_selector;
|
||||
return String.format("%s %s keys=%d selected=%d",
|
||||
return String.format("%s keys=%d selected=%d",
|
||||
super.toString(),
|
||||
SelectorManager.this.getState(),
|
||||
selector != null && selector.isOpen() ? selector.keys().size() : -1,
|
||||
selector != null && selector.isOpen() ? selector.selectedKeys().size() : -1);
|
||||
}
|
||||
|
|
|
@ -274,40 +274,55 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
|
|||
boolean some_progress=false;
|
||||
try
|
||||
{
|
||||
// We need buffers to progress
|
||||
allocateBuffers();
|
||||
|
||||
// if we don't have a buffer to put received data into
|
||||
if (toFill==null)
|
||||
{
|
||||
// use the unwrapbuffer to hold received data.
|
||||
_unwrapBuf.compact();
|
||||
toFill=_unwrapBuf;
|
||||
}
|
||||
// Else if the fill buffer is too small for the SSL session
|
||||
else if (toFill.capacity()<_session.getApplicationBufferSize())
|
||||
{
|
||||
// fill to the temporary unwrapBuffer
|
||||
boolean progress=process(null,toFlush);
|
||||
|
||||
// if we received any data,
|
||||
if (_unwrapBuf!=null && _unwrapBuf.hasContent())
|
||||
{
|
||||
// transfer from temp buffer to fill buffer
|
||||
_unwrapBuf.skip(toFill.put(_unwrapBuf));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
// return progress from recursive call
|
||||
return progress;
|
||||
}
|
||||
// Else if there is some temporary data
|
||||
else if (_unwrapBuf!=null && _unwrapBuf.hasContent())
|
||||
{
|
||||
// transfer from temp buffer to fill buffer
|
||||
_unwrapBuf.skip(toFill.put(_unwrapBuf));
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we are here, we have a buffer ready into which we can put some read data.
|
||||
|
||||
// If we have no data to flush, flush the empty buffer
|
||||
if (toFlush==null)
|
||||
toFlush=__ZERO_BUFFER;
|
||||
|
||||
// While we are making progress processing SSL engine
|
||||
boolean progress=true;
|
||||
|
||||
while (progress)
|
||||
{
|
||||
progress=false;
|
||||
|
||||
// Do any real IO
|
||||
int filled=0,flushed=0;
|
||||
|
||||
try
|
||||
{
|
||||
// Read any available data
|
||||
|
@ -356,20 +371,6 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
|
|||
task.run();
|
||||
}
|
||||
|
||||
// Detect SUN JVM Bug!!!
|
||||
/* TODO
|
||||
if(initialStatus==HandshakeStatus.NOT_HANDSHAKING &&
|
||||
_engine.getHandshakeStatus()==HandshakeStatus.NEED_UNWRAP && sent==0 )
|
||||
{
|
||||
// This should be NEED_WRAP
|
||||
// The fix simply detects the signature of the bug and then close the connection (fail-fast) so that ff3 will delegate to using SSL instead of TLS.
|
||||
// This is a jvm bug on java1.6 where the SSLEngine expects more data from the initial handshake when the client(ff3-tls) already had given it.
|
||||
// See http://jira.codehaus.org/browse/JETTY-567 for more details
|
||||
LOG.warn("{} JETTY-567",_session);
|
||||
_endp.close();
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -401,10 +402,12 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
|
|||
if (_endp.isOpen() && _engine.isOutboundDone() && !_outbound.hasContent())
|
||||
_endp.shutdownOutput();
|
||||
|
||||
// remember if any progress has been made
|
||||
some_progress|=progress;
|
||||
}
|
||||
|
||||
if (toFill.hasContent())
|
||||
// If we are reading into the temp buffer and it has some content, then we should be dispatched.
|
||||
if (toFill==_unwrapBuf && _unwrapBuf.hasContent())
|
||||
_aEndp.asyncDispatch();
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -337,7 +337,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
|
|||
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(toString()).append("\n");
|
||||
AggregateLifeCycle.dumpObject(out,this);
|
||||
AggregateLifeCycle.dump(out, indent, _beans.entrySet());
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<jetty-orbit-url>http://download.eclipse.org/jetty/orbit/</jetty-orbit-url>
|
||||
<assembly-directory>target/distribution</assembly-directory>
|
||||
<eclipse-ecj-version>3.6</eclipse-ecj-version>
|
||||
<orbit-javax-activation-version>${javax-activation-version}.0.v201005080500</orbit-javax-activation-version>
|
||||
<orbit-javax-annotation-version>1.0.0.v20100513-0750</orbit-javax-annotation-version>
|
||||
<orbit-javax-el-version>2.1.0.v201004190952</orbit-javax-el-version>
|
||||
<orbit-javax-mail-glassfish-version>${javax-mail-version}.v201005082020</orbit-javax-mail-glassfish-version>
|
||||
|
@ -198,7 +197,6 @@
|
|||
<mkdir dir="${orbit-cache}" />
|
||||
<get dest="${orbit-cache}" verbose="true" skipexisting="true">
|
||||
<url url="${jetty-orbit-url}/javax.servlet_${orbit-javax-servlet-version}.jar" />
|
||||
<url url="${jetty-orbit-url}/javax.activation_${orbit-javax-activation-version}.jar" />
|
||||
<url url="${jetty-orbit-url}/javax.mail.glassfish_${orbit-javax-mail-glassfish-version}.jar" />
|
||||
<url url="${jetty-orbit-url}/javax.el_${orbit-javax-el-version}.jar" />
|
||||
<url url="${jetty-orbit-url}/javax.servlet.jsp_${orbit-javax-servlet-jsp-version}.jar" />
|
||||
|
|
|
@ -358,7 +358,7 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
|
|||
{
|
||||
if (connector.isIntegral(request))
|
||||
return true;
|
||||
if (connector.getConfidentialPort() > 0)
|
||||
if (connector.getIntegralPort() > 0)
|
||||
{
|
||||
String url = connector.getIntegralScheme() + "://" + request.getServerName() + ":" + connector.getIntegralPort() + request.getRequestURI();
|
||||
if (request.getQueryString() != null)
|
||||
|
@ -440,6 +440,13 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
|
|||
public void dump(Appendable out,String indent) throws IOException
|
||||
{
|
||||
dumpThis(out);
|
||||
dump(out,indent,TypeUtil.asList(getHandlers()),getBeans(),Collections.singleton(_roles),_constraintMap.entrySet());
|
||||
dump(out,indent,
|
||||
Collections.singleton(getLoginService()),
|
||||
Collections.singleton(getIdentityService()),
|
||||
Collections.singleton(getAuthenticator()),
|
||||
Collections.singleton(_roles),
|
||||
_constraintMap.entrySet(),
|
||||
getBeans(),
|
||||
TypeUtil.asList(getHandlers()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -244,16 +244,19 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
|
|||
return _initParameters.put(key,value);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected LoginService findLoginService()
|
||||
{
|
||||
List<LoginService> list = getServer().getBeans(LoginService.class);
|
||||
|
||||
for (LoginService service : list)
|
||||
if (service.getName()!=null && service.getName().equals(getRealmName()))
|
||||
return service;
|
||||
if (list.size()>0)
|
||||
String realm=getRealmName();
|
||||
if (realm!=null)
|
||||
{
|
||||
for (LoginService service : list)
|
||||
if (service.getName()!=null && service.getName().equals(realm))
|
||||
return service;
|
||||
}
|
||||
else if (list.size()==1)
|
||||
return list.get(0);
|
||||
return null;
|
||||
}
|
||||
|
@ -414,7 +417,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
|
|||
|
||||
final Authenticator authenticator = _authenticator;
|
||||
|
||||
if (authenticator!=null && checkSecurity(baseRequest))
|
||||
if (checkSecurity(baseRequest))
|
||||
{
|
||||
Object constraintInfo = prepareConstraintInfo(pathInContext, baseRequest);
|
||||
|
||||
|
@ -433,13 +436,24 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
|
|||
boolean isAuthMandatory =
|
||||
isAuthMandatory(baseRequest, base_response, constraintInfo);
|
||||
|
||||
if (isAuthMandatory && authenticator==null)
|
||||
{
|
||||
LOG.warn("No authenticator for: "+constraintInfo);
|
||||
if (!baseRequest.isHandled())
|
||||
{
|
||||
response.sendError(Response.SC_FORBIDDEN);
|
||||
baseRequest.setHandled(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// check authentication
|
||||
Object previousIdentity = null;
|
||||
try
|
||||
{
|
||||
Authentication authentication = baseRequest.getAuthentication();
|
||||
if (authentication==null || authentication==Authentication.NOT_CHECKED)
|
||||
authentication=authenticator.validateRequest(request, response, isAuthMandatory);
|
||||
authentication=authenticator==null?Authentication.UNAUTHENTICATED:authenticator.validateRequest(request, response, isAuthMandatory);
|
||||
|
||||
if (authentication instanceof Authentication.Wrapped)
|
||||
{
|
||||
|
@ -500,9 +514,11 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
|
|||
else
|
||||
{
|
||||
baseRequest.setAuthentication(authentication);
|
||||
previousIdentity = _identityService.associate(null);
|
||||
if (_identityService!=null)
|
||||
previousIdentity = _identityService.associate(null);
|
||||
handler.handle(pathInContext, baseRequest, request, response);
|
||||
authenticator.secureResponse(request, response, isAuthMandatory, null);
|
||||
if (authenticator!=null)
|
||||
authenticator.secureResponse(request, response, isAuthMandatory, null);
|
||||
}
|
||||
}
|
||||
catch (ServerAuthException e)
|
||||
|
@ -513,7 +529,8 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
|
|||
}
|
||||
finally
|
||||
{
|
||||
_identityService.disassociate(previousIdentity);
|
||||
if (_identityService!=null)
|
||||
_identityService.disassociate(previousIdentity);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
// ========================================================================
|
||||
// Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.security;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.matchers.JUnitMatchers.containsString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpSchemes;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.LocalConnector;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1441 $ $Date: 2010-04-02 12:28:17 +0200 (Fri, 02 Apr 2010) $
|
||||
*/
|
||||
public class DataConstraintsTest
|
||||
{
|
||||
private Server _server;
|
||||
private LocalConnector _connector;
|
||||
private LocalConnector _connectorS;
|
||||
private SessionHandler _session;
|
||||
private ConstraintSecurityHandler _security;
|
||||
|
||||
@Before
|
||||
public void startServer()
|
||||
{
|
||||
_server = new Server();
|
||||
_connector = new LocalConnector();
|
||||
_connector.setIntegralPort(9998);
|
||||
_connector.setIntegralScheme("FTP");
|
||||
_connector.setConfidentialPort(9999);
|
||||
_connector.setConfidentialScheme("SPDY");
|
||||
_connectorS = new LocalConnector()
|
||||
{
|
||||
@Override
|
||||
public void customize(EndPoint endpoint, Request request) throws IOException
|
||||
{
|
||||
super.customize(endpoint,request);
|
||||
request.setScheme(HttpSchemes.HTTPS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIntegral(Request request)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConfidential(Request request)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
_server.setConnectors(new Connector[]{_connector,_connectorS});
|
||||
|
||||
ContextHandler _context = new ContextHandler();
|
||||
_session = new SessionHandler();
|
||||
|
||||
_context.setContextPath("/ctx");
|
||||
_server.setHandler(_context);
|
||||
_context.setHandler(_session);
|
||||
|
||||
_security = new ConstraintSecurityHandler();
|
||||
_session.setHandler(_security);
|
||||
|
||||
_security.setHandler(new AbstractHandler()
|
||||
{
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.sendError(404);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
public void stopServer() throws Exception
|
||||
{
|
||||
if (_server.isRunning())
|
||||
{
|
||||
_server.stop();
|
||||
_server.join();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIntegral() throws Exception
|
||||
{
|
||||
Constraint constraint0 = new Constraint();
|
||||
constraint0.setAuthenticate(false);
|
||||
constraint0.setName("integral");
|
||||
constraint0.setDataConstraint(Constraint.DC_INTEGRAL);
|
||||
ConstraintMapping mapping0 = new ConstraintMapping();
|
||||
mapping0.setPathSpec("/integral/*");
|
||||
mapping0.setConstraint(constraint0);
|
||||
|
||||
_security.setConstraintMappings(Arrays.asList(new ConstraintMapping[]
|
||||
{
|
||||
mapping0
|
||||
}));
|
||||
|
||||
_server.start();
|
||||
|
||||
String response;
|
||||
response = _connector.getResponses("GET /ctx/some/thing HTTP/1.0\r\n\r\n");
|
||||
assertThat(response, containsString("HTTP/1.1 404 Not Found"));
|
||||
|
||||
response = _connector.getResponses("GET /ctx/integral/info HTTP/1.0\r\n\r\n");
|
||||
assertThat(response, containsString("HTTP/1.1 302 Found"));
|
||||
assertThat(response, containsString("Location: FTP://"));
|
||||
assertThat(response, containsString(":9998"));
|
||||
|
||||
response = _connectorS.getResponses("GET /ctx/integral/info HTTP/1.0\r\n\r\n");
|
||||
assertThat(response, containsString("HTTP/1.1 404 Not Found"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfidential() throws Exception
|
||||
{
|
||||
Constraint constraint0 = new Constraint();
|
||||
constraint0.setAuthenticate(false);
|
||||
constraint0.setName("confid");
|
||||
constraint0.setDataConstraint(Constraint.DC_CONFIDENTIAL);
|
||||
ConstraintMapping mapping0 = new ConstraintMapping();
|
||||
mapping0.setPathSpec("/confid/*");
|
||||
mapping0.setConstraint(constraint0);
|
||||
|
||||
_security.setConstraintMappings(Arrays.asList(new ConstraintMapping[]
|
||||
{
|
||||
mapping0
|
||||
}));
|
||||
|
||||
_server.start();
|
||||
|
||||
String response;
|
||||
response = _connector.getResponses("GET /ctx/some/thing HTTP/1.0\r\n\r\n");
|
||||
assertThat(response, containsString("HTTP/1.1 404 Not Found"));
|
||||
|
||||
response = _connector.getResponses("GET /ctx/confid/info HTTP/1.0\r\n\r\n");
|
||||
assertThat(response, containsString("HTTP/1.1 302 Found"));
|
||||
assertThat(response, containsString("Location: SPDY://"));
|
||||
assertThat(response, containsString(":9999"));
|
||||
|
||||
response = _connectorS.getResponses("GET /ctx/confid/info HTTP/1.0\r\n\r\n");
|
||||
assertThat(response, containsString("HTTP/1.1 404 Not Found"));
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -889,11 +889,10 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s@%s:%d %s",
|
||||
return String.format("%s@%s:%d",
|
||||
getClass().getSimpleName(),
|
||||
getHost()==null?"0.0.0.0":getHost(),
|
||||
getLocalPort()<=0?getPort():getLocalPort(),
|
||||
AbstractLifeCycle.getState(this));
|
||||
getLocalPort()<=0?getPort():getLocalPort());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -131,7 +131,7 @@ public class Dispatcher implements RequestDispatcher
|
|||
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
Request baseRequest=(request instanceof Request)?((Request)request):AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||
request.removeAttribute(__JSP_FILE); // TODO remove when glassfish 1044 is fixed
|
||||
|
||||
|
||||
if (!(request instanceof HttpServletRequest))
|
||||
request = new ServletRequestHttpWrapper(request);
|
||||
|
@ -215,7 +215,7 @@ public class Dispatcher implements RequestDispatcher
|
|||
Response base_response=baseRequest.getResponse();
|
||||
response.resetBuffer();
|
||||
base_response.fwdReset();
|
||||
request.removeAttribute(__JSP_FILE); // TODO remove when glassfish 1044 is fixed
|
||||
|
||||
|
||||
if (!(request instanceof HttpServletRequest))
|
||||
request = new ServletRequestHttpWrapper(request);
|
||||
|
|
|
@ -94,7 +94,7 @@ public abstract class AbstractHandler extends AggregateLifeCycle implements Hand
|
|||
/* ------------------------------------------------------------ */
|
||||
public void dumpThis(Appendable out) throws IOException
|
||||
{
|
||||
out.append(toString()).append(' ').append(getState()).append('\n');
|
||||
out.append(toString()).append(" - ").append(getState()).append('\n');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -113,6 +113,6 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
|
|||
public void dump(Appendable out,String indent) throws IOException
|
||||
{
|
||||
dumpThis(out);
|
||||
dump(out,indent,TypeUtil.asList(getHandlers()),getBeans());
|
||||
dump(out,indent,getBeans(),TypeUtil.asList(getHandlers()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -448,8 +448,8 @@ public class HttpConnectionTest
|
|||
PrintWriter writer = response.getWriter();
|
||||
writer.write("<html><h1>FOO</h1></html>");
|
||||
writer.flush();
|
||||
writer.close();
|
||||
throw new RuntimeException("SHOULD NOT GET HERE");
|
||||
if (!writer.checkError())
|
||||
throw new RuntimeException("SHOULD NOT GET HERE");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
|
|
@ -31,16 +31,21 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.jetty.http.HttpParser;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.StdErrLog;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -492,7 +497,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
}
|
||||
finally
|
||||
{
|
||||
System.err.println("Got "+total+" of "+(512*1024));
|
||||
//System.err.println("Got "+total+" of "+(512*1024));
|
||||
client.close();
|
||||
}
|
||||
}
|
||||
|
@ -739,7 +744,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
IO.copy(is,bout);
|
||||
byte[] b=bout.toByteArray();
|
||||
|
||||
System.err.println("OUTPUT: "+new String(b));
|
||||
//System.err.println("OUTPUT: "+new String(b));
|
||||
int i=0;
|
||||
while (b[i]!='Z')
|
||||
i++;
|
||||
|
@ -1205,4 +1210,69 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
|
||||
|
||||
|
||||
@Test
|
||||
public void testUnreadInput () throws Exception
|
||||
{
|
||||
configureServer(new NoopHandler());
|
||||
final int REQS=5;
|
||||
String content="This is a loooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"oooooooooooonnnnnnnnnnnnnnnnggggggggg content"+
|
||||
new String(new char[65*1024]);
|
||||
final byte[] bytes = content.getBytes();
|
||||
|
||||
Socket client=newSocket(HOST,_connector.getLocalPort());
|
||||
final OutputStream out=client.getOutputStream();
|
||||
|
||||
new Thread()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int i=0; i<REQS; i++)
|
||||
{
|
||||
out.write("GET / HTTP/1.1\r\nHost: localhost\r\n".getBytes(StringUtil.__ISO_8859_1));
|
||||
out.write(("Content-Length: "+bytes.length+"\r\n" + "\r\n").getBytes(StringUtil.__ISO_8859_1));
|
||||
out.write(bytes,0,bytes.length);
|
||||
}
|
||||
out.write("GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n".getBytes(StringUtil.__ISO_8859_1));
|
||||
out.flush();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
|
||||
String resps = readResponse(client);
|
||||
|
||||
int offset=0;
|
||||
for (int i=0;i<(REQS+1);i++)
|
||||
{
|
||||
int ok=resps.indexOf("HTTP/1.1 200 OK",offset);
|
||||
assertThat("resp"+i,ok,greaterThanOrEqualTo(offset));
|
||||
offset=ok+15;
|
||||
}
|
||||
}
|
||||
|
||||
public class NoopHandler extends AbstractHandler
|
||||
{
|
||||
public void handle(String target, Request baseRequest,
|
||||
HttpServletRequest request, HttpServletResponse response) throws IOException,
|
||||
ServletException
|
||||
{
|
||||
//don't read the input, just send something back
|
||||
((Request)request).setHandled(true);
|
||||
response.setStatus(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
// ========================================================================
|
||||
// Copyright (c) 2008-2009 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.server;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.server.bio.SocketConnector;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class UnreadInputTest
|
||||
{
|
||||
public static final String __OK_RESPONSE = "HTTP/1.1 200 OK\r\nContent-Length: 0\r\nServer: Jetty(7.0.x)\r\n\r\n";
|
||||
protected Server _server = new Server();
|
||||
protected SocketConnector _connector;
|
||||
protected int _port;
|
||||
protected Socket _socket;
|
||||
protected OutputStream _outputStream;
|
||||
protected InputStream _inputStream;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception
|
||||
{
|
||||
//server side
|
||||
_connector = new SocketConnector();
|
||||
_server.setConnectors(new Connector[]{ _connector });
|
||||
_server.setHandler(new NoopHandler());
|
||||
_server.start();
|
||||
_port = _connector.getLocalPort();
|
||||
|
||||
//client side
|
||||
_socket = new Socket((String)null, _port);
|
||||
_outputStream = _socket.getOutputStream();
|
||||
_inputStream = _socket.getInputStream();
|
||||
}
|
||||
|
||||
@After
|
||||
public void destroy() throws Exception
|
||||
{
|
||||
_socket.close();
|
||||
|
||||
_server.stop();
|
||||
_server.join();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnreadInput () throws Exception
|
||||
{
|
||||
for (int i=0; i<2; i++)
|
||||
{
|
||||
String content = "This is a loooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooooooooooooooooooooooooo"+
|
||||
"ooooooooooooooooooooooonnnnnnnnnnnnnnnnggggggggg content";
|
||||
byte[] bytes = content.getBytes();
|
||||
|
||||
_outputStream.write("GET / HTTP/1.1\r\nHost: localhost\r\n".getBytes());
|
||||
Thread.currentThread();
|
||||
Thread.sleep(500L);
|
||||
|
||||
String str = "Content-Length: "+bytes.length+"\r\n" + "\r\n";
|
||||
_outputStream.write(str.getBytes());
|
||||
Thread.currentThread();
|
||||
Thread.sleep(500L);
|
||||
|
||||
//write some bytes of the content
|
||||
_outputStream.write(bytes, 0, (bytes.length/2));
|
||||
Thread.currentThread();
|
||||
Thread.sleep(1000L);
|
||||
|
||||
//write the rest
|
||||
_outputStream.write(bytes, bytes.length/2, (bytes.length - bytes.length/2));
|
||||
}
|
||||
|
||||
|
||||
byte[] inbuf = new byte[__OK_RESPONSE.getBytes().length*2];
|
||||
int x = _inputStream.read(inbuf);
|
||||
System.err.println(new String(inbuf, 0, x));
|
||||
}
|
||||
|
||||
public class NoopHandler extends AbstractHandler
|
||||
{
|
||||
public void handle(String target, Request baseRequest,
|
||||
HttpServletRequest request, HttpServletResponse response) throws IOException,
|
||||
ServletException
|
||||
{
|
||||
//don't read the input, just send something back
|
||||
((Request)request).setHandled(true);
|
||||
response.setStatus(200);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -260,7 +260,8 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
|
|||
/* ------------------------------------------------------------ */
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(_name).append("==").append(_className).append("\n");
|
||||
out.append(_name).append("==").append(_className)
|
||||
.append(" - ").append(AbstractLifeCycle.getState(this)).append("\n");
|
||||
AggregateLifeCycle.dump(out,indent,_initParams.entrySet());
|
||||
}
|
||||
|
||||
|
|
|
@ -209,9 +209,4 @@ public abstract class AbstractLifeCycle implements LifeCycle
|
|||
public void lifeCycleStopped(LifeCycle event) {}
|
||||
public void lifeCycleStopping(LifeCycle event) {}
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return super.toString()+"#"+getState();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,7 +339,16 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
|
|||
/* ------------------------------------------------------------ */
|
||||
protected void dumpThis(Appendable out) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(this)).append("\n");
|
||||
out.append(String.valueOf(this)).append(" - ").append(getState()).append("\n");
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public static void dumpObject(Appendable out,Object o) throws IOException
|
||||
{
|
||||
if (o instanceof LifeCycle)
|
||||
out.append(String.valueOf(o)).append(" - ").append((AbstractLifeCycle.getState((LifeCycle)o))).append("\n");
|
||||
else
|
||||
out.append(String.valueOf(o)).append("\n");
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -359,15 +368,11 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
|
|||
out.append(indent).append(" +- ");
|
||||
if (b._bean instanceof Dumpable)
|
||||
((Dumpable)b._bean).dump(out,indent+(i==size?" ":" | "));
|
||||
else
|
||||
out.append(String.valueOf(b._bean)).append("\n");
|
||||
else
|
||||
dumpObject(out,b._bean);
|
||||
}
|
||||
else
|
||||
{
|
||||
out.append(indent).append(" +~ ");
|
||||
out.append(String.valueOf(b._bean)).append("\n");
|
||||
}
|
||||
|
||||
else
|
||||
dumpObject(out,b._bean);
|
||||
}
|
||||
|
||||
if (i!=size)
|
||||
|
@ -395,16 +400,12 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
|
|||
|
||||
if (o instanceof Dumpable)
|
||||
((Dumpable)o).dump(out,indent+(i==size?" ":" | "));
|
||||
else
|
||||
out.append(String.valueOf(o)).append("\n");
|
||||
else
|
||||
dumpObject(out,o);
|
||||
}
|
||||
|
||||
if (i!=size)
|
||||
out.append(indent).append(" |\n");
|
||||
|
||||
out.append(indent).append(" |\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1524,11 +1524,10 @@ public class SslContextFactory extends AbstractLifeCycle
|
|||
/* ------------------------------------------------------------ */
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s@%x(%s,%s)#%s",
|
||||
return String.format("%s@%x(%s,%s)",
|
||||
getClass().getSimpleName(),
|
||||
hashCode(),
|
||||
_keyStorePath,
|
||||
_trustStorePath,
|
||||
getState());
|
||||
_trustStorePath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -498,7 +498,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
|
|||
}
|
||||
}
|
||||
|
||||
out.append(String.valueOf(this)).append("\n");
|
||||
AggregateLifeCycle.dumpObject(out,this);
|
||||
AggregateLifeCycle.dump(out,indent,dump);
|
||||
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return _name+"{"+getMinThreads()+"<="+getIdleThreads()+"<="+getThreads()+"/"+getMaxThreads()+","+(_jobs==null?-1:_jobs.size())+"}#"+getState();
|
||||
return _name+"{"+getMinThreads()+"<="+getIdleThreads()+"<="+getThreads()+"/"+getMaxThreads()+","+(_jobs==null?-1:_jobs.size())+"}";
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.jetty.websocket;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -28,9 +31,9 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import org.eclipse.jetty.io.Buffer;
|
||||
import org.eclipse.jetty.io.ByteArrayEndPoint;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
|
@ -41,13 +44,10 @@ import org.eclipse.jetty.util.StringUtil;
|
|||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.Utf8StringBuilder;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class WebSocketMessageRFC6455Test
|
||||
{
|
||||
private static Server __server;
|
||||
|
@ -606,7 +606,7 @@ public class WebSocketMessageRFC6455Test
|
|||
Thread.sleep(100);
|
||||
|
||||
assertEquals(count*(mesg.length()+2),totalB.get()); // all messages
|
||||
assertTrue(max>1000); // was blocked
|
||||
Assert.assertThat("Was blocked (max time)", max, greaterThan(1000L)); // was blocked
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -111,21 +111,22 @@ public class XmlConfiguration
|
|||
try
|
||||
{
|
||||
URL config60 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_6_0.dtd",true);
|
||||
URL config71 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_7_1.dtd",true);
|
||||
__parser.redirectEntity("configure.dtd",config71);
|
||||
URL config76 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_7_6.dtd",true);
|
||||
__parser.redirectEntity("configure.dtd",config76);
|
||||
__parser.redirectEntity("configure_1_0.dtd",config60);
|
||||
__parser.redirectEntity("configure_1_1.dtd",config60);
|
||||
__parser.redirectEntity("configure_1_2.dtd",config60);
|
||||
__parser.redirectEntity("configure_1_3.dtd",config60);
|
||||
__parser.redirectEntity("configure_6_0.dtd",config60);
|
||||
__parser.redirectEntity("configure_7_1.dtd",config71);
|
||||
__parser.redirectEntity("configure_7_6.dtd",config76);
|
||||
|
||||
__parser.redirectEntity("http://jetty.mortbay.org/configure.dtd",config71);
|
||||
__parser.redirectEntity("http://jetty.eclipse.org/configure.dtd",config71);
|
||||
__parser.redirectEntity("http://www.eclipse.org/jetty/configure.dtd",config71);
|
||||
|
||||
__parser.redirectEntity("http://jetty.mortbay.org/configure.dtd",config76);
|
||||
__parser.redirectEntity("http://jetty.eclipse.org/configure.dtd",config76);
|
||||
__parser.redirectEntity("http://www.eclipse.org/jetty/configure.dtd",config76);
|
||||
|
||||
__parser.redirectEntity("-//Mort Bay Consulting//DTD Configure//EN",config71);
|
||||
__parser.redirectEntity("-//Jetty//Configure//EN",config71);
|
||||
__parser.redirectEntity("-//Mort Bay Consulting//DTD Configure//EN",config76);
|
||||
__parser.redirectEntity("-//Jetty//Configure//EN",config76);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,14 @@ import org.junit.Test;
|
|||
public class XmlConfigurationTest
|
||||
{
|
||||
protected String _configure="org/eclipse/jetty/xml/configure.xml";
|
||||
|
||||
@Test
|
||||
public void testMortBay() throws Exception
|
||||
{
|
||||
URL url = XmlConfigurationTest.class.getClassLoader().getResource("org/eclipse/jetty/xml/mortbay.xml");
|
||||
XmlConfiguration configuration = new XmlConfiguration(url);
|
||||
Object o=configuration.configure();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPassedObject() throws Exception
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" "http://www.eclipse.org/jetty/configure_1_2.dtd">
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.xml.TestConfiguration">
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
|
||||
<Configure class="java.lang.Object">
|
||||
</Configure>
|
6
pom.xml
6
pom.xml
|
@ -11,7 +11,6 @@
|
|||
<url>${jetty.url}</url>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<javax-activation-version>1.1</javax-activation-version>
|
||||
<javax-mail-version>1.4.1</javax-mail-version>
|
||||
<javax-servlet-jsp-version>2.1.v20100127</javax-servlet-jsp-version>
|
||||
<javax-transaction-version>1.1.1</javax-transaction-version>
|
||||
|
@ -402,11 +401,6 @@
|
|||
<artifactId>mail</artifactId>
|
||||
<version>${javax-mail-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<version>${javax-activation-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
package org.eclipse.jetty.test.rfcs;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.matchers.JUnitMatchers.containsString;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.matchers.JUnitMatchers.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -42,6 +42,7 @@ import org.eclipse.jetty.toolchain.test.StringAssert;
|
|||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
|
@ -955,6 +956,7 @@ public abstract class RFC2616BaseTest
|
|||
* @see <a href="http://tools.ietf.org/html/rfc2616#section-9.8">RFC 2616 (section 9.8)</a>
|
||||
*/
|
||||
@Test
|
||||
@Ignore("Introduction of fix for realm-less security constraints has rendered this test invalid due to default configuration preventing use of TRACE in webdefault.xml")
|
||||
public void test9_8() throws Exception
|
||||
{
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
<Set name="contextPath">/rfc2616-webapp</Set>
|
||||
<Set name="war">
|
||||
|
|
Loading…
Reference in New Issue