You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/04/30 08:19:20 UTC

git commit: Fix URL decoding of '+' as space.

Repository: mesos
Updated Branches:
  refs/heads/master 25b5e58de -> e3a9eabe2


Fix URL decoding of '+' as space.


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

Branch: refs/heads/master
Commit: e3a9eabe237eb1efabbae9931d44178bf06a2c54
Parents: 25b5e58
Author: Jameel Al-Aziz <me...@jalaziz.io>
Authored: Tue Apr 29 23:16:37 2014 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Tue Apr 29 23:18:39 2014 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/http.hpp | 2 +-
 3rdparty/libprocess/src/tests/http_tests.cpp | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e3a9eabe/3rdparty/libprocess/include/process/http.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/http.hpp b/3rdparty/libprocess/include/process/http.hpp
index b3b9111..0fe7219 100644
--- a/3rdparty/libprocess/include/process/http.hpp
+++ b/3rdparty/libprocess/include/process/http.hpp
@@ -450,7 +450,7 @@ inline Try<std::string> decode(const std::string& s)
 
   for (size_t i = 0; i < s.length(); ++i) {
     if (s[i] != '%') {
-      out << s[i];
+      out << (s[i] == '+' ? ' ' : s[i]);
       continue;
     }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/e3a9eabe/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index fd7c252..06ce178 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -135,6 +135,10 @@ TEST(HTTP, Encode)
 
   EXPECT_SOME_EQ(unencoded, http::decode(encoded));
 
+  encoded = "a%24%26%2B%2C%2F%3A%3B%3D%3F%40+%22%3C%3E%23"
+            "%25%7B%7D%7C%5C%5E%7E%5B%5D%60%19%80%FF%00";
+  EXPECT_SOME_EQ(unencoded, http::decode(encoded));
+
   EXPECT_ERROR(http::decode("%"));
   EXPECT_ERROR(http::decode("%1"));
   EXPECT_ERROR(http::decode("%;1"));