From a1cb42e861865caaa4d58d9860a41fc041c5fe31 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 26 Jun 2011 11:24:29 -0700 Subject: [PATCH] Fail more gracefully when SSL is not supported, and on non-HTTP urls --- tornado/simple_httpclient.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tornado/simple_httpclient.py b/tornado/simple_httpclient.py index ad15a2d32..a8b90af1a 100644 --- a/tornado/simple_httpclient.py +++ b/tornado/simple_httpclient.py @@ -133,6 +133,12 @@ class _HTTPConnection(object): self._timeout = None with stack_context.StackContext(self.cleanup): parsed = urlparse.urlsplit(_unicode(self.request.url)) + if ssl is None and parsed.scheme == "https": + raise ValueError("HTTPS requires either python2.6+ or " + "curl_httpclient") + if parsed.scheme not in ("http", "https"): + raise ValueError("Unsupported url scheme: %s" % + self.request.url) # urlsplit results have hostname and port results, but they # didn't support ipv6 literals until python 2.7. netloc = parsed.netloc -- 2.47.3