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