Skip to content

Commit

Permalink
Merge pull request #12420 from jetty/jetty-12.1.x-12396-NcsaRequestLo…
Browse files Browse the repository at this point in the history
…gTest

Issue #12396 - fix and re-enable NcsaRequestLogTest
  • Loading branch information
lachlan-roberts authored Oct 24, 2024
2 parents c7ee9c0 + a2f02ce commit 2d9ef61
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class ErrorHandler implements Request.Handler
public static final String ERROR_MESSAGE = "org.eclipse.jetty.server.error_message";
public static final String ERROR_EXCEPTION = "org.eclipse.jetty.server.error_exception";
public static final String ERROR_CONTEXT = "org.eclipse.jetty.server.error_context";
public static final Set<String> ERROR_METHODS = Set.of("GET", "POST", "HEAD");
public static final Set<String> ERROR_METHODS = Set.of("GET", "POST", "HEAD", "BAD");
public static final HttpField ERROR_CACHE_CONTROL = new PreEncodedHttpField(HttpHeader.CACHE_CONTROL, "must-revalidate,no-cache,no-store");

boolean _showStacks = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ public void badMessage(HttpException failure)
HttpStreamOverHTTP1 stream = _stream.get();
if (stream == null)
{
stream = newHttpStream("GET", "/badMessage", HttpVersion.HTTP_1_0);
stream = newHttpStream("BAD", "/badMessage", HttpVersion.HTTP_1_0);
_stream.set(stream);
_httpChannel.setHttpStream(stream);
}
Expand All @@ -1054,12 +1054,7 @@ public void badMessage(HttpException failure)
// This is also done by HttpChannel.onFailure(), but here we can build
// a request with more information, such as the method, the URI, etc.
if (_httpChannel.getRequest() == null)
{
HttpURI uri = stream._uri;
if (uri.hasViolations())
uri = HttpURI.from("/badURI");
_httpChannel.onRequest(new MetaData.Request(_parser.getBeginNanoTime(), stream._method, uri, stream._version, HttpFields.EMPTY));
}
_httpChannel.onRequest(new MetaData.Request(_parser.getBeginNanoTime(), stream._method, stream._uri, stream._version, HttpFields.EMPTY));

Runnable task = _httpChannel.onFailure(_failure);
if (task != null)
Expand Down
Loading

0 comments on commit 2d9ef61

Please sign in to comment.