[vlc-commits] http: tests HTTP Basic formatter
Rémi Denis-Courmont
git at videolan.org
Sun Apr 3 17:26:57 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 3 18:26:19 2016 +0300| [7386c49a895813656fa85776f4aaf595d7c3c50d] | committer: Rémi Denis-Courmont
http: tests HTTP Basic formatter
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7386c49a895813656fa85776f4aaf595d7c3c50d
---
modules/access/http/message_test.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/modules/access/http/message_test.c b/modules/access/http/message_test.c
index 1677dba..74ceb8f 100644
--- a/modules/access/http/message_test.c
+++ b/modules/access/http/message_test.c
@@ -216,6 +216,14 @@ int main(void)
assert(vlc_http_msg_add_time(m, "Last-Modified", &t) == 0);
assert(t == vlc_http_msg_get_mtime(m));
+ assert(vlc_http_msg_add_creds_basic(m, false,
+ "Aladdin", "open sesame") == 0);
+ assert(vlc_http_msg_add_creds_basic(m, true, "test", "123£") == 0);
+ str = vlc_http_msg_get_header(m, "Authorization");
+ assert(str != NULL && !strcmp(str, "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="));
+ str = vlc_http_msg_get_header(m, "Proxy-Authorization");
+ assert(str != NULL && !strcmp(str, "Basic dGVzdDoxMjPCow=="));
+
vlc_http_msg_add_header(m, "Content-Length", "1234");
assert(vlc_http_msg_get_size(m) == 1234);
@@ -275,6 +283,10 @@ int main(void)
assert(vlc_http_msg_add_agent(m, "Bad/1.0 \"Evil\"") != 0);
assert(vlc_http_msg_add_agent(m, "(Hello world)") != 0);
+ assert(vlc_http_msg_add_creds_basic(m, false, "User:name", "12345") != 0);
+ assert(vlc_http_msg_add_creds_basic(m, false, "Alice\nand\nbob", "") != 0);
+ assert(vlc_http_msg_add_creds_basic(m, false, "john", "asdfg\x7f") != 0);
+
vlc_http_msg_destroy(m);
const char *bad1[][2] = {
More information about the vlc-commits
mailing list