@@ -170,25 +170,23 @@ fn parse_app_records(
170170
171171 if let Some ( start) = find_ccs ( raw_records) {
172172 // Skip the CCS and Finished handshake message by adding 2.
173- for record in raw_records
174- . iter ( )
175- . skip ( start + 2 )
176- . filter ( |record| record. hdr . record_type == APP_DATA )
177- {
173+ for record in raw_records. iter ( ) . skip ( start + 2 ) {
178174 let mut record = split_into_record ( seq as u64 , record. data , & record. hdr . record_type ) ?;
179175
180- if let Role :: Prover = role {
181- let cipher_len = record. ciphertext . len ( ) ;
182- if app_data[ consumed..] . len ( ) >= cipher_len {
183- let plaintext = app_data[ consumed..consumed + cipher_len] . to_vec ( ) ;
184-
185- record. plaintext = Some ( plaintext) ;
186- consumed += cipher_len;
187- } else {
188- return Err ( TlsParserError :: parse ( ) . with_msg ( "insufficient plaintext data" ) ) ;
176+ if record. typ == ContentType :: ApplicationData {
177+ if let Role :: Prover = role {
178+ let cipher_len = record. ciphertext . len ( ) ;
179+ if app_data[ consumed..] . len ( ) >= cipher_len {
180+ let plaintext = app_data[ consumed..consumed + cipher_len] . to_vec ( ) ;
181+
182+ record. plaintext = Some ( plaintext) ;
183+ consumed += cipher_len;
184+ } else {
185+ return Err ( TlsParserError :: parse ( ) . with_msg ( "insufficient plaintext data" ) ) ;
186+ }
189187 }
188+ parsed_app_records. push ( record) ;
190189 }
191- parsed_app_records. push ( record) ;
192190 seq += 1 ;
193191 }
194192 }
0 commit comments