vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Dec 16 
22:30:18 2015 +0200| [51bd1874f7bf45848940597c3a7c89e123d0e4d5] | committer: 
Rémi Denis-Courmont

https: use revectored time functions

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

 modules/access/http/file.c |   23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/modules/access/http/file.c b/modules/access/http/file.c
index fd0830a..b9fad18 100644
--- a/modules/access/http/file.c
+++ b/modules/access/http/file.c
@@ -84,18 +84,23 @@ static struct vlc_http_msg *vlc_http_file_req(const struct 
vlc_http_file *file,
     if (file->referrer != NULL) /* TODO: validate URL */
         vlc_http_msg_add_header(req, "Referer", "%s", file->referrer);
 
-    if (file->resp != NULL
-     && (str = vlc_http_msg_get_header(file->resp, "ETag")))
+    if (file->resp != NULL)
     {
-        if (!memcmp(str, "W/", 2))
-            str += 2; /* skip weak mark */
-        vlc_http_msg_add_header(req, "If-Match", "%s", str);
+        str = vlc_http_msg_get_header(file->resp, "ETag");
+        if (str != NULL)
+        {
+            if (!memcmp(str, "W/", 2))
+                str += 2; /* skip weak mark */
+            vlc_http_msg_add_header(req, "If-Match", "%s", str);
+        }
+        else
+        {
+            time_t mtime = vlc_http_msg_get_mtime(file->resp);
+            if (mtime != -1)
+                vlc_http_msg_add_time(req, "If-Unmodified-Since", &mtime);
+        }
     }
 
-    if (file->resp != NULL
-     && (str = vlc_http_msg_get_header(file->resp, "Date")))
-        vlc_http_msg_add_header(req, "If-Unmodified-Since", "%s", str);
-
     if (vlc_http_msg_add_header(req, "Range", "bytes=%ju-", offset)
      && offset != 0)
         goto error;

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to