/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/http_server.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-01 21:57:00 UTC
  • mfrom: (7490.39.3 move-launchpad)
  • Revision ID: breezy.the.bot@gmail.com-20200601215700-joxuzo6w172gq74v
Move launchpad hoster support to the launchpad plugin.

Merged from https://code.launchpad.net/~jelmer/brz/move-launchpad/+merge/384931

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
        header_line = '%s: %s\r\n' % (keyword, value)
188
188
        return len(header_line)
189
189
 
 
190
    def send_head(self):
 
191
        """Overrides base implementation to work around a bug in python2.5."""
 
192
        path = self.translate_path(self.path)
 
193
        if os.path.isdir(path) and not self.path.endswith('/'):
 
194
            # redirect browser - doing basically what apache does when
 
195
            # DirectorySlash option is On which is quite common (braindead, but
 
196
            # common)
 
197
            self.send_response(301)
 
198
            self.send_header("Location", self.path + "/")
 
199
            # Indicates that the body is empty for HTTP/1.1 clients
 
200
            self.send_header('Content-Length', '0')
 
201
            self.end_headers()
 
202
            return None
 
203
 
 
204
        return http_server.SimpleHTTPRequestHandler.send_head(self)
 
205
 
190
206
    def send_range_content(self, file, start, length):
191
207
        file.seek(start)
192
208
        self.wfile.write(file.read(length))