You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2016/11/22 03:27:26 UTC

[06/13] mesos git commit: Introduced a reader member to `Request` to support request streaming.

Introduced a reader member to `Request` to support request streaming.

These new members are needed for supporting request streaming i.e.,
the caller can use the writer to stream chunks to the server if
the request body is not known in advance.

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


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

Branch: refs/heads/master
Commit: f6286048a5f897ff6859b38a24c3d64aa3b54d01
Parents: 1003f3d
Author: Anand Mazumdar <an...@apache.org>
Authored: Mon Nov 21 18:07:20 2016 -0800
Committer: Anand Mazumdar <an...@apache.org>
Committed: Mon Nov 21 19:27:08 2016 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/http.hpp | 24 +++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f6286048/3rdparty/libprocess/include/process/http.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/http.hpp b/3rdparty/libprocess/include/process/http.hpp
index 51bfc7e..ed853d8 100644
--- a/3rdparty/libprocess/include/process/http.hpp
+++ b/3rdparty/libprocess/include/process/http.hpp
@@ -414,7 +414,7 @@ private:
 struct Request
 {
   Request()
-    : keepAlive(false) {}
+    : keepAlive(false), type(BODY) {}
 
   std::string method;
 
@@ -426,11 +426,6 @@ struct Request
 
   Headers headers;
 
-  // TODO(bmahler): Add a 'query' field which contains both
-  // the URL query and the parsed form data from the body.
-
-  std::string body;
-
   // TODO(bmahler): Ensure this is consistent with the 'Connection'
   // header; perhaps make this a function that checks the header.
   //
@@ -447,6 +442,23 @@ struct Request
   // Note that this may correspond to a proxy or load balancer address.
   network::Address client;
 
+  // Clients can choose to provide the entire body at once
+  // via BODY or can choose to stream the body over to the
+  // server via PIPE.
+  //
+  // Default: BODY.
+  enum
+  {
+    BODY,
+    PIPE
+  } type;
+
+  // TODO(bmahler): Add a 'query' field which contains both
+  // the URL query and the parsed form data from the body.
+
+  std::string body;
+  Option<Pipe::Reader> reader;
+
   /**
    * Returns whether the encoding is considered acceptable in the
    * response. See RFC 2616 section 14.3 for details.