clean build

This commit is contained in:
Greg Wilkins 2011-11-07 15:34:33 +11:00
parent 42179e193d
commit 202475aad9
9 changed files with 47 additions and 26 deletions

View File

@ -973,6 +973,12 @@ public class HttpParser implements Parser
return progress; return progress;
} }
catch(HttpException e)
{
_persistent=false;
_state=STATE_SEEKING_EOF;
throw e;
}
finally finally
{ {
_lock.unlock(); _lock.unlock();

View File

@ -108,6 +108,7 @@ public class ChannelEndPoint implements EndPoint
*/ */
protected final void shutdownChannelInput() throws IOException protected final void shutdownChannelInput() throws IOException
{ {
LOG.debug("ishut {}",this);
if (_channel.isOpen()) if (_channel.isOpen())
{ {
if (_channel instanceof SocketChannel) if (_channel instanceof SocketChannel)
@ -133,6 +134,7 @@ public class ChannelEndPoint implements EndPoint
protected final void shutdownChannelOutput() throws IOException protected final void shutdownChannelOutput() throws IOException
{ {
LOG.debug("oshut {}",this);
if (_channel.isOpen()) if (_channel.isOpen())
{ {
if (_channel instanceof SocketChannel) if (_channel instanceof SocketChannel)
@ -178,6 +180,7 @@ public class ChannelEndPoint implements EndPoint
*/ */
public void close() throws IOException public void close() throws IOException
{ {
LOG.debug("close {}",this);
_channel.close(); _channel.close();
} }

View File

@ -705,7 +705,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
(_readBlocked?"":",RB") + (_readBlocked?"":",RB") +
(_writeBlocked?"":",WB") + (_writeBlocked?"":",WB") +
(_writable?"":",!W") + (_writable?"":",!W") +
",io="+_interestOps + ","+_interestOps +
((_key==null || !_key.isValid())?"!":( ((_key==null || !_key.isValid())?"!":(
(_key.isReadable()?"R":"")+ (_key.isReadable()?"R":"")+
(_key.isWritable()?"W":"")))+ (_key.isWritable()?"W":"")))+

View File

@ -58,6 +58,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
private AsyncEndPoint _aEndp; private AsyncEndPoint _aEndp;
private boolean _allowRenegotiate=true; private boolean _allowRenegotiate=true;
private boolean _handshook; private boolean _handshook;
private boolean _oshut;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ -184,8 +185,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
} }
} }
LOG.debug("{} handle {} progress=",_session,this, progress);
LOG.debug("{} handle progress=",_session,progress);
} }
} }
finally finally
@ -272,10 +272,9 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
LOG.debug(e.toString()); LOG.debug(e.toString());
LOG.ignore(e); LOG.ignore(e);
} }
LOG.debug("{} {} filled={}/{} flushed={}/{}",_session,this,filled,_inbound.length(),flushed,_outbound.length()); LOG.debug("{} {} {} filled={}/{} flushed={}/{}",_session,this,_engine.getHandshakeStatus(),filled,_inbound.length(),flushed,_outbound.length());
// handle the current hand share status // handle the current hand share status
LOG.debug("{} status {}",_session,_engine.getHandshakeStatus());
switch(_engine.getHandshakeStatus()) switch(_engine.getHandshakeStatus())
{ {
case FINISHED: case FINISHED:
@ -347,7 +346,6 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
if (!_outbound.hasContent() && _engine.isOutboundDone()) if (!_outbound.hasContent() && _engine.isOutboundDone())
_endp.shutdownOutput(); _endp.shutdownOutput();
LOG.debug("{} process progress={}",_session,progress);
some_progress|=progress; some_progress|=progress;
} }
} }
@ -418,7 +416,9 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
break; break;
case CLOSED: case CLOSED:
_endp.close(); LOG.debug("wrap CLOSE {} {}",this,result);
if (result.getHandshakeStatus()==HandshakeStatus.FINISHED)
_endp.close();
break; break;
default: default:
@ -495,7 +495,9 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
break; break;
case CLOSED: case CLOSED:
_endp.close(); LOG.debug("unwrap CLOSE {} {}",this,result);
if (result.getHandshakeStatus()==HandshakeStatus.FINISHED)
_endp.close();
break; break;
default: default:
@ -530,7 +532,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
Buffer o=_outbound; Buffer o=_outbound;
Buffer u=_unwrapBuf; Buffer u=_unwrapBuf;
return super.toString()+" i/u/o="+(i==null?0:i.length())+"/"+(u==null?0:u.length())+"/"+(o==null?0:o.length()); return super.toString()+"|"+_engine.getHandshakeStatus()+" i/u/o="+(i==null?0:i.length())+"/"+(u==null?0:u.length())+"/"+(o==null?0:o.length());
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ -549,16 +551,25 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
public void shutdownOutput() throws IOException public void shutdownOutput() throws IOException
{ {
_engine.closeOutbound(); synchronized (SslConnection.this)
{
LOG.debug("{} ssl endp.oshut {}",_session,this);
_engine.closeOutbound();
_oshut=true;
}
} }
public boolean isOutputShutdown() public boolean isOutputShutdown()
{ {
return !isOpen(); synchronized (SslConnection.this)
{
return _oshut||!isOpen()||_engine.isOutboundDone();
}
} }
public void shutdownInput() throws IOException public void shutdownInput() throws IOException
{ {
LOG.debug("{} ssl endp.ishut!",_session);
// We do not do a closeInput here, as SSL does not support half close. // We do not do a closeInput here, as SSL does not support half close.
// isInputShutdown works it out itself from buffer state and underlying endpoint state. // isInputShutdown works it out itself from buffer state and underlying endpoint state.
} }
@ -575,6 +586,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
public void close() throws IOException public void close() throws IOException
{ {
LOG.debug("{} ssl endp.close",_session);
_endp.close(); _endp.close();
} }
@ -662,7 +674,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
{ {
synchronized (this) synchronized (this)
{ {
return _outbound!=null && _outbound.hasContent(); return _outbound!=null && _outbound.hasContent() || _engine.getHandshakeStatus()==HandshakeStatus.NEED_WRAP;
} }
} }
@ -776,7 +788,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
Buffer i=_inbound; Buffer i=_inbound;
Buffer o=_outbound; Buffer o=_outbound;
Buffer u=_unwrapBuf; Buffer u=_unwrapBuf;
return "SSL:"+_endp+" "+_engine.getHandshakeStatus()+" i/u/o="+(i==null?0:i.length())+"/"+(u==null?0:u.length())+"/"+(o==null?0:o.length()); return "SSL:"+_endp+" "+_engine.getHandshakeStatus()+" i/u/o="+(i==null?0:i.length())+"/"+(u==null?0:u.length())+"/"+(o==null?0:o.length()+(_oshut?" oshut":""));
} }
} }

