mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
rtsp: support basic/digest authentication
This commit is contained in:
parent
e67e71d62b
commit
e4fb5f2f61
25
lib/rtsp.c
25
lib/rtsp.c
@ -249,6 +249,8 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
|
|||||||
const char *p_stream_uri = NULL;
|
const char *p_stream_uri = NULL;
|
||||||
const char *p_transport = NULL;
|
const char *p_transport = NULL;
|
||||||
const char *p_uagent = NULL;
|
const char *p_uagent = NULL;
|
||||||
|
const char *p_proxyuserpwd = NULL;
|
||||||
|
const char *p_userpwd = NULL;
|
||||||
|
|
||||||
*done = TRUE;
|
*done = TRUE;
|
||||||
|
|
||||||
@ -326,7 +328,6 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
|
|||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: auth? */
|
|
||||||
/* TODO: proxy? */
|
/* TODO: proxy? */
|
||||||
|
|
||||||
/* Stream URI. Default to server '*' if not specified */
|
/* Stream URI. Default to server '*' if not specified */
|
||||||
@ -392,6 +393,14 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
|
|||||||
p_uagent = conn->allocptr.uagent;
|
p_uagent = conn->allocptr.uagent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* setup the authentication headers */
|
||||||
|
result = Curl_http_output_auth(conn, p_request, p_stream_uri, FALSE);
|
||||||
|
if(result)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
p_proxyuserpwd = conn->allocptr.proxyuserpwd;
|
||||||
|
p_userpwd = conn->allocptr.userpwd;
|
||||||
|
|
||||||
/* Referrer */
|
/* Referrer */
|
||||||
Curl_safefree(conn->allocptr.ref);
|
Curl_safefree(conn->allocptr.ref);
|
||||||
if(data->change.referer && !Curl_checkheaders(conn, "Referer:"))
|
if(data->change.referer && !Curl_checkheaders(conn, "Referer:"))
|
||||||
@ -464,13 +473,25 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
|
|||||||
"%s" /* range */
|
"%s" /* range */
|
||||||
"%s" /* referrer */
|
"%s" /* referrer */
|
||||||
"%s" /* user-agent */
|
"%s" /* user-agent */
|
||||||
|
"%s" /* proxyuserpwd */
|
||||||
|
"%s" /* userpwd */
|
||||||
,
|
,
|
||||||
p_transport ? p_transport : "",
|
p_transport ? p_transport : "",
|
||||||
p_accept ? p_accept : "",
|
p_accept ? p_accept : "",
|
||||||
p_accept_encoding ? p_accept_encoding : "",
|
p_accept_encoding ? p_accept_encoding : "",
|
||||||
p_range ? p_range : "",
|
p_range ? p_range : "",
|
||||||
p_referrer ? p_referrer : "",
|
p_referrer ? p_referrer : "",
|
||||||
p_uagent ? p_uagent : "");
|
p_uagent ? p_uagent : "",
|
||||||
|
p_proxyuserpwd ? p_proxyuserpwd : "",
|
||||||
|
p_userpwd ? p_userpwd : "");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM
|
||||||
|
* with basic and digest, it will be freed anyway by the next request
|
||||||
|
*/
|
||||||
|
Curl_safefree (conn->allocptr.userpwd);
|
||||||
|
conn->allocptr.userpwd = NULL;
|
||||||
|
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user