From f9f0020ebb1039327f99c3736ebc26ca9a483c47 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 14 Feb 2008 06:56:36 +0000
Subject: [PATCH] Even though RFC977 and RFC3977 clearly state a maximum of 512
 bytes per response line, "Timelord" reported a problem with some news server
 sending > 512-byte response lines for the XOVER command

---
 exec/newslink.js | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/exec/newslink.js b/exec/newslink.js
index 3fc70acaa8..9efeb57618 100644
--- a/exec/newslink.js
+++ b/exec/newslink.js
@@ -106,9 +106,9 @@ function writeln(str)
 	write(str + "\r\n");
 }
 
-function readln(str)
+function readln(len)
 {
-	rsp = socket.readln();
+	rsp = socket.recvline(len);
 	if(debug)
 		printf("rsp: %s\r\n",rsp);
 	return(rsp);
@@ -543,7 +543,10 @@ for(i in area) {
 		if(parseInt(readln())==224) {
 			printf("Getting headers for articles %u through %u\r\n", ptr, last_msg);
 			article_list = new Array();
-			while((rsp=readln())!='.' && socket.is_connected && !js.terminated) {
+			// RFC977 and RFC3977 clearly state 512-bytes per response line,
+			// but "Timelord" reported a problem with some news server sending
+			// > 512-byte response lines for the XOVER command
+			while((rsp=readln(1024))!='.' && socket.is_connected && !js.terminated) {
 				if(rsp)
 					article_list.push(parseInt(rsp));
 				maybe_yield();
@@ -582,7 +585,7 @@ for(i in area) {
 
 			maybe_yield();
 
-			line = socket.recvline(512 /*maxlen*/, 300 /*timeout*/);
+			line = readln();
 
 			if(line==null) {
 				print("!TIMEOUT waiting for text line\r\n");
@@ -647,7 +650,7 @@ for(i in area) {
 
 					if(part>0) {
 
-						line = socket.recvline(512 /*maxlen*/, 300 /*timeout*/);
+						line = readln();
 
 						body += line+"\r\n";
 
-- 
GitLab