[vlc-commits] http: HTTP/1.1 payload write function

Rémi Denis-Courmont git at videolan.org
Sun Oct 4 12:26:25 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct  4 10:52:14 2020 +0300| [8744fcbd08d563372491690b6d686a798523628f] | committer: Rémi Denis-Courmont

http: HTTP/1.1 payload write function

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

 modules/access/http/h1conn.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/modules/access/http/h1conn.c b/modules/access/http/h1conn.c
index ee7072793b..1a3cb9fb14 100644
--- a/modules/access/http/h1conn.c
+++ b/modules/access/http/h1conn.c
@@ -228,6 +228,22 @@ static struct vlc_http_msg *vlc_h1_stream_wait(struct vlc_http_stream *stream)
     return resp;
 }
 
+static ssize_t vlc_h1_stream_write(struct vlc_http_stream *stream,
+                                   const void *base, size_t length, bool eos)
+{
+    struct vlc_h1_conn *conn = vlc_h1_stream_conn(stream);
+
+    assert(conn->active);
+
+    if (conn->conn.tls == NULL)
+    {
+        errno = EPIPE;
+        return -1;
+    }
+
+    return vlc_https_chunked_write(conn->conn.tls, base, length, eos);
+}
+
 static block_t *vlc_h1_stream_read(struct vlc_http_stream *stream)
 {
     struct vlc_h1_conn *conn = vlc_h1_stream_conn(stream);
@@ -286,7 +302,7 @@ static void vlc_h1_stream_close(struct vlc_http_stream *stream, bool abort)
 static const struct vlc_http_stream_cbs vlc_h1_stream_callbacks =
 {
     vlc_h1_stream_wait,
-    NULL,
+    vlc_h1_stream_write,
     vlc_h1_stream_read,
     vlc_h1_stream_close,
 };



More information about the vlc-commits mailing list