diff options
Diffstat (limited to 'jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/ServerFCGIConnection.java')
-rw-r--r-- | jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/ServerFCGIConnection.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/ServerFCGIConnection.java b/jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/ServerFCGIConnection.java index ee196e71cd..c0af8c5846 100644 --- a/jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/ServerFCGIConnection.java +++ b/jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/ServerFCGIConnection.java @@ -29,9 +29,9 @@ import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.io.AbstractConnection; import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.server.ByteBufferQueuedHttpInput; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.HttpInput; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -82,11 +82,13 @@ public class ServerFCGIConnection extends AbstractConnection } else if (read == 0) { + bufferPool.release(buffer); fillInterested(); break; } else { + bufferPool.release(buffer); shutdown(); break; } @@ -96,11 +98,8 @@ public class ServerFCGIConnection extends AbstractConnection { if (LOG.isDebugEnabled()) LOG.debug(x); - // TODO: fail and close ? - } - finally - { bufferPool.release(buffer); + // TODO: fail and close ? } } @@ -122,8 +121,7 @@ public class ServerFCGIConnection extends AbstractConnection { // TODO: handle flags HttpChannelOverFCGI channel = new HttpChannelOverFCGI(connector, configuration, getEndPoint(), - new HttpTransportOverFCGI(connector.getByteBufferPool(), flusher, request, sendStatus200), - new ByteBufferQueuedHttpInput()); + new HttpTransportOverFCGI(connector.getByteBufferPool(), flusher, request, sendStatus200)); HttpChannelOverFCGI existing = channels.putIfAbsent(request, channel); if (existing != null) throw new IllegalStateException(); @@ -149,8 +147,8 @@ public class ServerFCGIConnection extends AbstractConnection LOG.debug("Request {} headers on {}", request, channel); if (channel != null) { - if (channel.headerComplete()) - channel.dispatch(); + channel.onRequest(); + channel.dispatch(); } } @@ -162,8 +160,9 @@ public class ServerFCGIConnection extends AbstractConnection LOG.debug("Request {} {} content {} on {}", request, stream, buffer, channel); if (channel != null) { - if (channel.content(buffer)) - channel.dispatch(); + ByteBuffer copy = ByteBuffer.allocate(buffer.remaining()); + copy.put(buffer).flip(); + channel.onContent(new HttpInput.Content(copy)); } return false; } @@ -176,8 +175,7 @@ public class ServerFCGIConnection extends AbstractConnection LOG.debug("Request {} end on {}", request, channel); if (channel != null) { - if (channel.messageComplete()) - channel.dispatch(); + channel.onRequestComplete(); } } @@ -189,7 +187,7 @@ public class ServerFCGIConnection extends AbstractConnection LOG.debug("Request {} failure on {}: {}", request, channel, failure); if (channel != null) { - channel.badMessage(400, failure.toString()); + channel.onBadMessage(400, failure.toString()); } } } |