-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement de/compression in Http2ServerHandler #10660
Conversation
- Decompression implemented through DelegatingDecompressorFrameListener because backpressure is a bit awkward otherwise - Compression implemented through custom code because we need it for the compression config options we provide - Merged DecompressionSpec into CompressionSpec - Moved CompressionSpec to micronaut HTTP client (for HTTP/3 support) - Added subclasses of CompressionSpec for HTTP/2 and HTTP/3
Quality Gate failedFailed conditions |
@@ -52,6 +57,8 @@ final class Compressor { | |||
private final SnappyOptions snappyOptions; | |||
|
|||
Compressor(HttpCompressionStrategy strategy) { | |||
assert strategy.isEnabled(); |
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.
should we raise a ConfigurationException instead?
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.
it's only a sanity check, the callers do not invoke the constructor at all in this case
if (!finished) { | ||
try { | ||
compressionChannel.finishAndReleaseAll(); | ||
} catch (DecompressionException ignored) { |
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.
should not we log this exception?
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.
this happens when a user closes a connection so we want to avoid log spam from half-finished data
@@ -92,6 +108,48 @@ class CompressionSpec extends Specification { | |||
-1 | 10000 | false | |||
} | |||
|
|||
def decompression(ChannelHandler compressor, CharSequence contentEncoding) { | |||
given: | |||
def ctx = ApplicationContext.run(['spec.name': 'CompressionSpec'] + serverOptions()) |
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.
def ctx = ApplicationContext.run(['spec.name': 'CompressionSpec'] + serverOptions()) | |
EmbeddedServer server = ApplicationContext.run(EmbeddedServer, ['spec.name': 'CompressionSpec'] + serverOptions()) |
def decompression(ChannelHandler compressor, CharSequence contentEncoding) { | ||
given: | ||
def ctx = ApplicationContext.run(['spec.name': 'CompressionSpec'] + serverOptions()) | ||
def server = ctx.getBean(EmbeddedServer).start() |
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.
def server = ctx.getBean(EmbeddedServer).start() |
given: | ||
def ctx = ApplicationContext.run(['spec.name': 'CompressionSpec'] + serverOptions()) | ||
def server = ctx.getBean(EmbeddedServer).start() | ||
def client = ctx.createBean(HttpClient, server.URI).toBlocking() |
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.
def client = ctx.createBean(HttpClient, server.URI).toBlocking() | |
def client = server.applicationContext.createBean(HttpClient, server.URI).toBlocking() |
cleanup: | ||
client.close() | ||
server.stop() | ||
ctx.close() |
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.
ctx.close() | |
server.close() |
|
||
cleanup: | ||
client.close() | ||
server.stop() |
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.
server.stop() |
Not scheduled to a project, it can go to 4.4 or 4.5 it doesn't matter