Create combine HTTP/HTTPS handler for proxy service, as in (Option to make Connect Proxy work with HTTP traffic?), but during the tests, get error, which I can't understand.
NIO/NIOAny.swift:200: Fatal error: tried to decode as type HTTPPart<HTTPRequestHead, ByteBuffer> but found IOData with contents ioData(IOData { ByteBuffer { readerIndex: 1104, writerIndex: 1917, readableBytes: 813, capacity: 2048, slice: _ByteBufferSlice { 0..<2048 }, storage: 0x0000000107131400 (2048 bytes) } })
Sometimes it appeared in HttpHttpsHandler func channelRead(), on trying to unwrap input data
stack trace
Crashed: NIO-ELT-#2
0 libswiftCore.dylib 0x3a514 assertionFailure(::file:line:flags:) + 304
1 cora-tunnel 0xc964 specialized NIOAny.forceAsOther(type:) + 4344695140
2 cora-tunnel 0xc604 specialized NIOAny.forceAs(type:) + 4344694276
3 cora-tunnel 0x6ad8 HttpHttpsConnectHandler.channelRead(context:data:) + 81 (HttpHttpsConnectHandler.swift:81)
4 NIO 0x28934 ChannelHandlerContext.invokeChannelRead(:) + 1332 (ChannelPipeline.swift:1332)
5 NIO 0x2895c ChannelHandlerContext.invokeChannelRead(:) + 1330 (ChannelPipeline.swift:1330)
6 NIO 0x25458 ChannelHandlerContext.fireChannelRead(:) + 1141 (ChannelPipeline.swift:1141)
7 NIOHTTP1 0x7c04 HTTPDecoder.decodeLast(context:buffer:seenEOF:) + 617 (HTTPDecoder.swift:617)
8 NIOHTTP1 0x7d0c protocol witness for ByteToMessageDecoder.decodeLast(context:buffer:seenEOF:) in conformance HTTPDecoder<A, B> + 4353162508 (:4353162508)
9 NIO 0x38238 ByteToMessageHandler.decodeLoop(context:decodeMode:) + 456 (Codec.swift:456)
10 NIO 0x37c98 ByteToMessageHandler.processLeftovers(context:) + 427 (Codec.swift:427)
11 NIO 0x38b2c ByteToMessageHandler.channelInactive(context:) + 1136 (ChannelPipeline.swift:1136)
12 NIO 0x28844 ChannelHandlerContext.invokeChannelInactive() + 1322 (ChannelPipeline.swift:1322)
Another pleace is GlueHandlers partnerWrite(_:)
NIO/NIOAny.swift:200: Fatal error: tried to decode as type HTTPPart<HTTPRequestHead, IOData> but found HTTPPart<HTTPRequestHead, ByteBuffer> with contents other(NIOHTTP1.HTTPPart<NIOHTTP1.HTTPRequestHead, NIO.ByteBuffer>.head(HTTPRequestHead { method: GET, uri: "http://testingmcafeesites.com/favicon.ico", version: HTTP/1.1, headers: [(name: "Host", value: "testingmcafeesites.com"), (name: "Proxy-Connection", value: "keep-alive"), (name: "Accept", value: "image/*;q=0.8"), (name: "User-Agent", value: "Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/96.0 Mobile/15E148 Safari/605.1.15"), (name: "Accept-Language", value: "en-GB,en;q=0.9"), (name: "Accept-Encoding", value: "gzip, deflate"), (name: "Connection", value: "keep-alive")] }))
Stacktrace
Crashed: NIO-ELT-#1
0 libswiftCore.dylib 0x3a514 assertionFailure(::file:line:flags:) + 304
1 NIO 0xb47f0 $s3NIO6NIOAnyV12forceAsOther4typexxm_tlF + 1784
2 NIO 0xb4af4 $s3NIO6NIOAnyV7forceAs4typexxm_tlF + 660
3 NIO 0x108b2c $s3NIO22ChannelOutboundHandlerPAAE06unwrapC2Iny0cF0QzAA6NIOAnyVF + 112
4 NIO 0x669c4 $s3NIO20ByteToMessageHandlerCA2A014WriteObservingbcD7DecoderRzrlE5write7context4data7promiseyAA07ChannelE7ContextC_AA6NIOAnyVAA16EventLoopPromiseVyytGSgtF + 724
5 NIO 0x66dc8 $s3NIO20ByteToMessageHandlerCyxGAA016_ChannelOutboundE0A2A014WriteObservingbcD7DecoderRzrlAaEP5write7context4data7promiseyAA0fE7ContextC_AA6NIOAnyVAA16EventLoopPromiseVyytGSgtFTW + 16
6 NIO 0x4ba5c $s3NIO21ChannelHandlerContextC11invokeWrite33_EEC863903996E9F191EBAFEB0FB0DFDDLL_7promiseyAA6NIOAnyV_AA16EventLoopPromiseVyytGSgtF + 1036
7 NIO 0x50cec $s3NIO21ChannelHandlerContextC5write_7promiseyAA6NIOAnyV_AA16EventLoopPromiseVyytGSgtF + 156
8 cora-tunnel 0x2e4a4 GlueHandler.partnerWrite(:) + 56 (GlueHandler.swift:56)
9 cora-tunnel 0x31a24 GlueHandler.channelRead(context:data:) + 127 (GlueHandler.swift:127)
Why is this error can occurred, and what are ways to handle it?
reference to HttpHttpsHandler - GitHub - YuriyNess/SwiftNIO-Http-Https-handler: Http/Https-handler