qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH] Add HTTP protocol using curl v7


From: Consul
Subject: [Qemu-devel] Re: [PATCH] Add HTTP protocol using curl v7
Date: Wed, 27 May 2009 10:45:56 -0700
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

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 via email to

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