Merged branch 'jetty-9.4.x' into 'jetty-10.0.x'.
This commit is contained in:
commit
7134b35286
|
@ -26,7 +26,12 @@ public class HttpResponseException extends RuntimeException
|
|||
|
||||
public HttpResponseException(String message, Response response)
|
||||
{
|
||||
super(message);
|
||||
this(message, response, null);
|
||||
}
|
||||
|
||||
public HttpResponseException(String message, Response response, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
|||
{
|
||||
HttpResponse response = exchange.getResponse();
|
||||
response.status(failure.getCode()).reason(failure.getReason());
|
||||
failAndClose(new HttpResponseException("HTTP protocol violation: bad response on " + getHttpConnection(), response));
|
||||
failAndClose(new HttpResponseException("HTTP protocol violation: bad response on " + getHttpConnection(), response, failure));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.eclipse.jetty.client.Origin;
|
|||
import org.eclipse.jetty.client.api.Response;
|
||||
import org.eclipse.jetty.client.util.FutureResponseListener;
|
||||
import org.eclipse.jetty.http.HttpCompliance;
|
||||
import org.eclipse.jetty.http.BadMessageException;
|
||||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.eclipse.jetty.http.HttpVersion;
|
||||
|
@ -209,6 +210,8 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
ExecutionException e = assertThrows(ExecutionException.class, ()->listener.get(5, TimeUnit.SECONDS));
|
||||
assertThat(e.getCause(), instanceOf(HttpResponseException.class));
|
||||
assertThat(e.getCause().getCause(),instanceOf(BadMessageException.class));
|
||||
assertThat(e.getCause().getCause().getCause(),instanceOf(NumberFormatException.class));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
|
|
@ -52,9 +52,7 @@ public class BadMessageException extends RuntimeException
|
|||
|
||||
public BadMessageException(int code, String reason)
|
||||
{
|
||||
super(code+": "+reason);
|
||||
_code=code;
|
||||
_reason=reason;
|
||||
this(code, reason, null);
|
||||
}
|
||||
|
||||
public BadMessageException(int code, String reason, Throwable cause)
|
||||
|
|
|
@ -1070,7 +1070,7 @@ public class HttpParser
|
|||
catch(NumberFormatException e)
|
||||
{
|
||||
LOG.ignore(e);
|
||||
throw new BadMessageException(HttpStatus.BAD_REQUEST_400,"Invalid Content-Length Value");
|
||||
throw new BadMessageException(HttpStatus.BAD_REQUEST_400,"Invalid Content-Length Value",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -333,15 +333,16 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
|
|||
}
|
||||
case SettingsFrame.ENABLE_PUSH:
|
||||
{
|
||||
boolean enabled = value == 1;
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} push for {}", pushEnabled ? "Enabling" : "Disabling", this);
|
||||
pushEnabled = value == 1;
|
||||
LOG.debug("{} push for {}", enabled ? "Enabling" : "Disabling", this);
|
||||
pushEnabled = enabled;
|
||||
break;
|
||||
}
|
||||
case SettingsFrame.MAX_CONCURRENT_STREAMS:
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Updating max local concurrent streams to {} for {}", maxLocalStreams, this);
|
||||
LOG.debug("Updating max local concurrent streams to {} for {}", value, this);
|
||||
maxLocalStreams = value;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -176,7 +176,8 @@ public class HTTP2Stream extends IdleTimeout implements IStream, Callback, Dumpa
|
|||
@Override
|
||||
public boolean isRemotelyClosed()
|
||||
{
|
||||
return closeState.get() == CloseState.REMOTELY_CLOSED;
|
||||
CloseState state = closeState.get();
|
||||
return state == CloseState.REMOTELY_CLOSED || state == CloseState.CLOSING;
|
||||
}
|
||||
|
||||
public boolean isLocallyClosed()
|
||||
|
|
|
@ -451,12 +451,15 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
closeNoExceptions(_selector);
|
||||
_selector = null;
|
||||
if (isRunning())
|
||||
LOG.warn(x);
|
||||
else
|
||||
{
|
||||
LOG.warn(x.toString());
|
||||
LOG.debug(x);
|
||||
}
|
||||
closeNoExceptions(_selector);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue