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) {
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:
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:
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;
{
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, ':'))