Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
39e357ac
Commit
39e357ac
authored
Dec 30, 2015
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: use vlc_credential
parent
8d49d1cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
modules/access/http.c
modules/access/http.c
+28
-7
No files found.
modules/access/http.c
View file @
39e357ac
...
...
@@ -36,7 +36,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_access.h>
#include <vlc_dialog.h>
#include <vlc_meta.h>
#include <vlc_network.h>
#include <vlc_url.h>
...
...
@@ -46,6 +45,7 @@
#include <vlc_input.h>
#include <vlc_http.h>
#include <vlc_interrupt.h>
#include <vlc_keystore.h>
#ifdef HAVE_ZLIB_H
# include <zlib.h>
...
...
@@ -213,6 +213,7 @@ static int Open( vlc_object_t *p_this )
const
char
*
psz_url
=
p_access
->
psz_url
;
char
*
psz
;
int
ret
=
VLC_EGENERIC
;
vlc_credential
credential
;
access_sys_t
*
p_sys
=
malloc
(
sizeof
(
*
p_sys
)
);
if
(
unlikely
(
p_sys
==
NULL
)
)
...
...
@@ -264,6 +265,7 @@ static int Open( vlc_object_t *p_this )
http_auth_Init
(
&
p_sys
->
auth
);
http_auth_Init
(
&
p_sys
->
proxy_auth
);
vlc_UrlParse
(
&
p_sys
->
url
,
psz_url
);
vlc_credential_init
(
&
credential
,
&
p_sys
->
url
);
if
(
p_sys
->
url
.
psz_host
==
NULL
||
*
p_sys
->
url
.
psz_host
==
'\0'
)
{
...
...
@@ -375,6 +377,13 @@ static int Open( vlc_object_t *p_this )
p_sys
->
b_continuous
=
var_InheritBool
(
p_access
,
"http-continuous"
);
p_access
->
p_sys
=
p_sys
;
if
(
vlc_credential_get
(
&
credential
,
p_access
,
NULL
,
NULL
,
NULL
,
NULL
)
)
{
p_sys
->
url
.
psz_username
=
(
char
*
)
credential
.
psz_username
;
p_sys
->
url
.
psz_password
=
(
char
*
)
credential
.
psz_password
;
}
connect:
/* Connect */
if
(
Connect
(
p_access
,
0
)
)
...
...
@@ -400,13 +409,20 @@ connect:
msg_Dbg
(
p_access
,
"authentication failed for realm %s"
,
p_sys
->
auth
.
psz_realm
);
dialog_Login
(
p_access
,
&
p_sys
->
psz_username
,
&
p_sys
->
psz_password
,
_
(
"HTTP authentication"
),
_
(
"Please enter a valid login name and a password for realm %s."
),
p_sys
->
auth
.
psz_realm
);
if
(
p_sys
->
psz_username
!=
NULL
&&
p_sys
->
psz_password
!=
NULL
)
credential
.
psz_realm
=
p_sys
->
auth
.
psz_realm
;
credential
.
psz_authtype
=
p_sys
->
auth
.
psz_nonce
?
"Digest"
:
"Basic"
;
if
(
vlc_credential_get
(
&
credential
,
p_access
,
NULL
,
NULL
,
_
(
"HTTP authentication"
),
_
(
"Please enter a valid login name and a "
"password for realm %s."
),
p_sys
->
auth
.
psz_realm
)
)
{
msg_Dbg
(
p_access
,
"retrying with user=%s"
,
p_sys
->
psz_username
);
p_sys
->
psz_username
=
strdup
(
credential
.
psz_username
);
p_sys
->
psz_password
=
strdup
(
credential
.
psz_password
);
if
(
!
p_sys
->
psz_username
||
!
p_sys
->
psz_password
)
goto
error
;
msg_Err
(
p_access
,
"retrying with user=%s"
,
p_sys
->
psz_username
);
p_sys
->
url
.
psz_username
=
p_sys
->
psz_username
;
p_sys
->
url
.
psz_password
=
p_sys
->
psz_password
;
Disconnect
(
p_access
);
...
...
@@ -415,6 +431,8 @@ connect:
else
goto
error
;
}
else
vlc_credential_store
(
&
credential
);
if
(
(
p_sys
->
i_code
==
301
||
p_sys
->
i_code
==
302
||
p_sys
->
i_code
==
303
||
p_sys
->
i_code
==
307
)
&&
...
...
@@ -448,9 +466,12 @@ connect:
p_access
->
pf_control
=
Control
;
p_access
->
pf_seek
=
Seek
;
vlc_credential_clean
(
&
credential
);
return
VLC_SUCCESS
;
error:
vlc_credential_clean
(
&
credential
);
vlc_UrlClean
(
&
p_sys
->
url
);
if
(
p_sys
->
b_proxy
)
vlc_UrlClean
(
&
p_sys
->
proxy
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment