|
|
df3bb2 |
From a3e99c84e1aed2fc275be00292f86414c8d4432a Mon Sep 17 00:00:00 2001
|
|
|
df3bb2 |
From: Nir Soffer <nirsof@gmail.com>
|
|
|
df3bb2 |
Date: Fri, 29 Jun 2018 17:41:10 +0300
|
|
|
df3bb2 |
Subject: [PATCH] v2v: rhv-upload-plugin: Remove unneeded auth
|
|
|
df3bb2 |
|
|
|
df3bb2 |
Old imageio proxy was using Authorization header for GET and PUT
|
|
|
df3bb2 |
requests. Remove unneeded authorization when sending OPTIONS request.
|
|
|
df3bb2 |
|
|
|
df3bb2 |
Remove unneeded duplicated comments about authorization for old
|
|
|
df3bb2 |
imageio, and replace them with a comment when we set needs_auth.
|
|
|
df3bb2 |
|
|
|
df3bb2 |
(cherry picked from commit d5f36bacf9bb6d4d244184551792989906f60896)
|
|
|
df3bb2 |
---
|
|
|
df3bb2 |
v2v/rhv-upload-plugin.py | 12 +++++-------
|
|
|
df3bb2 |
1 file changed, 5 insertions(+), 7 deletions(-)
|
|
|
df3bb2 |
|
|
|
df3bb2 |
diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
|
|
|
df3bb2 |
index 8805e3552..f404bd758 100644
|
|
|
df3bb2 |
--- a/v2v/rhv-upload-plugin.py
|
|
|
df3bb2 |
+++ b/v2v/rhv-upload-plugin.py
|
|
|
df3bb2 |
@@ -191,16 +191,17 @@ def open(readonly):
|
|
|
df3bb2 |
)
|
|
|
df3bb2 |
|
|
|
df3bb2 |
# The first request is to fetch the features of the server.
|
|
|
df3bb2 |
+
|
|
|
df3bb2 |
+ # Authentication was needed only for GET and PUT requests when
|
|
|
df3bb2 |
+ # communicating with old imageio-proxy.
|
|
|
df3bb2 |
needs_auth = not params['rhv_direct']
|
|
|
df3bb2 |
+
|
|
|
df3bb2 |
can_flush = False
|
|
|
df3bb2 |
can_trim = False
|
|
|
df3bb2 |
can_zero = False
|
|
|
df3bb2 |
unix_socket = None
|
|
|
df3bb2 |
|
|
|
df3bb2 |
- http.putrequest("OPTIONS", destination_url.path)
|
|
|
df3bb2 |
- http.putheader("Authorization", transfer.signed_ticket)
|
|
|
df3bb2 |
- http.endheaders()
|
|
|
df3bb2 |
-
|
|
|
df3bb2 |
+ http.request("OPTIONS", destination_url.path)
|
|
|
df3bb2 |
r = http.getresponse()
|
|
|
df3bb2 |
data = r.read()
|
|
|
df3bb2 |
|
|
|
df3bb2 |
@@ -298,7 +299,6 @@ def pread(h, count, offset):
|
|
|
df3bb2 |
transfer = h['transfer']
|
|
|
df3bb2 |
|
|
|
df3bb2 |
headers = {"Range", "bytes=%d-%d" % (offset, offset+count-1)}
|
|
|
df3bb2 |
- # Authorization is only needed for old imageio.
|
|
|
df3bb2 |
if h['needs_auth']:
|
|
|
df3bb2 |
headers["Authorization"] = transfer.signed_ticket
|
|
|
df3bb2 |
|
|
|
df3bb2 |
@@ -321,7 +321,6 @@ def pwrite(h, buf, offset):
|
|
|
df3bb2 |
h['highestwrite'] = max(h['highestwrite'], offset+count)
|
|
|
df3bb2 |
|
|
|
df3bb2 |
http.putrequest("PUT", h['path'] + "?flush=n")
|
|
|
df3bb2 |
- # Authorization is only needed for old imageio.
|
|
|
df3bb2 |
if h['needs_auth']:
|
|
|
df3bb2 |
http.putheader("Authorization", transfer.signed_ticket)
|
|
|
df3bb2 |
# The oVirt server only uses the first part of the range, and the
|
|
|
df3bb2 |
@@ -378,7 +377,6 @@ def emulate_zero(h, count, offset):
|
|
|
df3bb2 |
# After that we must emulate them with writes.
|
|
|
df3bb2 |
if offset+count < h['highestwrite']:
|
|
|
df3bb2 |
http.putrequest("PUT", h['path'])
|
|
|
df3bb2 |
- # Authorization is only needed for old imageio.
|
|
|
df3bb2 |
if h['needs_auth']:
|
|
|
df3bb2 |
http.putheader("Authorization", transfer.signed_ticket)
|
|
|
df3bb2 |
http.putheader("Content-Range",
|
|
|
df3bb2 |
--
|
|
|
df3bb2 |
2.21.0
|
|
|
df3bb2 |
|