Re: NNTPC: problem with "HEAD" followed by "BODY" requests on non-cached articles

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

 



In mail.nntpcache,
On Tue, 18 Jul 2000 10:38:37 -0700, Heather L. Sherman <heather@idealab.com> wrote:
>I'm trying out nntpcache (NNTPCache-2.4.0b5) and have run into the
>following oddness.  
>
>The news reader I was testing with (trn) typically does a "HEAD" on an
>article, followed by a "BODY".  If the article isn't cached I have the
>following two (probably related) problems:
>
>1) "body" includes the header as well as the article body.

Interesting. I've had same problems long time ago (with 2.3.2.1).
Anyway, back then, I fixed problem with following patch. I don't know if it
still has any merit, but you may want to look around that part of code
anyway:


--- src/article.c.old	Sat Jan 31 08:42:49 1998
+++ src/article.c	Sat Mar 28 20:27:36 1998
@@ -196,6 +196,24 @@
 		return FALSE;
 	}
 	artfile = links->head->data;
+	
+	{
+		char *pp = strstr (artfile, "_head");
+		/* logd (("test /mn/: here goes the ARTFILE=%s", artfile)); */
+		if (!pp) {
+			char *newart = malloc (strlen (artfile)+6);
+			if (!newart) {
+				logw (("Oops. No mem. Remove _head for %s skipped.", artfile));
+			} else {
+				strcpy (newart, artfile);
+				strcat (newart, "_head");
+				unlink (newart);
+				logd (("Removed obsolete _head: %s", newart));
+				free (newart);
+			}
+		}
+	}
+	
 	fd = open (artfile, O_WRONLY | O_EXCL | O_CREAT, 0664);
 	if (fd == -1)
 	{
@@ -745,10 +763,12 @@
 			
 			/* if we pulled it from the cache, then this has already been added */
 			art_stack = strnStackAdd (art_stack, XCACHE, sizeof(XCACHE)-1);
-			head_len = art_stack->used-1;
 		}
+		head_len = art_stack->used-1;	/* /mn/ 980328. unacached 'head' followed by 'body' returned header in the body also ! so I've moved this head_len out of if (!body). seems to work :) */
+		
 		if (type == c_article || (type == c_body && CurrentScfg->article_timeout))
 			art_stack = strnStackAdd (art_stack, "\r\n", 2);
+			
 		if (!f_filt)
 		{
 			emit_follows(type, artno, msgid, getbyid); /* 221 52 <839359140.253541@suburbia.net> head etc */
@@ -813,6 +833,7 @@
 				emit ((type == c_body && CurrentScfg->article_timeout)? art_stack->data+head_len+2: art_stack->data);
 			}
 		}
+		
 		if (type != c_stat)
 			emitrn (".");
 		if (CurrentScfg->article_timeout)

-- 
Opinions above are GNU-copylefted.


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux