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
14442b97
Commit
14442b97
authored
Mar 06, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use vlc_b64_decode instead of local implementation
parent
0b879fdf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
65 deletions
+4
-65
src/network/httpd.c
src/network/httpd.c
+4
-65
No files found.
src/network/httpd.c
View file @
14442b97
...
...
@@ -35,6 +35,7 @@
#include <vlc_network.h>
#include <vlc_tls.h>
#include <vlc_acl.h>
#include <vlc_strings.h>
#include "../libvlc.h"
#include <string.h>
...
...
@@ -186,63 +187,6 @@ struct httpd_client_t
/*****************************************************************************
* Various functions
*****************************************************************************/
/*char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";*/
static
void
b64_decode
(
char
*
restrict
dest
,
const
char
*
restrict
src
)
{
int
i_level
;
int
last
=
0
;
int
b64
[
256
]
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
/* 00-0F */
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-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,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
/* C0-CF */
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
/* D0-DF */
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
/* E0-EF */
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
/* F0-FF */
};
for
(
i_level
=
0
;
*
src
!=
'\0'
;
src
++
)
{
int
c
;
c
=
b64
[(
unsigned
int
)
*
src
];
if
(
c
==
-
1
)
{
continue
;
}
switch
(
i_level
)
{
case
0
:
i_level
++
;
break
;
case
1
:
*
dest
++
=
(
last
<<
2
)
|
(
(
c
>>
4
)
&
0x03
);
i_level
++
;
break
;
case
2
:
*
dest
++
=
(
(
last
<<
4
)
&
0xf0
)
|
(
(
c
>>
2
)
&
0x0f
);
i_level
++
;
break
;
case
3
:
*
dest
++
=
(
(
last
&
0x03
)
<<
6
)
|
c
;
i_level
=
0
;
}
last
=
c
;
}
*
dest
=
'\0'
;
}
static
struct
{
const
char
*
psz_ext
;
...
...
@@ -2204,7 +2148,7 @@ static void httpd_HostThread( httpd_host_t *host )
{
/* create the headers */
const
char
*
b64
=
httpd_MsgGet
(
query
,
"Authorization"
);
/* BASIC id */
char
*
auth
;
char
*
auth
=
NULL
;
char
*
id
;
asprintf
(
&
id
,
"%s:%s"
,
url
->
psz_user
,
url
->
psz_password
);
...
...
@@ -2216,15 +2160,10 @@ static void httpd_HostThread( httpd_host_t *host )
{
b64
++
;
}
auth
=
malloc
(
strlen
(
b64
)
+
1
);
b64_decode
(
auth
,
b64
);
}
else
{
auth
=
strdup
(
""
);
auth
=
vlc_b64_decode
(
b64
);
}
if
(
strcmp
(
id
,
auth
)
)
if
(
(
auth
==
NULL
)
||
strcmp
(
id
,
auth
)
)
{
httpd_MsgAdd
(
answer
,
"WWW-Authenticate"
,
"Basic realm=
\"
%s
\"
"
,
url
->
psz_user
);
/* We fail for all url */
...
...
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