[vlc-commits] http: always fill Accept-Language, test it
Rémi Denis-Courmont
git at videolan.org
Tue Mar 1 06:57:41 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 1 06:37:48 2016 +0200| [2ae9ae70858daa51a7ff9b867f645e6ac3062f59] | committer: Rémi Denis-Courmont
http: always fill Accept-Language, test it
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ae9ae70858daa51a7ff9b867f645e6ac3062f59
---
modules/access/http/file_test.c | 3 ++-
modules/access/http/resource.c | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/modules/access/http/file_test.c b/modules/access/http/file_test.c
index 977eddd..b0e585d 100644
--- a/modules/access/http/file_test.c
+++ b/modules/access/http/file_test.c
@@ -300,7 +300,8 @@ struct vlc_http_msg *vlc_http_mgr_request(struct vlc_http_mgr *mgr, bool https,
str = vlc_http_msg_get_header(req, "Accept");
assert(str == NULL || strstr(str, "*/*") != NULL);
str = vlc_http_msg_get_header(req, "Accept-Language");
- assert(str == NULL || strstr(str, "*") != NULL);
+ /* This test case does not call setlocale(), so en_US can be assumed. */
+ assert(str != NULL && strncmp(str, "en_US", 5) == 0);
str = vlc_http_msg_get_header(req, "Range");
assert(str != NULL && !strncmp(str, "bytes=", 6)
diff --git a/modules/access/http/resource.c b/modules/access/http/resource.c
index e3a4e06..309b5c9 100644
--- a/modules/access/http/resource.c
+++ b/modules/access/http/resource.c
@@ -50,9 +50,9 @@ vlc_http_res_req(const struct vlc_http_resource *res)
vlc_http_msg_add_header(req, "Accept", "*/*");
const char *lang = vlc_gettext("C");
- if (strcmp(lang, "C"))
- vlc_http_msg_add_header(req, "Accept-Language",
- "%s, *;q=0.5", lang);
+ if (!strcmp(lang, "C"))
+ lang = "en_US";
+ vlc_http_msg_add_header(req, "Accept-Language", "%s, *;q=0.5", lang);
/* Authentication */
/* TODO: authentication */
More information about the vlc-commits
mailing list