Juan Hernandez has uploaded a new change for review.

Change subject: sdk: Always set the request body
......................................................................

sdk: Always set the request body

The cURL library remembers the body of the request, and this means that
after sending a POST with a body the next GET will have the same body.
This isn't harmful, as servers will typically ignore bodies of GET
requests, but it isn't ideal. To solve this issue this patch changes the
SDK so that it will explicitly clear the request body.

Change-Id: I028f2672fa7f817b21c12f8805d5bf09ae2bb61e
Signed-off-by: Juan Hernandez <[email protected]>
---
M src/ovirtsdk/infrastructure/connectionspool.py
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/87/40487/1

diff --git a/src/ovirtsdk/infrastructure/connectionspool.py 
b/src/ovirtsdk/infrastructure/connectionspool.py
index 16b2b0e..aeae730 100644
--- a/src/ovirtsdk/infrastructure/connectionspool.py
+++ b/src/ovirtsdk/infrastructure/connectionspool.py
@@ -120,8 +120,7 @@
 
         # Copy headers and the request body to the curl object:
         self.__curl.setopt(pycurl.HTTPHEADER, header_lines)
-        if body is not None:
-            self.__curl.setopt(pycurl.POSTFIELDS, body)
+        self.__curl.setopt(pycurl.POSTFIELDS, body if body is not None else "")
 
         # Prepare the buffers to receive the response:
         body_buffer = cStringIO.StringIO()


-- 
To view, visit https://gerrit.ovirt.org/40487
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I028f2672fa7f817b21c12f8805d5bf09ae2bb61e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to