mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-20 14:18:34 +00:00
webrtcice: Add webrtc ALPN header for HTTP proxy
Section 3.4 in RFC8835 states that if a WebRTC endpoint uses an HTTP proxy to access the Internet it MUST include the "ALPN" header. This commit adds this header. By default the ALPN used when connecting to the TURN/TCP server via a proxy is set to "webrtc". It can be changed by adding an alpn url option for the http-proxy. For example: http://user:pass@my.http.proxy.com:8080?alpn=c-webrtc This will add the header "ALPN: c-webrtc" to the HTTP proxy CONNECT request. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4212>
This commit is contained in:
parent
07b18a6de5
commit
5b64cfaca3
5 changed files with 24 additions and 12 deletions
|
@ -764,7 +764,7 @@ for more information.</doc>
|
||||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||||
<return-value transfer-ownership="full">
|
<return-value transfer-ownership="full">
|
||||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
||||||
http://[username:password@]hostname[:port]
|
http://[username:password@]hostname[:port][?alpn=<alpn>]
|
||||||
|
|
||||||
Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
||||||
<type name="utf8" c:type="gchar*"/>
|
<type name="utf8" c:type="gchar*"/>
|
||||||
|
@ -897,7 +897,7 @@ Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
||||||
</instance-parameter>
|
</instance-parameter>
|
||||||
<parameter name="uri" transfer-ownership="none">
|
<parameter name="uri" transfer-ownership="none">
|
||||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
||||||
http://[username:password@]hostname[:port]</doc>
|
http://[username:password@]hostname[:port][?alpn=<alpn>]</doc>
|
||||||
<type name="utf8" c:type="const gchar*"/>
|
<type name="utf8" c:type="const gchar*"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
@ -1144,7 +1144,7 @@ Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
||||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||||
<return-value transfer-ownership="full">
|
<return-value transfer-ownership="full">
|
||||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
||||||
http://[username:password@]hostname[:port]
|
http://[username:password@]hostname[:port][?alpn=<alpn>]
|
||||||
|
|
||||||
Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
||||||
<type name="utf8" c:type="gchar*"/>
|
<type name="utf8" c:type="gchar*"/>
|
||||||
|
@ -1287,7 +1287,7 @@ Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
||||||
</instance-parameter>
|
</instance-parameter>
|
||||||
<parameter name="uri" transfer-ownership="none">
|
<parameter name="uri" transfer-ownership="none">
|
||||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
||||||
http://[username:password@]hostname[:port]</doc>
|
http://[username:password@]hostname[:port][?alpn=<alpn>]</doc>
|
||||||
<type name="utf8" c:type="const gchar*"/>
|
<type name="utf8" c:type="const gchar*"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
@ -1833,7 +1833,7 @@ stops automatic ICE gathering.</doc>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="uri" transfer-ownership="none">
|
<parameter name="uri" transfer-ownership="none">
|
||||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
||||||
http://[username:password@]hostname[:port]</doc>
|
http://[username:password@]hostname[:port][?alpn=<alpn>]</doc>
|
||||||
<type name="utf8" c:type="const gchar*"/>
|
<type name="utf8" c:type="const gchar*"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
@ -1844,7 +1844,7 @@ stops automatic ICE gathering.</doc>
|
||||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||||
<return-value transfer-ownership="full">
|
<return-value transfer-ownership="full">
|
||||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c">URI of the HTTP proxy of the form
|
||||||
http://[username:password@]hostname[:port]
|
http://[username:password@]hostname[:port][?alpn=<alpn>]
|
||||||
|
|
||||||
Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
||||||
<type name="utf8" c:type="gchar*"/>
|
<type name="utf8" c:type="gchar*"/>
|
||||||
|
|
|
@ -237931,7 +237931,7 @@
|
||||||
"writable": false
|
"writable": false
|
||||||
},
|
},
|
||||||
"http-proxy": {
|
"http-proxy": {
|
||||||
"blurb": "A HTTP proxy for use with TURN/TCP of the form http://[username:password@]hostname[:port]",
|
"blurb": "A HTTP proxy for use with TURN/TCP of the form http://[username:password@]hostname[:port][?alpn=<alpn>]",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
"construct": false,
|
"construct": false,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
|
|
|
@ -8776,7 +8776,7 @@ gst_webrtc_bin_class_init (GstWebRTCBinClass * klass)
|
||||||
* GstWebRTCBin:http-proxy:
|
* GstWebRTCBin:http-proxy:
|
||||||
*
|
*
|
||||||
* A HTTP proxy for use with TURN/TCP of the form
|
* A HTTP proxy for use with TURN/TCP of the form
|
||||||
* http://[username:password@]hostname[:port]
|
* http://[username:password@]hostname[:port][?alpn=<alpn>]
|
||||||
*
|
*
|
||||||
* Since: 1.22
|
* Since: 1.22
|
||||||
*/
|
*/
|
||||||
|
@ -8784,7 +8784,7 @@ gst_webrtc_bin_class_init (GstWebRTCBinClass * klass)
|
||||||
PROP_HTTP_PROXY,
|
PROP_HTTP_PROXY,
|
||||||
g_param_spec_string ("http-proxy", "HTTP Proxy",
|
g_param_spec_string ("http-proxy", "HTTP Proxy",
|
||||||
"A HTTP proxy for use with TURN/TCP of the form "
|
"A HTTP proxy for use with TURN/TCP of the form "
|
||||||
"http://[username:password@]hostname[:port]",
|
"http://[username:password@]hostname[:port][?alpn=<alpn>]",
|
||||||
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -458,7 +458,7 @@ gst_webrtc_ice_get_turn_server (GstWebRTCICE * ice)
|
||||||
* gst_webrtc_ice_set_http_proxy:
|
* gst_webrtc_ice_set_http_proxy:
|
||||||
* @ice: The #GstWebRTCICE
|
* @ice: The #GstWebRTCICE
|
||||||
* @uri: (transfer none): URI of the HTTP proxy of the form
|
* @uri: (transfer none): URI of the HTTP proxy of the form
|
||||||
* http://[username:password@]hostname[:port]
|
* http://[username:password@]hostname[:port][?alpn=<alpn>]
|
||||||
*
|
*
|
||||||
* Set HTTP Proxy to be used when connecting to TURN server.
|
* Set HTTP Proxy to be used when connecting to TURN server.
|
||||||
*
|
*
|
||||||
|
@ -478,7 +478,7 @@ gst_webrtc_ice_set_http_proxy (GstWebRTCICE * ice, const gchar * uri_s)
|
||||||
* @ice: The #GstWebRTCICE
|
* @ice: The #GstWebRTCICE
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): URI of the HTTP proxy of the form
|
* Returns: (transfer full): URI of the HTTP proxy of the form
|
||||||
* http://[username:password@]hostname[:port]
|
* http://[username:password@]hostname[:port][?alpn=<alpn>]
|
||||||
*
|
*
|
||||||
* Get HTTP Proxy to be used when connecting to TURN server.
|
* Get HTTP Proxy to be used when connecting to TURN server.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1351,8 +1351,10 @@ on_http_proxy_resolved (GstWebRTCICE * ice, GAsyncResult * res,
|
||||||
const gchar *userinfo;
|
const gchar *userinfo;
|
||||||
gchar *user = NULL;
|
gchar *user = NULL;
|
||||||
gchar *pass = NULL;
|
gchar *pass = NULL;
|
||||||
|
const gchar *alpn = NULL;
|
||||||
gchar *ip = NULL;
|
gchar *ip = NULL;
|
||||||
guint port = GST_URI_NO_PORT;
|
guint port = GST_URI_NO_PORT;
|
||||||
|
GHashTable *extra_headers;
|
||||||
|
|
||||||
if (!(addresses = resolve_host_finish (nice, res, &error))) {
|
if (!(addresses = resolve_host_finish (nice, res, &error))) {
|
||||||
GST_WARNING_OBJECT (ice, "Failed to resolve http proxy: %s",
|
GST_WARNING_OBJECT (ice, "Failed to resolve http proxy: %s",
|
||||||
|
@ -1382,13 +1384,23 @@ on_http_proxy_resolved (GstWebRTCICE * ice, GAsyncResult * res,
|
||||||
userinfo = gst_uri_get_userinfo (uri);
|
userinfo = gst_uri_get_userinfo (uri);
|
||||||
_parse_userinfo (userinfo, &user, &pass);
|
_parse_userinfo (userinfo, &user, &pass);
|
||||||
|
|
||||||
|
alpn = gst_uri_get_query_value (uri, "alpn");
|
||||||
|
if (!alpn) {
|
||||||
|
alpn = "webrtc";
|
||||||
|
}
|
||||||
|
extra_headers = g_hash_table_new_full (g_str_hash,
|
||||||
|
g_str_equal, g_free, g_free);
|
||||||
|
g_hash_table_insert (extra_headers, g_strdup ("ALPN"), g_strdup (alpn));
|
||||||
|
|
||||||
g_object_set (nice->priv->nice_agent,
|
g_object_set (nice->priv->nice_agent,
|
||||||
"proxy-ip", ip, "proxy-port", port, "proxy-type", NICE_PROXY_TYPE_HTTP,
|
"proxy-ip", ip, "proxy-port", port, "proxy-type", NICE_PROXY_TYPE_HTTP,
|
||||||
"proxy-username", user, "proxy-password", pass, NULL);
|
"proxy-username", user, "proxy-password", pass, "proxy-extra-headers",
|
||||||
|
extra_headers, NULL);
|
||||||
|
|
||||||
g_free (ip);
|
g_free (ip);
|
||||||
g_free (user);
|
g_free (user);
|
||||||
g_free (pass);
|
g_free (pass);
|
||||||
|
g_hash_table_unref (extra_headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstUri *
|
static GstUri *
|
||||||
|
|
Loading…
Reference in a new issue