-
Notifications
You must be signed in to change notification settings - Fork 2k
Issue #12806 - Overhaul ComplianceViolation.Listener reporting #14090
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
base: jetty-12.1.x
Are you sure you want to change the base?
Issue #12806 - Overhaul ComplianceViolation.Listener reporting #14090
Conversation
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/HttpQuotedCSV.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/HttpQuotedQualityCSV.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/HttpQuotedQualityCSV.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/HttpCompliance.java
Outdated
Show resolved
Hide resolved
gregw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking better, but still work to do.
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CookieCache.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CookieCache.java
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/CookieParser.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java
Outdated
Show resolved
Hide resolved
...ompression-server/src/main/java/org/eclipse/jetty/compression/server/CompressionHandler.java
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java
Outdated
Show resolved
Hide resolved
…806/compliance-violation-listener-cleanup
…806/compliance-violation-listener-cleanup
Very out of date review.
Using @sbordet for review.
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/ComplianceViolation.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/ComplianceViolation.java
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/ComplianceViolation.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/ComplianceViolationException.java
Show resolved
Hide resolved
jetty-core/jetty-http3/jetty-http3-server/src/main/java/module-info.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/UrlParameterViolationListener.java
Outdated
Show resolved
Hide resolved
…806/compliance-violation-listener-cleanup
Signed-off-by: Ludovic Orban <[email protected]>
… an exception or the last write is failed Signed-off-by: Ludovic Orban <[email protected]>
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/ComplianceUtils.java
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
|
|
||
| public static <T extends Throwable> void notifyAndAssert(ComplianceViolation.Mode compliance, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer the *Assert methods to be removed, as they don't add anything, and they're as verbose as just calling allowed()/notifyAndCheck() plus throwing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so you want to go from ...
if (checkCompliance(compliance, violation1, detail, error))
{
// do allowed part for violation1
}
else if (checkCompliance(compliance, violation2, detail, error))
{
// do allowed part for violation2
}to
if (allowed(compliance, violation1))
{
// do allowed part for violation1
}
else
{
throw error(violation1, detail)
}
if (allowed(compliance, violation2))
{
// do allowed part for violation2
}
else
{
throw error(violation2, detail)
}That's going to blossom the lines of code a significant bit
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/HttpCompliance.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/HttpCompliance.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormData.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/UrlParameterDecoder.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/UrlParameterDecoder.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/UrlParameterDecoder.java
Outdated
Show resolved
Hide resolved
…806/compliance-violation-listener-cleanup
… of github.com:jetty/jetty.project into fix/12.1.x/12806/compliance-violation-listener-cleanup
| boolean allowed = _complianceMode.allows(violation); | ||
| _listener.onComplianceViolation(new ComplianceViolation.Event(_complianceMode, violation, value, allowed)); | ||
| if (!allowed) | ||
| throw new BadMessageException("Invalid quoted: " + value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BadMessageException is deprecated and has been replaced by HttpException.RuntimeException.
Cleanup all code paths that perform a ComplianceViolation check to do the following ...
HttpChannelState.getCompliaceViolationListener()in all cases (this gets the benefit of a singleComplianceViolation.Listenerto use, along with all of theinitialize(),onRequestBegin(), andonRequestEnd()techniques.HttpConfigurationnotify methodsComplianceViolation.notify()static methods.Closes #12806