• File: https.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/cloudlinux/alt-php83/root/var/lib/php/session/https.pyc
  • Date Modified: 10/31/2014 10:04 AM
  • File size: 4.72 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

Oc@sdZdZdZdZdZdZdZddlZddlZdd	l	m
Z
dd
l	mZddlm
Z
ddlmZdd
lmZejeZdefdYZde
fdYZdS(sndg_httpsclient HTTPS module containing PyOpenSSL implementation of
httplib.HTTPSConnection

PyOpenSSL utility to make a httplib-like interface suitable for use with 
urllib2
sP J Kershaw (STFC)s09/12/11s2(C) 2012 Science and Technology Facilities Councils-BSD - see LICENSE file in top-level directorysPhilip.Kershaw@stfc.ac.uks$Id$iN(t
HTTPS_PORT(tHTTPConnection(tAbstractHTTPHandler(tSSL(t	SSLSockettHTTPSConnectioncBsGeZdZeZejZdde	j
ddZdZdZ
RS(sTThis 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
    cCsutj|||||t|ds4d|_n|dk	rqt|tjsetd|n||_ndS(Ntssl_contextsLExpecting OpenSSL.SSL.Context type for "ssl_context" keyword; got %r instead(	Rt__init__thasattrtNoneRt
isinstanceRtContextt	TypeError(tselfthosttporttstrictttimeoutR((s9/usr/lib/python2.7/site-packages/ndg/httpsclient/https.pyR,s
cCst|ddrIt|jtjs=td|jn|j}ntj|jj}t	j
|j|jf|j
}t|ddr||_|jnt|||_|jjdS(s.Create SSL socket and connect to peer
        RsNExpecting OpenSSL.SSL.Context type for "ssl_context" attribute; got %r insteadt_tunnel_hostN(tgetattrR	R
RRRRt	__class__tdefault_ssl_methodtsockettcreate_connectionRRRtsockt_tunnelRtset_connect_state(R
RR((s9/usr/lib/python2.7/site-packages/ndg/httpsclient/https.pytconnect:s!	
cCs|jjdS(s)Close socket and shut down SSL connectionN(Rtclose(R
((s9/usr/lib/python2.7/site-packages/ndg/httpsclient/https.pyRRsN(t__name__t
__module__t__doc__Rtdefault_portRt
SSLv23_METHODRR	Rt_GLOBAL_DEFAULT_TIMEOUTRRR(((s9/usr/lib/python2.7/site-packages/ndg/httpsclient/https.pyRs
	
	tHTTPSContextHandlercBs,eZdZejZddZdZRS(sSHTTPS handler that allows a SSL context to be set for the SSL
    connections.
    icCsftj|||dk	rMt|tjsAtd|n||_ntjtj|_dS(s
        @param ssl_context:SSL context
        @type ssl_context: OpenSSL.SSL.Context
        @param debuglevel: debug level for HTTPSHandler
        @type debuglevel: int
        sLExpecting OpenSSL.SSL.Context type for "ssl_context" keyword; got %r insteadN(	RRR	R
RRRRR!(R
Rt
debuglevel((s9/usr/lib/python2.7/site-packages/ndg/httpsclient/https.pyR]s
cCs2tdttfi|jd6}|j||S(scOpens HTTPS request
        @param req: HTTP request
        @return: HTTP Response object
        tCustomHTTPSContextConnectionR(ttypeRtobjectRtdo_open(R
treqtcustomHTTPSContextConnection((s9/usr/lib/python2.7/site-packages/ndg/httpsclient/https.pyt
https_openos	(RRRRtdo_request_t
https_requestRR+(((s9/usr/lib/python2.7/site-packages/ndg/httpsclient/https.pyR#Ws	(Rt
__author__t__date__t
__copyright__t__license__t__contact__t__revision__tloggingRthttplibRRturllib2RtOpenSSLRtndg.httpsclient.ssl_socketRt	getLoggerRtlogRR#(((s9/usr/lib/python2.7/site-packages/ndg/httpsclient/https.pyt<module>s <