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

Added support for more http status codes#210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deanberris merged 1 commit intocpp-netlib:0.9-develfrommarcb1:0.9-devel-integration
Feb 15, 2013
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added support for more http status codes
  • Loading branch information
@marcb1
marcb1 committedFeb 14, 2013
commit4bd81c31035b194756d4575c352c18e28e09a7af
58 changes: 57 additions & 1 deletionboost/network/protocol/http/impl/response.ipp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,6 +35,7 @@ namespace boost { namespace network { namespace http {
created = 201,
accepted = 202,
no_content = 204,
partial_content = 206,
multiple_choices = 300,
moved_permanently = 301,
moved_temporarily = 302,
Expand All@@ -45,10 +46,14 @@ namespace boost { namespace network { namespace http {
not_found = 404,
not_supported = 405,
not_acceptable = 406,
request_timeout = 408,
precondition_failed = 412,
unsatisfiable_range = 416,
internal_server_error = 500,
not_implemented = 501,
bad_gateway = 502,
service_unavailable = 503
service_unavailable = 503,
space_unavailable = 507
} status;

/// The headers to be included in the reply.
Expand DownExpand Up@@ -196,6 +201,27 @@ namespace boost { namespace network { namespace http {
"<head><title>Service Unavailable</title></head>"
"<body><h1>503 Service Unavailable</h1></body>"
"</html>";
static const char space_unavailable[] =
"<html>"
"<head><title>Space Unavailable</title></head>"
"<body><h1>HTTP/1.0 507 Insufficient Space to Store Resource</h1></body>"
"</html>";
static const char partial_content[] = "<html>"
"<head><title>Partial Content</title></head>"
"<body><h1>HTTP/1.1 206 Partial Content</h1></body>"
"</html>";
static const char request_timeout[] = "<html>"
"<head><title>Request Timeout</title></head>"
"<body><h1>HTTP/1.1 408 Request Timeout</h1></body>"
"</html>";
static const char precondition_failed[] = "<html>"
"<head><title>Precondition Failed</title></head>"
"<body><h1>HTTP/1.1 412 Precondition Failed</h1></body>"
"</html>";
static const char unsatisfiable_range[] = "<html>"
"<head><title>Unsatisfiable Range</title></head>"
"<body><h1>HTTP/1.1 416 Requested Range Not Satisfiable</h1></body>"
"</html>";

switch (status)
{
Expand DownExpand Up@@ -235,6 +261,16 @@ namespace boost { namespace network { namespace http {
return bad_gateway;
case basic_response<tags::http_server>::service_unavailable:
return service_unavailable;
case basic_response<tags::http_server>::space_unavailable:
return space_unavailable;
case basic_response<tags::http_server>::partial_content:
return partial_content;
case basic_response<tags::http_server>::request_timeout:
return request_timeout;
case basic_response<tags::http_server>::unsatisfiable_range:
return unsatisfiable_range;
case basic_response<tags::http_server>::precondition_failed:
return precondition_failed;
default:
return internal_server_error;
}
Expand DownExpand Up@@ -278,6 +314,16 @@ namespace boost { namespace network { namespace http {
"HTTP/1.0 502 Bad Gateway\r\n";
static const string_type service_unavailable =
"HTTP/1.0 503 Service Unavailable\r\n";
static const string_type space_unavailable =
"HTTP/1.0 507 Insufficient Space to Store Resource\r\n";
static const string_type partial_content =
"HTTP/1.1 206 Partial Content\r\n";
static const string_type request_timeout =
"HTTP/1.1 408 Request Timeout\r\n";
static const string_type precondition_failed =
"HTTP/1.1 412 Precondition Failed\r\n";
static const string_type unsatisfiable_range =
"HTTP/1.1 416 Requested Range Not Satisfiable\r\n";

switch (status) {
case basic_response<tags::http_server>::ok:
Expand DownExpand Up@@ -316,6 +362,16 @@ namespace boost { namespace network { namespace http {
return buffer(bad_gateway);
case basic_response<tags::http_server>::service_unavailable:
return buffer(service_unavailable);
case basic_response<tags::http_server>::space_unavailable:
return buffer(space_unavailable);
case basic_response<tags::http_server>::partial_content:
return buffer(partial_content);
case basic_response<tags::http_server>::request_timeout:
return buffer(request_timeout);
case basic_response<tags::http_server>::unsatisfiable_range:
return buffer(unsatisfiable_range);
case basic_response<tags::http_server>::precondition_failed:
return buffer(precondition_failed);
default:
return buffer(internal_server_error);
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp