Closed mnapoli closed 7 years ago
@mnapoli Are you sure WCWHNT doesn't have that issue as well? I remember that in the state I left it at there were still a lot of problems in my implementation if I recall correctly.
Could it have been maybe dealt with someplace else in my codebase? I remember I had a good bunch of places dedicated solely to cleaning up messages besides third party packages
I'd love to see a hex-dump of this message. As CRLF has a special meaning in NNTP and SMTP it'd be interesting to see what characters are actually sent there!
And does that problme exist with all messages or only with some?
Thanks for taking the time to answer!
I think I've identified the source of the problem: https://github.com/robinvdvleuten/php-nntp/blob/98553a170804c1a7cd0d9bc4a8f3e7bb34016470/src/Connection/Connection.php#L162 When debugging the code that reads from the socket I can see the empty lines are correctly read (and added to an array with the other lines), but they are dropped by the array_filter()
that is done afterwards.
I cannot understand why empty lines would need to be excluded from the response. That array_filter()
is here since v0.1.0 so it doesn't seem like a random choice…
@robinvdvleuten maybe you know the logic behind that?
By the way I confirm that by removing the array_filter()
everything seems to be working perfectly, I'm starting to import more emails (I was testing with the last 5) and I'll see how it goes.
Does the test suite still run without issues after removing the array_filter
?
I've opened #32 let's see
Sorry guys, was offline for a couple of days. Most of the core functionality is borrowed from the original Net_NTTP pecl package, which I've optimised / modernised since then. Some of this "modernisation" is based on using the client with nzb newsgroups and a couple of other nzb related open-source projects.
I did some effort to go through the official specs and match the test cases where possible, but that definitely could get some more attention.
The array_filter
is probably an artifact of one of the above. Of course this can be removed if this makes the library more spec complaint 👍 Thanks @mnapoli for opening a PR for this, let's move the discussing of the blank lines to that as well!
Hi there, bumping on #28 -> I'm trying to use NNTP instead of IMAP for https://externals.io
I've got the whole thing working but I'm still stuck with a big issue: whether I get the body of messages using the
ARTICLE
orBODY
command, all blank lines are missing (i.e. there are no blank lines).Because of that:
I've read bits of the NNTP specs and it seems blank lines are allowed in the BODY, so there shouldn't be any issue.
Would you have any idea why I'm getting this issue? I've debugged with xdebug and it seems in the multiline response there are no empty lines received through the socket… I'm really lost since I'm not familiar with NNTP.
@Anahkiasen you've used that library for https://github.com/madewithlove/why-cant-we-have-nice-things (which by the way is a huge help, thanks for that) and it seems you don't have that problem: you also use the https://github.com/php-mime-mail-parser/php-mime-mail-parser library and it seems to parse the messages correctly. Am I missing something?
Here is an example of a response to a BODY command (click to expand)
``` Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99668 Return-Path:This is the same message as displayed on the official UI: http://news.php.net/php.internals/99668
As you can see, there are blank lines here.
There are also blank lines when fetching the email (that's what I do in the current version of externals.io) : https://externals.io/thread/980#email-15703 And here is the source of the email: https://externals.io/email/15703/source
So it seems to be an issue very specific to NNTP…