qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Consul <void@aleksoft.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] Add HTTP protocol using curl v7
Date: Wed, 27 May 2009 10:45:56 -0700	[thread overview]
Message-ID: <gvju8l$lc7$1@ger.gmane.org> (raw)
In-Reply-To: <4A1D550C.6030807@codemonkey.ws>

Anthony Liguori wrote:
> It's already in git.

Does it work on Windows for anybody? In my case the git version of configure does not even recognize the presence of libcurl.
The hack below makes it to compile in, but running for example "qemu -cdrom http://aleksoft.net/fdbasecd.iso" hangs the emulator
with the following log. Any hints?

Alex

curl --version
curl 7.19.5 (i686-pc-mingw32) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3 libssh2/0.18
Protocols: tftp ftp telnet dict ldap http file https ftps scp sftp
Features: Largefile NTLM SSL libz

<log>

C:\qemu-dist>qemu -cdrom http://aleksoft.net/fdbasecd.iso
CURL: Opening http://aleksoft.net/fdbasecd.iso
* About to connect() to aleksoft.net port 80 (#0)
*   Trying 74.220.214.207... * connected
* Connected to aleksoft.net (74.220.214.207) port 80 (#0)
 > HEAD /fdbasecd.iso HTTP/1.1
Host: aleksoft.net
Accept: */*

< HTTP/1.1 200 OK
< Date: Wed, 27 May 2009 16:28:38 GMT
< Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_pass
through/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
< Last-Modified: Wed, 27 May 2009 16:27:53 GMT
< ETag: "40719c4-7f2800-46ae75337d440"
< Accept-Ranges: bytes
< Content-Length: 8333312
< Content-Type: application/octet-stream
<
* Connection #0 to host aleksoft.net left intact
CURL: Size = 8333312
* Closing connection #0
CURL (AIO): Reading 2048 at 0 (0-0)
CURL (AIO): Sock action 2 on fd 1828
CURL (AIO): Sock action 4 on fd 1828
* About to connect() to aleksoft.net port 80 (#0)
*   Trying 74.220.214.207... CURL (AIO): Sock action 2 on fd 1784
* Connected to aleksoft.net (74.220.214.207) port 80 (#0)
 > GET /fdbasecd.iso HTTP/1.1
Range: bytes=0-0
Host: aleksoft.net
Accept: */*

CURL (AIO): Sock action 1 on fd 1784
< HTTP/1.1 206 Partial Content
< Date: Wed, 27 May 2009 16:28:38 GMT
< Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_pass
through/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
< Last-Modified: Wed, 27 May 2009 16:27:53 GMT
< ETag: "40719c4-7f2800-46ae75337d440"
< Accept-Ranges: bytes
< Content-Length: 1
< Content-Range: bytes 0-0/8333312
< Content-Type: application/octet-stream
<
CURL: Just reading 1 bytes
read 1
CURL (AIO): Sock action 4 on fd 1784
* Connection #0 to host aleksoft.net left intact

</log>

diff --git a/block/curl.c b/block/curl.c
index 5d1487d..14ce646 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -25,8 +25,8 @@
  #include "block_int.h"
  #include <curl/curl.h>

-// #define DEBUG
-// #define DEBUG_VERBOSE
+ #define DEBUG_CURL
+ #define DEBUG_VERBOSE

  #ifdef DEBUG_CURL
  #define dprintf(fmt, ...) do { printf(fmt, ## __VA_ARGS__); } while (0)
@@ -141,6 +141,7 @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
      }

  read_end:
+    printf("read %x\n",realsize);
      return realsize;
  }

@@ -255,7 +256,11 @@ static CURLState *curl_init_state(BDRVCURLState *s)
              break;
          }
          if (!state) {
+#ifndef _WIN32
              usleep(100);
+#else
+            Sleep(0);
+#endif
              curl_multi_do(s);
          }
      } while(!state);
diff --git a/configure b/configure
index bcf1207..c85c29e 100755
--- a/configure
+++ b/configure
@@ -640,7 +640,7 @@ if test "$mingw32" = "yes" ; then
      oss="no"
      linux_user="no"
      bsd_user="no"
-    OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
+    OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -DCURL_STATICLIB"
  fi

  if test ! -x "$(which cgcc 2>/dev/null)"; then
@@ -1103,7 +1103,7 @@ if test "$curl" = "yes" ; then
  int main(void) { return curl_easy_init(); }
  EOF
    curl_libs=`curl-config --libs 2>/dev/null`
- if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+ if $cc $ARCH_CFLAGS -DCURL_STATICLIB -o $TMPE $TMPC $curl_libs > /dev/null 2> /dev/null ; then
      curl=yes
    fi
  fi # test "$curl"

  reply	other threads:[~2009-05-27 17:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 14:57 [Qemu-devel] [PATCH] Add HTTP protocol using curl v7 Alexander Graf
2009-05-22 15:41 ` Laurent Vivier
2009-05-27 14:49 ` Richard W.M. Jones
2009-05-27 14:55   ` Alexander Graf
2009-05-27 15:01     ` Richard W.M. Jones
2009-05-27 14:58   ` Anthony Liguori
2009-05-27 17:45     ` Consul [this message]
2009-05-28  8:45       ` [Qemu-devel] " Anthony Liguori
2009-05-28 18:20         ` Consul
2009-05-28 18:23         ` Consul

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='gvju8l$lc7$1@ger.gmane.org' \
    --to=void@aleksoft.net \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).