[Python-Dev] SSL socket read at EOF; SourceForge problem

Guido van Rossum guido@digicool.com
Tue, 30 Jan 2001 20:35:25 -0500

> I'm going to repeat a question that I posted about a week ago that passed
> without comment on the newsgroup. The issue is the SSL support in the socket
> module, which raises an exception when the reading socket is at EOF, rather
> than returning an empty string. I'm hesitant to call it a "bug", but I
> wouldn't have implemented it this way.  There are the names of two people
> mentioned at the top of socketmodule.c, but no contact information, so I'm
> suggesting here that it be changed to conform to normal file/socket
> practice. (SSL was actually added at 2.0, so I'm late to the party with
> this; mea culpa, mea culpa.  I delayed trying Python2 because of the
> extension rebuilding.)

I agree that it makes more sense if a read at EOF returns an empty
string, since that's what other file-like objects in Python do.  I
can't do much about this right now, but I'd love to see a patch.  It
could go into 2.1a2 if small enough.

Note that input() and raw_input() are specifically excepted because
they are intended for use in interactive mode by newbies mostly; and
because "" as return value for EOF would be ambiguous for these.

--Guido van Rossum (home page: http://www.python.org/~guido/)