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:15 UTC
[06/12] mesos git commit: Moved http::URL output operator from header
to .cpp file.
Moved http::URL output operator from header to .cpp file.
Review: https://reviews.apache.org/r/32340
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7d37e4a8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7d37e4a8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7d37e4a8
Branch: refs/heads/master
Commit: 7d37e4a8809e54d64ef300cede756fc0f8eff79a
Parents: 87bece8
Author: Benjamin Mahler <be...@gmail.com>
Authored: Tue Mar 17 13:00:13 2015 -0700
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Tue Mar 24 16:47:18 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/include/process/http.hpp | 28 +++-----------------
3rdparty/libprocess/src/http.cpp | 31 ++++++++++++++++++++++-
2 files changed, 33 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/7d37e4a8/3rdparty/libprocess/include/process/http.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/http.hpp b/3rdparty/libprocess/include/process/http.hpp
index 1c7b752..332f939 100644
--- a/3rdparty/libprocess/include/process/http.hpp
+++ b/3rdparty/libprocess/include/process/http.hpp
@@ -3,6 +3,7 @@
#include <stdint.h>
+#include <iosfwd>
#include <queue>
#include <sstream>
#include <string>
@@ -515,32 +516,9 @@ struct URL
};
-inline std::ostream& operator << (
+std::ostream& operator << (
std::ostream& stream,
- const URL& url)
-{
- stream << url.scheme << "://";
-
- if (url.domain.isSome()) {
- stream << url.domain.get();
- } else if (url.ip.isSome()) {
- stream << url.ip.get();
- }
-
- stream << ":" << url.port;
-
- stream << "/" << strings::remove(url.path, "/", strings::PREFIX);
-
- if (!url.query.empty()) {
- stream << "?" << query::encode(url.query);
- }
-
- if (url.fragment.isSome()) {
- stream << "#" << url.fragment.get();
- }
-
- return stream;
-}
+ const URL& url);
// Asynchronously sends an HTTP GET request to the specified URL and
http://git-wip-us.apache.org/repos/asf/mesos/blob/7d37e4a8/3rdparty/libprocess/src/http.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http.cpp b/3rdparty/libprocess/src/http.cpp
index 1df8824..a7eeee9 100644
--- a/3rdparty/libprocess/src/http.cpp
+++ b/3rdparty/libprocess/src/http.cpp
@@ -8,7 +8,7 @@
#include <cstring>
#include <deque>
#include <iomanip>
-#include <iostream>
+#include <ostream>
#include <map>
#include <queue>
#include <string>
@@ -36,6 +36,7 @@
using std::deque;
using std::istringstream;
using std::map;
+using std::ostream;
using std::ostringstream;
using std::queue;
using std::string;
@@ -485,6 +486,34 @@ std::string encode(const hashmap<std::string, std::string>& query)
} // namespace query {
+ostream& operator << (
+ ostream& stream,
+ const URL& url)
+{
+ stream << url.scheme << "://";
+
+ if (url.domain.isSome()) {
+ stream << url.domain.get();
+ } else if (url.ip.isSome()) {
+ stream << url.ip.get();
+ }
+
+ stream << ":" << url.port;
+
+ stream << "/" << strings::remove(url.path, "/", strings::PREFIX);
+
+ if (!url.query.empty()) {
+ stream << "?" << query::encode(url.query);
+ }
+
+ if (url.fragment.isSome()) {
+ stream << "#" << url.fragment.get();
+ }
+
+ return stream;
+}
+
+
namespace internal {
Future<Response> decode(const string& buffer)