[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 0/4] block/curl: Fix FTP
From: |
Max Reitz |
Subject: |
[Qemu-stable] [PATCH 0/4] block/curl: Fix FTP |
Date: |
Tue, 25 Oct 2016 04:54:27 +0200 |
At least for me, the FTP support of our curl block driver currently
doesn't work at all. This is due to (at least) three issues, for each of
which this series provides a patch (and the first patch is just a minor
clean-up).
1. When establishing an FTP connection, libcurl hands us some data we do
not expect because we have not really been asking for it. Not an
issue in theory, because we can just ignore it. Unfortunately, qemu
has decided to be more direct about the issue and tell libcurl that
we did not process any of that data. libcurl doesn't like that. At
all. Therefore, it returns the favor and just cancels the connection.
In effect, it is impossible to even open a connection to an FTP
server (at least in my test environment).
Patch 2 fixes this by just playing along nicely.
2. libcurl has an old function called curl_multi_socket_all(). It allows
you to kick off action on all of the sockets there are.
Unfortunately, it is deprecated. Therefore, our code decides to be
good and use the non-deprecated curl_multi_socket_action() function.
However, that one only works on a single socket and wants to know
which. So our code remembers the socket of the current connection.
Works great for HTTP which generally only uses one socket.
Unfortunately, FTP generally uses at least two, one for the control
and one for the data stream. So us remembering only one of those two
results in qemu only being able to receive the first 16 kB of any
request (and maybe even of any connection).
Patch 3 fixes this by putting the sockets into a list and thus being
able to remember more than one.
3. The first two patches make curl work on files with file sizes that
are multiples of 512, but not so well with others. curl still uses
the sector-based interface, so it may receive requests beyond the
EOF into the partial last sector. While it will actually not pass a
request beyond the EOF to libcurl, it will unfortunately still wait
to receive data from there. Which of course will not happen. So every
request into that last sector makes the whole BDS hang indefinitely.
Patch 4 fixes this by letting go of the futile hope for data from
where there is none.
Max Reitz (4):
block/curl: Use BDRV_SECTOR_SIZE
block/curl: Fix return value from curl_read_cb
block/curl: Remember all sockets
block/curl: Do not wait for data beyond EOF
block/curl.c | 99 +++++++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 75 insertions(+), 24 deletions(-)
--
2.10.1
- [Qemu-stable] [PATCH 0/4] block/curl: Fix FTP,
Max Reitz <=