Commits

Andriy Kornatskyy  committed 25c2be4

Added support for https url scheme.

  • Participants
  • Parent commits 038ab2f

Comments (0)

Files changed (3)

File doc/userguide.rst

     >>>> str(project.title)
     Buildbot
 
-Supports: HTTP GET/HEAD/POST verbs, follows redirects, handles cookies between
-requests, gzip content encoding.
+Supports: HTTP(S) GET/HEAD/POST verbs, follows redirects, handles cookies
+between requests, gzip content encoding.
 
 i18n
 ----

File src/wheezy/core/comp.py

 
 if PY3:  # pragma: nocover
     from http.client import HTTPConnection
+    from http.client import HTTPSConnection
     from urllib.parse import urlencode
     from urllib.parse import urljoin
-    from urllib.parse import urlparse
     from urllib.parse import urlsplit
     from urllib.parse import urlunsplit
 else:  # pragma: nocover
     from httplib import HTTPConnection  # noqa
+    from httplib import HTTPSConnection  # noqa
     from urllib import urlencode  # noqa
     from urlparse import urljoin  # noqa
-    from urlparse import urlparse  # noqa
     from urlparse import urlsplit  # noqa
     from urlparse import urlunsplit  # noqa
 

File src/wheezy/core/httpclient.py

 from wheezy.core.collections import defaultdict
 from wheezy.core.comp import Decimal
 from wheezy.core.comp import HTTPConnection
+from wheezy.core.comp import HTTPSConnection
 from wheezy.core.comp import SimpleCookie
 from wheezy.core.comp import json_loads
 from wheezy.core.comp import urlencode
 from wheezy.core.comp import urljoin
-from wheezy.core.comp import urlparse
 from wheezy.core.comp import urlsplit
 from wheezy.core.gzip import decompress
 
             `url` - a base url for interaction with remote server.
             `headers` - a dictionary of headers.
         """
-        r = urlparse(url)
-        self.connection = HTTPConnection(r[1])  # netloc
+        scheme, netloc, path, query, fragment = urlsplit(url)
+        http_class = scheme == 'http' and HTTPConnection or HTTPSConnection
+        self.connection = http_class(netloc)
         self.default_headers = headers and headers or {}
         self.default_headers['Accept-Encoding'] = 'gzip'
-        self.path = r[2]  # path
+        self.path = path
         self.method = None
         self.headers = None
         self.cookies = {}