From: Ben Darnell Date: Sun, 26 Jun 2011 18:24:29 +0000 (-0700) Subject: Fail more gracefully when SSL is not supported, and on non-HTTP urls X-Git-Tag: v2.1.0~150 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1cb42e861865caaa4d58d9860a41fc041c5fe31;p=thirdparty%2Ftornado.git Fail more gracefully when SSL is not supported, and on non-HTTP urls --- 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