[vlc-commits] https: make HTTP/2 ALPN flag an input/output parameter
Rémi Denis-Courmont
git at videolan.org
Wed Jan 13 21:49:51 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jan 13 21:58:08 2016 +0200| [16847983e25f19cf8c617664ccfcf19d6602b0f6] | committer: Rémi Denis-Courmont
https: make HTTP/2 ALPN flag an input/output parameter
This enables forcing HTTP/1 (for proxies).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=16847983e25f19cf8c617664ccfcf19d6602b0f6
---
modules/access/http/connmgr.c | 11 +++++------
modules/access/http/transport.c | 2 +-
modules/access/http/tunnel.c | 4 ++--
modules/access/http/tunnel_test.c | 2 +-
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/modules/access/http/connmgr.c b/modules/access/http/connmgr.c
index b7a3808..7a0e4b1 100644
--- a/modules/access/http/connmgr.c
+++ b/modules/access/http/connmgr.c
@@ -39,7 +39,7 @@ struct vlc_https_connecting
vlc_tls_creds_t *creds;
const char *host;
unsigned port;
- bool http2;
+ bool *http2;
vlc_sem_t done;
};
@@ -71,12 +71,12 @@ static void *vlc_https_connect_thread(void *data)
char *proxy = vlc_https_proxy_find(c->host, c->port);
if (proxy != NULL)
{
- tls = vlc_https_connect_proxy(c->creds, c->host, c->port, &c->http2,
+ tls = vlc_https_connect_proxy(c->creds, c->host, c->port, c->http2,
proxy);
free(proxy);
}
else
- tls = vlc_https_connect(c->creds, c->host, c->port, &c->http2);
+ tls = vlc_https_connect(c->creds, c->host, c->port, c->http2);
vlc_sem_post(&c->done);
return tls;
}
@@ -92,6 +92,7 @@ static vlc_tls_t *vlc_https_connect_i11e(vlc_tls_creds_t *creds,
c.creds = creds;
c.host = host;
c.port = port;
+ c.http2 = http_two;
vlc_sem_init(&c.done, 0);
if (vlc_clone(&th, vlc_https_connect_thread, &c,
@@ -108,8 +109,6 @@ static vlc_tls_t *vlc_https_connect_i11e(vlc_tls_creds_t *creds,
if (res == VLC_THREAD_CANCELED)
res = NULL;
- if (res != NULL)
- *http_two = c.http2;
return res;
}
@@ -229,7 +228,7 @@ static struct vlc_http_msg *vlc_https_request(struct vlc_http_mgr *mgr,
if (resp != NULL)
return resp; /* existing connection reused */
- bool http2;
+ bool http2 = true;
vlc_tls_t *tls = vlc_https_connect_i11e(mgr->creds, host, port, &http2);
if (tls == NULL)
return NULL;
diff --git a/modules/access/http/transport.c b/modules/access/http/transport.c
index 81ca4c2..5b737f9 100644
--- a/modules/access/http/transport.c
+++ b/modules/access/http/transport.c
@@ -136,7 +136,7 @@ vlc_tls_t *vlc_https_connect(vlc_tls_creds_t *creds, const char *name,
char *alp;
vlc_tls_t *tls = vlc_tls_ClientSessionCreateFD(creds, fd, name, "https",
- alpn, &alp);
+ alpn + !*two, &alp);
if (tls == NULL)
{
net_Close(fd);
diff --git a/modules/access/http/tunnel.c b/modules/access/http/tunnel.c
index 1ea7cee..42cc237 100644
--- a/modules/access/http/tunnel.c
+++ b/modules/access/http/tunnel.c
@@ -168,8 +168,8 @@ vlc_tls_t *vlc_https_connect_proxy(vlc_tls_creds_t *creds,
session->close = vlc_http_tls_close_ignore;
vlc_http_msg_destroy(resp); /* <- session is destroyed here */
- session = vlc_tls_ClientSessionCreateFD(creds, fd, hostname, "https", alpn,
- &alp);
+ session = vlc_tls_ClientSessionCreateFD(creds, fd, hostname, "https",
+ alpn + !*two, &alp);
#endif
if (session == NULL)
{
diff --git a/modules/access/http/tunnel_test.c b/modules/access/http/tunnel_test.c
index 75e6eaf..7e59980 100644
--- a/modules/access/http/tunnel_test.c
+++ b/modules/access/http/tunnel_test.c
@@ -129,7 +129,7 @@ int main(void)
{
char *url;
unsigned port;
- bool two;
+ bool two = false;
/* Test bad URLs */
vlc_https_connect_proxy(NULL, "www.example.com", 0, &two,
More information about the vlc-commits
mailing list