From: Jaroslav Kysela Date: Mon, 26 Oct 2015 11:21:18 +0000 (+0100) Subject: http client: use similar protocol version as in original request for redirects, fixes... X-Git-Tag: v4.2.1~1765 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ae1f1235810a24434422412ac46b59fcf07d21a0;p=thirdparty%2Ftvheadend.git http client: use similar protocol version as in original request for redirects, fixes #3207 --- diff --git a/src/http.h b/src/http.h index e4ec13b49..74eb1b30e 100644 --- a/src/http.h +++ b/src/http.h @@ -276,6 +276,7 @@ struct http_client { int hc_code; http_ver_t hc_version; + http_ver_t hc_redirv; http_cmd_t hc_cmd; struct http_arg_list hc_args; /* header */ @@ -361,7 +362,7 @@ int http_client_send( http_client_t *hc, http_cmd_t cmd, http_arg_list_t *header, void *body, size_t body_size ); void http_client_basic_auth( http_client_t *hc, http_arg_list_t *h, const char *user, const char *pass ); -int http_client_simple_reconnect ( http_client_t *hc, const url_t *u ); +int http_client_simple_reconnect ( http_client_t *hc, const url_t *u, http_ver_t ver ); int http_client_simple( http_client_t *hc, const url_t *url); int http_client_clear_state( http_client_t *hc ); int http_client_run( http_client_t *hc ); diff --git a/src/httpc.c b/src/httpc.c index f92b0af9b..72fcd931b 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -1142,7 +1142,7 @@ http_client_basic_args ( http_client_t *hc, http_arg_list_t *h, const url_t *url } int -http_client_simple_reconnect ( http_client_t *hc, const url_t *u ) +http_client_simple_reconnect ( http_client_t *hc, const url_t *u, http_ver_t ver ) { http_arg_list_t h; tvhpoll_t *efd; @@ -1176,6 +1176,7 @@ http_client_simple_reconnect ( http_client_t *hc, const url_t *u ) 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 (r < 0) @@ -1215,7 +1216,7 @@ http_client_redirected ( http_client_t *hc ) } free(location); - r = http_client_simple_reconnect(hc, &u); + r = http_client_simple_reconnect(hc, &u, hc->hc_redirv); urlreset(&u); return r; @@ -1339,6 +1340,7 @@ http_client_reconnect port = http_port(hc, scheme, port); hc->hc_pevents = 0; hc->hc_version = ver; + hc->hc_redirv = ver; hc->hc_scheme = strdup(scheme); hc->hc_host = strdup(host); hc->hc_port = port; diff --git a/src/input/mpegts/iptv/iptv_http.c b/src/input/mpegts/iptv/iptv_http.c index 8b6ae2a56..8149161e4 100644 --- a/src/input/mpegts/iptv/iptv_http.c +++ b/src/input/mpegts/iptv/iptv_http.c @@ -148,7 +148,7 @@ iptv_http_complete urlinit(&u); if (!urlparse(url, &u)) { hc->hc_keepalive = 0; - r = http_client_simple_reconnect(hc, &u); + r = http_client_simple_reconnect(hc, &u, HTTP_VERSION_1_1); if (r < 0) tvherror("iptv", "cannot reopen http client: %d'", r); } else {