mercurial/hgweb/request.py
changeset 7180 a42d27bc809d
parent 6774 0dbb56e90a71
child 7741 a3d7f99c23c0
equal deleted inserted replaced
7179:3d080733a339 7180:a42d27bc809d
     5 #
     5 #
     6 # This software may be used and distributed according to the terms
     6 # This software may be used and distributed according to the terms
     7 # of the GNU General Public License, incorporated herein by reference.
     7 # of the GNU General Public License, incorporated herein by reference.
     8 
     8 
     9 import socket, cgi, errno
     9 import socket, cgi, errno
       
    10 from mercurial import util
    10 from common import ErrorResponse, statusmessage
    11 from common import ErrorResponse, statusmessage
    11 
    12 
    12 shortcuts = {
    13 shortcuts = {
    13     'cl': [('cmd', ['changelog']), ('rev', None)],
    14     'cl': [('cmd', ['changelog']), ('rev', None)],
    14     'sl': [('cmd', ['shortlog']), ('rev', None)],
    15     'sl': [('cmd', ['shortlog']), ('rev', None)],
    54     def __iter__(self):
    55     def __iter__(self):
    55         return iter([])
    56         return iter([])
    56 
    57 
    57     def read(self, count=-1):
    58     def read(self, count=-1):
    58         return self.inp.read(count)
    59         return self.inp.read(count)
       
    60 
       
    61     def drain(self):
       
    62         '''need to read all data from request, httplib is half-duplex'''
       
    63         length = int(self.env.get('CONTENT_LENGTH', 0))
       
    64         for s in util.filechunkiter(self.inp, limit=length):
       
    65             pass
    59 
    66 
    60     def respond(self, status, type=None, filename=None, length=0):
    67     def respond(self, status, type=None, filename=None, length=0):
    61         if self._start_response is not None:
    68         if self._start_response is not None:
    62 
    69 
    63             self.httphdr(type, filename, length)
    70             self.httphdr(type, filename, length)