You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2015/03/25 01:02:14 UTC

[05/12] mesos git commit: Moved http::initialize from header to .cpp file.

Moved http::initialize from header to .cpp file.

Review: https://reviews.apache.org/r/32337


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dab7bdb2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dab7bdb2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dab7bdb2

Branch: refs/heads/master
Commit: dab7bdb26c3fcabc5552fb85579686c46a2eff65
Parents: 0a5e973
Author: Benjamin Mahler <be...@gmail.com>
Authored: Tue Mar 17 12:30:26 2015 -0700
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Tue Mar 24 16:47:18 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/http.hpp | 61 ++++-------------------
 3rdparty/libprocess/src/http.cpp             | 51 +++++++++++++++++--
 2 files changed, 58 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dab7bdb2/3rdparty/libprocess/include/process/http.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/http.hpp b/3rdparty/libprocess/include/process/http.hpp
index 1b40b4f..a96bc28 100644
--- a/3rdparty/libprocess/include/process/http.hpp
+++ b/3rdparty/libprocess/include/process/http.hpp
@@ -38,6 +38,16 @@ class Future;
 
 namespace http {
 
+// Status code reason strings, from the HTTP1.1 RFC:
+// http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html
+extern hashmap<uint16_t, std::string> statuses;
+
+// Initializes 'statuses'.
+// TODO(bmahler): Provide a function that returns the string for
+// a status code instead!
+void initialize();
+
+
 struct Request
 {
   // TODO(benh): Add major/minor version.
@@ -696,57 +706,6 @@ Future<Response> post(
     const Option<std::string>& body = None(),
     const Option<std::string>& contentType = None());
 
-
-// Status code reason strings, from the HTTP1.1 RFC:
-// http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html
-extern hashmap<uint16_t, std::string> statuses;
-
-
-inline void initialize()
-{
-  statuses[100] = "100 Continue";
-  statuses[101] = "101 Switching Protocols";
-  statuses[200] = "200 OK";
-  statuses[201] = "201 Created";
-  statuses[202] = "202 Accepted";
-  statuses[203] = "203 Non-Authoritative Information";
-  statuses[204] = "204 No Content";
-  statuses[205] = "205 Reset Content";
-  statuses[206] = "206 Partial Content";
-  statuses[300] = "300 Multiple Choices";
-  statuses[301] = "301 Moved Permanently";
-  statuses[302] = "302 Found";
-  statuses[303] = "303 See Other";
-  statuses[304] = "304 Not Modified";
-  statuses[305] = "305 Use Proxy";
-  statuses[307] = "307 Temporary Redirect";
-  statuses[400] = "400 Bad Request";
-  statuses[401] = "401 Unauthorized";
-  statuses[402] = "402 Payment Required";
-  statuses[403] = "403 Forbidden";
-  statuses[404] = "404 Not Found";
-  statuses[405] = "405 Method Not Allowed";
-  statuses[406] = "406 Not Acceptable";
-  statuses[407] = "407 Proxy Authentication Required";
-  statuses[408] = "408 Request Time-out";
-  statuses[409] = "409 Conflict";
-  statuses[410] = "410 Gone";
-  statuses[411] = "411 Length Required";
-  statuses[412] = "412 Precondition Failed";
-  statuses[413] = "413 Request Entity Too Large";
-  statuses[414] = "414 Request-URI Too Large";
-  statuses[415] = "415 Unsupported Media Type";
-  statuses[416] = "416 Requested range not satisfiable";
-  statuses[417] = "417 Expectation Failed";
-  statuses[500] = "500 Internal Server Error";
-  statuses[501] = "501 Not Implemented";
-  statuses[502] = "502 Bad Gateway";
-  statuses[503] = "503 Service Unavailable";
-  statuses[504] = "504 Gateway Time-out";
-  statuses[505] = "505 HTTP Version not supported";
-}
-
-
 } // namespace http {
 } // namespace process {
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/dab7bdb2/3rdparty/libprocess/src/http.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http.cpp b/3rdparty/libprocess/src/http.cpp
index 1865546..3d2b541 100644
--- a/3rdparty/libprocess/src/http.cpp
+++ b/3rdparty/libprocess/src/http.cpp
@@ -45,6 +45,54 @@ namespace process {
 namespace http {
 
 
+hashmap<uint16_t, string> statuses;
+
+
+void initialize()
+{
+  statuses[100] = "100 Continue";
+  statuses[101] = "101 Switching Protocols";
+  statuses[200] = "200 OK";
+  statuses[201] = "201 Created";
+  statuses[202] = "202 Accepted";
+  statuses[203] = "203 Non-Authoritative Information";
+  statuses[204] = "204 No Content";
+  statuses[205] = "205 Reset Content";
+  statuses[206] = "206 Partial Content";
+  statuses[300] = "300 Multiple Choices";
+  statuses[301] = "301 Moved Permanently";
+  statuses[302] = "302 Found";
+  statuses[303] = "303 See Other";
+  statuses[304] = "304 Not Modified";
+  statuses[305] = "305 Use Proxy";
+  statuses[307] = "307 Temporary Redirect";
+  statuses[400] = "400 Bad Request";
+  statuses[401] = "401 Unauthorized";
+  statuses[402] = "402 Payment Required";
+  statuses[403] = "403 Forbidden";
+  statuses[404] = "404 Not Found";
+  statuses[405] = "405 Method Not Allowed";
+  statuses[406] = "406 Not Acceptable";
+  statuses[407] = "407 Proxy Authentication Required";
+  statuses[408] = "408 Request Time-out";
+  statuses[409] = "409 Conflict";
+  statuses[410] = "410 Gone";
+  statuses[411] = "411 Length Required";
+  statuses[412] = "412 Precondition Failed";
+  statuses[413] = "413 Request Entity Too Large";
+  statuses[414] = "414 Request-URI Too Large";
+  statuses[415] = "415 Unsupported Media Type";
+  statuses[416] = "416 Requested range not satisfiable";
+  statuses[417] = "417 Expectation Failed";
+  statuses[500] = "500 Internal Server Error";
+  statuses[501] = "501 Not Implemented";
+  statuses[502] = "502 Bad Gateway";
+  statuses[503] = "503 Service Unavailable";
+  statuses[504] = "504 Gateway Time-out";
+  statuses[505] = "505 HTTP Version not supported";
+}
+
+
 bool Request::accepts(const string& encoding) const
 {
   // See RFC 2616, section 14.3 for the details.
@@ -253,8 +301,6 @@ Future<Nothing> Pipe::Writer::readerClosed()
 }
 
 
-hashmap<uint16_t, string> statuses;
-
 namespace query {
 
 Try<hashmap<std::string, std::string>> decode(const std::string& query)
@@ -551,6 +597,5 @@ Future<Response> post(
   return post(url, headers, body, contentType);
 }
 
-
 } // namespace http {
 } // namespace process {