]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
SATIP server: changes for VLC 3
authorJaroslav Kysela <perex@perex.cz>
Sat, 24 Feb 2018 17:59:24 +0000 (18:59 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sat, 24 Feb 2018 17:59:24 +0000 (18:59 +0100)
src/http.c
src/satip/rtsp.c

index 59d91e24c1262b5b3d08c24c302883fda1db28f3..7232f29308851db045f25835f9800605f0323c57 100644 (file)
@@ -659,9 +659,10 @@ http_error(http_connection_t *hc, int error)
       level = LOG_DEBUG;
     else if (error == HTTP_STATUS_BAD_REQUEST || error > HTTP_STATUS_UNAUTHORIZED)
       level = LOG_ERR;
-    tvhlog(level, hc->hc_subsys, "%s: %s %s %s -- %d",
+    if (hc->hc_cmd == 6 && strstr(hc->hc_url, "&pids")) abort();
+    tvhlog(level, hc->hc_subsys, "%s: %s %s (%d) %s -- %d",
           hc->hc_peer_ipstr, http_ver2str(hc->hc_version),
-           http_cmd2str(hc->hc_cmd), hc->hc_url, error);
+           http_cmd2str(hc->hc_cmd), hc->hc_cmd, hc->hc_url, error);
   }
 
   if (hc->hc_version != RTSP_VERSION_1_0) {
@@ -1386,19 +1387,16 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill)
   case RTSP_VERSION_1_0:
     hc->hc_keep_alive = 1;
     /* Extract CSeq */
-    if((v = http_arg_get(&hc->hc_args, "CSeq")) != NULL)
+    if((v = http_arg_get(&hc->hc_args, "CSeq")) != NULL) {
       hc->hc_cseq = strtoll(v, NULL, 10);
-    else
+    } else {
       hc->hc_cseq = 0;
+    }
     free(hc->hc_session);
     if ((v = http_arg_get(&hc->hc_args, "Session")) != NULL)
       hc->hc_session = tvh_strdupa(v);
     else
       hc->hc_session = NULL;
-    if(hc->hc_cseq == 0) {
-      http_error(hc, HTTP_STATUS_BAD_REQUEST);
-      return -1;
-    }
     break;
 
   case HTTP_VERSION_1_0:
@@ -1458,10 +1456,7 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill)
   case RTSP_VERSION_1_0:
     if (tvhtrace_enabled())
       dump_request(hc);
-    if (hc->hc_cseq)
-      rval = hc->hc_process(hc, spill);
-    else
-      http_error(hc, HTTP_STATUS_HTTP_VERSION);
+    rval = hc->hc_process(hc, spill);
     break;
 
   case HTTP_VERSION_1_0:
index 50086d15668779464b9976a6df7d0baa72006877..cfab4fdb8424caa926d01fb334b42c5e28991fda 100644 (file)
@@ -1081,6 +1081,8 @@ rtsp_parse_cmd
     rs->rtp_peer_port = r;
     rs->frontend = fe > 0 ? fe : 1;
   } else {
+    if (!rs && !stream && cmd == RTSP_CMD_DESCRIBE)
+      rs = rtsp_new_session(hc->hc_peer_ipstr, msys, 0, -1);
     if (!rs || stream != rs->stream) {
       if (rs)
         errcode = HTTP_STATUS_NOT_FOUND;
@@ -1358,7 +1360,8 @@ rtsp_describe_session(session_t *rs, htsbuf_queue_t *q)
 {
   char buf[4096];
 
-  htsbuf_qprintf(q, "a=control:stream=%d\r\n", rs->stream);
+  if (rs->stream > 0)
+    htsbuf_qprintf(q, "a=control:stream=%d\r\n", rs->stream);
   htsbuf_qprintf(q, "a=tool:%s\r\n", config_get_http_server_name());
   htsbuf_append_str(q, "m=video 0 RTP/AVP 33\r\n");
   if (strchr(rtsp_ip, ':'))