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

[leafnode-list] delaybody (was: fetchnews fails to download bodies)



* Cornelius Krasel <krasel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> [010123 19:18]:
> 
> > Has anybody tried to run fetchnews with "delaybody=1"
> > in leafnode-2.0b8?
> > 
> > Fetchnews seems to be able to download the headers only
> > but not the bodies that are marked for retrieval.
> 
> I think (but am not sure) that the problem lies in fetchnews::doxover().
> fetchnews writes a "pseudobody" which confuses the heck out of the
> nntpd. The following patch (for 2.0b8, no change in the nntpd) may
> help:
> 
> --- fetchnews.c.orig	Tue Jan 23 12:09:21 2001
> +++ fetchnews.c	Tue Jan 23 12:10:26 2001
> @@ -697,7 +697,6 @@
>  		}
>  		if ( ( f = fopenmsgid( c, FALSE ) ) != NULL ) {
>  		    fprintf( f, "%s", hdr );
> -		    fprintf( f, "\n[ Thread has been marked for download ]\n" );
>  		    fclose( f );
>  		    store( c, f, newsgroups, messageid );
>  		}
> 

I've applied your patch and it works like expected. nntpd is able to
mark articles for download. (My line numbers and yours differed btw. Did
you use a different fetchnews.c than that of leafnode-2.0b8?)

However, fetchnews is still not able to store the downloaded bodies. The
problem is that fopenmsgid is called twice for those articles. The first 
time when the pseudoarticle ist stored (doxover::fopenmsgid) and a second 
time in a subsequent run when fetchnews downloads the bodies 
(getmarked::getarticle::fopenmsgid). In the latter case, fopenmsgid 
realizes that the article is already stored (i.e. the pseudoarticle)
and refuses to overwrite. 

I've tried the following patch, which seems to work if there is only one
upstream server. But if there are two or more upstream servers you may 
end up with multiple copies of some articles.
Actually, I don't think there is a really quick and clean solution 
for delaybody without some major changes in fetchnews.c.

Regards - Juergen.


--- fetchnews.c.orig    Tue Jan 23 19:26:44 2001
+++ fetchnews.c Tue Jan 23 23:49:28 2001
@@ -686,7 +686,6 @@
                }
                if ( ( f = fopenmsgid( c, FALSE ) ) != NULL ) {
                    fprintf( f, "%s", hdr );
-                   fprintf( f, "\n[ Thread has been marked for download ]\n" );
                    fclose( f );
                    store( c, f, newsgroups, messageid );
                }
@@ -813,6 +812,7 @@
     unsigned long hsize = 0;
     unsigned long hlen = 0;
     int reply = 0;
+    int override = FALSE;
     unsigned long artno;
 
     l = getaline( nntpin );
@@ -860,7 +860,10 @@
        groupkilled++;
        return artno;
     }
-    if ( (f = fopenmsgid( filename, FALSE )) == NULL ) {
+    
+    if ( delaybody ) override = TRUE; /* (pseudo)article already here */
+
+    if ( (f = fopenmsgid( filename, override )) == NULL ) {
        _ignore_answer( nntpin );
        free( h );
        groupkilled++;



-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list