
٨[Qc           @   s	  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l Z y d d l m Z Wn! e k
 r d d l m Z n Xd d l m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z m  Z  m! Z! m" Z" e
 j# d  Z$ d a& d e	 j' d  Z( d   Z) d	 e* f d
     YZ+ d e+ e f d     YZ, e j- d  Z. d   Z/ d dD d     YZ0 d dE d     YZ1 d   Z2 d dF d     YZ3 d e3 f d     YZ4 d e3 f d     YZ5 d e3 f d     YZ6 d   Z7 d e3 f d     YZ8 d dG d      YZ9 d! e9 f d"     YZ: d# dH d$     YZ; d% e; e3 f d&     YZ< d' e; e3 f d(     YZ= d)   Z> d* dI d+     YZ? d, e3 e? f d-     YZ@ d. e3 e? f d/     YZA d0 e3 f d1     YZB d2 eB f d3     YZC eD e d4  r|d5 eB f d6     YZE n  d7 e3 f d8     YZF d9 e3 f d:     YZG d;   ZH d<   ZI d=   ZJ d> e3 f d?     YZK d@ e3 f dA     YZL dB eL f dC     YZM d S(J   s!  An extensible library for opening URLs using a variety of protocols

The simplest way to use this module is to call the urlopen function,
which accepts a string containing a URL or a Request object (described
below).  It opens the URL and returns the results as file-like
object; the returned object has some extra methods described below.

The OpenerDirector manages a collection of Handler objects that do
all the actual work.  Each Handler implements a particular protocol or
option.  The OpenerDirector is a composite object that invokes the
Handlers needed to open the requested URL.  For example, the
HTTPHandler performs HTTP GET and POST requests and deals with
non-error returns.  The HTTPRedirectHandler automatically deals with
HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
deals with digest authentication.

urlopen(url, data=None) -- Basic usage is the same as original
urllib.  pass the url and optionally data to post to an HTTP URL, and
get a file-like object back.  One difference is that you can also pass
a Request instance instead of URL.  Raises a URLError (subclass of
IOError); for HTTP errors, raises an HTTPError, which can also be
treated as a valid response.

build_opener -- Function that creates a new OpenerDirector instance.
Will install the default handlers.  Accepts one or more Handlers as
arguments, either instances or Handler classes that it will
instantiate.  If one of the argument is a subclass of the default
handler, the argument will be installed instead of the default.

install_opener -- Installs a new opener as the default opener.

objects of interest:

OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
the Handler classes, while dealing with requests and responses.

Request -- An object that encapsulates the state of a request.  The
state can be as simple as the URL.  It can also include extra HTTP
headers, e.g. a User-Agent.

BaseHandler --

exceptions:
URLError -- A subclass of IOError, individual protocols have their own
specific subclass.

HTTPError -- Also a valid HTTP response, so you can treat an HTTP error
as an exceptional event or valid response.

internals:
BaseHandler and parent
_call_chain conventions

Example usage:

import urllib2

# set up authentication info
authinfo = urllib2.HTTPBasicAuthHandler()
authinfo.add_password(realm='PDQ Application',
                      uri='https://mahler:8092/site-updates.py',
                      user='klem',
                      passwd='geheim$parole')

proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"})

# build a new opener that adds authentication and caching FTP handlers
opener = urllib2.build_opener(proxy_support, authinfo, urllib2.CacheFTPHandler)

# install it
urllib2.install_opener(opener)

f = urllib2.urlopen('http://www.python.org/')


iN(   t   StringIO(   t   unwrapt   unquotet	   splittypet	   splithostt   quotet
   addinfourlt	   splitportt   splittagt	   splitattrt
   ftpwrappert	   splitusert   splitpasswdt
   splitvalue(   t	   localhostt   url2pathnamet
   getproxiest   proxy_bypassi   c         C   s+   t  d  k r t   a  n  t  j |  | |  S(   N(   t   _openert   Nonet   build_openert   open(   t   urlt   datat   timeout(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   urlopenz   s    c         C   s
   |  a  d  S(   N(   R   (   t   opener(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   install_opener   s    t   URLErrorc           B   s   e  Z d    Z d   Z RS(   c         C   s   | f |  _  | |  _ d  S(   N(   t   argst   reason(   t   selfR   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   __init__   s    c         C   s   d |  j  S(   Ns   <urlopen error %s>(   R   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   __str__   s    (   t   __name__t
   __module__R    R!   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR      s   	t	   HTTPErrorc           B   s8   e  Z d  Z e j Z d   Z d   Z e d    Z RS(   sB   Raised when HTTP error occurs, but also acts like non-error returnc         C   sV   | |  _  | |  _ | |  _ | |  _ | |  _ | d  k	 rR |  j | | | |  n  d  S(   N(   t   codet   msgt   hdrst   fpt   filenameR   t   _HTTPError__super_init(   R   R   R%   R&   R'   R(   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR       s    					c         C   s   d |  j  |  j f S(   Ns   HTTP Error %s: %s(   R%   R&   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR!      s    c         C   s   |  j  S(   N(   R&   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR      s    (	   R"   R#   t   __doc__R   R    R*   R!   t   propertyR   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR$      s
   			s   :\d+$c         C   s_   |  j    } t j |  d } | d k r@ |  j d d  } n  t j d | d  } | j   S(   s   Return request-host, as defined by RFC 2965.

    Variation from RFC: returned value is lowercased, for convenient
    comparison.

    i   t    t   Host(   t   get_full_urlt   urlparset
   get_headert   _cut_port_ret   subt   lower(   t   requestR   t   host(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   request_host   s    t   Requestc           B   s   e  Z d i  d e d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d d  Z d   Z RS(   c         C   s   t  |  |  _ t |  j  \ |  _ |  _ d  |  _ d  |  _ d  |  _ d  |  _ | |  _	 i  |  _
 x* | j   D] \ } } |  j | |  qm Wi  |  _ | d  k r t |   } n  | |  _ | |  _ d  S(   N(   R   t   _Request__originalR   t   _Request__fragmentR   t   typeR6   t   portt   _tunnel_hostR   t   headerst   itemst
   add_headert   unredirected_hdrsR7   t   origin_req_hostt   unverifiable(   R   R   R   R>   RB   RC   t   keyt   value(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR       s    								c         C   s^   | d  d k rQ | d } t  t d |  rQ t |  d |    t |  |  Sn  t |  d  S(   Ni   t   _Request__r_t   get_(   t   hasattrR8   t   getattrt   AttributeError(   R   t   attrt   name(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   __getattr__   s    
c         C   s   |  j    r d Sd Sd  S(   Nt   POSTt   GET(   t   has_data(   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt
   get_method   s    c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   add_data   s    c         C   s   |  j  d  k	 S(   N(   R   R   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRP      s    c         C   s   |  j  S(   N(   R   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   get_data   s    c         C   s(   |  j  r d |  j |  j  f S|  j Sd  S(   Ns   %s#%s(   R:   R9   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR/      s    	c         C   sV   |  j  d  k rO t |  j  \ |  _  |  _ |  j  d  k rO t d |  j  qO n  |  j  S(   Ns   unknown url type: %s(   R;   R   R   R9   t   _Request__r_typet
   ValueError(   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   get_type   s
    c         C   sR   |  j  d  k rK t |  j  \ |  _  |  _ |  j  rK t |  j   |  _  qK n  |  j  S(   N(   R6   R   R   RT   t   _Request__r_hostR   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   get_host  s
    	c         C   s   |  j  S(   N(   RW   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   get_selector  s    c         C   sJ   |  j  d k r( |  j r( |  j |  _ n | |  _  |  j |  _ | |  _ d  S(   Nt   https(   R;   R=   R6   R9   RW   (   R   R6   R;   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt	   set_proxy  s
    	c         C   s   |  j  |  j k S(   N(   RW   R9   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt	   has_proxy  s    c         C   s   |  j  S(   N(   RB   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   get_origin_req_host  s    c         C   s   |  j  S(   N(   RC   (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   is_unverifiable  s    c         C   s   | |  j  | j   <d  S(   N(   R>   t
   capitalize(   R   RD   t   val(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR@     s    c         C   s   | |  j  | j   <d  S(   N(   RA   R_   (   R   RD   R`   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   add_unredirected_header!  s    c         C   s   | |  j  k p | |  j k S(   N(   R>   RA   (   R   t   header_name(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt
   has_header%  s    c         C   s"   |  j  j | |  j j | |   S(   N(   R>   t   getRA   (   R   Rb   t   default(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR1   )  s    	c         C   s)   |  j  j   } | j |  j  | j   S(   N(   RA   t   copyt   updateR>   R?   (   R   R'   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   header_items.  s    N(   R"   R#   R   t   FalseR    RM   RQ   RR   RP   RS   R/   RV   RX   RY   R[   R\   R]   R^   R@   Ra   Rc   R1   Rh   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR8      s(   																	t   OpenerDirectorc           B   sS   e  Z d    Z d   Z d   Z d   Z d e j d  Z	 d d  Z
 d   Z RS(   c         C   sM   d t  } d | f g |  _ g  |  _ i  |  _ i  |  _ i  |  _ i  |  _ d  S(   Ns   Python-urllib/%ss
   User-agent(   t   __version__t
   addheaderst   handlerst   handle_opent   handle_errort   process_responset   process_request(   R   t   client_version(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    4  s    
				c         C   s  t  | d  s( t d t |    n  t } xet |  D]W} | d k rS q; n  | j d  } | |  } | | d } | j d  r | j d  | d } | | d } y t |  } Wn t k
 r n X|  j	 j
 | i   }	 |	 |  j	 | <n] | d	 k r| } |  j }	 n? | d
 k r3| } |  j }	 n! | d k r; | } |  j }	 n q; |	 j | g   }
 |
 rt j |
 |  n |
 j |  t } q; W| rt j |  j |  | j |   n  d  S(   Nt
   add_parents%   expected BaseHandler instance, got %rt   redirect_requestt   do_opent
   proxy_opent   _i   t   errorR   t   responseR5   (   s   redirect_requests   do_opens
   proxy_open(   RH   t	   TypeErrorR;   Ri   t   dirt   findt
   startswitht   intRU   Ro   Rd   Rn   Rp   Rq   t
   setdefaultt   bisectt   insortt   appendt   TrueRm   Rs   (   R   t   handlert   addedt   metht   it   protocolt	   conditiont   jt   kindt   lookupRm   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   add_handler?  sJ    

c         C   s   d  S(   N(    (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   closen  s    c   	      G   sR   | j  | d  } x9 | D]1 } t | |  } | |   } | d  k	 r | Sq Wd  S(   N(    (   Rd   RI   R   (	   R   t   chainR   t	   meth_nameR   Rm   R   t   funct   result(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   _call_chainr  s    c   
      C   s   t  | t  r! t | |  } n" | } | d  k	 rC | j |  n  | | _ | j   } | d } x8 |  j j | g   D]! } t	 | |  } | |  } qx W|  j
 | |  }	 | d } x; |  j j | g   D]$ } t	 | |  } | | |	  }	 q W|	 S(   Nt   _requestt	   _response(   t
   isinstancet
   basestringR8   R   RR   R   RV   Rq   Rd   RI   t   _openRp   (
   R   t   fullurlR   R   t   reqR   R   t	   processorR   Ry   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR   ~  s"    	

c         C   ss   |  j  |  j d d |  } | r% | S| j   } |  j  |  j | | d |  } | rZ | S|  j  |  j d d |  S(   NRe   t   default_openR   t   unknownt   unknown_open(   R   Rn   RV   (   R   R   R   R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s    c         G   s   | d
 k r< |  j  d } | d } d | } d } | } n |  j  } | d } d } | | | f | } |  j |   } | r | S| r | d d	 f | } |  j |   Sd  S(   Nt   httpRZ   i   s   http_error_%si   t   _errori    Re   t   http_error_default(   R   s   https(   Ro   R   (   R   t   protoR   t   dictR   t   http_errt	   orig_argsR   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRx     s     

		
N(   R"   R#   R    R   R   R   R   t   sockett   _GLOBAL_DEFAULT_TIMEOUTR   R   Rx   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRj   3  s   		/		c             sR  d d l      f d   } t   } t t t t t t t t	 g } t
 t d  ra | j t  n  t   } xl | D]d } x[ |  D]S } | |  r t | |  r | j |  q q~ t | |  r~ | j |  q~ q~ Wqq Wx | D] } | j |  q Wx | D] } | j |    q Wx3 |  D]+ } | |  r=|   } n  | j |  qW| S(   s+  Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP, FTP and when applicable, HTTPS.

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    iNc            s   t  |    j t f  S(   N(   R   t	   ClassTypeR;   (   t   obj(   t   types(    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   isclass  s    t   HTTPS(   R   Rj   t   ProxyHandlert   UnknownHandlert   HTTPHandlert   HTTPDefaultErrorHandlert   HTTPRedirectHandlert
   FTPHandlert   FileHandlert   HTTPErrorProcessorRH   t   httplibR   t   HTTPSHandlert   sett
   issubclasst   addR   t   removeR   (   Rm   R   R   t   default_classest   skipt   klasst   checkt   h(    (   R   s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s2    				t   BaseHandlerc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   i  c         C   s   | |  _  d  S(   N(   t   parent(   R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRs     s    c         C   s   d  S(   N(    (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s    c         C   s#   t  | d  s t S|  j | j k  S(   Nt   handler_order(   RH   R   R   (   R   t   other(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   __lt__  s    (   R"   R#   R   Rs   R   R   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s   		R   c           B   s#   e  Z d  Z d Z d   Z e Z RS(   s   Process HTTP error responses.i  c         C   sd   | j  | j | j   } } } d | k o7 d k  n s` |  j j d | | | | |  } n  | S(   Ni   i,  R   (   R%   R&   t   infoR   Rx   (   R   R5   Ry   R%   R&   R'   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   http_response   s
     	(   R"   R#   R+   R   R   t   https_response(    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s   	R   c           B   s   e  Z d    Z RS(   c         C   s"   t  | j   | | | |   d  S(   N(   R$   R/   (   R   R   R(   R%   R&   R'   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s    (   R"   R#   R   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s   R   c           B   s:   e  Z d  Z d Z d   Z d   Z e Z Z Z d Z	 RS(   i   i
   c   	      C   s   | j    } | d k r$ | d k s< | d k r | d k r | j d d	  } t d
   | j j   D  } t | d | d | j   d t St | j	   | | | |   d S(   s  Return a Request or None in response to a redirect.

        This is called by the http_error_30x methods when a
        redirection response is received.  If a redirection should
        take place, return a new Request to allow http_error_30x to
        perform the redirect.  Otherwise, raise HTTPError if no-one
        else should try to handle this url.  Return None if you can't
        but another Handler might.
        i-  i.  i/  i3  RO   t   HEADRN   t    s   %20c         s   s3   |  ]) \ } } | j    d k r | | f Vq d S(   s   content-lengths   content-typeN(   s   content-lengths   content-type(   R4   (   t   .0t   kt   v(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pys	   <genexpr>-  s    	R>   RB   RC   N(   i-  i.  i/  i3  (   s   GETR   (   i-  i.  i/  (
   RQ   t   replaceR   R>   R?   R8   R]   R   R$   R/   (	   R   R   R(   R%   R&   R>   t   newurlt   mt
   newheaders(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRt     s    
	c      	   C   s  d | k r" | j  d  d } n& d | k rD | j  d  d } n d  St j |  } | j sy t |  } d | d <n  t j |  } t j | j   |  } | j   } | j d  p | j d  p | j d  s t	 | | | d	 | | |   n  |  j
 | | | | | |  }	 |	 d  k r*d  St | d
  r| j }
 |	 _ |
 j | d  |  j k syt |
  |  j k rt	 | j   | |  j | | |   qn i  }
 |	 _ | _ |
 j | d  d |
 | <| j   | j   |  j j |	 d | j S(   Nt   locationi    t   urit   /i   s   http://s   https://s   ftp://s)    - Redirection to url '%s' is not allowedt   redirect_dicti   R   (   t
   getheadersR0   t   patht   listt
   urlunparset   urljoinR/   R4   R}   R$   Rt   R   RH   R   Rd   t   max_repeatst   lent   max_redirectionst   inf_msgt   readR   R   R   R   (   R   R   R(   R%   R&   R>   R   t   urlpartst   newurl_lowert   newt   visited(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   http_error_302;  sB    		

so   The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
(
   R"   R#   R   R   Rt   R   t   http_error_301t   http_error_303t   http_error_307R   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s   	"	8c   	      C   s   t  |   \ } } | j d  s0 d } |  } nV | j d  sR t d |    n  | j d d  } | d k ry d } n  | d | !} t |  \ } } | d k	 r t |  \ } } n
 d } } | | | | f S(   s3  Return (scheme, user, password, host/port) given a URL or an authority.

    If a URL is supplied, it must have an authority (host:port) component.
    According to RFC 3986, having an authority component means the URL must
    have two slashes after the scheme:

    >>> _parse_proxy('file:/ftp.example.com/')
    Traceback (most recent call last):
    ValueError: proxy URL with no authority: 'file:/ftp.example.com/'

    The first three items of the returned tuple may be None.

    Examples of authority parsing:

    >>> _parse_proxy('proxy.example.com')
    (None, None, None, 'proxy.example.com')
    >>> _parse_proxy('proxy.example.com:3128')
    (None, None, None, 'proxy.example.com:3128')

    The authority component may optionally include userinfo (assumed to be
    username:password):

    >>> _parse_proxy('joe:password@proxy.example.com')
    (None, 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('joe:password@proxy.example.com:3128')
    (None, 'joe', 'password', 'proxy.example.com:3128')

    Same examples, but with URLs instead:

    >>> _parse_proxy('http://proxy.example.com/')
    ('http', None, None, 'proxy.example.com')
    >>> _parse_proxy('http://proxy.example.com:3128/')
    ('http', None, None, 'proxy.example.com:3128')
    >>> _parse_proxy('http://joe:password@proxy.example.com/')
    ('http', 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
    ('http', 'joe', 'password', 'proxy.example.com:3128')

    Everything after the authority is ignored:

    >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
    ('ftp', 'joe', 'password', 'proxy.example.com')

    Test for no trailing '/' case:

    >>> _parse_proxy('http://joe:password@proxy.example.com')
    ('http', 'joe', 'password', 'proxy.example.com')

    R   s   //s   proxy URL with no authority: %ri   iN(   R   R}   R   RU   R|   R   R   (	   t   proxyt   schemet   r_schemet	   authorityt   endt   userinfot   hostportt   usert   password(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   _parse_proxyz  s    2		
R   c           B   s#   e  Z d  Z d d  Z d   Z RS(   id   c         C   se   | d  k r t   } n  | |  _ x= | j   D]/ \ } } t |  d | | | |  j d   q. Wd  S(   Ns   %s_openc         S   s   | |  | |  S(   N(    (   t   rR   R;   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   <lambda>  s    (   R   R   t   proxiesR?   t   setattrRv   (   R   R   R;   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR      s    	c         C   s   | j    } t |  \ } } } } | d  k r9 | } n  | j rU t | j  rU d  S| r | r d t |  t |  f }	 t j |	  j   }
 | j	 d d |
  n  t |  } | j
 | |  | | k s | d k r d  S|  j j | d | j Sd  S(   Ns   %s:%ss   Proxy-authorizations   Basic RZ   R   (   RV   R   R   R6   R   R   t   base64t	   b64encodet   stripR@   R[   R   R   R   (   R   R   R   R;   t	   orig_typet
   proxy_typeR   R   R   t	   user_passt   creds(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRv     s    	N(   R"   R#   R   R   R    Rv   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s   
t   HTTPPasswordMgrc           B   s8   e  Z d    Z d   Z d   Z e d  Z d   Z RS(   c         C   s   i  |  _  d  S(   N(   t   passwd(   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR      s    c         C   s   t  | t  r | g } n  | |  j k r: i  |  j | <n  xV t t f D]H } t g  | D] } |  j | |  ^ qW  } | | f |  j | | <qG Wd  S(   N(   R   R   R   R   Ri   t   tuplet
   reduce_uri(   R   t   realmR   R   R   t   default_portt   ut   reduced_uri(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   add_password  s    (c   	      C   s   |  j  j | i   } xj t t f D]\ } |  j | |  } xA | j   D]3 \ } } x$ | D] } |  j | |  rZ | SqZ WqG Wq" Wd S(   N(   NN(   R   Rd   R   Ri   R   t	   iteritemst	   is_suburiR   (	   R   R   t   authurit   domainsR  t   reduced_authurit   urist   authinfoR   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   find_user_password  s    c   
      C   s   t  j |  } | d r@ | d } | d } | d p: d } n d
 } | } d } t |  \ } } | r | d
 k r | d
 k	 r i d d 6d d 6j |  }	 |	 d
 k	 r d	 | |	 f } q n  | | f S(   s@   Accept authority or URI and extract only the authority and path.i   i    i   R   iP   R   i  RZ   s   %s:%dN(   R0   t   urlsplitR   R   Rd   (
   R   R   R  t   partsR   R   R   R6   R<   t   dport(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s     




	c         C   si   | | k r t  S| d | d k r( t St j | d | d f  } t |  t | d  k re t  St S(   sc   Check if test is below base in a URI tree

        Both args must be URIs in reduced form.
        i    i   (   R   Ri   t	   posixpatht   commonprefixR   (   R   t   baset   testt   common(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    s    (   R"   R#   R    R  R  R   R   R  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s
   			
t   HTTPPasswordMgrWithDefaultRealmc           B   s   e  Z d    Z RS(   c         C   sD   t  j |  | |  \ } } | d  k	 r1 | | f St  j |  d  |  S(   N(   R   R  R   (   R   R   R  R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR  /  s
    
(   R"   R#   R  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR  -  s   t   AbstractBasicAuthHandlerc           B   sD   e  Z e j d  e j  Z d d  Z d   Z d   Z	 d   Z
 RS(   s-   (?:.*,)*[ 	]*([^ 	]+)[ 	]+realm=(["'])(.*?)\2c         C   s=   | d  k r t   } n  | |  _ |  j j |  _ d |  _ d  S(   Ni    (   R   R   R   R  t   retried(   R   t   password_mgr(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    E  s
    	c         C   s   d |  _  d  S(   Ni    (   R  (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   reset_retry_countL  s    c   
      C   s   | j  | d   } |  j d k rB t | j   d d | d    n |  j d 7_ | r t j j |  } | r | j   \ } } } | j	   d k r |  j
 | | |  }	 |	 r |	 j d k r d |  _ n  |	 Sq n  d  S(   Ni   i  s   basic auth failedi   t   basici    (   Rd   R   R  R$   R/   R  t   rxt   searcht   groupsR4   t   retry_http_basic_authR%   (
   R   t   authreqR6   R   R>   t   moR   R   R   Ry   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   http_error_auth_reqedO  s    c         C   s   |  j  j | |  \ } } | d  k	 r d | | f } d t j |  j   } | j j |  j d   | k rr d  S| j	 |  j |  |  j
 j | d | j Sd  Sd  S(   Ns   %s:%ss   Basic %sR   (   R   R  R   R   R   R   R>   Rd   t   auth_headerRa   R   R   R   (   R   R6   R   R   R   t   pwt   rawt   auth(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR  f  s    N(   R"   R#   t   ret   compilet   IR  R   R    R  R!  R  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR  7  s   			t   HTTPBasicAuthHandlerc           B   s   e  Z d  Z d   Z RS(   t   Authorizationc         C   s2   | j    } |  j d | | |  } |  j   | S(   Ns   www-authenticate(   R/   R!  R  (   R   R   R(   R%   R&   R>   R   Ry   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   http_error_401w  s
    	
(   R"   R#   R"  R+  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR)  s  s   t   ProxyBasicAuthHandlerc           B   s   e  Z d  Z d   Z RS(   s   Proxy-authorizationc         C   s2   | j    } |  j d | | |  } |  j   | S(   Ns   proxy-authenticate(   RX   R!  R  (   R   R   R(   R%   R&   R>   R   Ry   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   http_error_407  s
    	
(   R"   R#   R"  R-  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR,    s   c         C   s}   t  j j d  r; t d  } | j |   } | j   | Sg  t |   D] } t t j	 d d   ^ qH } d j
 |  Sd S(   s   Return n random bytes.s   /dev/urandomi    i   R-   N(   t   osR   t   existsR   R   R   t   ranget   chrt   randomt	   randranget   join(   t   nt   ft   sR   t   L(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   randombytes  s    
1t   AbstractDigestAuthHandlerc           B   sS   e  Z d d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(	   c         C   sO   | d  k r t   } n  | |  _ |  j j |  _ d |  _ d |  _ d  |  _ d  S(   Ni    (   R   R   R   R  R  t   nonce_countt
   last_nonce(   R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR      s    			c         C   s   d |  _  d  S(   Ni    (   R  (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    s    c         C   s   | j  | d   } |  j d k rB t | j   d d | d    n |  j d 7_ | r | j   d } | j   d k r |  j | |  Sn  d  S(   Ni   i  s   digest auth failedi   i    t   digest(   Rd   R   R  R$   R/   t   splitR4   t   retry_http_digest_auth(   R   R"  R6   R   R>   R  R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR!    s    c         C   s   | j  d d  \ } } t t |   } |  j | |  } | r d | } | j j |  j d   | k rn d  S| j |  j |  |  j	 j
 | d | j } | Sd  S(   NR   i   s	   Digest %sR   (   R>  t   parse_keqv_listt   parse_http_listt   get_authorizationR>   Rd   R"  R   Ra   R   R   R   (   R   R   R%  t   tokent	   challenget   chalt   auth_valt   resp(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR?    s    
c         C   s<   t  j d |  j | t j   t d  f  j   } | d  S(   Ns   %s:%s:%s:%si   i   (   t   hashlibt   sha1R;  t   timet   ctimeR9  t	   hexdigest(   R   t   noncet   dig(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt
   get_cnonce  s    c         C   sd  yK | d } | d } | j  d  } | j  d d  } | j  d d   } Wn t k
 r_ d  SX|  j |  \ } }	 | d  k r d  S|  j j | | j    \ }
 } |
 d  k r d  S| j   r |  j | j	   |  } n d  } d |
 | | f } d | j
   | j   f } | d	 k r| |  j k r?|  j d
 7_ n d
 |  _ | |  _ d |  j } |  j |  } d | | | | | |  f } |	 | |  |  } nD | d  k r|	 | |  d | | |  f  } n t d |   d |
 | | | j   | f } | r| d | 7} n  | r5| d | 7} n  | d | 7} | r`| d | | f 7} n  | S(   NR   RM  t   qopt	   algorithmt   MD5t   opaques   %s:%s:%ss   %s:%sR%  i   s   %08xs   %s:%s:%s:%s:%ss   qop '%s' is not supported.s>   username="%s", realm="%s", nonce="%s", uri="%s", response="%s"s   , opaque="%s"s   , digest="%s"s   , algorithm="%s"s   , qop=auth, nc=%s, cnonce="%s"(   Rd   R   t   KeyErrort   get_algorithm_implsR   R  R/   RP   t   get_entity_digestRS   RQ   RY   R<  R;  RO  R   (   R   R   RE  R   RM  RP  RQ  RS  t   Ht   KDR   R#  t   entdigt   A1t   A2t   ncvaluet   cnoncet   noncebitt   respdigR  (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRB    sV    

!		(
c            sU   | j    } | d k r$ d     n | d k r< d     n    f d   }   | f S(   NRR  c         S   s   t  j |   j   S(   N(   RH  t   md5RL  (   t   x(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s    t   SHAc         S   s   t  j |   j   S(   N(   RH  RI  RL  (   Ra  (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s    c            s     d |  | f  S(   Ns   %s:%s(    (   R7  t   d(   RW  (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR   !  s    (   t   upper(   R   RQ  RX  (    (   RW  s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRU    s    c         C   s   d  S(   N(   R   (   R   R   RE  (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRV  $  s    N(   R"   R#   R   R    R  R!  R?  RO  RB  RU  RV  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR:    s   					
	=	t   HTTPDigestAuthHandlerc           B   s#   e  Z d  Z d Z d Z d   Z RS(   s   An authentication protocol defined by RFC 2069

    Digest authentication improves on basic authentication because it
    does not transmit passwords in the clear.
    R*  i  c         C   s?   t  j  | j    d } |  j d | | |  } |  j   | S(   Ni   s   www-authenticate(   R0   R/   R!  R  (   R   R   R(   R%   R&   R>   R6   t   retry(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR+  3  s
    	
(   R"   R#   R+   R"  R   R+  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRe  )  s   t   ProxyDigestAuthHandlerc           B   s   e  Z d  Z d Z d   Z RS(   s   Proxy-Authorizationi  c         C   s2   | j    } |  j d | | |  } |  j   | S(   Ns   proxy-authenticate(   RX   R!  R  (   R   R   R(   R%   R&   R>   R6   Rf  (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR-  @  s
    	
(   R"   R#   R"  R   R-  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRg  ;  s   t   AbstractHTTPHandlerc           B   s/   e  Z d  d  Z d   Z d   Z d   Z RS(   i    c         C   s   | |  _  d  S(   N(   t   _debuglevel(   R   t
   debuglevel(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    I  s    c         C   s   | |  _  d  S(   N(   Ri  (   R   t   level(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   set_http_debuglevelL  s    c   
      C   s:  | j    } | s! t d   n  | j   r | j   } | j d  s[ | j d d  n  | j d  s | j d d t |   q n  | } | j   r t | j	    \ } } t
 |  \ } } n  | j d  s | j d |  n  xH |  j j D]: \ } }	 | j   } | j |  s | j | |	  q q W| S(   Ns   no host givens   Content-types!   application/x-www-form-urlencodeds   Content-lengths   %dR.   (   RX   R   RP   RS   Rc   Ra   R   R\   R   RY   R   R   Rl   R_   (
   R   R5   R6   R   t   sel_hostR   t   selt   sel_pathRL   RE   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   do_request_O  s.    
c            s  | j    } | s! t d   n  | | d | j } | j |  j  t | j      j t   f d   | j j	   D   d   d <t d     j	   D    | j
 r i  } d } |   k r   | | | <  | =n  | j | j
 d | n  y) | j | j   | j   | j    Wn, t j k
 rP} | j   t |   n7 Xy | j d	 t  } Wn t k
 r| j   } n X| j | _ t j | d t }	 t |	 | j | j    }
 | j |
 _ | j |
 _ |
 S(
   s  Return an addinfourl object for the request, using http_class.

        http_class must implement the HTTPConnection API from httplib.
        The addinfourl return value is a file-like object.  It also
        has methods and attributes including:
            - info(): return a mimetools.Message object for the headers
            - geturl(): return the original request URL
            - code: HTTP status code
        s   no host givenR   c         3   s-   |  ]# \ } } |   k r | | f Vq d  S(   N(    (   R   R   R   (   R>   (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pys	   <genexpr>~  s    	R   t
   Connectionc         s   s'   |  ] \ } } | j    | f Vq d  S(   N(   t   title(   R   RL   R`   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pys	   <genexpr>  s    s   Proxy-AuthorizationR>   t	   buffering(   RX   R   R   t   set_debuglevelRi  R   RA   Rg   R>   R?   R=   t
   set_tunnelR5   RQ   RY   R   R   Rx   R   t   getresponseR   Rz   R   t   recvt   _fileobjectR   R&   R/   t   statusR%   R   (   R   t
   http_classR   R6   R   t   tunnel_headerst   proxy_auth_hdrt   errR   R(   RG  (    (   R>   s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRu   l  s@    
,	
	
)
(   R"   R#   R    Rl  Rp  Ru   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRh  G  s   		R   c           B   s   e  Z d    Z e j Z RS(   c         C   s   |  j  t j |  S(   N(   Ru   R   t   HTTPConnection(   R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt	   http_open  s    (   R"   R#   R  Rh  Rp  t   http_request(    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s   	R   R   c           B   s   e  Z d    Z e j Z RS(   c         C   s   |  j  t j |  S(   N(   Ru   R   t   HTTPSConnection(   R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt
   https_open  s    (   R"   R#   R  Rh  Rp  t   https_request(    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s   	t   HTTPCookieProcessorc           B   s2   e  Z d d   Z d   Z d   Z e Z e Z RS(   c         C   s4   d d  l  } | d  k r' | j   } n  | |  _ d  S(   Ni(   t	   cookielibR   t	   CookieJart	   cookiejar(   R   R  R  (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR      s    c         C   s   |  j  j |  | S(   N(   R  t   add_cookie_header(   R   R5   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    s    c         C   s   |  j  j | |  | S(   N(   R  t   extract_cookies(   R   R5   Ry   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s    N(   R"   R#   R   R    R  R   R  R   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    s
   		R   c           B   s   e  Z d    Z RS(   c         C   s    | j    } t d |   d  S(   Ns   unknown url type: %s(   RV   R   (   R   R   R;   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s    (   R"   R#   R   (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s   c         C   sm   i  } x` |  D]X } | j  d d  \ } } | d d k r[ | d d k r[ | d d !} n  | | | <q W| S(   s>   Parse list of key=value strings where keys are not duplicated.t   =i   i    t   "i(   R>  (   t   lt   parsedt   eltR   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR@    s     c         C   s   g  } d } t  } } x |  D] } | r? | | 7} t  } q n  | r | d k r] t } q n | d k rr t  } n  | | 7} q n  | d k r | j |  d } q n  | d k r t } n  | | 7} q W| r | j |  n  g  | D] } | j   ^ q S(   sp  Parse lists as described by RFC 2068 Section 2.

    In particular, parse comma-separated lists where the elements of
    the list may include quoted-strings.  A quoted-string could
    contain a comma.  A non-quoted string could have quotes in the
    middle.  Neither commas nor quotes count if they are escaped.
    Only double-quotes count, not single-quotes.
    R-   s   \R  t   ,(   Ri   R   R   R   (   R7  t   rest   partt   escapeR   t   cur(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyRA    s4    	

	
	c         C   s-   y t  j |   SWn t  j k
 r( d  SXd  S(   N(   R   t   gethostbynamet   gaierrorR   (   R6   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   _safe_gethostbyname  s    R   c           B   s)   e  Z d    Z d Z d   Z d   Z RS(   c         C   sq   | j    } | d  d k r` | d d !d k r` | j r` | j d k r` d | _ |  j j |  S|  j |  Sd  S(   Ni   s   //i   R   R   t   ftp(   RY   R6   R;   R   R   t   open_local_file(   R   R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt	   file_open  s    ,	c         C   s|   t  j d  k ru y7 t t j d  d t j t j    d  t  _ Wqu t j k
 rq t j d  f t  _ qu Xn  t  j S(   NR   i   (	   R   t   namesR   R   R   t   gethostbyname_ext   gethostnameR  R  (   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt	   get_names"  s    $c         C   s[  d d  l  } d d  l } | j   } | j   } t |  } y t j |  } | j } | j j	 | j
 d t }	 | j |  d }
 t j t d |
 p d | |	 f   } | r t |  \ } } n  | s | r(t |  |  j   k r(| rd | | } n
 d | } t t | d  | |  SWn t k
 rJ} t |   n Xt d   d  S(	   Nit   usegmti    s6   Content-type: %s
Content-length: %d
Last-modified: %s
s
   text/plains   file://t   rbs   file not on local host(   t   email.utilst	   mimetypesRX   RY   R   R.  t   statt   st_sizet   utilst
   formatdatet   st_mtimeR   t
   guess_typet	   mimetoolst   MessageR    R   R  R  R   R   t   OSErrorR   (   R   R   t   emailR  R6   R)   t	   localfilet   statst   sizet   modifiedt   mtypeR>   R<   t   origurlR&   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR  -  s0    		
N(   R"   R#   R  R   R  R  R  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR     s   	
	R   c           B   s   e  Z d    Z d   Z RS(   c         C   s  d d  l  } d d  l } | j   } | s9 t d   n  t |  \ } } | d  k rc | j } n t |  } t |  \ } } | r t	 |  \ } } n d  } t
 |  } | p d } | p d } y t j |  } Wn" t j k
 r } t |   n Xt | j    \ }	 }
 |	 j d  } t t
 |  } | d  | d } } | rg| d rg| d } n  y/|  j | | | | | | j  } | rd pd } xM |
 D]E } t |  \ } } | j   d	 k r| d k r| j   } qqW| j | |  \ } } d } | j | j    d } | r;| d | 7} n  | d  k	 rd| d k rd| d | 7} n  t |  } t j |  } t | | | j    SWn0 | j k
 r} t d | t j    d  n Xd  S(   Nis   ftp error: no host givenR-   R   i    i   R(  t   DR;   t   at   AR   Rc  s   Content-type: %s
s   Content-length: %d
s   ftp error: %si   (   R  R  R   R(  Rc  R  (!   t   ftplibR  RX   R   R   R   t   FTP_PORTR~   R   R   R   R   R  Rx   R	   RY   R>  t   mapt   connect_ftpR   R   R4   Rd  t   retrfileR  R/   R    R  R  R   t
   all_errorst   syst   exc_info(   R   R   R  R  R6   R<   R   R   R&   R   t   attrst   dirst   filet   fwR;   RK   RE   R(   t   retrlenR>   R  t   sf(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   ftp_openJ  s\    !c      	   C   s%   t  | | | | | | d t } | S(   Nt
   persistent(   R
   Ri   (   R   R   R   R6   R<   R  R   R  (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    s    	(   R"   R#   R  R  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR   I  s   	5t   CacheFTPHandlerc           B   s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s1   i  |  _  i  |  _ d |  _ d |  _ d |  _ d  S(   Ni    i<   i   (   t   cacheR   t   soonestt   delayt	   max_conns(   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR      s
    				c         C   s   | |  _  d  S(   N(   R  (   R   t   t(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt
   setTimeout  s    c         C   s   | |  _  d  S(   N(   R  (   R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   setMaxConns  s    c         C   s   | | | d j  |  | f } | |  j k rJ t j   |  j |  j | <n< t | | | | | |  |  j | <t j   |  j |  j | <|  j   |  j | S(   NR   (   R4  R  RJ  R  R   R
   t   check_cache(   R   R   R   R6   R<   R  R   RD   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    s    "
c         C   s  t  j    } |  j | k rr xT |  j j   D]@ \ } } | | k  r+ |  j | j   |  j | =|  j | =q+ q+ Wn  t |  j j    |  _ t |  j  |  j	 k rxD |  j j   D]3 \ } } | |  j k r |  j | =|  j | =Pq q Wt |  j j    |  _ n  d  S(   N(
   RJ  R  R   R?   R  R   t   mint   valuesR   R  (   R   R  R   R   (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    s    


c         C   sB   x! |  j  j   D] } | j   q W|  j  j   |  j j   d  S(   N(   R  R  R   t   clearR   (   R   t   conn(    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   clear_cache  s    (   R"   R#   R    R  R  R  R  R  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyR    s   				
	(    (    (    (    (    (    (N   R+   R   RH  R   R  R.  R  R2  R&  R   R  RJ  R0   R   t	   cStringIOR    t   ImportErrort   urllibR   R   R   R   R   R   R   R   R	   R
   R   R   R   R   R   R   R   t   versionRk   R   R   R   R   R   t   IOErrorR   R$   R'  R2   R7   R8   Rj   R   R   R   R   R   R   R   R   R  R  R)  R,  R9  R:  Re  Rg  Rh  R   RH   R   R  R   R@  RA  R  R   R   R  (    (    (    s;   /home/tom/ab/x64lucid-deps/install/lib/python2.7/urllib2.pyt   <module>L   sr   X"		r	'i	H+@
<	m	
	+	4<