@Override public void handleEvent(ConduitStreamSinkChannel conduitStreamSinkChannel) { connection.getUpgradeListener().handleUpgrade(connection.getChannel(), exchange); } }, new ClosingChannelExceptionHandler<ConduitStreamSinkChannel>(connection)));
@Override public void run() { handleEvent(connection.getChannel().getSourceChannel()); }
private boolean handleHttp2PriorKnowledge(PooledByteBuffer pooled, HttpServerExchange httpServerExchange) throws IOException { if(httpServerExchange.getRequestMethod().equals(PRI) && connection.getUndertowOptions().get(UndertowOptions.ENABLE_HTTP2, false)) { handleHttp2PriorKnowledge(connection.getChannel(), connection, pooled); return false; } else { sendBadRequestAndClose(connection.getChannel(), new IOException()); return true; } }
/** * Gets the channel wrapper that implements the buffering */ public void setupPipelineBuffer(final HttpServerExchange exchange) { ((HttpServerConnection) exchange.getConnection()).getChannel().getSinkChannel().setConduit(this); }
final HttpServerConnection.ConduitState oldState = connection.resetChannel(); if (!flushPipelinedData()) { final StreamConnection channel = connection.getChannel(); channel.getSinkChannel().setWriteListener(new ChannelListener<Channel>() { @Override connection.getChannel().getSinkChannel().resumeWrites(); return; } else { IoUtils.safeClose(connection.getChannel()); } catch (Throwable t) { UndertowLogger.REQUEST_IO_LOGGER.handleUnexpectedFailure(t); IoUtils.safeClose(connection.getChannel());
if (read > maxRequestSize) { UndertowLogger.REQUEST_LOGGER.requestHeaderWasTooLarge(connection.getPeerAddress(), maxRequestSize); sendBadRequestAndClose(connection.getChannel(), null); return; HttpString protocol = httpServerExchange.getProtocol(); if(protocol != Protocols.HTTP_1_1 && protocol != Protocols.HTTP_1_0 && protocol != Protocols.HTTP_0_9) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing connection from %s due to unknown protocol %s", connection.getChannel().getPeerAddress(), protocol); sendBadRequestAndClose(connection.getChannel(), new IOException()); return; sendBadRequestAndClose(connection.getChannel(), UndertowMessages.MESSAGES.moreThanOneHostHeader()); return; sendBadRequestAndClose(connection.getChannel(), UndertowMessages.MESSAGES.noHostInHttp11Request()); return; sendBadRequestAndClose(connection.getChannel(), UndertowMessages.MESSAGES.invalidHeaders()); return; sendBadRequestAndClose(connection.getChannel(), t); return; } finally {
ConduitStreamSourceChannel sourceChannel = ((HttpServerConnection) exchange.getConnection()).getChannel().getSourceChannel(); sourceChannel.setConduit(new ChunkedStreamSourceConduit(sourceChannel.getConduit(), exchange, chunkedDrainListener(exchange))); } else if (contentLengthHeader != null) { } else { ConduitStreamSourceChannel sourceChannel = ((HttpServerConnection) exchange.getConnection()).getChannel().getSourceChannel(); sourceChannel.setConduit(fixedLengthStreamSourceConduitWrapper(contentLength, sourceChannel.getConduit(), exchange));
final HttpServerConnection connection = this.connection; if (exchange.isPersistent() && !isUpgradeOrConnect(exchange)) { final StreamConnection channel = connection.getChannel(); if (connection.getExtraBytes() == null) { ConnectionUtils.cleanClose(connection.getChannel(), connection); } else { connection.getChannel().getSourceChannel().setConduit(new ReadDataStreamSourceConduit(connection.getChannel().getSourceChannel().getConduit(), connection)); if (!connection.getChannel().getSinkChannel().flush()) { connection.getChannel().getSinkChannel().setWriteListener(ChannelListeners.flushingChannelListener(new ChannelListener<ConduitStreamSinkChannel>() { @Override public void handleEvent(ConduitStreamSinkChannel conduitStreamSinkChannel) { connection.getChannel().getSinkChannel().resumeWrites(); return; connection.getUpgradeListener().handleUpgrade(connection.getChannel(), exchange); } catch (IOException e) { UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
pipeliningBuffer.setupPipelineBuffer(exchange); ConduitStreamSourceChannel sourceChannel = connection.getChannel().getSourceChannel(); sourceChannel.setConduit(connection.getReadDataStreamSourceConduit());
@Override public void handleEvent(ConduitStreamSinkChannel conduitStreamSinkChannel) { connection.getUpgradeListener().handleUpgrade(connection.getChannel(), exchange); } }, new ClosingChannelExceptionHandler<ConduitStreamSinkChannel>(connection)));
@Override public void handleEvent(ConduitStreamSinkChannel conduitStreamSinkChannel) { connection.getUpgradeListener().handleUpgrade(connection.getChannel(), exchange); } }, new ClosingChannelExceptionHandler<ConduitStreamSinkChannel>(connection)));
@Override public void run() { handleEvent(connection.getChannel().getSourceChannel()); }
@Override public void run() { handleEvent(connection.getChannel().getSourceChannel()); }
private boolean handleHttp2PriorKnowledge(PooledByteBuffer pooled, HttpServerExchange httpServerExchange) throws IOException { if(httpServerExchange.getRequestMethod().equals(PRI) && connection.getUndertowOptions().get(UndertowOptions.ENABLE_HTTP2, false)) { handleHttp2PriorKnowledge(connection.getChannel(), connection, pooled); return false; } else { sendBadRequestAndClose(connection.getChannel(), new IOException()); return true; } }
private boolean handleHttp2PriorKnowledge(PooledByteBuffer pooled, HttpServerExchange httpServerExchange) throws IOException { if(httpServerExchange.getRequestMethod().equals(PRI) && connection.getUndertowOptions().get(UndertowOptions.ENABLE_HTTP2, false)) { handleHttp2PriorKnowledge(connection.getChannel(), connection, pooled); return false; } else { sendBadRequestAndClose(connection.getChannel(), new IOException()); return true; } }
/** * Gets the channel wrapper that implements the buffering */ public void setupPipelineBuffer(final HttpServerExchange exchange) { ((HttpServerConnection) exchange.getConnection()).getChannel().getSinkChannel().setConduit(this); }
/** * Gets the channel wrapper that implements the buffering */ public void setupPipelineBuffer(final HttpServerExchange exchange) { ((HttpServerConnection) exchange.getConnection()).getChannel().getSinkChannel().setConduit(this); }
final HttpServerConnection.ConduitState oldState = connection.resetChannel(); if (!flushPipelinedData()) { final StreamConnection channel = connection.getChannel(); channel.getSinkChannel().setWriteListener(new ChannelListener<Channel>() { @Override connection.getChannel().getSinkChannel().resumeWrites(); return; } else { IoUtils.safeClose(connection.getChannel()); } catch (Throwable t) { UndertowLogger.REQUEST_IO_LOGGER.handleUnexpectedFailure(t); IoUtils.safeClose(connection.getChannel());
pipeliningBuffer.setupPipelineBuffer(exchange); ConduitStreamSourceChannel sourceChannel = connection.getChannel().getSourceChannel(); sourceChannel.setConduit(connection.getReadDataStreamSourceConduit());
pipeliningBuffer.setupPipelineBuffer(exchange); ConduitStreamSourceChannel sourceChannel = connection.getChannel().getSourceChannel(); sourceChannel.setConduit(connection.getReadDataStreamSourceConduit());