Hi Simon,
I have a few comments regarding style. First::
if thisflag == False:
...
is unnecessarily long. Just write::
if not thisflag:
...
Also, what is "thisflag"? It'd be better to give it a descriptive name.
--- httptask.py.orig Fri Jan 06 02:15:48 2006
+++ httptask.py Thu Sep 21 17:31:17 2006
@@ -126,6 +126,15 @@
else:
close_it = 1
elif version == '1.1':
+ #modified by Simon
+ thisflag = False
+ for each in self.accumulated_headers:
+ if each.lower() == 'connection: keep-alive':
+ thisflag = True
+ break
+ if thisflag == False:
+ close_it = 1
+
I think you make this a lot simpler::
if 'connection: keep-alive' not in (header.lower() for header in
self.accumulated_headers):
close_it = 1
(instead of the lines you added)
if connection == 'close':
close_it = 1
elif 'Transfer-Encoding' in response_headers:
@@ -134,8 +143,15 @@
elif self.status == '304':
# Replying with headers only.
pass
+ #modified by simon
elif not ('Content-Length' in response_headers):
- close_it = 1
+ thisflag = False
+ for each in self.accumulated_headers:
+ if each[:14].lower() == 'content-length':
+ thisflag = True
+ break
+ if thisflag == False: #only content_length not exist in
accumulated headers too
+ close_it = 1
I don't understand the comment (English grammar not correct), but my
suggestion would apply here as well, I think.
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users