]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
webui: streaming - implement properly HEAD request for streaming URLs, fixes #2999
authorJaroslav Kysela <perex@perex.cz>
Mon, 6 Jul 2015 19:58:39 +0000 (21:58 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 8 Jul 2015 09:44:56 +0000 (11:44 +0200)
src/webui/webui.c

index c11cdc3f79cbf8cdd3e26596cfefb0bbd221f0a6..983b2c64cd83f8fc4b49c9b9ac8100ea6e52ad1c 100644 (file)
@@ -260,6 +260,7 @@ http_stream_run(http_connection_t *hc, profile_chain_t *prch,
   struct timeval  tp;
   int err = 0;
   socklen_t errlen = sizeof(err);
+  int64_t mono;
 
   if(muxer_open_stream(mux, hc->hc_fd))
     run = 0;
@@ -322,9 +323,21 @@ http_stream_run(http_connection_t *hc, profile_chain_t *prch,
     case SMT_START:
       grace = 10;
       if(!started) {
-        tvhlog(LOG_DEBUG, "webui",  "Start streaming %s", hc->hc_url_orig);
+        tvhlog(LOG_DEBUG, "webui", "%s streaming %s",
+               hc->hc_no_output ? "Probe" : "Start", hc->hc_url_orig);
         http_output_content(hc, muxer_mime(mux, sm->sm_data));
 
+        if (hc->hc_no_output) {
+          streaming_msg_free(sm);
+          mono = getmonoclock() + 2000000;
+          while (getmonoclock() < mono) {
+            if (getsockopt(hc->hc_fd, SOL_SOCKET, SO_ERROR, (char *)&err, &errlen) || err)
+              break;
+            usleep(50000);
+          }
+          return;
+        }
+
         if(muxer_init(mux, sm->sm_data, name) < 0)
           run = 0;