Mega Search
23.2 Million


Sign Up

Make a donation  
TIdMessage decoding failure (Max line length exceeded) [Edit  
News Group: embarcadero.public.cppbuilder.internet.socket

Message (26 KB size) decoding fails with:

EIdReadLnMaxLineLengthExceeded with message 'Max line length exceeded.'.

I understand that this is caused by too long lines in the original message longer than 16k before new lines. I also understand that indy reads message line by line to avoid keeping it all in memory - I don't particularly follow that logic because MIME messages larger than 20 or 30 MB will be rejected by most servers and there is no reason not to decode entire message from memory.

Anyway, is there a way to decode such message or make Indy decoder more tolerant of such messages? Messages are sent using all kinds of programs and not all of them follow the RFC rules therefore I believe that message decoder should be tolerant in decoding such messages but strict in encoding (creating new messages). Any way to make Indy accept any line size and decode the above? Or make it as a feature to decode from memory (especially if message is such a small one like 26 KB).

The above was tested with latest Indy (5231).

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 26-Dec-2014, at 1:24 PM EST
From: John May
 
Re: TIdMessage decoding failure (Max line length exceeded) [  
News Group: embarcadero.public.cppbuilder.internet.socket
Thank you for addressing this! The messages in question now indeed decode well just like in various email programs.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 27-Dec-2014, at 7:03 AM EST
From: John May
 
Re: TIdMessage decoding failure (Max line length exceeded) [  
News Group: embarcadero.public.cppbuilder.internet.socket
John wrote:

> I am sorry, how does that help

By allowing the email parser to read lines that are longer than 16K characters/bytes.

> or how to use that?

You don't have to do anything, just upgrade to the latest snapshot.  The 
new default is enablled by default in the email parser system.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 26-Dec-2014, at 7:07 PM EST
From: Remy Lebeau (TeamB)
 
Re: TIdMessage decoding failure (Max line length exceeded) [  
News Group: embarcadero.public.cppbuilder.internet.socket
> > Anyway, is there a way to decode such message or make Indy decoder
> > more tolerant of such messages?
> I have checked in an update to use MaxInt for the default MaxLineLength when 
> parsing an email.

I am sorry, how does that help or how to use that?

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 26-Dec-2014, at 4:54 PM EST
From: John May
 
Re: TIdMessage decoding failure (Max line length exceeded) [  
News Group: embarcadero.public.cppbuilder.internet.socket
John wrote:

> Message (26 KB size) decoding fails with:
> 
> EIdReadLnMaxLineLengthExceeded with message 'Max line length
> exceeded.'.
> 
> I understand that this is caused by too long lines in the original
> message longer than 16k before new lines.

Technically, yes.  More specifically, it typically occurs if there is unencoded 
binary data in the email, as binary lines easily exceed the MaxLineLength. 
 Most email apps encode binary data using schemes, like base64, which impose 
max line lengths that easily fit within Indy's default.

> I also understand that indy reads message line by line to avoid keeping
> it all in memory - I don't particularly follow that logic because MIME
> messages larger than 20 or 30 MB will be rejected by most servers

Many do, many do not.

> and there is no reason not to decode entire message from memory.

Yes, there is good reason, especially on mobile and embedded devices where 
memory is limited.

> Anyway, is there a way to decode such message or make Indy decoder
> more tolerant of such messages?

I have checked in an update to use MaxInt for the default MaxLineLength when 
parsing an email.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 26-Dec-2014, at 3:42 PM EST
From: Remy Lebeau (TeamB)