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

RFC: Pull out status_t to the top level to allow using those enum values from clients.#837

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

Open
igorpeshansky wants to merge1 commit intocpp-netlib:main
base:main
Choose a base branch
Loading
fromigorpeshansky:igorpeshansky-global-status_t
Open
Show file tree
Hide file tree
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
28 changes: 2 additions & 26 deletionsboost/network/protocol/http/server/async_connection.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,7 @@
#include <boost/asio/write.hpp>
#include <boost/network/protocol/http/algorithms/linearize.hpp>
#include <boost/network/protocol/http/server/request_parser.hpp>
#include <boost/network/protocol/http/status.hpp>
#include <boost/network/protocol/stream_handler.hpp>
#include <boost/network/utils/thread_pool.hpp>
#include <boost/optional.hpp>
Expand DownExpand Up@@ -71,32 +72,7 @@ extern void parse_headers(std::string const& input,
template <class Tag, class Handler>
struct async_connection
: std::enable_shared_from_this<async_connection<Tag, Handler> > {
/// The set of known status codes for HTTP server responses.
enum status_t {
ok = 200,
created = 201,
accepted = 202,
no_content = 204,
partial_content = 206,
multiple_choices = 300,
moved_permanently = 301,
moved_temporarily = 302,
not_modified = 304,
bad_request = 400,
unauthorized = 401,
forbidden = 403,
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,
space_unavailable = 507
};
typedef boost::network::http::status_t status_t;

typedef typename string<Tag>::type string_type;
typedef basic_request<Tag> request;
Expand Down
39 changes: 39 additions & 0 deletionsboost/network/protocol/http/status.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_STATUS_HPP_20180501
#define BOOST_NETWORK_PROTOCOL_HTTP_STATUS_HPP_20180501
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Consider naming this filestatus_code.hpp along with the suggested change to the enum name.


namespace boost {
namespace network {
namespace http {

/// The set of known status codes for HTTP server responses.
enum status_t {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If we're doing this, then I suggest dropping the_t suffix, and calling itstatus_code to be more descriptive.

Also, if we're going to do this as well, we might as well add the following:

  • An "unknown" value to be the default (say,0).
  • More known status codes, even those that are extensions -- we can probably do those later on, instead of in this PR.

ok = 200,
created = 201,
accepted = 202,
no_content = 204,
partial_content = 206,
multiple_choices = 300,
moved_permanently = 301,
moved_temporarily = 302,
not_modified = 304,
bad_request = 400,
unauthorized = 401,
forbidden = 403,
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,
space_unavailable = 507,
};

} // namespace http
} // namespace network
} // namespace boost

#endif // BOOST_NETWORK_PROTOCOL_HTTP_STATUS_HPP_20180501

[8]ページ先頭

©2009-2025 Movatter.jp