[vlc-commits] http: test error reporting in HTTP/1.1

Rémi Denis-Courmont git at videolan.org
Tue Aug 30 15:12:59 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 30 15:52:14 2016 +0300| [1b5d9785d39ca44e81c5670050a576da1e265464] | committer: Rémi Denis-Courmont

http: test error reporting in HTTP/1.1

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

 modules/access/http/h1conn_test.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/modules/access/http/h1conn_test.c b/modules/access/http/h1conn_test.c
index 881eb5a..16968c5 100644
--- a/modules/access/http/h1conn_test.c
+++ b/modules/access/http/h1conn_test.c
@@ -221,5 +221,25 @@ int main(void)
     vlc_http_msg_destroy(m);
     conn_destroy();
 
+    /* Test HTTP/1.1 with content length, shortened by error */
+    conn_create();
+    s = stream_open();
+    assert(s != NULL);
+    conn_send("HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\n");
+    m = vlc_http_msg_get_initial(s);
+    assert(m != NULL);
+
+    conn_send("Hello ");
+    b = vlc_http_msg_read(m);
+    assert(b != NULL);
+    assert(b->i_buffer == 6);
+    assert(!memcmp(b->p_buffer, "Hello ", 6));
+    block_Release(b);
+    conn_shutdown(SHUT_RDWR);
+    b = vlc_http_msg_read(m);
+    assert(b == vlc_http_error);
+    vlc_http_msg_destroy(m);
+    conn_destroy();
+
     return 0;
 }



More information about the vlc-commits mailing list