ignore frames that don't have a HTTP/1 equivalent (#146)

Motivation:

Previously, the H2to1 codec would crash if for example a push promise
came by.

Modifications:

Instead of crashing, ignore the frames without equivalent.

Result:

Fewer crashes.
This commit is contained in:
Johannes Weiss authored and Cory Benfield committed 2019-07-18 17:04:27 +01:00
1 parent 17434a9658
commit 7de397fda8
3 files changed
+25 -5

No files matched your search

+2 -5
View File
@@ -79,12 +79,9 @@ public final class HTTP2ToHTTP1ClientCodec: ChannelInboundHandler, ChannelOutbou
if content.endStream {
context.fireChannelRead(self.wrapInboundOut(.end(nil)))
}
case .alternativeService, .rstStream, .priority, .windowUpdate:
// All these frames may be sent on a stream, but are ignored by the multiplexer and will be
// handled elsewhere.
case .alternativeService, .rstStream, .priority, .windowUpdate, .settings, .pushPromise, .ping, .goAway, .origin:
// These don't have an HTTP/1 equivalent, so let's drop them.
return
default:
fatalError("unimplemented frame \(frame)")
}
}