From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,865c3d125a8dbc3b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Howto read line from a stream Date: Mon, 1 Jun 2009 18:30:31 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <83317a97-dae5-4c84-a1ac-88a87833cf3f@q14g2000vbn.googlegroups.com> <1a90e055-44a3-4d00-b4cd-64798c731a55@e24g2000vbe.googlegroups.com> <16949835-6528-4a7a-a653-fd466b37bb45@s21g2000vbb.googlegroups.com> <18nn8atp3gdq1$.6g5cqv5h6u1c.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1243899056 31682 69.95.181.76 (1 Jun 2009 23:30:56 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 1 Jun 2009 23:30:56 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news2.google.com comp.lang.ada:6168 Date: 2009-06-01T18:30:31-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:18nn8atp3gdq1$.6g5cqv5h6u1c.dlg@40tude.net... ... >> My protocol says that every line ends with CR & LF, only length can >> vary. > > The best practice of dealing with texts (streams or not) is to use LF as a > line terminator and remove training (or any) CR's from the buffer. This > makes it working under both Linux and Windows. That's lousy advice if he is working with a protocol that is defined outside of his system. For instance, most Internet protocols (like HTTP, SMTP, and FTP) require lines to be ended with CR LF. Lines that don't include the CR are simply wrong and do not conform to the protocol. The originating system is irrelevant, Windows, Linux, Mac, whatever. Indeed, the lack of those characters is usually a good sign that spammers, malware, and the like is trying to access your system. For instance, my spam filter blocks e-mail messages that are missing the CRs required by the protocol, because only clueless or sloppy systems miss them (in addition, some older e-mail clients would crash on such messages, and there still is a danger to allowing them through). Randy.