summaryrefslogtreecommitdiff
path: root/flup
diff options
context:
space:
mode:
authorAllan Saddi <allan@saddi.com>2007-09-10 15:56:44 -0700
committerAllan Saddi <allan@saddi.com>2007-09-10 15:56:44 -0700
commitac40930383daac77cb44bd75b2a899fa2934a81e (patch)
tree9a277503f371d068d17fd4a490fd3041eab80850 /flup
parent2cc8ad871b91e425554899fad58ccd89610fe721 (diff)
downloadflup-ac40930383daac77cb44bd75b2a899fa2934a81e.tar.gz
Fix readline implementations so size argument is checked
earlier. (transplanted from f1cc536d3f42ce695e4401ad729eec1985803579)
Diffstat (limited to 'flup')
-rw-r--r--flup/server/ajp_base.py6
-rw-r--r--flup/server/fcgi_base.py6
2 files changed, 6 insertions, 6 deletions
diff --git a/flup/server/ajp_base.py b/flup/server/ajp_base.py
index 74dddde..b9dfa0f 100644
--- a/flup/server/ajp_base.py
+++ b/flup/server/ajp_base.py
@@ -398,15 +398,15 @@ class InputStream(object):
newPos = self._avail
break
else:
+ if length is not None and len(self._buf) >= length + self._pos:
+ newPos = self._pos + length
+ break
# Wait for more to come.
self._waitForData()
continue
else:
newPos = i + 1
break
- if length is not None:
- if self._pos + length < newPos:
- newPos = self._pos + length
r = self._buf[self._pos:newPos]
self._pos = newPos
self._shrinkBuffer()
diff --git a/flup/server/fcgi_base.py b/flup/server/fcgi_base.py
index 42ab282..2c68484 100644
--- a/flup/server/fcgi_base.py
+++ b/flup/server/fcgi_base.py
@@ -189,15 +189,15 @@ class InputStream(object):
newPos = self._avail
break
else:
+ if length is not None and len(self._buf) >= length + self._pos:
+ newPos = self._pos + length
+ break
# Wait for more to come.
self._waitForData()
continue
else:
newPos = i + 1
break
- if length is not None:
- if self._pos + length < newPos:
- newPos = self._pos + length
r = self._buf[self._pos:newPos]
self._pos = newPos
self._shrinkBuffer()