Statistics
| Branch: | Revision:

root / block / curl.c @ 34b5d2c6

History | View | Annotate | Download (18.5 kB)

# Date Author Comment
015a1036 09/12/2013 11:12 am Max Reitz

bdrv: Use "Error" for opening images

Add an Error ** parameter to BlockDriver.bdrv_open and
BlockDriver.bdrv_file_open to allow more specific error messages.

Signed-off-by: Max Reitz <>

5b21a2ae 09/01/2013 06:11 pm Stefan Hajnoczi

curl: qemu_bh_new() can never return NULL

Drop error code path which cannot be taken since qemu_bh_new() does not
return NULL.

Signed-off-by: Stefan Hajnoczi <>
Reviewed-by: Paolo Bonzini <>
Signed-off-by: Michael Tokarev <>

f2e5dca4 08/19/2013 04:52 pm Stefan Hajnoczi

aio: drop io_flush argument

The .io_flush() handler no longer exists and has no users. Drop the
io_flush argument to aio_set_fd_handler() and related functions.

The AioFlushEventNotifierHandler and AioFlushHandler typedefs are no
longer used and are dropped too....

0d146022 08/19/2013 04:45 pm Stefan Hajnoczi

block/curl: drop curl_aio_flush()

.io_flush() is no longer called so drop curl_aio_flush(). The acb[]
array that the function checks is still used in other parts of
block/curl.c. Therefore we cannot remove acb[], it is needed.

Signed-off-by: Stefan Hajnoczi <>

3494d650 07/05/2013 10:40 am Fam Zheng

curl: refuse to open URL from HTTP server without range support

CURL driver requests partial data from server on guest IO req. For HTTP
and HTTPS, it uses "Range: ***" in requests, and this will not work if
server not accepting range. This patch does this check when open....

a7cea2ba 06/17/2013 06:47 pm Richard W.M. Jones

block/curl.c: Refuse to open the handle for writes.

Signed-off-by: Richard W.M. Jones <>
Signed-off-by: Fam Zheng <>
Signed-off-by: Kevin Wolf <>

8da1aa15 06/17/2013 06:47 pm Richard W.M. Jones

curl: Don't set curl options on the handle just before it's going to be deleted.

(Found by Kamil Dudka)

Signed-off-by: Richard W.M. Jones <>
Cc: Michael Tokarev <>
Signed-off-by: Kevin Wolf <>

9e5e2b23 06/11/2013 10:45 pm Richard W.M. Jones

curl: Whitespace only changes.

Trivial patch to remove odd whitespace.

Signed-off-by: Richard W.M. Jones <>
Signed-off-by: Michael Tokarev <>

56d1b4d2 04/22/2013 12:34 pm Kevin Wolf

block: Remove filename parameter from .bdrv_file_open()

It is unused now in all block drivers.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

8e6d58cd 04/22/2013 11:27 am Kevin Wolf

curl: Use bdrv_open options instead of filename

As a bonus, going through the QemuOpts QEMU_OPT_SIZE parser for the
readahead option gives us proper error reporting that the previous use
of atoi() lacked.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

787e4a85 03/22/2013 06:51 pm Kevin Wolf

block: Add options QDict to bdrv_file_open() prototypes

The new parameter is unused yet.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

8a8f5840 02/13/2013 07:57 pm Stefan Hajnoczi

block/curl: only restrict protocols with libcurl>=7.19.4

The curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, ...) interface was
introduced in libcurl 7.19.4. Therefore we cannot protect against
CVE-2013-0249 when linking against an older libcurl.

This fixes the build failure introduced by...

fb6d1bbd 02/08/2013 07:14 pm Stefan Hajnoczi

block/curl: disable extra protocols to prevent CVE-2013-0249

There is a buffer overflow in libcurl POP3/SMTP/IMAP. The workaround is
simple: disable extra protocols so that they cannot be exploited. Full
details here:

http://curl.haxx.se/docs/adv_20130206.html...
737e150e 12/19/2012 09:31 am Paolo Bonzini

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

d7331bed 11/14/2012 07:19 pm Stefan Hajnoczi

aio: rename AIOPool to AIOCBInfo

Now that AIOPool no longer keeps a freelist, it isn't really a "pool"
anymore. Rename it to AIOCBInfo and make it const since it no longer
needs to be modified.

Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

45724d6d 09/12/2012 04:50 pm Stefan Weil

block/curl: Fix wrong free statement

Report from smatch:
block/curl.c:546 curl_close(21) info: redundant null check on s->url calling free()

The check was redundant, and free was also wrong because the memory
was allocated using g_strdup.

Signed-off-by: Stefan Weil <>...