View File

@ -870,6 +870,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
if (!_host) if (!_host)
{ {
LOG.debug("!host {}",this);
_generator.setResponse(HttpStatus.BAD_REQUEST_400, null); _generator.setResponse(HttpStatus.BAD_REQUEST_400, null);
_responseFields.put(HttpHeaders.CONNECTION_BUFFER, HttpHeaderValues.CLOSE_BUFFER); _responseFields.put(HttpHeaders.CONNECTION_BUFFER, HttpHeaderValues.CLOSE_BUFFER);
_generator.completeHeader(_responseFields, true); _generator.completeHeader(_responseFields, true);
@ -879,6 +880,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
if (_expect) if (_expect)
{ {
LOG.debug("!expectation {}",this);
_generator.setResponse(HttpStatus.EXPECTATION_FAILED_417, null); _generator.setResponse(HttpStatus.EXPECTATION_FAILED_417, null);
_responseFields.put(HttpHeaders.CONNECTION_BUFFER, HttpHeaderValues.CLOSE_BUFFER); _responseFields.put(HttpHeaders.CONNECTION_BUFFER, HttpHeaderValues.CLOSE_BUFFER);
_generator.completeHeader(_responseFields, true); _generator.completeHeader(_responseFields, true);

View File

@ -14,8 +14,8 @@ import org.eclipse.jetty.util.log.Logger;
public class AsyncHttpConnection extends AbstractHttpConnection implements AsyncConnection public class AsyncHttpConnection extends AbstractHttpConnection implements AsyncConnection
{ {
private final static int NO_PROGRESS_INFO = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_INFO",100); private final static int NO_PROGRESS_INFO = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_INFO",1000);
private final static int NO_PROGRESS_CLOSE = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_CLOSE",200); private final static int NO_PROGRESS_CLOSE = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_CLOSE",2000);
private static final Logger LOG = Log.getLogger(AsyncHttpConnection.class); private static final Logger LOG = Log.getLogger(AsyncHttpConnection.class);
private int _total_no_progress; private int _total_no_progress;
@ -72,11 +72,11 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
LOG.debug("fields="+_requestFields); LOG.debug("fields="+_requestFields);
LOG.debug(e); LOG.debug(e);
} }
progress=true;
_generator.sendError(e.getStatus(), e.getReason(), null, true); _generator.sendError(e.getStatus(), e.getReason(), null, true);
_parser.reset();
} }
finally finally
{ {
// Is this request/response round complete and are fully flushed? // Is this request/response round complete and are fully flushed?
if (_parser.isComplete() && _generator.isComplete() && !_endp.isBufferingOutput()) if (_parser.isComplete() && _generator.isComplete() && !_endp.isBufferingOutput())
{ {
@ -118,7 +118,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
LOG.info("EndPoint making no progress: "+_total_no_progress+" "+_endp); LOG.info("EndPoint making no progress: "+_total_no_progress+" "+_endp);
if (NO_PROGRESS_CLOSE>0 && _total_no_progress==NO_PROGRESS_CLOSE) if (NO_PROGRESS_CLOSE>0 && _total_no_progress==NO_PROGRESS_CLOSE)
{ {
LOG.warn("Closing EndPoint making no progress: "+_total_no_progress+" "+_endp); LOG.warn("Closing EndPoint making no progress: "+_total_no_progress+" "+_endp+" "+this);
if (_endp instanceof SelectChannelEndPoint) if (_endp instanceof SelectChannelEndPoint)
((SelectChannelEndPoint)_endp).getChannel().close(); ((SelectChannelEndPoint)_endp).getChannel().close();
} }

View File

@ -21,7 +21,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.jmx.MBeanContainer; import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.security.HashLoginService; import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Handler;

View File

@ -1075,8 +1075,6 @@ public abstract class RFC2616BaseTest
specId = "10.3 Redirection HTTP/1.0 - basic"; specId = "10.3 Redirection HTTP/1.0 - basic";
response.assertStatus(specId,HttpStatus.FOUND_302); response.assertStatus(specId,HttpStatus.FOUND_302);
response.assertHeader(specId,"Location",serverURI + "/tests/"); response.assertHeader(specId,"Location",serverURI + "/tests/");
response.assertHeader(specId,"Connection","close");
} }
/** /**
@ -1136,9 +1134,6 @@ public abstract class RFC2616BaseTest
String specId = "10.3 Redirection HTTP/1.0 w/content"; String specId = "10.3 Redirection HTTP/1.0 w/content";
response.assertStatus(specId,HttpStatus.FOUND_302); response.assertStatus(specId,HttpStatus.FOUND_302);
response.assertHeader(specId,"Location",server.getScheme() + "://localhost/tests/R1.txt"); response.assertHeader(specId,"Location",server.getScheme() + "://localhost/tests/R1.txt");
response.assertHeader(specId,"Connection","close");
response.assertHeaderNotPresent(specId,"Content-Length");
} }
/** /**
@ -1803,7 +1798,6 @@ public abstract class RFC2616BaseTest
response = responses.get(1); // response 2 response = responses.get(1); // response 2
response.assertStatusOK(specId); response.assertStatusOK(specId);
response.assertHeader(specId,"Connection","close");
response.assertBodyContains(specId,"Resource=R2"); response.assertBodyContains(specId,"Resource=R2");
/* Compatibility with HTTP/1.0 */ /* Compatibility with HTTP/1.0 */
@ -1849,7 +1843,6 @@ public abstract class RFC2616BaseTest
response = responses.get(2); response = responses.get(2);
response.assertStatusOK(specId); response.assertStatusOK(specId);
response.assertHeader(specId,"Connection","close");
response.assertBody(specId,"Host=Default\nResource=R2\n"); response.assertBody(specId,"Host=Default\nResource=R2\n");
} }

View File

@ -44,4 +44,9 @@ public class RFC2616NIOHttpsTest extends RFC2616BaseTest
{ {
return new HttpsSocketImpl(); return new HttpsSocketImpl();
} }
public void test8_2_ExpectInvalid() throws Exception
{
super.test8_2_ExpectInvalid();
}
} }