All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: jcody@redhat.com, kwolf@redhat.com, qemu-block@nongnu.org,
	qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] block: curl: Allow arbitrary HTTP request headers to be set.
Date: Thu, 1 Mar 2018 16:11:18 +0000	[thread overview]
Message-ID: <20180301161118.GW14643@redhat.com> (raw)
In-Reply-To: <20180301135856.22698-2-rjones@redhat.com>

On Thu, Mar 01, 2018 at 01:58:55PM +0000, Richard W.M. Jones wrote:
> Allow arbitrary HTTP request headers to be set, like this:
> 
>   qemu-img create -f qcow2 \
>       -b 'json:{ "file.driver":"http",
>                  "file.url":"http://192.168.0.249/scratch/test.img",
>                  "file.header": ["Authorization: letmein"] }' \
>       test.qcow2
> 
> which adds the ‘Authorization: letmein’ header to the outgoing request
> for the backing file.  Multiple headers can be set, and curl built-in
> headers can be removed (using "Header:").
> 
> Note this uses the same format as curl's CURLOPT_HTTPHEADER, thus
> pulling in curl API guarantees into qemu, but curl has had very strong
> API backward compatibility since the start of the project.

It doesn't appear like there's anything really curl specific about
this - isn't   'Key: value' just the standard HTTP format (minus the
\r\n line ending of course.  IOW, I don't see any problem with using
this format.

> 
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> ---
>  block/curl.c         | 21 ++++++++++++++++++++-
>  qapi/block-core.json | 10 ++++++++--
>  2 files changed, 28 insertions(+), 3 deletions(-)
> 


> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 5c5921bfb7..ca1ebdbef1 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -3047,12 +3047,15 @@
>  # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
>  #                 secure way. See @cookie for the format. (since 2.10)
>  #
> +# @header:      List of HTTP request headers, see CURLOPT_HTTPHEADER(3).

Put  a '(since 2.12)' anntation on end of the docs for this new field

> +#
>  # Since: 2.9
>  ##
>  { 'struct': 'BlockdevOptionsCurlHttp',
>    'base': 'BlockdevOptionsCurlBase',
>    'data': { '*cookie': 'str',
> -            '*cookie-secret': 'str'} }
> +            '*cookie-secret': 'str',
> +            '*header': [ 'str' ] } }
>  
>  ##
>  # @BlockdevOptionsCurlHttps:
> @@ -3070,13 +3073,16 @@
>  # @cookie-secret: ID of a QCryptoSecret object providing the cookie data in a
>  #                 secure way. See @cookie for the format. (since 2.10)
>  #
> +# @header:      List of HTTP request headers, see CURLOPT_HTTPHEADER(3).

Same here about version annotation.

> +#
>  # Since: 2.9
>  ##
>  { 'struct': 'BlockdevOptionsCurlHttps',
>    'base': 'BlockdevOptionsCurlBase',
>    'data': { '*cookie': 'str',
>              '*sslverify': 'bool',
> -            '*cookie-secret': 'str'} }
> +            '*cookie-secret': 'str',
> +            '*header': [ 'str' ] } }

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  parent reply	other threads:[~2018-03-01 16:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01 13:58 [Qemu-devel] [PATCH 0/2] block: curl: Proof of concept for connecting to oVirt Richard W.M. Jones
2018-03-01 13:58 ` [Qemu-devel] [PATCH 1/2] block: curl: Allow arbitrary HTTP request headers to be set Richard W.M. Jones
2018-03-01 15:24   ` Nir Soffer
2018-03-01 15:46     ` Richard W.M. Jones
2018-03-01 16:11   ` Daniel P. Berrangé [this message]
2018-03-01 16:29     ` Richard W.M. Jones
2018-03-01 13:58 ` [Qemu-devel] [PATCH 2/2] block: curl: Allow Certificate Authority bundle to be passed in Richard W.M. Jones
2018-03-01 15:27   ` Nir Soffer
2018-03-01 15:34   ` Daniel P. Berrangé
2018-03-01 15:47     ` Richard W.M. Jones
2018-03-01 14:21 ` [Qemu-devel] [PATCH 0/2] block: curl: Proof of concept for connecting to oVirt no-reply
2018-03-01 14:31   ` Richard W.M. Jones
2018-03-01 14:49 ` no-reply
2018-03-01 15:38 ` no-reply
2018-03-01 16:54 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180301161118.GW14643@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.