[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] block: curl: Allow arbitrary H

From: Richard W.M. Jones
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] block: curl: Allow arbitrary HTTP request headers to be set.
Date: Thu, 1 Mar 2018 16:29:08 +0000
User-agent: Mutt/1.5.20 (2009-12-10)

On Thu, Mar 01, 2018 at 04:11:18PM +0000, Daniel P. Berrangé wrote:
> 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":"";,
> >                  "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.

I'm going to withdraw this patch is it's not needed.  However this
does introduce a dependency on curl because of this from

                                                        "If  you  add  a
   header that is otherwise generated and used by libcurl internally, your
   added one will be used instead. If you add a header with no content  as
   in  'Accept:'  (no data on the right side of the colon), the internally
   used header will get disabled. With this option you can add  new  head‐
   ers,  replace  internal  headers  and remove internal headers. To add a
   header with no content (nothing to the right side of  the  colon),  use
   the form 'MyHeader;' (note the ending semicolon)."

> > 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

Will change the second patch accordingly, thanks.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]