|
Posted by Tim Van Wassenhove on 10/11/14 11:44
On 2006-04-07, void * clvrmnky() <clvrmnky.invalid@hotmail.com.invalid> wrote:
> test wrote:
>> On Fri, 7 Apr 2006 10:30:26 +0000 (UTC), Tim Van Wassenhove
>> wrote:
>>
>>> On 2006-04-07, test <test@test.test> wrote:
>>>> I am using fgets() to recieve an article from a NNTP server.
>>>> The articles end with:
>>>> or in other words: <crlf>.<crlf>
>>>> while ($t != ".") { // this doesn't work, nor does ".\n"
>>> So you only tested with . and .<lf>
>>> What happens if you try to read until ".\r\n"?
>>> (and the previous line was "\r\n")
>>
>> Upon futher testing, ".\r\n" indeed works :)
>> Thanks, Tim.
>
> You may want to accept the other combinations of line-ends, as well,
> perhaps issuing a warning. The specification demands that "\r\n" be
> used in NNTP messages, but there are a lot of poorly written servers out
> there.
>
> You do not want to get into the trap of being so true to the standard
> that you end up reading it the way the devil reads the bible.
> Admittedly, this is more of a problem for SMTP messaging.
In analogy with HTTP i tende to be as forgiving as possible.
In case of the line-ending i usually rtrim the line and then analyse the
content without <cr|crlf|lf| ... > ending.
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>
Navigation:
[Reply to this message]
|