Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
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
Hide 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,89 +177,89 @@ struct httpd_client_t
/*****************************************************************************
* Various functions
*****************************************************************************/
typedef
struct
{
unsigned
i_code
;
const
char
psz_reason
[
36
];
}
http_status_info
;
static
const
http_status_info
http_reason
[]
=
{
/*{ 100, "Continue" },
{ 101, "Switching Protocols" },*/
{
200
,
"OK"
},
/*{ 201, "Created" },
{ 202, "Accepted" },
{ 203, "Non-authoritative information" },
{ 204, "No content" },
{ 205, "Reset content" },
{ 206, "Partial content" },
{ 250, "Low on storage space" },
{ 300, "Multiple choices" },*/
{
301
,
"Moved permanently"
},
/*{ 302, "Moved temporarily" },
{ 303, "See other" },
{ 304, "Not modified" },
{ 305, "Use proxy" },
{ 307, "Temporary redirect" },
{ 400, "Bad request" },*/
{
401
,
"Unauthorized"
},
/*{ 402, "Payment Required" },*/
{
403
,
"Forbidden"
},
{
404
,
"Not found"
},
{
405
,
"Method not allowed"
},
/*{ 406, "Not acceptable" },
{ 407, "Proxy authentication required" },
{ 408, "Request time-out" },
{ 409, "Conflict" },
{ 410, "Gone" },
{ 411, "Length required" },
{ 412, "Precondition failed" },
{ 413, "Request entity too large" },
{ 414, "Request-URI too large" },
{ 415, "Unsupported media Type" },
{ 416, "Requested range not satisfiable" },
{ 417, "Expectation failed" },
{ 451, "Parameter not understood" },
{ 452, "Conference not found" },
{ 453, "Not enough bandwidth" },*/
{
454
,
"Session not found"
},
{
455
,
"Method not valid in this State"
},
{
456
,
"Header field not valid for resource"
},
{
457
,
"Invalid range"
},
/*{ 458, "Read-only parameter" },*/
{
459
,
"Aggregate operation not allowed"
},
{
460
,
"Non-aggregate operation not allowed"
},
{
461
,
"Unsupported transport"
},
/*{ 462, "Destination unreachable" },*/
{
500
,
"Internal server error"
},
{
501
,
"Not implemented"
},
/*{ 502, "Bad gateway" },*/
{
503
,
"Service unavailable"
},
/*{ 504, "Gateway time-out" },*/
{
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
;
typedef
struct
{
unsigned
i_code
;
const
char
psz_reason
[
36
];
}
http_status_info
;
static
const
http_status_info
http_reason
[]
=
{
/*{ 100, "Continue" },
{ 101, "Switching Protocols" },*/
{
200
,
"OK"
},
/*{ 201, "Created" },
{ 202, "Accepted" },
{ 203, "Non-authoritative information" },
{ 204, "No content" },
{ 205, "Reset content" },
{ 206, "Partial content" },
{ 250, "Low on storage space" },
{ 300, "Multiple choices" },*/
{
301
,
"Moved permanently"
},
/*{ 302, "Moved temporarily" },
{ 303, "See other" },
{ 304, "Not modified" },
{ 305, "Use proxy" },
{ 307, "Temporary redirect" },
{ 400, "Bad request" },*/
{
401
,
"Unauthorized"
},
/*{ 402, "Payment Required" },*/
{
403
,
"Forbidden"
},
{
404
,
"Not found"
},
{
405
,
"Method not allowed"
},
/*{ 406, "Not acceptable" },
{ 407, "Proxy authentication required" },
{ 408, "Request time-out" },
{ 409, "Conflict" },
{ 410, "Gone" },
{ 411, "Length required" },
{ 412, "Precondition failed" },
{ 413, "Request entity too large" },
{ 414, "Request-URI too large" },
{ 415, "Unsupported media Type" },
{ 416, "Requested range not satisfiable" },
{ 417, "Expectation failed" },
{ 451, "Parameter not understood" },
{ 452, "Conference not found" },
{ 453, "Not enough bandwidth" },*/
{
454
,
"Session not found"
},
{
455
,
"Method not valid in this State"
},
{
456
,
"Header field not valid for resource"
},
{
457
,
"Invalid range"
},
/*{ 458, "Read-only parameter" },*/
{
459
,
"Aggregate operation not allowed"
},
{
460
,
"Non-aggregate operation not allowed"
},
{
461
,
"Unsupported transport"
},
/*{ 462, "Destination unreachable" },*/
{
500
,
"Internal server error"
},
{
501
,
"Not implemented"
},
/*{ 502, "Bad gateway" },*/
{
503
,
"Service unavailable"
},
/*{ 504, "Gateway time-out" },*/
{
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"
};
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