private boolean doHttp2PriRead(StreamConnection connection, ByteBuffer buffer, HttpServerConnection serverConnection, PooledByteBuffer extraData) throws IOException { if(buffer.hasRemaining()) { int res = connection.getSourceChannel().read(buffer); if (res == -1) { return true; //fail } if (buffer.hasRemaining()) { return false; } } buffer.flip(); for(int i = 0; i < PRI_EXPECTED.length; ++i) { if(buffer.get() != PRI_EXPECTED[i]) { throw UndertowMessages.MESSAGES.http2PriRequestFailed(); } } Http2Channel channel = new Http2Channel(connection, null, serverConnection.getByteBufferPool(), extraData, false, false, false, serverConnection.getUndertowOptions()); Http2ReceiveListener receiveListener = new Http2ReceiveListener(serverConnection.getRootHandler(), serverConnection.getUndertowOptions(), serverConnection.getBufferSize(), null); channel.getReceiveSetter().set(receiveListener); channel.resumeReceives(); return true; } }
long res = sourceChannel.read(b); if (res == -1) { conn.trace("Received EOF");
@Override public void handleEvent(ConduitStreamSourceChannel channel) { try { int res = channel.read(b); if (res != 0) { IoUtils.safeClose(connection); IoUtils.safeClose(additional); key.remove(); } } catch (Exception e) { if (e instanceof IOException) { UndertowLogger.REQUEST_IO_LOGGER.ioException((IOException) e); } else { UndertowLogger.REQUEST_IO_LOGGER.ioException(new IOException(e)); } IoUtils.safeClose(connection); IoUtils.safeClose(additional); key.remove(); } } });
if (!hasData) { pooled.getBuffer().clear(); read = channel.getSourceChannel().read(pooled.getBuffer()); if (read == 0) {
int res = connection.getSourceChannel().read(b); b.clear(); if (res == 0) {
long end = System.currentTimeMillis() + MAX_RENEGOTIATION_WAIT; while (!waiter.isDone() && serverConnection.isOpen() && System.currentTimeMillis() < end) { int read = serverConnection.getSourceChannel().read(buff); if (read != 0) { throw new SSLPeerUnverifiedException("");
try { while (true) { int res = channel.getSourceChannel().read(buffer.getBuffer()); if (res == -1) { IoUtils.safeClose(channel);
buffer.clear(); try { res = channel.read(buffer); } catch (IOException e) { UndertowLogger.REQUEST_IO_LOGGER.debug("Error reading request", e);
ByteBuffer bb = ByteBuffer.allocate(15); StringBuilder builder = new StringBuilder(); while(sourceChannel.read(bb) > 0){ bb.flip(); while(bb.position() < bb.limit()){
private boolean doHttp2PriRead(StreamConnection connection, ByteBuffer buffer, HttpServerConnection serverConnection, PooledByteBuffer extraData) throws IOException { if(buffer.hasRemaining()) { int res = connection.getSourceChannel().read(buffer); if (res == -1) { return true; //fail } if (buffer.hasRemaining()) { return false; } } buffer.flip(); for(int i = 0; i < PRI_EXPECTED.length; ++i) { if(buffer.get() != PRI_EXPECTED[i]) { throw UndertowMessages.MESSAGES.http2PriRequestFailed(); } } Http2Channel channel = new Http2Channel(connection, null, serverConnection.getByteBufferPool(), extraData, false, false, false, serverConnection.getUndertowOptions()); Http2ReceiveListener receiveListener = new Http2ReceiveListener(serverConnection.getRootHandler(), serverConnection.getUndertowOptions(), serverConnection.getBufferSize(), null); channel.getReceiveSetter().set(receiveListener); channel.resumeReceives(); return true; } }
private boolean doHttp2PriRead(StreamConnection connection, ByteBuffer buffer, HttpServerConnection serverConnection, PooledByteBuffer extraData) throws IOException { if(buffer.hasRemaining()) { int res = connection.getSourceChannel().read(buffer); if (res == -1) { return true; //fail } if (buffer.hasRemaining()) { return false; } } buffer.flip(); for(int i = 0; i < PRI_EXPECTED.length; ++i) { if(buffer.get() != PRI_EXPECTED[i]) { throw UndertowMessages.MESSAGES.http2PriRequestFailed(); } } Http2Channel channel = new Http2Channel(connection, null, serverConnection.getByteBufferPool(), extraData, false, false, false, serverConnection.getUndertowOptions()); Http2ReceiveListener receiveListener = new Http2ReceiveListener(serverConnection.getRootHandler(), serverConnection.getUndertowOptions(), serverConnection.getBufferSize(), null); channel.getReceiveSetter().set(receiveListener); channel.resumeReceives(); return true; } }
@Override public void handleEvent(ConduitStreamSourceChannel channel) { try { int res = channel.read(b); if (res != 0) { IoUtils.safeClose(connection); IoUtils.safeClose(additional); key.remove(); } } catch (Exception e) { if (e instanceof IOException) { UndertowLogger.REQUEST_IO_LOGGER.ioException((IOException) e); } else { UndertowLogger.REQUEST_IO_LOGGER.ioException(new IOException(e)); } IoUtils.safeClose(connection); IoUtils.safeClose(additional); key.remove(); } } });
@Override public void handleEvent(ConduitStreamSourceChannel channel) { try { int res = channel.read(b); if (res != 0) { IoUtils.safeClose(connection); IoUtils.safeClose(additional); key.remove(); } } catch (Exception e) { if (e instanceof IOException) { UndertowLogger.REQUEST_IO_LOGGER.ioException((IOException) e); } else { UndertowLogger.REQUEST_IO_LOGGER.ioException(new IOException(e)); } IoUtils.safeClose(connection); IoUtils.safeClose(additional); key.remove(); } } });
int res = connection.getSourceChannel().read(b); b.clear(); if (res == 0) {
int res = connection.getSourceChannel().read(b); b.clear(); if (res == 0) {
long end = System.currentTimeMillis() + MAX_RENEGOTIATION_WAIT; while (!waiter.isDone() && serverConnection.isOpen() && System.currentTimeMillis() < end) { int read = serverConnection.getSourceChannel().read(buff); if (read != 0) { throw new SSLPeerUnverifiedException("");
long end = System.currentTimeMillis() + MAX_RENEGOTIATION_WAIT; while (!waiter.isDone() && serverConnection.isOpen() && System.currentTimeMillis() < end) { int read = serverConnection.getSourceChannel().read(buff); if (read != 0) { throw new SSLPeerUnverifiedException("");
try { while (true) { int res = channel.getSourceChannel().read(buffer.getBuffer()); if (res == -1) { IoUtils.safeClose(channel);
try { while (true) { int res = channel.getSourceChannel().read(buffer.getBuffer()); if (res == -1) { IoUtils.safeClose(channel);
buffer.clear(); try { res = channel.read(buffer); } catch (IOException e) { UndertowLogger.REQUEST_IO_LOGGER.debug("Error reading request", e);