Part of bzrlib.tests.http_server View In Hierarchy
Known subclasses: bzrlib.plugins.launchpad.test_lp_directory.PredefinedRequestHandler, bzrlib.tests.http_utils.AuthRequestHandler, bzrlib.tests.http_utils.RedirectRequestHandler, bzrlib.tests.http_utils.SmartRequestHandler, bzrlib.tests.test_http.BadProtocolRequestHandler, bzrlib.tests.test_http.BadStatusRequestHandler, bzrlib.tests.test_http.ForbiddenRequestHandler, bzrlib.tests.test_http.ForbiddenRequestHandler 0, bzrlib.tests.test_http.InvalidStatusRequestHandler, bzrlib.tests.test_http.LimitedRangeRequestHandler, bzrlib.tests.test_http.MultipleRangeWithoutContentLengthRequestHandler, bzrlib.tests.test_http.NoRangeRequestHandler, bzrlib.tests.test_http.PredefinedRequestHandler, bzrlib.tests.test_http.SingleOnlyRangeRequestHandler, bzrlib.tests.test_http.SingleRangeRequestHandler, bzrlib.tests.test_http.TruncatedBeforeBoundaryRequestHandler, bzrlib.tests.test_http.TruncatedMultipleRangeRequestHandler, bzrlib.tests.test_http.WallRequestHandler
A TestingHTTPRequestHandler is instantiated for every request received by the associated server. Note that 'request' here is inherited from the base TCPServer class, for the HTTP server it is really a connection which itself will handle one or several HTTP requests.
Method | setup | Undocumented |
Method | log_message | Undocumented |
Method | handle | Undocumented |
Method | handle_one_request | Handle a single HTTP request. |
Method | send_error | Send and log an error reply. |
Method | send_head | Overrides base implementation to work around a bug in python2.5. |
Method | send_range_content | Undocumented |
Method | get_single_range | Undocumented |
Method | get_multiple_ranges | Undocumented |
Method | do_GET | Serve a GET request. |
Method | translate_path | Translate a /-separated PATH to the local filename syntax. |
Method | _handle_one_request | Undocumented |
Method | _parse_ranges | Parse the range header value and returns ranges. |
Method | _header_line_length | Undocumented |
Method | _translate_path | Translate a /-separated PATH to the local filename syntax. |
We catch all socket errors occurring when the client close the connection early to avoid polluting the test results.
We redefine the python-provided version to be able to set a Content-Length header as some http/1.1 clients complain otherwise (see bug #568421).
Parameters | code | The HTTP error code. |
message | The explanation of the error code, Defaults to a short entry. |
RFC2616 14.35 says that syntactically invalid range specifiers MUST be ignored. In that case, we return None instead of a range list.
Parameters | ranges_header | The 'Range' header value. |
file_size | The size of the requested file. | |
Returns | A list of (start, end) tuples or None if some invalid range specifier is encountered. |
Handles the Range header.
If the server requires it, proxy the path before the usual translation
Note that we're translating http URLs here, not file URLs. The URL root location is the server's startup directory. Components that mean special things to the local file system (e.g. drive or directory names) are ignored. (XXX They should probably be diagnosed.)
Override from python standard library to stop it calling os.getcwd()