On Sat, 18 Aug 2007 12:07:57 -0700
Micah Cowan <[EMAIL PROTECTED]> wrote:
> Well, the additional treatment for the --spider option seems appropriate
> as well.
i definitely think so.
> However, it seems right to me, that if the local file exists, and
> timestamping is on, then (since we don't use If-Modified-Since), a HEAD
> request ought to be sent. This would mean that row 4 of the first table
> above would have a conditional truth value.
unfortunately, implementing this behaviour in the current code requires a
rather ugly hack. in fact, unless -O is given, wget delays the decision about
the destination filename until it has parsed the HTTP response.
anyway, to change wget's logic as you request, i just commited this patch into
the b20323 branch:
Index: src/http.c
===================================================================
--- src/http.c (revisione 2340)
+++ src/http.c (copia locale)
@@ -2351,12 +2351,19 @@
/* Reset the document type. */
*dt = 0;
- /* Skip preliminary HEAD request if we're not in spider mode. Also skip it
+ /* Skip preliminary HEAD request if we're not in spider mode AND
* if -O was given or HTTP Content-Disposition support is disabled. */
if (!opt.spider
&& (got_name || !opt.content_disposition))
send_head_first = false;
+ /* Send preliminary HEAD request if -N is given and we have an existing
+ * destination file. */
+ if (opt.timestamping
+ && !opt.content_disposition
+ && file_exists_p (url_file_name (u)))
+ send_head_first = true;
+
/* THE loop */
do
{
> Also, I'm not understanding why we send HEAD, ever, if we specify -O.
> Are the semantics of -O going to change, then, and we'll do timestamping
> on the output file, rather than treat it as if it were a redirection?
actually, we don't. the 2nd table was wrong. i did a "cut & paste" from the
first table but forgot to change the values in the 3rd column. i sincerely
apologize. this is the correct version of the table:
-N | --no-content-disposition | Preliminary HEAD | Preliminary HEAD
| | request in 1.11 | request in 1.10.2
------------------------------------------------------------------------
no | no | yes | no
no | yes | no | N/A
yes | no | yes | no
yes | yes | no | N/A
-O | --no-content-disposition | Preliminary HEAD | Preliminary HEAD
| | request in 1.11 | request in 1.10.2
------------------------------------------------------------------------
no | no | no | no
no | yes | no | N/A
yes | no | no | no
yes | yes | no | N/A
--spider | -r | --no-cont.disp | Preliminary HEAD | Preliminary HEAD
| | | request in 1.11 | request in 1.10.2
-------------------------------------------------------------------------
yes | no | no | yes | yes
yes | no | yes | yes | N/A
yes | yes | no | yes | N/A*
yes | yes | yes | yes | N/A*
*) recursive spider mode is broken in wget 1.10.* and 1.9.*
--
Mauro Tortonesi <[EMAIL PROTECTED]>