<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Jun 29, 2018 at 6:08 PM Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Jun 29, 2018 at 05:41:10PM +0300, Nir Soffer wrote:<br>
> Old imageio proxy was using Authorization header for GET and PUT<br>
> requests. Remove unneeded authorization when sending OPTIONS request.<br>
> <br>
> Remove unneeded duplicated comments about authorization for old<br>
> imageio, and replace them with a comment when we set needs_auth.<br>
<br>
I'll push it, thanks.<br>
<br>
Can we get rid of the Authorization stuff completely yet?<br></blockquote><div><br></div><div>Yes, if you want to drop support for ovirt < 4.2.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Rich.<br>
<br>
>  v2v/rhv-upload-plugin.py | 12 +++++-------<br>
>  1 file changed, 5 insertions(+), 7 deletions(-)<br>
> <br>
> diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py<br>
> index 8805e3552..f404bd758 100644<br>
> --- a/v2v/rhv-upload-plugin.py<br>
> +++ b/v2v/rhv-upload-plugin.py<br>
> @@ -191,16 +191,17 @@ def open(readonly):<br>
>      )<br>
>  <br>
>      # The first request is to fetch the features of the server.<br>
> +<br>
> +    # Authentication was needed only for GET and PUT requests when<br>
> +    # communicating with old imageio-proxy.<br>
>      needs_auth = not params['rhv_direct']<br>
> +<br>
>      can_flush = False<br>
>      can_trim = False<br>
>      can_zero = False<br>
>      unix_socket = None<br>
>  <br>
> -    http.putrequest("OPTIONS", destination_url.path)<br>
> -    http.putheader("Authorization", transfer.signed_ticket)<br>
> -    http.endheaders()<br>
> -<br>
> +    http.request("OPTIONS", destination_url.path)<br>
>      r = http.getresponse()<br>
>      data = r.read()<br>
>  <br>
> @@ -298,7 +299,6 @@ def pread(h, count, offset):<br>
>      transfer = h['transfer']<br>
>  <br>
>      headers = {"Range", "bytes=%d-%d" % (offset, offset+count-1)}<br>
> -    # Authorization is only needed for old imageio.<br>
>      if h['needs_auth']:<br>
>          headers["Authorization"] = transfer.signed_ticket<br>
>  <br>
> @@ -321,7 +321,6 @@ def pwrite(h, buf, offset):<br>
>      h['highestwrite'] = max(h['highestwrite'], offset+count)<br>
>  <br>
>      http.putrequest("PUT", h['path'] + "?flush=n")<br>
> -    # Authorization is only needed for old imageio.<br>
>      if h['needs_auth']:<br>
>          http.putheader("Authorization", transfer.signed_ticket)<br>
>      # The oVirt server only uses the first part of the range, and the<br>
> @@ -378,7 +377,6 @@ def emulate_zero(h, count, offset):<br>
>      # After that we must emulate them with writes.<br>
>      if offset+count < h['highestwrite']:<br>
>          http.putrequest("PUT", h['path'])<br>
> -        # Authorization is only needed for old imageio.<br>
>          if h['needs_auth']:<br>
>              http.putheader("Authorization", transfer.signed_ticket)<br>
>          http.putheader("Content-Range",<br>
> -- <br>
> 2.17.1<br>
<br>
-- <br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
virt-builder quickly builds VMs from scratch<br>
<a href="http://libguestfs.org/virt-builder.1.html" rel="noreferrer" target="_blank">http://libguestfs.org/virt-builder.1.html</a><br>
</blockquote></div></div>