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
80d4c0ee
Commit
80d4c0ee
authored
Jun 25, 2005
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up : use user and pass from vlc_UrlParse
parent
7f952008
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
81 deletions
+9
-81
modules/access/http.c
modules/access/http.c
+9
-81
No files found.
modules/access/http.c
View file @
80d4c0ee
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
* Rémi Denis-Courmont <rem # videolan.org>
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
...
@@ -52,14 +53,6 @@ static void Close( vlc_object_t * );
...
@@ -52,14 +53,6 @@ static void Close( vlc_object_t * );
"Allows you to modify the default caching value for http streams. This " \
"Allows you to modify the default caching value for http streams. This " \
"value should be set in millisecond units." )
"value should be set in millisecond units." )
#define USER_TEXT N_("HTTP user name")
#define USER_LONGTEXT N_("Allows you to modify the user name that will " \
"be used for the connection (Basic authentication only).")
#define PASS_TEXT N_("HTTP password")
#define PASS_LONGTEXT N_("Allows you to modify the password that will be " \
"used for the connection.")
#define AGENT_TEXT N_("HTTP user agent")
#define AGENT_TEXT N_("HTTP user agent")
#define AGENT_LONGTEXT N_("Allows you to modify the user agent that will be " \
#define AGENT_LONGTEXT N_("Allows you to modify the user agent that will be " \
"used for the connection.")
"used for the connection.")
...
@@ -83,8 +76,6 @@ vlc_module_begin();
...
@@ -83,8 +76,6 @@ vlc_module_begin();
VLC_FALSE
);
VLC_FALSE
);
add_integer
(
"http-caching"
,
4
*
DEFAULT_PTS_DELAY
/
1000
,
NULL
,
add_integer
(
"http-caching"
,
4
*
DEFAULT_PTS_DELAY
/
1000
,
NULL
,
CACHING_TEXT
,
CACHING_LONGTEXT
,
VLC_TRUE
);
CACHING_TEXT
,
CACHING_LONGTEXT
,
VLC_TRUE
);
add_string
(
"http-user"
,
NULL
,
NULL
,
USER_TEXT
,
USER_LONGTEXT
,
VLC_FALSE
);
add_string
(
"http-pwd"
,
NULL
,
NULL
,
PASS_TEXT
,
PASS_LONGTEXT
,
VLC_FALSE
);
add_string
(
"http-user-agent"
,
COPYRIGHT_MESSAGE
,
NULL
,
AGENT_TEXT
,
add_string
(
"http-user-agent"
,
COPYRIGHT_MESSAGE
,
NULL
,
AGENT_TEXT
,
AGENT_LONGTEXT
,
VLC_FALSE
);
AGENT_LONGTEXT
,
VLC_FALSE
);
add_bool
(
"http-reconnect"
,
0
,
NULL
,
RECONNECT_TEXT
,
add_bool
(
"http-reconnect"
,
0
,
NULL
,
RECONNECT_TEXT
,
...
@@ -111,8 +102,6 @@ struct access_sys_t
...
@@ -111,8 +102,6 @@ struct access_sys_t
/* From uri */
/* From uri */
vlc_url_t
url
;
vlc_url_t
url
;
char
*
psz_user
;
char
*
psz_passwd
;
char
*
psz_user_agent
;
char
*
psz_user_agent
;
/* Proxy */
/* Proxy */
...
@@ -153,8 +142,7 @@ static int Seek( access_t *, int64_t );
...
@@ -153,8 +142,7 @@ static int Seek( access_t *, int64_t );
static
int
Control
(
access_t
*
,
int
,
va_list
);
static
int
Control
(
access_t
*
,
int
,
va_list
);
/* */
/* */
static
void
ParseURL
(
access_sys_t
*
,
char
*
psz_url
);
static
int
Connect
(
access_t
*
,
int64_t
);
static
int
Connect
(
access_t
*
,
int64_t
);
static
int
Request
(
access_t
*
p_access
,
int64_t
i_tell
);
static
int
Request
(
access_t
*
p_access
,
int64_t
i_tell
);
static
void
Disconnect
(
access_t
*
);
static
void
Disconnect
(
access_t
*
);
...
@@ -236,11 +224,11 @@ static int Open( vlc_object_t *p_this )
...
@@ -236,11 +224,11 @@ static int Open( vlc_object_t *p_this )
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
ParseURL
(
p_sys
,
psz
);
vlc_UrlParse
(
&
p_sys
->
url
,
psz
,
0
);
free
(
psz
);
free
(
psz
);
}
}
else
else
ParseURL
(
p_sys
,
p_access
->
psz_path
);
vlc_UrlParse
(
&
p_sys
->
url
,
p_access
->
psz_path
,
0
);
if
(
p_sys
->
url
.
psz_host
==
NULL
||
*
p_sys
->
url
.
psz_host
==
'\0'
)
if
(
p_sys
->
url
.
psz_host
==
NULL
||
*
p_sys
->
url
.
psz_host
==
'\0'
)
{
{
...
@@ -259,11 +247,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -259,11 +247,6 @@ static int Open( vlc_object_t *p_this )
if
(
p_sys
->
url
.
i_port
<=
0
)
if
(
p_sys
->
url
.
i_port
<=
0
)
p_sys
->
url
.
i_port
=
80
;
p_sys
->
url
.
i_port
=
80
;
}
}
if
(
!
p_sys
->
psz_user
||
*
p_sys
->
psz_user
==
'\0'
)
{
p_sys
->
psz_user
=
var_CreateGetString
(
p_access
,
"http-user"
);
p_sys
->
psz_passwd
=
var_CreateGetString
(
p_access
,
"http-pwd"
);
}
/* Do user agent */
/* Do user agent */
p_sys
->
psz_user_agent
=
var_CreateGetString
(
p_access
,
"http-user-agent"
);
p_sys
->
psz_user_agent
=
var_CreateGetString
(
p_access
,
"http-user-agent"
);
...
@@ -308,10 +291,10 @@ static int Open( vlc_object_t *p_this )
...
@@ -308,10 +291,10 @@ static int Open( vlc_object_t *p_this )
msg_Dbg
(
p_access
,
" proxy %s:%d"
,
p_sys
->
proxy
.
psz_host
,
msg_Dbg
(
p_access
,
" proxy %s:%d"
,
p_sys
->
proxy
.
psz_host
,
p_sys
->
proxy
.
i_port
);
p_sys
->
proxy
.
i_port
);
}
}
if
(
p_sys
->
psz_user
&&
*
p_sys
->
psz_user
)
if
(
p_sys
->
url
.
psz_username
&&
*
p_sys
->
url
.
psz_username
)
{
{
msg_Dbg
(
p_access
,
" user='%s', pwd='%s'"
,
msg_Dbg
(
p_access
,
" user='%s', pwd='%s'"
,
p_sys
->
psz_user
,
p_sys
->
psz_passw
d
);
p_sys
->
url
.
psz_username
,
p_sys
->
url
.
psz_passwor
d
);
}
}
p_sys
->
b_reconnect
=
var_CreateGetBool
(
p_access
,
"http-reconnect"
);
p_sys
->
b_reconnect
=
var_CreateGetBool
(
p_access
,
"http-reconnect"
);
...
@@ -366,8 +349,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -366,8 +349,6 @@ static int Open( vlc_object_t *p_this )
if
(
p_sys
->
psz_pragma
)
free
(
p_sys
->
psz_pragma
);
if
(
p_sys
->
psz_pragma
)
free
(
p_sys
->
psz_pragma
);
if
(
p_sys
->
psz_location
)
free
(
p_sys
->
psz_location
);
if
(
p_sys
->
psz_location
)
free
(
p_sys
->
psz_location
);
if
(
p_sys
->
psz_user_agent
)
free
(
p_sys
->
psz_user_agent
);
if
(
p_sys
->
psz_user_agent
)
free
(
p_sys
->
psz_user_agent
);
if
(
p_sys
->
psz_user
)
free
(
p_sys
->
psz_user
);
if
(
p_sys
->
psz_passwd
)
free
(
p_sys
->
psz_passwd
);
Disconnect
(
p_access
);
Disconnect
(
p_access
);
free
(
p_sys
);
free
(
p_sys
);
...
@@ -433,8 +414,6 @@ error:
...
@@ -433,8 +414,6 @@ error:
if
(
p_sys
->
psz_pragma
)
free
(
p_sys
->
psz_pragma
);
if
(
p_sys
->
psz_pragma
)
free
(
p_sys
->
psz_pragma
);
if
(
p_sys
->
psz_location
)
free
(
p_sys
->
psz_location
);
if
(
p_sys
->
psz_location
)
free
(
p_sys
->
psz_location
);
if
(
p_sys
->
psz_user_agent
)
free
(
p_sys
->
psz_user_agent
);
if
(
p_sys
->
psz_user_agent
)
free
(
p_sys
->
psz_user_agent
);
if
(
p_sys
->
psz_user
)
free
(
p_sys
->
psz_user
);
if
(
p_sys
->
psz_passwd
)
free
(
p_sys
->
psz_passwd
);
Disconnect
(
p_access
);
Disconnect
(
p_access
);
free
(
p_sys
);
free
(
p_sys
);
...
@@ -452,9 +431,6 @@ static void Close( vlc_object_t *p_this )
...
@@ -452,9 +431,6 @@ static void Close( vlc_object_t *p_this )
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_UrlClean
(
&
p_sys
->
proxy
);
vlc_UrlClean
(
&
p_sys
->
proxy
);
if
(
p_sys
->
psz_user
)
free
(
p_sys
->
psz_user
);
if
(
p_sys
->
psz_passwd
)
free
(
p_sys
->
psz_passwd
);
if
(
p_sys
->
psz_mime
)
free
(
p_sys
->
psz_mime
);
if
(
p_sys
->
psz_mime
)
free
(
p_sys
->
psz_mime
);
if
(
p_sys
->
psz_pragma
)
free
(
p_sys
->
psz_pragma
);
if
(
p_sys
->
psz_pragma
)
free
(
p_sys
->
psz_pragma
);
if
(
p_sys
->
psz_location
)
free
(
p_sys
->
psz_location
);
if
(
p_sys
->
psz_location
)
free
(
p_sys
->
psz_location
);
...
@@ -780,54 +756,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -780,54 +756,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
* ParseURL: extract user:password
*****************************************************************************/
static
void
ParseURL
(
access_sys_t
*
p_sys
,
char
*
psz_url
)
{
char
*
psz_dup
=
strdup
(
psz_url
);
char
*
p
=
psz_dup
;
char
*
psz
;
/* Syntax //[user:password]@<hostname>[:<port>][/<path>] */
while
(
*
p
==
'/'
)
{
p
++
;
}
psz
=
p
;
/* Parse auth */
if
(
(
p
=
strchr
(
psz
,
'@'
)
)
)
{
char
*
comma
;
*
p
++
=
'\0'
;
comma
=
strchr
(
psz
,
':'
);
/* Retreive user:password */
if
(
comma
)
{
*
comma
++
=
'\0'
;
p_sys
->
psz_user
=
strdup
(
psz
);
p_sys
->
psz_passwd
=
strdup
(
comma
);
}
else
{
p_sys
->
psz_user
=
strdup
(
psz
);
}
}
else
{
p
=
psz
;
}
/* Parse uri */
vlc_UrlParse
(
&
p_sys
->
url
,
p
,
0
);
free
(
psz_dup
);
}
/*****************************************************************************
/*****************************************************************************
* Connect:
* Connect:
*****************************************************************************/
*****************************************************************************/
...
@@ -1000,13 +928,13 @@ static int Request( access_t *p_access, int64_t i_tell )
...
@@ -1000,13 +928,13 @@ static int Request( access_t *p_access, int64_t i_tell )
}
}
/* Authentification */
/* Authentification */
if
(
p_sys
->
psz_user
&&
*
p_sys
->
psz_user
)
if
(
p_sys
->
url
.
psz_username
&&
*
p_sys
->
url
.
psz_username
)
{
{
char
*
buf
;
char
*
buf
;
char
*
b64
;
char
*
b64
;
asprintf
(
&
buf
,
"%s:%s"
,
p_sys
->
psz_user
,
asprintf
(
&
buf
,
"%s:%s"
,
p_sys
->
url
.
psz_username
,
p_sys
->
psz_passwd
?
p_sys
->
psz_passw
d
:
""
);
p_sys
->
url
.
psz_password
?
p_sys
->
url
.
psz_passwor
d
:
""
);
b64
=
vlc_b64_encode
(
buf
);
b64
=
vlc_b64_encode
(
buf
);
free
(
buf
);
free
(
buf
);
...
...
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