wcmd = TAILQ_FIRST(&hc->hc_wqueue);
if (wcmd)
http_client_cmd_destroy(hc, wcmd);
- if (hc->hc_version != RTSP_VERSION_1_0 &&
- hc->hc_handle_location &&
+ if (hc->hc_handle_location &&
(hc->hc_code == HTTP_STATUS_MOVED ||
hc->hc_code == HTTP_STATUS_FOUND ||
hc->hc_code == HTTP_STATUS_SEE_OTHER ||
http_client_flush(hc, 0);
- http_arg_init(&h);
- hc->hc_hdr_create(hc, &h, u, 0);
hc->hc_reconnected = 1;
hc->hc_shutdown = 0;
hc->hc_pevents = 0;
hc->hc_version = ver;
- r = http_client_send(hc, hc->hc_cmd, u->path, u->query, &h, NULL, 0);
+ if (ver != RTSP_VERSION_1_0) {
+ http_arg_init(&h);
+ hc->hc_hdr_create(hc, &h, u, 0);
+ r = http_client_send(hc, hc->hc_cmd, u->path, u->query, &h, NULL, 0);
+ } else
+ r = http_client_send(hc, hc->hc_cmd, u->raw, u->query, NULL, NULL, 0);
if (r < 0)
return r;
{
iptv_mux_t *im = hc->hc_aux;
rtsp_priv_t *rp;
- url_t url;
int r;
char *p;
return 0;
}
- if (hc->hc_cmd == RTSP_CMD_DESCRIBE && hc->hc_code != HTTP_STATUS_OK && hc->hc_code != HTTP_STATUS_SEE_OTHER) {
+ if (hc->hc_cmd == RTSP_CMD_DESCRIBE && hc->hc_code != HTTP_STATUS_OK &&
+ !(hc->hc_code == HTTP_STATUS_MOVED ||
+ hc->hc_code == HTTP_STATUS_FOUND ||
+ hc->hc_code == HTTP_STATUS_SEE_OTHER ||
+ hc->hc_code == HTTP_STATUS_NOT_MODIFIED)) {
tvherror(LS_IPTV, "DESCRIBE request returned an invalid error code (%d) for '%s', "
"fall back to GET_PARAMETER in keep alive loop.", hc->hc_code, im->mm_iptv_url_raw);
hc->hc_rtsp_keep_alive_cmd = RTSP_CMD_GET_PARAMETER;
switch (hc->hc_cmd) {
case RTSP_CMD_DESCRIBE:
- if(rp->play) {
+ if (rp->play) {
// Already active, most probably a keep-alive response
break;
}
- if (hc->hc_code == HTTP_STATUS_SEE_OTHER) {
+ if (hc->hc_code == HTTP_STATUS_MOVED ||
+ hc->hc_code == HTTP_STATUS_FOUND ||
+ hc->hc_code == HTTP_STATUS_SEE_OTHER ||
+ hc->hc_code == HTTP_STATUS_NOT_MODIFIED) {
+ // Redirect from RTSP server
if (!hc->hc_handle_location) {
- tvherror(LS_IPTV, "received code 303 from RTSP server but redirects disabled '%s'",
- im->mm_iptv_url_raw);
+ tvherror(LS_IPTV, "received code %d from RTSP server but redirects disabled '%s'",
+ hc->hc_code, im->mm_iptv_url_raw);
return -1;
}
- // Redirect from RTSP server, parse new location and use that instead
p = http_arg_get(&hc->hc_args, "Location");
if (p == NULL) {
- tvherror(LS_IPTV, "received code 303 from RTSP server but no new location given for '%s'",
- im->mm_iptv_url_raw);
- return -1;
- }
- tvhinfo(LS_IPTV, "received new location from RTSP server '%s' was '%s'", p,
- im->mm_iptv_url_raw);
- urlinit(&url);
- if (urlparse(p, &url) || strncmp(url.scheme, "rtsp", 4) != 0) {
- tvherror(LS_IPTV, "%s - invalid URL [%s]", im->mm_nicename, p);
- return -1;
- }
- if(rp->path)
- free(rp->path);
- if(rp->query)
- free(rp->query);
- rp->path = strdup(url.path ? : "");
- rp->query = strdup(url.query ? : "");
- urlreset(&url);
- r = rtsp_describe(hc, rp->path, rp->query);
- if (r < 0) {
- tvherror(LS_IPTV, "rtsp: DESCRIBE failed");
+ tvherror(LS_IPTV, "received code %d from RTSP server but no new location given for '%s'",
+ hc->hc_code, im->mm_iptv_url_raw);
return -1;
}
+ tvhinfo(LS_IPTV, "received new location from RTSP server (code: %d) '%s' was '%s'",
+ hc->hc_code, p, im->mm_iptv_url_raw);
}
break;
case RTSP_CMD_SETUP: