Re: RetrieveMsgSize problem

Giganews Newsgroups
Subject: Re: RetrieveMsgSize problem
Posted by:  Remy Lebeau \(TeamB\) (no.spam@no.spam.com)
Date: Tue, 23 Sep 2008

"Indy" <t.ka…@hccnet.nl> wrote in message
news:5C8FC27D1A64E340t.ka…@hccnet.nl...

> I have the following problem, and i can't figure out why i get -1 as a
> result when using the RetrieveMsgSize command.

That happens when TIdPOP3 can't parse the reply that the server returns.

> The server -i think formats well ( '1 messages  (6351 octets)' is
> returned by LastCmdResult.Text[0])

That is NOT a well-formed reply for RetreiveMsgSize().  That reply is the
kind that would normally be returned for a LIST command that does not
specify a particular message, thus returning a multi-line reply containing
all messages in the mailbox.  But RetrieveMgSize() does specify a particular
message, so the reply is wrong for that command.  Thus RetreiveMsgSize() is
trying to convert the string 'messages' to a number, which will obviously
fail.  The server is buggy and needs to be fixed.

> in function TIdPOP3.RetrieveMsgSize, function Fetch (idGlobal), for some
> reason doesn't returns the correct size

It can't, because the server is sending back the wrong reply.  RFC 1939 is
very specific in how the reply to the LIST command must look:

    If an argument was given and the POP3 server issues a
    positive response with a line containing information for
    that message.  This line is called a "scan listing" for
    that message.

    If no argument was given and the POP3 server issues a
    positive response, then the response given is multi-line.
    After the initial +OK, for each message in the maildrop,
    the POP3 server responds with a line containing
    information for that message.  This line is also called a
    "scan listing" for that message.  If there are no
    messages in the maildrop, then the POP3 server responds
    with no scan listings--it issues a positive response
    followed by a line containing a termination octet and a
    CRLF pair.

    In order to simplify parsing, all POP3 servers are
    required to use a certain format for scan listings.  A
    scan listing consists of the message-number of the
    message, followed by a single space and the exact size of
    the message in octets.

RetrieveMsgSize() expects a reply that conforms to the first paragraph, but
the server is sending a reply that follows the second paragraph instead.
That is the wrong thing for the server to do.

--
Remy Lebeau (TeamB)

Replies

None

In response to

RetrieveMsgSize problem posted by Indy on Mon, 22 Sep 2008