* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
#include "qemu/osdep.h"
#include "qapi/error.h"
-#include "qemu-common.h"
#include "qemu/error-report.h"
+#include "qemu/option.h"
#include "block/block_int.h"
-#include "qapi/qmp/qbool.h"
+#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h"
#include "crypto/secret.h"
#include <curl/curl.h>
size_t start;
size_t end;
-
- QSIMPLEQ_ENTRY(CURLAIOCB) next;
} CURLAIOCB;
typedef struct CURLSocket {
bool accept_range;
AioContext *aio_context;
QemuMutex mutex;
- QSIMPLEQ_HEAD(, CURLAIOCB) free_state_waitq;
+ CoQueue free_state_waitq;
char *username;
char *password;
char *proxyusername;
curl_easy_setopt(state->curl, CURLOPT_URL, s->url);
curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYPEER,
(long) s->sslverify);
+ curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYHOST,
+ s->sslverify ? 2L : 0L);
if (s->cookie) {
curl_easy_setopt(state->curl, CURLOPT_COOKIE, s->cookie);
}
/* Called with s->mutex held. */
static void curl_clean_state(CURLState *s)
{
- CURLAIOCB *next;
int j;
for (j = 0; j < CURL_NUM_ACB; j++) {
assert(!s->acb[j]);
s->in_use = 0;
- next = QSIMPLEQ_FIRST(&s->s->free_state_waitq);
- if (next) {
- QSIMPLEQ_REMOVE_HEAD(&s->s->free_state_waitq, next);
- qemu_mutex_unlock(&s->s->mutex);
- aio_co_wake(next->co);
- qemu_mutex_lock(&s->s->mutex);
- }
+ qemu_co_enter_next(&s->s->free_state_waitq, &s->s->mutex);
}
static void curl_parse_filename(const char *filename, QDict *options,
}
DPRINTF("CURL: Opening %s\n", file);
- QSIMPLEQ_INIT(&s->free_state_waitq);
+ qemu_co_queue_init(&s->free_state_waitq);
s->aio_context = bdrv_get_aio_context(bs);
s->url = g_strdup(file);
qemu_mutex_lock(&s->mutex);
}
/* Prior CURL 7.19.4 return value of 0 could mean that the file size is not
* know or the size is zero. From 7.19.4 CURL returns -1 if size is not
- * known and zero if it is realy zero-length file. */
+ * known and zero if it is really zero-length file. */
#if LIBCURL_VERSION_NUM >= 0x071304
if (d < 0) {
pstrcpy(state->errmsg, CURL_ERROR_SIZE,
if (state) {
break;
}
- QSIMPLEQ_INSERT_TAIL(&s->free_state_waitq, acb, next);
- qemu_mutex_unlock(&s->mutex);
- qemu_coroutine_yield();
- qemu_mutex_lock(&s->mutex);
+ qemu_co_queue_wait(&s->free_state_waitq, &s->mutex);
}
if (curl_init_state(s, state) < 0) {