ó 9(Zc@sddlZddlZddlZddlZddlZddlZddlmZddlmZm Z m Z m Z m Z ddl mZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZejeƒZd e fd „ƒYZdefd„ƒYZdefd„ƒYZ x?ej!j"ƒD].\Z#Z$ej%e$ƒrae&e e#e$ƒqaqaWddd„Z(d„Z)d„Z*dej+ej,fd„ƒYZ-dej.fd„ƒYZ/e e_0ee_0dS(iÿÿÿÿN(tsix(t HTTPHeaderst HTTPResponset urlunsplitturlsplitturlparse(tUnseekableStreamError(tpercent_encode_sequence(tmodels(tREDIRECT_STATI(tVerifiedHTTPSConnection(tHTTPConnection(tHTTPConnectionPool(tHTTPSConnectionPooltAWSHTTPResponsecBseZd„Zd„ZRS(cOs)|jdƒ|_tj|||ŽdS(Nt status_tuple(tpopt _status_tupleRt__init__(tselftargstkwargs((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR,scCs6|jdk r%|j}d|_|Stj|ƒSdS(N(RtNoneRt _read_status(RR((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR0s   (t__name__t __module__RR(((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR)s tAWSHTTPConnectioncBsteZdZd„Zd„Zd„Zd„Zd„Zd d„Z d„Z d„Z d „Z d „Z d „ZRS( sòHTTPConnection that supports Expect 100-continue. This is conceptually a subclass of httplib.HTTPConnection (though technically we subclass from urllib3, which subclasses httplib.HTTPConnection) and we only override this class to support Expect 100-continue, which we need for S3. As far as I can tell, this is general purpose enough to not be specific to S3, but I'm being tentative and keeping it in botocore because I've only tested this against AWS services. cOs5tj|||Ž|j|_t|_t|_dS(N(R Rtresponse_classt_original_response_clstFalset_response_receivedt_expect_header_set(RRR((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyREs cCs/tj|ƒt|_t|_|j|_dS(N(R tcloseRRRRR(R((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR Ss   cCsBtjd d kr tj|ƒS|j|j|jƒ|jd|j|j fƒx4|j j ƒD]#\}}|jd||fƒqcW|jdƒ|j |j d|jd|jƒ}|jƒ\}}}|dkr|jƒtjd ||jƒfƒ‚nx3tr=|jjƒ}|s*Pn|d kr Pq q WdS(NiisCONNECT %s:%d HTTP/1.0 s%s: %s s tstricttmethodiÈsTunnel connection failed: %d %ss t(ii(s s R#(tsyst version_infoR t_tunnelt _set_hostportt _tunnel_hostt _tunnel_porttsendthosttportt_tunnel_headerst iteritemsRtsockR!t_methodRR tsocketterrortstriptTruetfptreadline(Rtheadertvaluetresponsetversiontcodetmessagetline((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR&Zs(        cOspt|_|jddƒdkr-t|_nt|_|j|_tj|||||||Ž}t|_|S(NtExpectR#s 100-continue( RRtgetR4RRRR t _send_request(RR"turltbodytheadersRRtrval((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR@zs     cCsbg}xF|D]>}t|tjƒr>|j|jdƒƒq |j|ƒq Wdj|ƒ}|S(Nsutf-8s (t isinstanceRt text_typetappendtencodetjoin(Rt mixed_buffert bytes_buffertchunktmsg((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyt_convert_to_bytes†s cOsâ|jjdƒ|j|jƒ}|j2t|tƒrK||7}d}n|j|ƒ|jrÂtj dƒt j |j gg|j gdƒ\}}}|r²|j |ƒdStj dƒn|dk rÞ|j|ƒndS(NR#s"Waiting for 100 Continue response.isCNo response seen from server, continuing to send the response body.(R#R#( t_buffertextendRNREtbytesRR*RtloggertdebugtselectR/t_handle_expect_response(Rt message_bodyRRRMtreadtwritetexc((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyt _send_output“s      -   cCs)d}x|dkr$|jƒ}q WdS(Ns (RR6(RR5tcurrent((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyt_consume_headers¸scCs|jjddƒ}zê|jƒ}|jddƒ}|j|ƒro|j|ƒtjdƒ|j |ƒnt |ƒdkrþ|dj dƒrþtjdƒ|dj dƒt |d ƒ|dj dƒf}tjtd |ƒ}||_t|_nWd|jƒXdS( Ntrbiis5100 Continue response seen, now sending request body.isHTTP/sOReceived a non 100 Continue response from the server, NOT sending request body.tasciiiR(R/tmakefileR6tsplitRt_is_100_continue_statusR\RRRSt_send_message_bodytlent startswithtdecodetintt functoolstpartialRRR4RR (RRVR5tmaybe_status_linetpartsRR((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRUÄs"   % # cCs |dk r|j|ƒndS(N(RR*(RRV((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRbés cCs*|jrtjdƒdStj||ƒS(Ns@send() called, but reseponse already received. Not sending data.(RRRRSR R*(Rtstr((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR*ís  cCsE|jddƒ}t|ƒdkoD|djdƒoD|ddkS(NiiisHTTP/it100(R`RRcRd(RRiRj((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRaôs%N(RRt__doc__RR R&R@RNRRZR\RURbR*Ra(((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR9s    % %  tAWSHTTPSConnectioncBseZRS((RR(((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRnüscCsµ|}|d k r)|d}||dConstructs a :class:`AWSPreparedRequest `.(tAWSPreparedRequesttprepare_methodR"t prepare_urlRAtparamstprepare_headersRCtprepare_cookiestcookiest prepare_bodyRztfilest prepare_authtauth(RR((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pytpreparejs cCsctjƒ}|jiƒ|j|j|jƒt|jtj ƒr\|jj dƒ|_n|jS(Nsutf-8( RtPreparedRequestRŒRRzRRERBRRFRH(RR((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRBvs   (RRRR“tpropertyRB(((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR{Us  RˆcBs>eZdZd„Zd„Zd„Zd„Zdd„ZRS(sœRepresents a prepared request. :ivar method: HTTP Method :ivar url: The full url :ivar headers: The HTTP headers to send. :ivar body: The HTTP body. :ivar hooks: The set of callback hooks. In addition to the above attributes, the following attributes are available: :ivar query_params: The original query parameters. :ivar post_param: The original POST params (dict). cCs?||_tt|ƒjƒ|jjdgƒj|jƒdS(NR9(toriginaltsuperRˆRthookst setdefaultRGtreset_stream_on_redirect(Rtoriginal_request((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRs cKsE|jtkrA|j|jƒrAtjd|jƒ|jƒndS(Ns'Redirect received, rewinding stream: %s(t status_codeR t_looks_like_fileRBRRRSt reset_stream(RR9R((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRš–scCst|dƒot|dƒS(NRWtseek(thasattr(RRB((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRœscCs |jdks9t|jtjƒs9t|jtjƒr=dSy'tjd|jƒ|jjdƒWn5t k r›}tjd|ƒt d|jƒ‚nXdS(NsRewinding stream: %sisUnable to rewind stream: %st stream_object( RBRRERRFt binary_typeRRRSRŸt ExceptionR(Rte((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRžŸs$cCsÁtt|ƒj|||ƒd|jkr½t|dƒr½t|dƒr½|jƒ}|jddƒ|jƒ}t||ƒ|jd<|j|ƒd|jkrº|jjdƒqºq½ndS(s"Prepares the given HTTP body data.sContent-LengthRŸttelliisTransfer-EncodingN( R—RˆRRCR R¥RŸRkR(RRzRtjsontorig_post end_file_pos((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyR¯s   N( RRRmRRšRRžRR(((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyRˆ€s     (1R$tloggingRTRgR1tinspecttbotocore.compatRRRRRRtbotocore.exceptionsRtbotocore.utilsRtbotocore.vendored.requestsRt#botocore.vendored.requests.sessionsR t6botocore.vendored.requests.packages.urllib3.connectionR R t:botocore.vendored.requests.packages.urllib3.connectionpoolR R t getLoggerRRRRRRnt__dict__R†tnametfunctiont isfunctiontsetattrRRyR~RstRequestEncodingMixinR…R{R”Rˆt ConnectionCls(((s5/tmp/pip-build-wDUJoH/botocore/botocore/awsrequest.pyts<      (à "  +F