Issue222816

classification
Title: read () doesn't always read to EOF
Type: Severity: normal
Components: Library Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: bckfnn
Priority: normal Keywords:

Created on 2000-11-18.19:09:11 by bckfnn, last changed 2000-12-05.19:27:27 by bckfnn.

Messages
msg71 (view) Author: Finn Bock (bckfnn) Date: 2000-11-18.19:09:11
In CPython, the read () method of file objects is stated to return the entire
contents of
the file.

When similar code is run under JPython, however, it frequently only seems to
return part of the
file.  It's as if it relies on the Java "read (buffer)" API which is not
guaranteed to actually read
the entire file, but never checks the results.

The best way to test this appears to be to try loading a reasonably long page
over a network connection,
as this is most likely to cause the JPython code to fail.

For Example:
  slashdotfile = urllib.urlopen ('http://www.slashdot.org/')
  page = slashdotfile.read ()
  print page

This will almost always only get about half the page under JPython.
msg72 (view) Author: Finn Bock (bckfnn) Date: 2000-11-26.15:20:30
The original problem is solved, but using the new httplob from CPython2.0 causes a new bug. The socket gets closed right after reading the response with HTTP.getresponse(). The body will then be read through a dup'ed fd with sock.makefile(). 

Jython does not support the dupping. When the socket is closed, the sock.makefile file is close closed.
msg73 (view) Author: Finn Bock (bckfnn) Date: 2000-12-05.19:27:27
Fixed in Lib/socket.py revision: 1.8.
History
Date User Action Args
2000-11-18 19:09:11bckfnncreate