Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4bd81c3

Browse files
committed
Added support for more http status codes
1 parent9391911 commit4bd81c3

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

‎boost/network/protocol/http/impl/response.ipp

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ namespace boost { namespace network { namespace http {
3535
created =201,
3636
accepted =202,
3737
no_content =204,
38+
partial_content =206,
3839
multiple_choices =300,
3940
moved_permanently =301,
4041
moved_temporarily =302,
@@ -45,10 +46,14 @@ namespace boost { namespace network { namespace http {
4546
not_found =404,
4647
not_supported =405,
4748
not_acceptable =406,
49+
request_timeout =408,
50+
precondition_failed =412,
51+
unsatisfiable_range =416,
4852
internal_server_error =500,
4953
not_implemented =501,
5054
bad_gateway =502,
51-
service_unavailable =503
55+
service_unavailable =503,
56+
space_unavailable =507
5257
} status;
5358

5459
/// The headers to be included in the reply.
@@ -196,6 +201,27 @@ namespace boost { namespace network { namespace http {
196201
"<head><title>Service Unavailable</title></head>"
197202
"<body><h1>503 Service Unavailable</h1></body>"
198203
"</html>";
204+
staticconstchar space_unavailable[] =
205+
"<html>"
206+
"<head><title>Space Unavailable</title></head>"
207+
"<body><h1>HTTP/1.0 507 Insufficient Space to Store Resource</h1></body>"
208+
"</html>";
209+
staticconstchar partial_content[] ="<html>"
210+
"<head><title>Partial Content</title></head>"
211+
"<body><h1>HTTP/1.1 206 Partial Content</h1></body>"
212+
"</html>";
213+
staticconstchar request_timeout[] ="<html>"
214+
"<head><title>Request Timeout</title></head>"
215+
"<body><h1>HTTP/1.1 408 Request Timeout</h1></body>"
216+
"</html>";
217+
staticconstchar precondition_failed[] ="<html>"
218+
"<head><title>Precondition Failed</title></head>"
219+
"<body><h1>HTTP/1.1 412 Precondition Failed</h1></body>"
220+
"</html>";
221+
staticconstchar unsatisfiable_range[] ="<html>"
222+
"<head><title>Unsatisfiable Range</title></head>"
223+
"<body><h1>HTTP/1.1 416 Requested Range Not Satisfiable</h1></body>"
224+
"</html>";
199225

200226
switch (status)
201227
{
@@ -235,6 +261,16 @@ namespace boost { namespace network { namespace http {
235261
return bad_gateway;
236262
case basic_response<tags::http_server>::service_unavailable:
237263
return service_unavailable;
264+
case basic_response<tags::http_server>::space_unavailable:
265+
return space_unavailable;
266+
case basic_response<tags::http_server>::partial_content:
267+
return partial_content;
268+
case basic_response<tags::http_server>::request_timeout:
269+
return request_timeout;
270+
case basic_response<tags::http_server>::unsatisfiable_range:
271+
return unsatisfiable_range;
272+
case basic_response<tags::http_server>::precondition_failed:
273+
return precondition_failed;
238274
default:
239275
return internal_server_error;
240276
}
@@ -278,6 +314,16 @@ namespace boost { namespace network { namespace http {
278314
"HTTP/1.0 502 Bad Gateway\r\n";
279315
staticconst string_type service_unavailable =
280316
"HTTP/1.0 503 Service Unavailable\r\n";
317+
staticconst string_type space_unavailable =
318+
"HTTP/1.0 507 Insufficient Space to Store Resource\r\n";
319+
staticconst string_type partial_content =
320+
"HTTP/1.1 206 Partial Content\r\n";
321+
staticconst string_type request_timeout =
322+
"HTTP/1.1 408 Request Timeout\r\n";
323+
staticconst string_type precondition_failed =
324+
"HTTP/1.1 412 Precondition Failed\r\n";
325+
staticconst string_type unsatisfiable_range =
326+
"HTTP/1.1 416 Requested Range Not Satisfiable\r\n";
281327

282328
switch (status) {
283329
case basic_response<tags::http_server>::ok:
@@ -316,6 +362,16 @@ namespace boost { namespace network { namespace http {
316362
returnbuffer(bad_gateway);
317363
case basic_response<tags::http_server>::service_unavailable:
318364
returnbuffer(service_unavailable);
365+
case basic_response<tags::http_server>::space_unavailable:
366+
returnbuffer(space_unavailable);
367+
case basic_response<tags::http_server>::partial_content:
368+
returnbuffer(partial_content);
369+
case basic_response<tags::http_server>::request_timeout:
370+
returnbuffer(request_timeout);
371+
case basic_response<tags::http_server>::unsatisfiable_range:
372+
returnbuffer(unsatisfiable_range);
373+
case basic_response<tags::http_server>::precondition_failed:
374+
returnbuffer(precondition_failed);
319375
default:
320376
returnbuffer(internal_server_error);
321377
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp