diff --git a/tests/checker/data/http.html.result b/tests/checker/data/http.html.result index decac2da..8c60ae50 100644 --- a/tests/checker/data/http.html.result +++ b/tests/checker/data/http.html.result @@ -91,14 +91,14 @@ url /?d=directory&p=page1 cache key http://localhost:%(port)d/?d=directory&p=page1 real url http://localhost:%(port)d/?d=directory&p=page1 name should not be cached -warning Content with 1KB is the same as in URLs (http://localhost:%(port)d/?d=directory&p=page). +warning Content with 309B is the same as in URLs (http://localhost:%(port)d/?d=directory&p=page). valid url /?quoted=ΓΌ cache key http://localhost:%(port)d/?quoted=%%C3%%BC real url http://localhost:%(port)d/?quoted=%%C3%%BC name html entities -warning Content with 1KB is the same as in URLs (http://localhost:%(port)d/?d=directory&p=page,http://localhost:%(port)d/?d=directory&p=page1). +warning Content with 309B is the same as in URLs (http://localhost:%(port)d/?d=directory&p=page,http://localhost:%(port)d/?d=directory&p=page1). valid url (cached) diff --git a/tests/checker/httpserver.py b/tests/checker/httpserver.py index dfd9a9a5..ee255218 100644 --- a/tests/checker/httpserver.py +++ b/tests/checker/httpserver.py @@ -23,6 +23,9 @@ import BaseHTTPServer import httplib import time import threading +import cgi +import urllib +from cStringIO import StringIO from . import LinkCheckTest @@ -67,7 +70,8 @@ class StoppableHttpServer (BaseHTTPServer.HTTPServer, object): class NoQueryHttpRequestHandler (StoppableHttpRequestHandler): """ - Handler ignoring the query part of requests. + Handler ignoring the query part of requests and sending dummy directory + listings. """ def remove_path_query (self): @@ -92,6 +96,34 @@ class NoQueryHttpRequestHandler (StoppableHttpRequestHandler): self.remove_path_query() super(NoQueryHttpRequestHandler, self).do_HEAD() + def list_directory(self, path): + """Helper to produce a directory listing (absent index.html). + + Return value is either a file object, or None (indicating an + error). In either case, the headers are sent, making the + interface the same as for send_head(). + + """ + f = StringIO() + f.write('') + f.write("\n