πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90768

Re: Historical articles and longest retention. dot-stuff

#90768
From: Billy G. (go-while)
Date: Tue, 12 Sep 2023 17:12
80 lines
3517 bytes
On 11.09.23 17:42, Russ Allbery wrote:
> "Billy G. (go-while)" <no-reply@no.spam> writes:
>> On 02.06.23 23:36, Julien Γ‰LIE wrote:
> 
>>> Actually, you need adding an additional dot to lines *beginning* with a
>>> dot, not only lines containing only a dot.
> 
>> are you sure?
> 
> Yes.  :)
> 
> But see the bit that you quoted:
> 
>>     3.  If any line of the data block begins with the "termination octet"
>>         ("." or %x2E), that line MUST be "dot-stuffed" by prepending an
>>         additional termination octet to that line of the block.
> 

++thanks Russ!
++thanks Julien!

sometimes you can't see the forest for the trees!

found this and looks like GO does it correctly...
if you use dotreader/dotwriter.

i don't. the basic GO way does not stop reading.
in order to have an incoming article size limit, i read by lines, count 
bytes and break out if an article is too large.
basic dotreader returns whenever client sends a closing dot which could 
be somewhere near infinite.


to send data use "dotwriter": add a dot to every leading dot.

to read data use "dotreader": cut any first dot if line is not only a 
(closing) dot.


i hope this is correct or did i miss something?

1) a) server sends article via IHAVE/TAKETHIS OR
    b) client sends article via POST to server OR
    c) server sends ARTICLE/BODY to a client:
    --> use "dotwriter"

2) server receives article via IHAVE/TAKETHIS/POST
    --> use "dotreader"
        + server writes data to storage
        + client requests ARTICLE/BODY: jump to 1) c).

3) client receives (reads) ARTICLE/BODY:
    --> use "dotreader" and print it.




dotreader
https://cs.opensource.google/go/go/+/refs/tags/go1.21.1:src/net/textproto/reader.go;drc=1e43cfa15b4b618812e85c00c9e92c2615b324c8;l=448

// Dot by itself marks end; otherwise cut one dot.
if len(line) > 0 && line[0] == '.' {
   if len(line) == 1 {
     break
   }
   line = line[1:]
}


dotwriter
https://cs.opensource.google/go/go/+/refs/tags/go1.21.1:src/net/textproto/writer.go;drc=2580d0e08d5e9f979b943758d3c49877fb2324cb;l=67,

case wstateBegin, wstateBeginLine:
   d.state = wstateData
   if c == '.' {
     // escape leading dot
     bw.WriteByte('.')
   }

Technical Details
Message-ID: <LV0MM.40635$Flj7.17760@fx13.ams4>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <u3rlen$2nvcc$1@dont-email.me> <4NzXdKS8lFiC65I9j@bongo-ra.co> <c4db4cd6e81e8d13c68c2aacd83cb130@news.novabbs.org> <u5dfr0$saq6$1@news.trigofacile.com> <7de70a7c22f63299fb931a49bf940647@news.novabbs.org> <73a75e2e9b285d7543495da6efe71c48@news.novabbs.org> <u5dndi$saq6$5@news.trigofacile.com> <pDzLM.9482$eyS6.866@fx15.ams4> <87cyyoyavg.fsf@hope.eyrie.org>

Show Full Headers
Complete Article Headers
Message-ID: <LV0MM.40635$Flj7.17760@fx13.ams4>
Subject: Re: Historical articles and longest retention. dot-stuff
Date: Tue, 12 Sep 2023 19:12:51 +0200
From: "Billy G. (go-while)" <no-reply@no.spam>
References: <u3rlen$2nvcc$1@dont-email.me> <4NzXdKS8lFiC65I9j@bongo-ra.co> <c4db4cd6e81e8d13c68c2aacd83cb130@news.novabbs.org> <u5dfr0$saq6$1@news.trigofacile.com> <7de70a7c22f63299fb931a49bf940647@news.novabbs.org> <73a75e2e9b285d7543495da6efe71c48@news.novabbs.org> <u5dndi$saq6$5@news.trigofacile.com> <pDzLM.9482$eyS6.866@fx15.ams4> <87cyyoyavg.fsf@hope.eyrie.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
MIME-Version: 1.0
User-Agent: NoZilla/3.11 (Hackint; Unicorn; rv:0.8.15) go-while/19720229
 NewsRW/4.2.0
Content-Language: en-US
Newsgroups: news.software.nntp
Organization: github.com/go-while
In-Reply-To: <87cyyoyavg.fsf@hope.eyrie.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 81
X-Complaints-To: abuse@blocknews.net
NNTP-Posting-Date: Tue, 12 Sep 2023 17:07:55 UTC
X-Received-Bytes: 3350