summaryrefslogtreecommitdiff
path: root/libavformat/http.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-01-30 02:17:51 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-02-02 04:16:50 +0100
commitfe3fed0b143ef6bf2d9b65ce05d55aba4224429e (patch)
tree45ead8f324a1e5190ea4905cb574325a3d9196bd /libavformat/http.c
parent1dba8371d93cf1c83bcd5c432d921905206a60f3 (diff)
Update demuxers and protocols for protocol whitelist support
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/http.c')
-rw-r--r--libavformat/http.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index a1f1807550..a06e36671e 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -219,8 +219,9 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options)
ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
if (!s->hd) {
- err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, options);
+ err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE,
+ &h->interrupt_callback, options,
+ h->protocol_whitelist);
if (err < 0)
return err;
}
@@ -453,8 +454,10 @@ static int http_listen(URLContext *h, const char *uri, int flags,
NULL);
if ((ret = av_dict_set_int(options, "listen", s->listen, 0)) < 0)
goto fail;
- if ((ret = ffurl_open(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, options)) < 0)
+ if ((ret = ffurl_open_whitelist(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
+ &h->interrupt_callback, options,
+ h->protocol_whitelist
+ )) < 0)
goto fail;
s->handshake_step = LOWER_PROTO;
if (s->listen == HTTP_SINGLE) { /* single client */
@@ -1519,6 +1522,7 @@ URLProtocol ff_http_protocol = {
.priv_data_size = sizeof(HTTPContext),
.priv_data_class = &http_context_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
+ .default_whitelist = "http,https,tls,rtp,tcp,udp"
};
#endif /* CONFIG_HTTP_PROTOCOL */
@@ -1537,6 +1541,7 @@ URLProtocol ff_https_protocol = {
.priv_data_size = sizeof(HTTPContext),
.priv_data_class = &https_context_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
+ .default_whitelist = "http,https,tls,rtp,tcp,udp"
};
#endif /* CONFIG_HTTPS_PROTOCOL */
@@ -1575,8 +1580,9 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags)
ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port,
NULL);
redo:
- ret = ffurl_open(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, NULL);
+ ret = ffurl_open_whitelist(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
+ &h->interrupt_callback, NULL,
+ h->protocol_whitelist);
if (ret < 0)
return ret;