Blame SOURCES/bz1600169-01-disable-usage-of-Expect-HTTP-header.patch

be1b1f
From 5df7d647e3cdb4b73e0bfd0a4fa83b78efd861f5 Mon Sep 17 00:00:00 2001
be1b1f
From: Ivan Devat <idevat@redhat.com>
be1b1f
Date: Mon, 6 Aug 2018 08:43:47 +0200
be1b1f
Subject: [PATCH] disable usage of 'Expect' HTTP header
be1b1f
be1b1f
---
be1b1f
 pcs/common/node_communicator.py | 1 +
be1b1f
 pcs/lib/external.py             | 1 +
be1b1f
 pcs/test/tools/custom_mock.py   | 4 ++++
be1b1f
 pcs/utils.py                    | 1 +
be1b1f
 pcsd/pcs.rb                     | 1 +
be1b1f
 5 files changed, 8 insertions(+)
be1b1f
be1b1f
diff --git a/pcs/common/node_communicator.py b/pcs/common/node_communicator.py
be1b1f
index f7fe2419..d54e8566 100644
be1b1f
--- a/pcs/common/node_communicator.py
be1b1f
+++ b/pcs/common/node_communicator.py
be1b1f
@@ -532,6 +532,7 @@ def _create_request_handle(request, cookies, timeout):
be1b1f
     handle.setopt(pycurl.SSL_VERIFYHOST, 0)
be1b1f
     handle.setopt(pycurl.SSL_VERIFYPEER, 0)
be1b1f
     handle.setopt(pycurl.NOSIGNAL, 1) # required for multi-threading
be1b1f
+    handle.setopt(pycurl.HTTPHEADER, ["Expect: "])
be1b1f
     if cookies:
be1b1f
         handle.setopt(
be1b1f
             pycurl.COOKIE, _dict_to_cookies(cookies).encode("utf-8")
be1b1f
diff --git a/pcs/lib/external.py b/pcs/lib/external.py
be1b1f
index fe17a864..e53a54ee 100644
be1b1f
--- a/pcs/lib/external.py
be1b1f
+++ b/pcs/lib/external.py
be1b1f
@@ -620,6 +620,7 @@ class NodeCommunicator(object):
be1b1f
         handler.setopt(pycurl.SSL_VERIFYHOST, 0)
be1b1f
         handler.setopt(pycurl.SSL_VERIFYPEER, 0)
be1b1f
         handler.setopt(pycurl.NOSIGNAL, 1) # required for multi-threading
be1b1f
+        handler.setopt(pycurl.HTTPHEADER, ["Expect: "])
be1b1f
         if cookies:
be1b1f
             handler.setopt(pycurl.COOKIE, ";".join(cookies).encode("utf-8"))
be1b1f
         if data:
be1b1f
diff --git a/pcs/test/tools/custom_mock.py b/pcs/test/tools/custom_mock.py
be1b1f
index c05a5a45..849f83fb 100644
be1b1f
--- a/pcs/test/tools/custom_mock.py
be1b1f
+++ b/pcs/test/tools/custom_mock.py
be1b1f
@@ -75,6 +75,10 @@ class MockCurl(object):
be1b1f
         self._opts = {}
be1b1f
 
be1b1f
     def setopt(self, opt, val):
be1b1f
+        if isinstance(val, list):
be1b1f
+           # in tests we use set operations (e.g. assertLessEqual) which
be1b1f
+           # require hashable values
be1b1f
+           val = tuple(val)
be1b1f
         if val is None:
be1b1f
             self.unsetopt(opt)
be1b1f
         else:
be1b1f
diff --git a/pcs/utils.py b/pcs/utils.py
be1b1f
index 347ad73e..8a989f52 100644
be1b1f
--- a/pcs/utils.py
be1b1f
+++ b/pcs/utils.py
be1b1f
@@ -498,6 +498,7 @@ def sendHTTPRequest(
be1b1f
     handler.setopt(pycurl.TIMEOUT_MS, int(timeout * 1000))
be1b1f
     handler.setopt(pycurl.SSL_VERIFYHOST, 0)
be1b1f
     handler.setopt(pycurl.SSL_VERIFYPEER, 0)
be1b1f
+    handler.setopt(pycurl.HTTPHEADER, ["Expect: "])
be1b1f
     if cookies:
be1b1f
         handler.setopt(pycurl.COOKIE, ";".join(cookies).encode("utf-8"))
be1b1f
     if data:
be1b1f
diff --git a/pcsd/pcs.rb b/pcsd/pcs.rb
be1b1f
index 66919c0c..ad153f62 100644
be1b1f
--- a/pcsd/pcs.rb
be1b1f
+++ b/pcsd/pcs.rb
be1b1f
@@ -513,6 +513,7 @@ def send_request(
be1b1f
     :httpget => (post ? 0 : 1),
be1b1f
     :nosignal => 1, # required for multi-threading
be1b1f
   })
be1b1f
+  req.compose_header('Expect', '')
be1b1f
   return_code = req.perform
be1b1f
   if return_code == :ok
be1b1f
     return req.response_code, req.response_body
be1b1f
-- 
be1b1f
2.13.6
be1b1f