From cf66804fe5b667d3a7f082a864045a68d8d7ee06 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 18 Jul 2014 17:50:03 -0400 Subject: [PATCH] Give a different error message for timeouts. Cheating a bit. --- copyvios/checker.py | 5 +++-- templates/index.mako | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/copyvios/checker.py b/copyvios/checker.py index 93c4a61..e9108b9 100644 --- a/copyvios/checker.py +++ b/copyvios/checker.py @@ -51,9 +51,10 @@ def _get_results(query, follow=True): if urlparse(query.url).scheme not in ["http", "https"]: query.error = "bad URI" return - result = page.copyvio_compare(query.url) + max_time = 30 + result = page.copyvio_compare(query.url, max_time=max_time) if result.source_chain is page.EMPTY: - query.error = "no data" + query.error = "timeout" if result.time > max_time else "no data" return query.result = result query.result.cached = False diff --git a/templates/index.mako b/templates/index.mako index 543c70f..d4e8e39 100644 --- a/templates/index.mako +++ b/templates/index.mako @@ -11,6 +11,10 @@

Couldn't find any text in ${query.url | h}. Note: only HTML and plain text pages are supported, and content generated by JavaScript or found inside iframes is ignored.

+ % elif query.error == "timeout": +
+

The URL ${query.url | h} timed out before any data could be retrieved.

+
% elif not query.site:

The given site (project=${query.project | h}, language=${query.lang | h}) doesn't seem to exist. It may also be closed or private. Confirm its URL.