Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
fcda0b5d
Commit
fcda0b5d
authored
Oct 06, 2004
by
Derk-Jan Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* vlc_b64_encode patch by Torsten Spindler
parent
090481f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
44 deletions
+46
-44
include/network.h
include/network.h
+45
-1
modules/access/http.c
modules/access/http.c
+1
-43
No files found.
include/network.h
View file @
fcda0b5d
...
...
@@ -164,9 +164,53 @@ static inline void vlc_UrlClean( vlc_url_t *url )
url
->
psz_path
=
NULL
;
url
->
psz_option
=
NULL
;
}
/*****************************************************************************
* vlc_b64_encode:
*****************************************************************************
*
*****************************************************************************/
static
inline
char
*
vlc_b64_encode
(
unsigned
char
*
src
)
{
static
const
char
b64
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
;
char
*
dst
=
malloc
(
strlen
(
src
)
*
4
/
3
+
12
);
char
*
ret
=
dst
;
unsigned
i_bits
=
0
;
unsigned
i_shift
=
0
;
for
(
;;
)
{
if
(
*
src
)
{
i_bits
=
(
i_bits
<<
8
)
|
(
*
src
++
);
i_shift
+=
8
;
}
else
if
(
i_shift
>
0
)
{
i_bits
<<=
6
-
i_shift
;
i_shift
=
6
;
}
else
{
*
dst
++
=
'='
;
break
;
}
while
(
i_shift
>=
6
)
{
i_shift
-=
6
;
*
dst
++
=
b64
[(
i_bits
>>
i_shift
)
&
0x3f
];
}
}
*
dst
++
=
'\0'
;
return
ret
;
}
#define net_OpenTCP(a, b, c) __net_OpenTCP(VLC_OBJECT(a), b, c)
VLC_EXPORT
(
int
,
__net_OpenTCP
,
(
vlc_object_t
*
p_this
,
char
*
psz_host
,
int
i_port
)
);
VLC_EXPORT
(
int
,
__net_OpenTCP
,
(
vlc_object_t
*
p_this
,
c
onst
c
har
*
psz_host
,
int
i_port
)
);
#define net_ListenTCP(a, b, c) __net_ListenTCP(VLC_OBJECT(a), b, c)
VLC_EXPORT
(
int
,
__net_ListenTCP
,
(
vlc_object_t
*
p_this
,
char
*
psz_localaddr
,
int
i_port
)
);
...
...
modules/access/http.c
View file @
fcda0b5d
...
...
@@ -130,7 +130,6 @@ 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
char
*
b64_encode
(
unsigned
char
*
src
);
/*****************************************************************************
* Open:
...
...
@@ -685,7 +684,7 @@ static int Connect( access_t *p_access, int64_t i_tell )
asprintf
(
&
buf
,
"%s:%s"
,
p_sys
->
psz_user
,
p_sys
->
psz_passwd
?
p_sys
->
psz_passwd
:
""
);
b64
=
b64_encode
(
buf
);
b64
=
vlc_
b64_encode
(
buf
);
net_Printf
(
VLC_OBJECT
(
p_access
),
p_sys
->
fd
,
"Authorization: Basic %s
\r\n
"
,
b64
);
...
...
@@ -818,44 +817,3 @@ error:
return
VLC_EGENERIC
;
}
/*****************************************************************************
* b64_encode:
*****************************************************************************/
static
char
*
b64_encode
(
unsigned
char
*
src
)
{
static
const
char
b64
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
;
char
*
dst
=
malloc
(
strlen
(
src
)
*
4
/
3
+
12
);
char
*
ret
=
dst
;
unsigned
i_bits
=
0
;
unsigned
i_shift
=
0
;
for
(
;;
)
{
if
(
*
src
)
{
i_bits
=
(
i_bits
<<
8
)
|
(
*
src
++
);
i_shift
+=
8
;
}
else
if
(
i_shift
>
0
)
{
i_bits
<<=
6
-
i_shift
;
i_shift
=
6
;
}
else
{
*
dst
++
=
'='
;
break
;
}
while
(
i_shift
>=
6
)
{
i_shift
-=
6
;
*
dst
++
=
b64
[(
i_bits
>>
i_shift
)
&
0x3f
];
}
}
*
dst
++
=
'\0'
;
return
ret
;
}
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