/usr/lib/python2.6/site-packages/ndg/httpsclient
Edit: /usr/lib/python2.6/site-packages/ndg/httpsclient/https.pyc (5062B)
Ñò
˜KVc @ s% d Z d Z d Z d Z d Z d Z d Z d d k Z d d k Z d d k Z e i
d d
j o4 d d k l Z d d k l
Z
d d
k l Z n1 d d k l Z d d k l
Z
d d
k l Z d d k l Z d d k l Z e i e ƒ Z d e
f d „ ƒ YZ d e f d „ ƒ YZ d S( s¯ ndg_httpsclient HTTPS module containing PyOpenSSL implementation of
httplib.HTTPSConnection
PyOpenSSL utility to make a httplib-like interface suitable for use with
urllib2
s P J Kershaw (STFC)s 09/12/11s2 (C) 2012 Science and Technology Facilities Councils- BSD - see LICENSE file in top-level directorys Philip.Kershaw@stfc.ac.uks $Id$iÿÿÿÿNi i ( t
HTTPS_PORT( t HTTPConnection( t AbstractHTTPHandler( t SSL( t SSLSockett HTTPSConnectionc B sG e Z d Z e Z e i Z d d e i
d d „ Z d „ Z d „ Z
RS( sT This class allows communication via SSL using PyOpenSSL.
It is based on httplib.HTTPSConnection, modified to use PyOpenSSL.
Note: This uses the constructor inherited from HTTPConnection to allow it to
be used with httplib and HTTPSContextHandler. To use the class directly with
an SSL context set ssl_context after construction.
@cvar default_port: default port for this class (443)
@type default_port: int
@cvar default_ssl_method: default SSL method used if no SSL context is
explicitly set - defaults to version 2/3.
@type default_ssl_method: int
c C s{ t i | | | | | ƒ t | d ƒ p
d | _ n | d j o4 t | t i ƒ p t d | ƒ ‚ n | | _ n d S( Nt ssl_contextsL Expecting OpenSSL.SSL.Context type for "ssl_context" keyword; got %r instead( R t __init__t hasattrt NoneR t
isinstanceR t Contextt TypeError( t selft hostt portt strictt timeoutR ( ( s9 /usr/lib/python2.6/site-packages/ndg/httpsclient/https.pyR 5 s
c C sÐ t | d d ƒ o: t | i t i ƒ p t d | i ƒ ‚ n | i } n t i | i i ƒ } t i
| i | i f | i
ƒ } t | d d ƒ o | | _ | i ƒ n t | | ƒ | _ | i i ƒ d S( s. Create SSL socket and connect to peer
R sN Expecting OpenSSL.SSL.Context type for "ssl_context" attribute; got %r insteadt _tunnel_hostN( t getattrR R
R R R R t __class__t default_ssl_methodt sockett create_connectionR R R t sockt _tunnelR t set_connect_state( R
R R ( ( s9 /usr/lib/python2.6/site-packages/ndg/httpsclient/https.pyt connectC s
! c C s( t | i d ƒ o | i i ƒ n d S( s) Close socket and shut down SSL connectiont closeN( R R R ( R
( ( s9 /usr/lib/python2.6/site-packages/ndg/httpsclient/https.pyR [ s N( t __name__t
__module__t __doc__R t default_portR t
SSLv23_METHODR R R t _GLOBAL_DEFAULT_TIMEOUTR R R ( ( ( s9 /usr/lib/python2.6/site-packages/ndg/httpsclient/https.pyR $ s
t HTTPSContextHandlerc B s, e Z d Z e i Z d d „ Z d „ Z RS( sS HTTPS handler that allows a SSL context to be set for the SSL
connections.
i c C sj t i | | ƒ | d j o4 t | t i ƒ p t d | ƒ ‚ n | | _ n t i t i ƒ | _ d S( sµ
@param ssl_context:SSL context
@type ssl_context: OpenSSL.SSL.Context
@param debuglevel: debug level for HTTPSHandler
@type debuglevel: int
sL Expecting OpenSSL.SSL.Context type for "ssl_context" keyword; got %r insteadN( R R R R
R R R R t TLSv1_METHOD( R
R t
debuglevel( ( s9 /usr/lib/python2.6/site-packages/ndg/httpsclient/https.pyR g s
c C s2 t d t t f h | i d 6ƒ } | i | | ƒ S( sc Opens HTTPS request
@param req: HTTP request
@return: HTTP Response object
t CustomHTTPSContextConnectionR ( t typeR t objectR t do_open( R
t reqt customHTTPSContextConnection( ( s9 /usr/lib/python2.6/site-packages/ndg/httpsclient/https.pyt
https_openy s ( R R R R t do_request_t
https_requestR R, ( ( ( s9 /usr/lib/python2.6/site-packages/ndg/httpsclient/https.pyR# a s ( R t
__author__t __date__t
__copyright__t __license__t __contact__t __revision__t loggingR t syst version_infot http.clientR R t urllib.requestR t httplibt urllib2t OpenSSLR t ndg.httpsclient.ssl_socketR t getLoggerR t logR R# ( ( ( s9 /usr/lib/python2.6/site-packages/ndg/httpsclient/https.pyt
s* =