Tk Library Source Code

View Ticket
Login
Ticket UUID: 224477
Title: pop3::list and pop3::top can hang
Type: Bug Version:
Submitter: jenglish Created on: 2000-12-05 02:04:02
Subsystem: pop3 Assigned To: redman
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2001-05-02 22:06:33
Resolution: Fixed Closed By: redman
    Closed on: 2001-05-02 15:06:33
Description:
Depending on the POP3 server, [pop3::list] and [pop3::top] can hang
forever.  I've tracked this down to the termination condition in the while loop
(duplicated in both routines):

        while {1} {
            set line [gets $chan]
            # End of the message is a line with just "."
            if {$line == "."} {;# <== here's the problem
                break
            } elseif { ... }

When the POP3 server uses CR+LF as the line terminator (which IIRC
is what it's supposed to do) and $chan uses -translation binary (which
pop3::open sets), then '$line' ends up containing ".\r", not ".".

Suggested fix:

replace 
if {$line == "."} { ... }
with
if {[string equal [string trimright $line] "."]}  { ... }

This seems to fix the problem for me.
User Comments: redman added on 2001-05-02 22:06:33:
Logged In: YES 
user_id=106931

Andreas Kupries reminded me that I hadn't checked this in...and so I tried and cvs on sourceforge seems
to be working again.  Should be fixed now.

redman added on 2001-01-25 03:57:28:
'string equal' is not provided prior to 8.2, I'm going to use this instead:

[string trimright $line] == "." 

Now if only the CVS server would let me commit the files, this would be fixed.

redman added on 2001-01-23 02:35:38:
Can someone assign this to me?