]> git.sesse.net Git - ffmpeg/commitdiff
avformat/tls_schannel: always decrypt all received data
authorJan Ekström <jeebjp@gmail.com>
Tue, 12 May 2020 21:27:58 +0000 (00:27 +0300)
committerJan Ekström <jeebjp@gmail.com>
Wed, 13 May 2020 14:05:23 +0000 (17:05 +0300)
The dec_buf seems to be properly managed between read calls,
and we have no logic to decrypt before attempting socket I/O.
Thus - until now - such data would not be decrypted in case of
connections such as HTTP keep-alive, as the recv call would
always get executed first, block until rw_timeout, and then get
retried by retry_transfer_wrapper.

Thus - if data is received - decrypt all of it right away. This way
it is available for the following requests in case they can be
satisfied with it.

libavformat/tls_schannel.c

index 4f0badcb8dde3ae0c406bf46fe1b5c362b5eeebb..7a8842e7fe47f64d602f22f1ceb1499a6183c327 100644 (file)
@@ -424,7 +424,7 @@ static int tls_read(URLContext *h, uint8_t *buf, int len)
         c->enc_buf_offset += ret;
     }
 
-    while (c->enc_buf_offset > 0 && sspi_ret == SEC_E_OK && c->dec_buf_offset < len) {
+    while (c->enc_buf_offset > 0 && sspi_ret == SEC_E_OK) {
         /*  input buffer */
         init_sec_buffer(&inbuf[0], SECBUFFER_DATA, c->enc_buf, c->enc_buf_offset);