From: Jaroslav Kysela Date: Mon, 6 Jul 2015 19:58:39 +0000 (+0200) Subject: webui: streaming - implement properly HEAD request for streaming URLs, fixes #2999 X-Git-Tag: v4.0.6~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e43936ecce34f1f633ec9fa5d7ffa40da3c822c6;p=thirdparty%2Ftvheadend.git webui: streaming - implement properly HEAD request for streaming URLs, fixes #2999 --- diff --git a/src/webui/webui.c b/src/webui/webui.c index c11cdc3f7..983b2c64c 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -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;