Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
http client: use similar protocol version as in original request for …
…redirects, fixes #3207
  • Loading branch information
perexg committed Oct 26, 2015
1 parent d8e8dd8 commit ae1f123
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/http.h
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 );
Expand Down
6 changes: 4 additions & 2 deletions src/httpc.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/input/mpegts/iptv/iptv_http.c
Expand Up @@ -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 {
Expand Down

0 comments on commit ae1f123

Please sign in to comment.