souphttpclientsink: Implement proxy support

The properties were there before, but not used anywhere.
This commit is contained in:
Sebastian Dröge 2015-03-08 17:54:07 +01:00
parent d0587467fc
commit 814f741a28

View file

@ -535,11 +535,19 @@ gst_soup_http_client_sink_start (GstBaseSink * sink)
g_mutex_unlock (&souphttpsink->mutex); g_mutex_unlock (&souphttpsink->mutex);
GST_LOG_OBJECT (souphttpsink, "main loop thread running"); GST_LOG_OBJECT (souphttpsink, "main loop thread running");
souphttpsink->session = if (souphttpsink->proxy == NULL) {
soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT, souphttpsink->session =
souphttpsink->context, SOUP_SESSION_USER_AGENT, soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT,
souphttpsink->user_agent, SOUP_SESSION_TIMEOUT, souphttpsink->timeout, souphttpsink->context, SOUP_SESSION_USER_AGENT,
NULL); souphttpsink->user_agent, SOUP_SESSION_TIMEOUT, souphttpsink->timeout,
NULL);
} else {
souphttpsink->session =
soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT,
souphttpsink->context, SOUP_SESSION_USER_AGENT,
souphttpsink->user_agent, SOUP_SESSION_TIMEOUT, souphttpsink->timeout,
SOUP_SESSION_PROXY_URI, souphttpsink->proxy, NULL);
}
g_signal_connect (souphttpsink->session, "authenticate", g_signal_connect (souphttpsink->session, "authenticate",
G_CALLBACK (authenticate), souphttpsink); G_CALLBACK (authenticate), souphttpsink);
@ -793,9 +801,15 @@ authenticate (SoupSession * session, SoupMessage * msg,
GstSoupHttpClientSink *souphttpsink = GST_SOUP_HTTP_CLIENT_SINK (user_data); GstSoupHttpClientSink *souphttpsink = GST_SOUP_HTTP_CLIENT_SINK (user_data);
if (!retrying) { if (!retrying) {
if (souphttpsink->user_id && souphttpsink->user_pw) { /* First time authentication only, if we fail and are called again with retry true fall through */
soup_auth_authenticate (auth, if (msg->status_code == SOUP_STATUS_UNAUTHORIZED) {
souphttpsink->user_id, souphttpsink->user_pw); if (souphttpsink->user_id && souphttpsink->user_pw)
soup_auth_authenticate (auth, souphttpsink->user_id,
souphttpsink->user_pw);
} else if (msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED) {
if (souphttpsink->proxy_id && souphttpsink->proxy_pw)
soup_auth_authenticate (auth, souphttpsink->proxy_id,
souphttpsink->proxy_pw);
} }
} }
} }