Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UNDERTOW-2031][UNDERTOW-2113][UNDERTOW-2130][UNDERTOW-2133][UNDERTOW-2135] backport bug fixes to 2.2.x branch #1359

Merged
merged 5 commits into from Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -31,6 +31,7 @@
import io.undertow.conduits.ConduitListener;
import io.undertow.server.Connectors;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.RequestTooBigException;
import io.undertow.util.ImmediatePooledByteBuffer;
import org.xnio.IoUtils;
import org.xnio.channels.StreamSinkChannel;
Expand Down Expand Up @@ -202,6 +203,8 @@ public int read(ByteBuffer dst) throws IOException {
}
assert STATE_FINISHED == state;
return -1;
} catch (RequestTooBigException e) {
throw e;
} catch (IOException | RuntimeException e) {
IoUtils.safeClose(exchange.getConnection());
throw e;
Expand Down
Expand Up @@ -142,7 +142,6 @@ public void awaitWritable(long time, TimeUnit timeUnit) throws IOException {
HttpServerExchange newExchange = exchange.getConnection().sendOutOfBandResponse(exchange);
exchange.putAttachment(ALREADY_SENT, true);
newExchange.setStatusCode(StatusCodes.CONTINUE);
newExchange.getResponseHeaders().put(Headers.CONTENT_LENGTH, 0);
final StreamSinkChannel responseChannel = newExchange.getResponseChannel();
return new ContinueResponseSender() {
boolean shutdown = false;
Expand Down Expand Up @@ -219,7 +218,6 @@ private static void internalSendContinueResponse(final HttpServerExchange exchan
HttpServerExchange newExchange = exchange.getConnection().sendOutOfBandResponse(exchange);
exchange.putAttachment(ALREADY_SENT, true);
newExchange.setStatusCode(StatusCodes.CONTINUE);
newExchange.getResponseHeaders().put(Headers.CONTENT_LENGTH, 0);
final StreamSinkChannel responseChannel = newExchange.getResponseChannel();
try {
responseChannel.shutdownWrites();
Expand Down
Expand Up @@ -74,9 +74,8 @@ public Http2UpgradeHandler(HttpHandler next, String... upgradeStrings) {
public void handleRequest(HttpServerExchange exchange) throws Exception {
final String upgrade = exchange.getRequestHeaders().getFirst(Headers.UPGRADE);
final String settings = exchange.getRequestHeaders().getFirst("HTTP2-Settings");
if(settings != null && upgrade != null
&& upgradeStrings.contains(upgrade)) {
if(HttpContinue.requiresContinueResponse(exchange) && false) {
if(settings != null && upgrade != null && upgradeStrings.contains(upgrade)) {
if(HttpContinue.requiresContinueResponse(exchange)) {
HttpContinue.sendContinueResponse(exchange, new IoCallback() {
@Override
public void onComplete(HttpServerExchange exchange, Sender sender) {
Expand Down
Expand Up @@ -136,7 +136,7 @@ public long getContentLength() {
client.execute(post);
} catch (SocketException e) {
Assert.assertTrue(e.getMessage(), e.getMessage().contains("Broken pipe")
|| e.getMessage().contains("connection abort"));
|| e.getMessage().contains("connection abort") || e.getMessage().contains("connection was aborted"));
socketFailure = true;
}
Assert.assertTrue("Test sent request without any exception", socketFailure);
Expand Down
Expand Up @@ -18,9 +18,6 @@

package io.undertow.servlet.test.streams;

import io.undertow.testutils.DefaultServer;
import org.junit.runner.RunWith;

import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServlet;
Expand All @@ -33,7 +30,6 @@
/**
* @author Stuart Douglas
*/
@RunWith(DefaultServer.class)
public class EarlyCloseClientServlet extends HttpServlet {

private static volatile boolean exceptionThrown;
Expand Down
Expand Up @@ -29,12 +29,10 @@
import io.undertow.servlet.handlers.ServletRequestContext;
import io.undertow.servlet.spec.HttpServletRequestImpl;
import io.undertow.testutils.DefaultServer;
import org.junit.runner.RunWith;

/**
* @author Stuart Douglas
*/
@RunWith(DefaultServer.class)
public class EarlyCloseServlet extends HttpServlet {

private volatile ServerConnection connection;
Expand Down
Expand Up @@ -23,14 +23,10 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.runner.RunWith;

import io.undertow.testutils.DefaultServer;

/**
* @author Stuart Douglas
*/
@RunWith(DefaultServer.class)
public class ForceDrainServlet extends HttpServlet {

@Override
Expand Down