From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoYPF-0005kd-0C for qemu-devel@nongnu.org; Mon, 17 Jun 2013 08:19:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UoYPA-0000LJ-A9 for qemu-devel@nongnu.org; Mon, 17 Jun 2013 08:19:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoYPA-0000LE-2Y for qemu-devel@nongnu.org; Mon, 17 Jun 2013 08:19:28 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5HCJRZf022754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Jun 2013 08:19:27 -0400 Date: Mon, 17 Jun 2013 13:19:23 +0100 From: "Richard W.M. Jones" Message-ID: <20130617121923.GE1882@redhat.com> References: <1371463763-25628-1-git-send-email-famz@redhat.com> <20130617105413.GC1882@redhat.com> <20130617110200.GA26067@localhost.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130617110200.GA26067@localhost.nay.redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] curl: refuse to open URL from HTTP server without range support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Kevin Wolf , stefanha@redhat.com On Mon, Jun 17, 2013 at 07:02:00PM +0800, Fam Zheng wrote: > On Mon, 06/17 11:54, Richard W.M. Jones wrote: > > On Mon, Jun 17, 2013 at 06:09:23PM +0800, Fam Zheng wrote: > > > + if (real_size >= strlen(accept_len) > > > > What's accept_len? This patch gives me a couple of compile errors: > > > Oops, a copy&paste mistake. I meant this: > > + if (realsize >= strlen(accept_line) I added this fix and tested it against a Python HTTP server (which does not support ranges): $ cd /tmp $ python -m SimpleHTTPServer [in another window ...] $ http_proxy= ./qemu-io -r http://127.0.0.1:8000/test1.img -c 'read -v 0 512' CURL: Error opening file: Server not supporting range. qemu-io: can't open device http://127.0.0.1:8000/test1.img no file open, try 'help open' [against another server which does support ranges ...] $ LD_LIBRARY_PATH=~/d/curl/lib/.libs http_proxy= ./qemu-io -r http://libguestfs.org/index.html -c 'read -v 0 512' 00000000: 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 20 50 ..DOCTYPE.html.P [etc] By the way I think it would be better if the error message said "Server does not support 'range' (byte ranges)." Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/