Ciao miei cari talponi,

        as we use persistent connections, I think we have to raise, at least, 2
other configuration attributes.

        The first regards if we wanna use them. So I would call it
'persistent_connections' and let it assumes a boolean value (default 'true').

        As we use them, another trouble comes up. Indeed, while htdig is parsing a
document, the wait time could be longer than the timeout, and so we can
have, sometimes, a 'connection down' result for a document retrieving. But
this proposal is valid in general. I suggest, for example, to use a
configuration attribute for setting the number of retries for a document
retrieving ('max_retries'? - default = 3). We should retry until we have a
valid document status returned (not 'connection down' or 'no connection) or
number of retries is greater than the one choosen by the user.

Here is the little code change required (I already tested it and works).

@@ -293,7 +294,20 @@ Document::Retrieve(HtDateTime date)
       
       // Make the request
       // Here is the main operation ... Let's make the request !!!
-      status = transportConnect->Request();
+      // We now perform a loop until we want to retry the request
+
+      NumRetries = 0;
+      
+      do
+      {
+         status = transportConnect->Request();
+
+         if (NumRetries++)
+            if(debug>0)
+               cout << ".";
+
+      } while (ShouldWeRetry(status) && NumRetries<3);   // Max retries is 3
+                                                         // But it could be

This is the 'ShouldWeRetry' method.

+int Document::ShouldWeRetry(Transport::DocStatus DocumentStatus)
+{
+
+   if (DocumentStatus == Transport::Document_connection_down)
+      return 1;
+      
+   if (DocumentStatus == Transport::Document_no_connection)
+      return 1;
+      
+   return 0;
 }

The third attribute I propose is the one regarding the 'head_before_get'
setting and should be set by default to 'false'. By setting it to true, we
ask the server for a document, with a HEAD HTTP method and later, if
needed, with a GET we obtain the whole contents.

Do you want to vote on them, please?

Ciao
-Gabriele


-------------------------------------------------

Gabriele Bartolini
U.O. Rete Civica - Comune di Prato
Prato - Italia - Europa

e-mail: [EMAIL PROTECTED]
http://www.po-net.prato.it

"Life teaches you never stop learning ..."

-------------------------------------------------

------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to