03396148 06/11/2012 10:12 pm Michael Tokarev

allow qemu_iovec_from_buffer() to specify offset from which to start copying

Similar to
qemu_iovec_memset(QEMUIOVector *qiov, size_t offset,
int c, size_t bytes);
the new prototype is:
qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset,...

bafbd6a1 04/19/2012 05:37 pm Paolo Bonzini

aio: remove process_queue callback and qemu_aio_process_queue

Both unused after the previous patch.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

fb7c8e8a 04/03/2012 11:34 am Stefan Weil

block/curl: Replace usleep by g_usleep

The function usleep is not available for all supported platforms:
at least some versions of MinGW don't support it.

usleep was also declared obsolete by POSIX.1-2001.

The function g_usleep is part of glib2.0, so it is available for...

91977c2e 12/15/2011 01:40 pm Paolo Bonzini

block: qemu_aio_get does not return NULL

Initially done with the following semantic patch:

rule1
expression E;
statement S;
@@
E = qemu_aio_get (...);
(
- if (E == NULL) { ... } |
- if (E) { <... S ...> }
)

which however missed occurrences in linux-aio.c and posix-aio-compat.c....

363c3c85 09/21/2011 04:16 pm Nick Thomas

block/curl: Don't finish AIOCBs too early

The previous behaviour was to finish AIOCBs inside curl_aio_readv()
if the data was cached. This caused the following failed assertion
at hw/ide/pci.c:314: bmdma_cmd_writeb

"Assertion `bm->bus->dma->aiocb == ((void *)0)' failed."...

c84dcdc1 09/21/2011 04:16 pm Nick Thomas

block/curl: Implement a flush function on the fd handlers

Signed-off-by: Nick Thomas <>
Signed-off-by: Kevin Wolf <>

f785a5ae 08/23/2011 06:41 pm Nicholas Thomas

block/curl: Handle failed reads gracefully.

Current behaviour if a read fails is for the acb to not get finished.
This causes an infinite loop in bdrv_read_em (block.c). The read failure
never gets reported to the guest and if the error condition clears, the...

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

0bfcd599 05/22/2010 11:02 am Blue Swirl

Fix %lld or %llx printf format use

Signed-off-by: Blue Swirl <>

66f82cee 05/03/2010 11:07 am Kevin Wolf

block: Open the underlying image file in generic code

Format drivers shouldn't need to bother with things like file names, but rather
just get an open BlockDriverState for the underlying protocol. This patch
introduces this behaviour for bdrv_open implementation. For protocols which...

6265eb26 02/10/2010 10:00 pm Jim Meyering

don't dereference NULL after failed strdup

Most of these are obvious NULL-deref bug fixes, for example,
the ones in these files:

block/curl.c
net.c
slirp/misc.c

and the first one in block/vvfat.c.
The others in block/vvfat.c may not lead to an immediate segfault, but I...

48a402e6 02/08/2010 11:44 am malc

block/curl: %Z is not a valid conversion specifier

Signed-off-by: malc <>

d0f2c4c6 02/07/2010 01:03 am malc

Do not use dprintf

dprintf is already claimed by POSIX1, and on at least one system
is implemented as a macro

[1] http://www.opengroup.org/onlinepubs/9699919799/functions/dprintf.html

Signed-off-by: malc <>

8febfa26 10/27/2009 07:28 pm Kevin Wolf

Add qemu_aio_process_queue()

We'll leave some AIO completions unhandled when we can't call the callback.
qemu_aio_process_queue() is used later to run any callbacks that are left and
can be run then.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Anthony Liguori <>

df3cee1a 08/01/2009 01:13 pm Blue Swirl

Fix Sparse warning about "expression using sizeof on a function"

Signed-off-by: Blue Swirl <>

c76f4952 07/10/2009 12:06 am Nolan

Allow adjustment of http block device's readahead size, via a new
":readahead=###:" suffix.

Signed-off-by: Nolan Leake <nolan <at> sigbus.net>
Signed-off-by: Anthony Liguori <>

c16b5a2c 05/27/2009 05:46 pm Christoph Hellwig

fully split aio_pool from BlockDriver

Now that we have a separate aio pool structure we can remove those
aio pool details from BlockDriver.

Every driver supporting AIO now needs to declare a static AIOPool
with the aiocb size and the cancellation method. This cleans up the...

769ce76d 05/22/2009 06:50 pm Alexander Graf

Add HTTP protocol using curl v6

Currently Qemu can read from posix I/O and NBD. This patch adds a
third protocol to the game: HTTP.

In certain situations it can be useful to access HTTP data directly,
for example if you want to try out an http provided OS image, but...