现在的位置: 首页 > 综合 > 正文

gevent pywsgi overflow

2013年08月04日 ⁄ 综合 ⁄ 共 846字 ⁄ 字号 评论关闭
 def _do_read(self, length=None, use_readline=False):
        if use_readline:
            reader = self.rfile.readline
        else:
            reader = self.rfile.read
        content_length = self.content_length
        if content_length is None:
            # Either Content-Length or "Transfer-Encoding: chunked" must be present in a request with a body
            # if it was chunked, then this function would have not been called
            return ''
        self._send_100_continue()
        left = content_length - self.position  // left = content_length
        if length is None:
            length = left
        elif length > left:
            length = left
        if not length:
            return ''
        read = reader(length)
        self.position += len(read)
        if len(read) < length:
            if (use_readline and not read.endswith("\n")) or not use_readline:
                raise IOError("unexpected end of file while reading request at position %s" % (self.position,))

        return read

# if content_length > signed int, get error
# You cat inherit the Input class , give the size or length a default value
# you cat give left a value
if left > 2*1024*1024*1024:
left = 2*1024*1024*1024

抱歉!评论已关闭.