[vlc-commits] https: send CANCEL error if closing before end-of-stream

Rémi Denis-Courmont git at videolan.org
Fri Dec 18 21:07:45 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Dec 18 21:11:51 2015 +0200| [0c73679a0dd9e42df5ef52bfe5e8b0b68a8be335] | committer: Rémi Denis-Courmont

https: send CANCEL error if closing before end-of-stream

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0c73679a0dd9e42df5ef52bfe5e8b0b68a8be335
---

 modules/access/http/h2conn.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/access/http/h2conn.c b/modules/access/http/h2conn.c
index 0199b51..ad4d421 100644
--- a/modules/access/http/h2conn.c
+++ b/modules/access/http/h2conn.c
@@ -309,11 +309,12 @@ static block_t *vlc_h2_stream_read(struct vlc_http_stream *stream)
  * Sends an HTTP/2 stream reset, removes the stream from the HTTP/2 connection
  * and deletes any stream resource.
  */
-static void vlc_h2_stream_close(struct vlc_http_stream *stream, bool abort)
+static void vlc_h2_stream_close(struct vlc_http_stream *stream, bool aborted)
 {
     struct vlc_h2_stream *s = (struct vlc_h2_stream *)stream;
     struct vlc_h2_conn *conn = s->conn;
     bool destroy = false;
+    uint_fast32_t code = VLC_H2_NO_ERROR;
 
     vlc_mutex_lock(&conn->lock);
     if (s->older != NULL)
@@ -328,7 +329,11 @@ static void vlc_h2_stream_close(struct vlc_http_stream *stream, bool abort)
     }
     vlc_mutex_unlock(&conn->lock);
 
-    vlc_h2_stream_error(conn, s->id, abort ? VLC_H2_CANCEL : VLC_H2_NO_ERROR);
+    if (s->recv_hdr != NULL || s->recv_head != NULL || !s->recv_end)
+        code = VLC_H2_CANCEL;
+    (void) aborted;
+
+    vlc_h2_stream_error(conn, s->id, code);
 
     if (s->recv_hdr != NULL)
         vlc_http_msg_destroy(s->recv_hdr);



More information about the vlc-commits mailing list