~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/response.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-01 19:55:27 UTC
  • mto: This revision was merged to the branch mainline in revision 6460.
  • Revision ID: jelmer@samba.org-20120201195527-p11zolw13w81035y
Consider invalid mail clients an error rather than just a warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
21
21
responses.
22
22
"""
23
23
 
 
24
from __future__ import absolute_import
24
25
 
25
26
import httplib
26
27
from cStringIO import StringIO
28
29
 
29
30
from bzrlib import (
30
31
    errors,
31
 
    trace,
32
32
    osutils,
33
33
    )
34
34
 
82
82
        # Default to the whole file of unspecified size
83
83
        self.set_range(0, -1)
84
84
 
 
85
    def close(self):
 
86
        """Close this file.
 
87
 
 
88
        Dummy implementation for consistency with the 'file' API.
 
89
        """
 
90
 
85
91
    def set_range(self, start, size):
86
92
        """Change the range mapping"""
87
93
        self._start = start
109
115
            # To be on the safe side we allow it before any boundary line
110
116
            boundary_line = self._file.readline()
111
117
 
 
118
        if boundary_line == '':
 
119
            # A timeout in the proxy server caused the response to end early.
 
120
            # See launchpad bug 198646.
 
121
            raise errors.HttpBoundaryMissing(
 
122
                self._path,
 
123
                self._boundary)
 
124
 
112
125
        if boundary_line != '--' + self._boundary + '\r\n':
113
126
            # rfc822.unquote() incorrectly unquotes strings enclosed in <>
114
127
            # IIS 6 and 7 incorrectly wrap boundary strings in <>