def _readline(self, context):
     # try to read a line from the wsgi input; annotate any timeout or read
     # errors with a description of the calling context
     with exceptions.MessageTimeout(
             self.app.client_timeout, context):
         try:
             line = self.fp.readline(self.app.network_chunk_size)
         except (eventlet.wsgi.ChunkReadError, IOError) as err:
             raise exceptions.ChunkReadError('%s: %s' % (context, err))
         return line
Exemple #2
0
 def subreq_iter():
     left = content_length
     while left > 0:
         with exceptions.MessageTimeout(self.app.client_timeout,
                                        'updates content'):
             chunk = self.fp.read(
                 min(left, self.app.network_chunk_size))
         if not chunk:
             raise exceptions.ChunkReadError(
                 'Early termination for %s %s' % (method, path))
         left -= len(chunk)
         yield chunk