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
1eec0949
Commit
1eec0949
authored
Feb 16, 2014
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpd: cosmetics
parent
370c3df3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
71 deletions
+48
-71
src/network/httpd.c
src/network/httpd.c
+48
-71
No files found.
src/network/httpd.c
View file @
1eec0949
...
@@ -2070,93 +2070,70 @@ static void* httpd_HostThread( void *data )
...
@@ -2070,93 +2070,70 @@ static void* httpd_HostThread( void *data )
bool
b_auth_failed
=
false
;
bool
b_auth_failed
=
false
;
/* Search the url and trigger callbacks */
/* Search the url and trigger callbacks */
for
(
int
i
=
0
;
i
<
host
->
i_url
;
i
++
)
for
(
int
i
=
0
;
i
<
host
->
i_url
;
i
++
)
{
{
httpd_url_t
*
url
=
host
->
url
[
i
];
httpd_url_t
*
url
=
host
->
url
[
i
];
if
(
!
strcmp
(
url
->
psz_url
,
query
->
psz_url
)
)
if
(
strcmp
(
url
->
psz_url
,
query
->
psz_url
))
{
continue
;
if
(
url
->
catch
[
i_msg
].
cb
)
if
(
!
url
->
catch
[
i_msg
].
cb
)
{
continue
;
if
(
answer
&&
(
*
url
->
psz_user
||
*
url
->
psz_password
)
)
{
if
(
answer
&&
(
*
url
->
psz_user
||
*
url
->
psz_password
))
{
/* create the headers */
/* create the headers */
const
char
*
b64
=
httpd_MsgGet
(
query
,
"Authorization"
);
/* BASIC id */
const
char
*
b64
=
httpd_MsgGet
(
query
,
"Authorization"
);
/* BASIC id */
char
*
user
=
NULL
,
*
pass
=
NULL
;
char
*
user
=
NULL
,
*
pass
=
NULL
;
if
(
b64
!=
NULL
if
(
b64
&&
!
strncasecmp
(
b64
,
"BASIC"
,
5
))
{
&&
!
strncasecmp
(
b64
,
"BASIC"
,
5
)
)
b64
+=
5
;
{
while
(
*
b64
==
' '
)
b64
+=
5
;
b64
++
;
while
(
*
b64
==
' '
)
b64
++
;
user
=
vlc_b64_decode
(
b64
);
if
(
user
)
{
user
=
vlc_b64_decode
(
b64
);
pass
=
strchr
(
user
,
':'
);
if
(
user
!=
NULL
)
if
(
pass
)
{
*
pass
++
=
'\0'
;
pass
=
strchr
(
user
,
':'
);
if
(
pass
!=
NULL
)
*
pass
++
=
'\0'
;
}
}
if
((
user
==
NULL
)
||
(
pass
==
NULL
)
||
strcmp
(
user
,
url
->
psz_user
)
||
strcmp
(
pass
,
url
->
psz_password
))
{
httpd_MsgAdd
(
answer
,
"WWW-Authenticate"
,
"Basic realm=
\"
VLC stream
\"
"
);
/* We fail for all url */
b_auth_failed
=
true
;
free
(
user
);
break
;
}
free
(
user
);
}
}
}
if
(
!
url
->
catch
[
i_msg
].
cb
(
url
->
catch
[
i_msg
].
p_sys
,
cl
,
answer
,
query
)
)
if
(
!
user
||
strcmp
(
user
,
url
->
psz_user
)
||
{
!
pass
||
strcmp
(
pass
,
url
->
psz_password
))
{
if
(
answer
->
i_proto
==
HTTPD_PROTO_NONE
)
httpd_MsgAdd
(
answer
,
"WWW-Authenticate"
,
{
"Basic realm=
\"
VLC stream
\"
"
);
/* Raw answer from a CGI */
b_auth_failed
=
true
;
/* We fail for all url */
cl
->
i_buffer
=
cl
->
i_buffer_size
;
free
(
user
);
}
break
;
else
cl
->
i_buffer
=
-
1
;
/* only one url can answer */
answer
=
NULL
;
if
(
cl
->
url
==
NULL
)
{
cl
->
url
=
url
;
}
}
}
}
free
(
user
);
}
}
}
if
(
answer
)
if
(
url
->
catch
[
i_msg
].
cb
(
url
->
catch
[
i_msg
].
p_sys
,
cl
,
answer
,
query
))
{
continue
;
char
*
p
;
if
(
answer
->
i_proto
==
HTTPD_PROTO_NONE
)
cl
->
i_buffer
=
cl
->
i_buffer_size
;
/* Raw answer from a CGI */
else
cl
->
i_buffer
=
-
1
;
/* only one url can answer */
answer
=
NULL
;
if
(
cl
->
url
==
NULL
)
cl
->
url
=
url
;
}
if
(
answer
)
{
answer
->
i_proto
=
query
->
i_proto
;
answer
->
i_proto
=
query
->
i_proto
;
answer
->
i_type
=
HTTPD_MSG_ANSWER
;
answer
->
i_type
=
HTTPD_MSG_ANSWER
;
answer
->
i_version
=
0
;
answer
->
i_version
=
0
;
if
(
b_auth_failed
)
if
(
b_auth_failed
)
{
answer
->
i_status
=
401
;
answer
->
i_status
=
401
;
}
else
else
{
answer
->
i_status
=
404
;
/* no url registered */
/* no url registered */
answer
->
i_status
=
404
;
}
answer
->
i_body
=
httpd_HtmlError
(
&
p
,
char
*
p
;
answer
->
i_status
,
answer
->
i_body
=
httpd_HtmlError
(
&
p
,
answer
->
i_status
,
query
->
psz_url
);
query
->
psz_url
);
answer
->
p_body
=
(
uint8_t
*
)
p
;
answer
->
p_body
=
(
uint8_t
*
)
p
;
...
...
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