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
5e0e8697
Commit
5e0e8697
authored
Feb 16, 2014
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpd: simplify httpd_ReasonFromCode
parent
d2f69bc3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
72 deletions
+72
-72
src/network/httpd.c
src/network/httpd.c
+72
-72
No files found.
src/network/httpd.c
View file @
5e0e8697
...
...
@@ -177,14 +177,16 @@ struct httpd_client_t
/*****************************************************************************
* Various functions
*****************************************************************************/
typedef
struct
static
const
char
*
httpd_ReasonFromCode
(
unsigned
i_code
)
{
typedef
struct
{
unsigned
i_code
;
const
char
psz_reason
[
36
];
}
http_status_info
;
}
http_status_info
;
static
const
http_status_info
http_reason
[]
=
{
static
const
http_status_info
http_reason
[]
=
{
/*{ 100, "Continue" },
{ 101, "Switching Protocols" },*/
{
200
,
"OK"
},
...
...
@@ -240,26 +242,24 @@ static const http_status_info http_reason[] =
{
505
,
"Protocol version not supported"
},
{
551
,
"Option not supported"
},
{
999
,
""
}
};
};
static
const
char
psz_fallback_reason
[
5
][
16
]
=
{
"Continue"
,
"OK"
,
"Found"
,
"Client error"
,
"Server error"
};
static
const
char
*
httpd_ReasonFromCode
(
unsigned
i_code
)
{
const
http_status_info
*
p
;
static
const
char
psz_fallback_reason
[
5
][
16
]
=
{
"Continue"
,
"OK"
,
"Found"
,
"Client error"
,
"Server error"
};
assert
(
(
i_code
>=
100
)
&&
(
i_code
<=
599
)
);
for
(
p
=
http_reason
;
i_code
>
p
->
i_code
;
p
++
);
const
http_status_info
*
p
=
http_reason
;
while
(
i_code
<
p
->
i_code
)
p
++
;
if
(
p
->
i_code
==
i_code
)
if
(
p
->
i_code
==
i_code
)
return
p
->
psz_reason
;
return
psz_fallback_reason
[(
i_code
/
100
)
-
1
];
}
static
size_t
httpd_HtmlError
(
char
**
body
,
int
code
,
const
char
*
url
)
{
const
char
*
errname
=
httpd_ReasonFromCode
(
code
);
...
...
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