Out of date with a PSL httplib change

Bug #143947 reported by Plone Forge
2
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Medium
Unassigned

Bug Description

The code in HTTP(httplib.HTTP):getreply is out of date with changes (a long time ago) to the Python standard library httplib at line 33: self.sock should be self._conn.sock.

Also there is a really ugly assumption in Resource:put that filesnames are 7-bit ASCII which is not true on modern filesystems: they could be latin1 or utf-8 for example. The assumption is that if the thing given to the first argument of put doesn't match isbin=re.compile(r'[\000-\006\177-\277]') then then it might be a filename, and it calls os.stat on what could be a very large string full of control characters to see if it's a filename to be opened, which may provoke OSErrors on some OSs.

I think this method should be deprecated, and 2 new methods putFile and putBytes should replace it without the binary assumption code, even if it means changing all of the code that calls this method (probably not many occurences).

Tags: bug zope
Revision history for this message
Plone Forge (ploneforge) wrote :
Changed in zope2:
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope2 project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope2.

Changed in zope2:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.