FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

RFC: Pull out status_t to the top level to allow using those enum values from clients. by igorpeshansky · Pull Request #837 · cpp-netlib/cpp-netlib · GitHub

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .hpp  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
28 changes: 2 additions & 26 deletions boost/network/protocol/http/server/async_connection.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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 Down Expand 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 deletions boost/network/protocol/http/status.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_STATUS_HPP_20180501
#define BOOST_NETWORK_PROTOCOL_HTTP_STATUS_HPP_20180501

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Consider naming this file status_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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If we're doing this, then I suggest dropping the _t suffix, and calling it status_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

Back | FazBrowse Home | New Git URL