/usr/lib/python2.6/site-packages/ndg/httpsclient
NameSizeModeActions
test/-0755rm
https.py48340644editdlrm
https.pyc50620644editdlrm
ssl_context_util.py34580644editdlrm
ssl_context_util.pyc40410644editdlrm
ssl_peer_verification.py96610644editdlrm
ssl_peer_verification.pyc91640644editdlrm
ssl_socket.py93440644editdlrm
ssl_socket.pyc123320644editdlrm
subj_alt_name.py61310644editdlrm
subj_alt_name.pyc68580644editdlrm
urllib2_build_opener.py26890644editdlrm
urllib2_build_opener.pyc26280644editdlrm
utils.py157360644editdlrm
utils.pyc132160644editdlrm
__init__.py3900644editdlrm
__init__.pyc6250644editdlrm
Edit: /usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyc (12332B)
Ñò ˜KVc@s›dZdZdZdZdZdZdZddklZdd kZdd k Z dd k l Z dd k l Z eieƒZd efd „ƒYZd S(s’PyOpenSSL utilities including HTTPSSocket class which wraps PyOpenSSL SSL connection into a httplib-like interface suitable for use with urllib2 s P J Kershaws21/12/10s2(C) 2012 Science and Technology Facilities Councils-BSD - see LICENSE file in top-level directorysPhilip.Kershaw@stfc.ac.uks$Id$iÿÿÿÿ(tdatetimeN(tBytesIO(tSSLt SSLSocketcBs.eZdZdZdd„Zd„Zed„ƒZei d„ƒZd„Z d„Z d„Z d „Z d „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zed„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"RS( s:SSL Socket class wraps pyOpenSSL's SSL.Connection class implementing the makefile method so that it is compatible with the standard socket interface and usable with httplib. @cvar default_buf_size: default buffer size for recv operations in the makefile method @type default_buf_size: int i cCs…|dj o ||_n8tititiƒ|_|iititidƒti||iƒ|_ |i i |_ d|_ dS(s¹Create SSL socket object @param ctx: SSL context @type ctx: OpenSSL.SSL.Context @param sock: underlying socket object @type sock: socket.socket iiN(tNonetsockettAF_INETt SOCK_STREAMt setsockoptt SOL_SOCKETt SO_REUSEADDRRt Connectiont_SSLSocket__ssl_connt __class__tdefault_buf_sizetbuf_sizet_makefile_refs(tselftctxtsock((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyt__init__!s  cCs|iƒdS(sCClose underlying socket when this object goes out of scope N(tclose(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyt__del__3scCs|iS(s1Buffer size for makefile method recv() operations(t_SSLSocket__buf_size(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR8scCs7t|tƒptdt|ƒƒ‚n||_dS(s1Buffer size for makefile method recv() operationss1Expecting int type for "buf_size"; got %r insteadN(t isinstancetintt TypeErrorttypeR(Rtvalue((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR=scCsZ|idjo7y|iiƒWqVtitifj oqVXn|id8_dS(sVShutdown the SSL connection and call the close method of the underlying socketiN(RR tshutdownRtErrort SysCallError(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyREs  cCs|ii|ƒdS(s“Set the shutdown state of the Connection. @param mode: bit vector of either or both of SENT_SHUTDOWN and RECEIVED_SHUTDOWN N(R t set_shutdown(Rtmode((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR QscCs |iiƒS(sGet the shutdown state of the Connection. @return: bit vector of either or both of SENT_SHUTDOWN and RECEIVED_SHUTDOWN (R t get_shutdown(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR"XscCs|ii|ƒdS(sŠbind to the given address - calls method of the underlying socket @param addr: address/port number tuple @type addr: tupleN(R tbind(Rtaddr((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR#_scCs|ii|ƒdS(sðListen for connections made to the socket. @param backlog: specifies the maximum number of queued connections and should be at least 1; the maximum value is system-dependent (usually 5). @param backlog: int N(R tlisten(Rtbacklog((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR%escCs|iiƒdS(slSet the connection to work in server mode. The handshake will be handled automatically by read/writeN(R tset_accept_state(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR'nscCs |iiƒS(sÒAccept an SSL connection. @return: pair (ssl, addr) where ssl is a new SSL connection object and addr is the address bound to the other end of the SSL connection. @rtype: tuple (R taccept(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR(sscCs|iiƒdS(slSet the connection to work in client mode. The handshake will be handled automatically by read/writeN(R tset_connect_state(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR)|scCs|ii|ƒdS(sùCall the connect method of the underlying socket and set up SSL on the socket, using the Context object supplied to this Connection object at creation. @param addr: address/port number pair @type addr: tuple N(R tconnect(RR$((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR*scCs |iiƒS(sÜSend the shutdown message to the Connection. @param how: for socket.socket this flag determines whether read, write or both type operations are supported. OpenSSL.SSL.Connection doesn't support this so this parameter is IGNORED @return: true if the shutdown message exchange is completed and false otherwise (in which case you call recv() or send() when the connection becomes readable/writeable. @rtype: bool (R R(Rthow((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR‹s cCs |iiƒS(s-Renegotiate this connection's SSL parameters.(R t renegotiate(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR,˜scCs |iiƒS(sk@return: numbers of bytes that can be safely read from the SSL buffer. @rtype: int (R tpending(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR-œscGs|ii|ƒS(sÝSend data to the socket. Nb. The optional flags argument is ignored. - retained for compatibility with socket.socket interface @param data: data to send down the socket @type data: string (R tsend(Rtdatat flags_arg((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR.£scCs|ii|ƒdS(N(R tsendall(RR/((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR1¬scCs|ii|ƒS(sÁReceive data from the Connection. @param size: The maximum amount of data to be received at once @type size: int @return: data received. @rtype: string (R trecv(Rtsize((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR2¯scCs|ii|ƒdS(s}Set this connection's underlying socket blocking _mode_. @param mode: blocking mode @type mode: int N(R t setblocking(RR!((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR4¹scCs |iiƒS(s_ @return: file descriptor number for the underlying socket @rtype: int (R tfileno(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR5ÁscGs|ii|ŒS(s%See socket.socket.getsockopt (R t getsockopt(Rtargs((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR6ÈscGs|ii|ŒS(ssSee socket.socket.setsockopt @return: value of the given socket option @rtype: int/string (R R(RR7((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyRÍscCs |iiƒS(s(Return the SSL state of this connection.(R t state_string(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyR8ÕscGsë|id7_|i}d}tƒ}tiƒ}yN|ii|ƒ}x5|o-|d7}|i|ƒ|ii|ƒ}qKWWnti ti fj onXt i ƒt ijo!t id|tiƒ|ƒn|idƒ|S(shSpecific to Python socket API and required by httplib: convert response into a file-like object. This implementation reads using recv and copies the output into a StringIO buffer to simulate a file object for consumption by httplib Nb. Ignoring optional file open mode (StringIO is generic and will open for read and write unless a string is passed to the constructor) and buffer size - httplib set a zero buffer size which results in recv reading nothing @return: file object for data returned from socket @rtype: cStringIO.StringO iis-Socket.makefile %d recv calls completed in %s(RRRRtutcnowR R2twriteRtZeroReturnErrorRtlogtgetEffectiveLeveltloggingtDEBUGtdebugtseek(RR7t _buf_sizetitstreamt startTimetdat((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pytmakefileÙs&       cCs |iiƒS(sC @return: the socket's own address @rtype: (R t getsockname(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyRHscCs |iiƒS(sJ @return: remote address to which the socket is connected (R t getpeername(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyRIscCs |iiƒS(s=Retrieve the Context object associated with this Connection. (R t get_context(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyRJscCs |iiƒS(s0Retrieve the other side's certificate (if any) (R tget_peer_certificate(R((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyRKsN(#t__name__t __module__t__doc__RRRRtpropertyRtsetterRR R"R#R%R'R(R)R*RR,R-R.R1R2R4R5R6RR8RGRHRIRJRK(((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyRs>                .   (RNt __author__t__date__t __copyright__t __license__t __contact__t __revision__RR>RtioRtOpenSSLRt getLoggerRLR<tobjectR(((s>/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_socket.pyts