Re: [Libguestfs] [PATCH nbdkit 2/2] curl: Fallback to GET if HEAD not supported

2023-06-08 Thread Laszlo Ersek
On 6/7/23 14:59, Richard W.M. Jones wrote: > On Tue, Jun 06, 2023 at 08:06:50PM +0100, Richard W.M. Jones wrote: >> >> Michael Henriksen pointed out an issue with this approach. >> >> If the web server is actually generating the content on the fly then >> it may send it as chunked encoding, and in

Re: [Libguestfs] [PATCH nbdkit 2/2] curl: Fallback to GET if HEAD not supported

2023-06-08 Thread Laszlo Ersek
On 6/6/23 21:06, Richard W.M. Jones wrote: > > Michael Henriksen pointed out an issue with this approach. > > If the web server is actually generating the content on the fly then > it may send it as chunked encoding, and in HTTP/1.1 it's not required > that the Content-Length field is present

Re: [Libguestfs] [PATCH nbdkit 2/2] curl: Fallback to GET if HEAD not supported

2023-06-08 Thread Laszlo Ersek
On 6/6/23 18:38, Richard W.M. Jones wrote: > On Tue, Jun 06, 2023 at 06:09:09PM +0200, Laszlo Ersek wrote: >> On 6/6/23 13:22, Richard W.M. Jones wrote: >>> @@ -250,6 +255,11 @@ handle_requests (int s) >>>} >>>memcpy (path, [5], n); >>>path[n] = '\0'; >>> + if

Re: [Libguestfs] [PATCH nbdkit 2/2] curl: Fallback to GET if HEAD not supported

2023-06-07 Thread Richard W.M. Jones
On Tue, Jun 06, 2023 at 08:06:50PM +0100, Richard W.M. Jones wrote: > > Michael Henriksen pointed out an issue with this approach. > > If the web server is actually generating the content on the fly then > it may send it as chunked encoding, and in HTTP/1.1 it's not required > that the

Re: [Libguestfs] [PATCH nbdkit 2/2] curl: Fallback to GET if HEAD not supported

2023-06-06 Thread Richard W.M. Jones
Michael Henriksen pointed out an issue with this approach. If the web server is actually generating the content on the fly then it may send it as chunked encoding, and in HTTP/1.1 it's not required that the Content-Length field is present (since it may not be known when the server begins

Re: [Libguestfs] [PATCH nbdkit 2/2] curl: Fallback to GET if HEAD not supported

2023-06-06 Thread Richard W.M. Jones
On Tue, Jun 06, 2023 at 06:09:09PM +0200, Laszlo Ersek wrote: > only superficial comments: > > On 6/6/23 13:22, Richard W.M. Jones wrote: [...] > > diff --git a/tests/test-curl-head-forbidden.c > > b/tests/test-curl-head-forbidden.c > > new file mode 100644 > > index 0..16b1f0533 > > ---

Re: [Libguestfs] [PATCH nbdkit 2/2] curl: Fallback to GET if HEAD not supported

2023-06-06 Thread Laszlo Ersek
only superficial comments: On 6/6/23 13:22, Richard W.M. Jones wrote: > Some servers do not support HEAD for requesting the headers. If the > HEAD request fails, fallback to using the GET method, abandoning the > transfer as soon as possible after the headers have been received. > > Fixes: