
Hi all,
SourceForge isn't letting me in, so I'm dropping a note here to report that Raymond Hettinger's changes to httplib.py (Rev 1.72 on Wed Feb 26 22:45:18 2003 UTC) have broken the read() method on the SSLFile object. I suspect that he was trying to be clever by adding iterators to code that worked just fine (if not better) without them. Unfortunately, clever code has to be tested. The diff below repairs it, though I'd be just as happy if that part of Rev 1.72 was reverted.
--- httplib.py.orig 2003-03-05 19:37:28.000000000 -0500 +++ httplib.py 2003-03-06 10:11:01.000000000 -0500 @@ -864,13 +864,15 @@
def read(self, size=None): L = [self._buf] + self._buf = '' if size is None: - self._buf = '' for s in iter(self._read, ""): L.append(s) - return "".join(L) else: - avail = len(self._buf) + avail = len(L[0]) + if avail >= size: + self._buf = L[0][size:] + return L[0][:size] for s in iter(self._read, ""): L.append(s) avail += len(s) @@ -878,14 +880,19 @@ all = "".join(L) self._buf = all[size:] return all[:size] + return "".join(L)
def readline(self): L = [self._buf] self._buf = '' + i = L[0].find("\n") + 1 + if i > 0: + self._buf = L[0][i:] + return L[0][:i] for s in iter(self._read, ""): L.append(s) - if "\n" in s: - i = s.find("\n") + 1 + i = s.find("\n") + 1 + if i > 0: self._buf = s[i:] L[-1] = s[:i] break
Regards, -Kevin

I'll put in your SF report and fix it.
Raymond
----- Original Message ----- From: "Kevin Jacobs" jacobs@penguin.theopalgroup.com To: python-dev@python.org; "Raymond Hettinger" python@rcn.com Sent: Thursday, March 06, 2003 10:18 AM Subject: [Python-Dev] httplib SSLFile broken in CVS
Hi all,
SourceForge isn't letting me in, so I'm dropping a note here to report that Raymond Hettinger's changes to httplib.py (Rev 1.72 on Wed Feb 26 22:45:18 2003 UTC) have broken the read() method on the SSLFile object. I suspect that he was trying to be clever by adding iterators to code that worked just fine (if not better) without them. Unfortunately, clever code has to be tested. The diff below repairs it, though I'd be just as happy if that part of Rev 1.72 was reverted.
--- httplib.py.orig 2003-03-05 19:37:28.000000000 -0500 +++ httplib.py 2003-03-06 10:11:01.000000000 -0500 @@ -864,13 +864,15 @@
def read(self, size=None): L = [self._buf]
self._buf = '' if size is None:
self._buf = '' for s in iter(self._read, ""): L.append(s)
return "".join(L) else:
avail = len(self._buf)
avail = len(L[0])
if avail >= size:
self._buf = L[0][size:]
return L[0][:size] for s in iter(self._read, ""): L.append(s) avail += len(s)
@@ -878,14 +880,19 @@ all = "".join(L) self._buf = all[size:] return all[:size]
return "".join(L)
def readline(self): L = [self._buf] self._buf = ''
i = L[0].find("\n") + 1
if i > 0:
self._buf = L[0][i:]
return L[0][:i] for s in iter(self._read, ""): L.append(s)
if "\n" in s:
i = s.find("\n") + 1
i = s.find("\n") + 1
if i > 0: self._buf = s[i:] L[-1] = s[:i] break
Regards, -Kevin
--
Kevin Jacobs The OPAL Group - Enterprise Systems Architect Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com Fax: (216) 986-0714 WWW: http://www.theopalgroup.com
Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev

On Thu, 6 Mar 2003, Raymond Hettinger wrote:
I'll put in your SF report and fix it.
Thanks. Let me know if you'd like me to test any additional changes, since I have a large test suite for my applications that uses httplib+SSL extensively.
-Kevin

On Thu, Mar 06, 2003 at 10:40:10AM -0500, Kevin Jacobs wrote:
Thanks. Let me know if you'd like me to test any additional changes, since I have a large test suite for my applications that uses httplib+SSL extensively.
Kevin,
Any chance we could get you to augment the regression tests? It would be very helpful.
Neal

On Thu, 6 Mar 2003, Neal Norwitz wrote:
On Thu, Mar 06, 2003 at 10:40:10AM -0500, Kevin Jacobs wrote:
Thanks. Let me know if you'd like me to test any additional changes, since I have a large test suite for my applications that uses httplib+SSL extensively.
Any chance we could get you to augment the regression tests? It would be very helpful.
How many people run the regression suite with 'network' enabled? If nobody does, then it will be a waste of time to add it.
-Kevin

How many people run the regression suite with 'network' enabled? If nobody does, then it will be a waste of time to add it.
I *always* run the suit with network enabled and it only takes one person running a suite to detect an error. Also, everyone who makes a change to a network resource should be running the tests with network enabled (at least for that particular change).
IOW, it is definitely not a waste of time.
Raymond Hettinger
################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# #################################################################

On Thu, 6 Mar 2003, Raymond Hettinger wrote:
How many people run the regression suite with 'network' enabled? If nobody does, then it will be a waste of time to add it.
IOW, it is definitely not a waste of time.
Great! (Until today I didn't even know how to enable the network resource)
I'll submit a patch to test_socket_ssl, since it is already using urllib.
-Kevin
participants (4)
-
Kevin Jacobs
-
Neal Norwitz
-
Raymond Hettinger
-
Tim Peters