a 97aӱ@sdZddlmZmZmZmZddlmZddlTdZ ddgZ ddl m Z dd l mZdd lmZdd l mZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZd ZdZ ddZ!Gdddej"Z#Gdddej$Z%Gddde%Z&ddZ'd a(ddZ)ddZ*Gddde&Z+e%e#ddfdd Z,e-d!kre.Z/e/j0d"d#d$d%e/j0d&d'de1d(d)d*e/2Z3e3j4re,e+e3j5d+ne,e&e3j5d+d S),aQHTTP server classes. From Python 3.3 Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST, and CGIHTTPRequestHandler for CGI scripts. It does, however, optionally implement HTTP/1.1 persistent connections, as of version 0.3. Notes on CGIHTTPRequestHandler ------------------------------ This class implements GET and POST requests to cgi-bin scripts. If the os.fork() function is not present (e.g. on Windows), subprocess.Popen() is used as a fallback, with slightly altered semantics. In all cases, the implementation is intentionally naive -- all requests are executed synchronously. SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL -- it may execute arbitrary Python code or external programs. Note that status code 200 is sent prior to execution of a CGI script, so scripts cannot send other status codes such as 302 (redirect). XXX To do: - log requests even later (to capture byte count) - log user-agent header and other interesting goodies - send error log to separate file )absolute_importdivisionprint_functionunicode_literals)utils)*z0.6 HTTPServerBaseHTTPRequestHandlerhtml)client)parse) socketserverNa Error response

Error response

Error code: %(code)d

Message: %(message)s.

Error code explanation: %(code)s - %(explain)s.

ztext/html;charset=utf-8cCs|ddddddS)N&z&z>)replacer rw/private/var/folders/s6/9n5zrl012gv99k63s4q6ccsd4s6mqz/T/pip-target-f5cq3f2q/lib/python/future/backports/http/server.py _quote_htmlsrc@seZdZdZddZdS)rcCs8tj||jdd\}}t||_||_dS)z.Override server_bind to store the server name.N)r TCPServer server_bindsocket getsocknamegetfqdn server_name server_port)selfhostportrrrrs  zHTTPServer.server_bindN)__name__ __module__ __qualname__allow_reuse_addressrrrrrrsc-@s@eZdZdZdejdZdeZ e Z e Z dZddZdd Zd d Zd d ZdZddZd[ddZd\ddZddZddZddZd]ddZddZd d!Zd"d#Zd^d$d%Zd&d'Zgd(Zgd)Z d*d+Z!d,Z"e#j$Z%d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdY,Z&dS)_r aHTTP request handler base class. The following explanation of HTTP serves to guide you through the code as well as to expose any misunderstandings I may have about HTTP (so you don't need to read the code to figure out I'm wrong :-). HTTP (HyperText Transfer Protocol) is an extensible protocol on top of a reliable stream transport (e.g. TCP/IP). The protocol recognizes three parts to a request: 1. One line identifying the request type and path 2. An optional set of RFC-822-style headers 3. An optional data part The headers and data are separated by a blank line. The first line of the request has the form where is a (case-sensitive) keyword such as GET or POST, is a string containing path information for the request, and should be the string "HTTP/1.0" or "HTTP/1.1". is encoded using the URL encoding scheme (using %xx to signify the ASCII character with hex code xx). The specification specifies that lines are separated by CRLF but for compatibility with the widest range of clients recommends servers also handle LF. Similarly, whitespace in the request line is treated sensibly (allowing multiple spaces between components and allowing trailing whitespace). Similarly, for output, lines ought to be separated by CRLF pairs but most clients grok LF characters just fine. If the first line of the request has the form (i.e. is left out) then this is assumed to be an HTTP 0.9 request; this form has no optional headers and data part and the reply consists of just the data. The reply form of the HTTP 1.x protocol again has three parts: 1. One line giving the response code 2. An optional set of RFC-822-style headers 3. The data Again, the headers and data are separated by a blank line. The response code line has the form where is the protocol version ("HTTP/1.0" or "HTTP/1.1"), is a 3-digit response code indicating success or failure of the request, and is an optional human-readable string explaining what the response code means. This server parses the request and the headers, and then calls a function specific to the request type (). Specifically, a request SPAM will be handled by a method do_SPAM(). If no such method exists the server sends an error response to the client. If it exists, it is called with no arguments: do_SPAM() Note that the request name is case sensitive (i.e. SPAM and spam are different requests). The various request details are stored in instance variables: - client_address is the client IP address in the form (host, port); - command, path and version are the broken-down request line; - headers is an instance of email.message.Message (or a derived class) containing the header information; - rfile is a file object open for reading positioned at the start of the optional input data part; - wfile is a file object open for writing. IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING! The first thing to be written must be the response line. Then follow 0 or more header lines, then a blank line, and then the actual data (if any). The meaning of the header lines depends on the command executed by the server; in most cases, when data is returned, there should be at least one header line of the form Content-type: / where and should be registered MIME types, e.g. "text/html" or "text/plain". zPython/rz BaseHTTP/HTTP/0.9c Cs\d|_|j|_}d|_t|jd}|d}||_|}t |dkr$|\}}}|dddkrx| dd |d SzF|d dd}|d }t |d krt t |dt |df}Wn(t t fy| dd |Yd S0|dkr|jdkrd|_|dkr~| dd|d SnZt |d kr`|\}}d|_|dkr~| dd|d Sn|sjd S| dd|d S||||_|_|_ztj|j|jd|_Wn$tjy| ddYd S0|jdd}|dkrd|_n |dkr|jdkrd|_|jdd} | dkrX|jdkrX|jdkrX|sXd SdS) a'Parse a request (internal). The request should be stored in self.raw_requestline; the results are in self.command, self.path, self.request_version and self.headers. Return True for success, False for failure; on failure, an error is sent back. Nrz iso-8859-1z zHTTP/zBad request version (%r)F/.rr)rrzHTTP/1.1)rrzInvalid HTTP Version (%s)GETzBad HTTP/0.9 request type (%r)zBad request syntax (%r))_classz Line too long Connectionclose keep-aliveZExpectz 100-continueT)commanddefault_request_versionrequest_versionclose_connectionstrraw_requestlinerstrip requestlinesplitlen send_error ValueErrorint IndexErrorprotocol_versionpath http_client parse_headersrfile MessageClassheaders LineTooLonggetlowerhandle_expect_100) rversionr:wordsr3rBZbase_version_numberZversion_numberZconntypeexpectrrr parse_request s            z$BaseHTTPRequestHandler.parse_requestcCs|d|dS)a7Decide what to do with an "Expect: 100-continue" header. If the client is expecting a 100 Continue response, we must respond with either a 100 Continue or a final response before waiting for the request body. The default is to always respond with a 100 Continue. You can behave differently (for example, reject unauthorized requests) by overriding this method. This method should either return True (possibly after sending a 100 Continue response) or send an error response and return False. dT)send_response_only flush_headersrrrrrK]s z(BaseHTTPRequestHandler.handle_expect_100c Csz|jd|_t|jdkr@d|_d|_d|_|dWdS|jsRd|_WdS| s`WdSd|j}t ||s|dd |jWdSt ||}||j Wn:tjy}z |d |d|_WYd}~dSd}~00dS) zHandle a single HTTP request. You normally don't need to override this method; see the class __doc__ string for information on how to handle specific HTTP commands such as GET and POST. iir0NrZdo_zUnsupported method (%r)zRequest timed out: %r)rEreadliner8r<r:r5r3r=r6rOhasattrgetattrwfileflushrtimeout log_error)rZmnamemethoderrrhandle_one_requestos0     z)BaseHTTPRequestHandler.handle_one_requestcCs"d|_||js|qdS)z&Handle multiple requests if necessary.rN)r6r_rSrrrhandleszBaseHTTPRequestHandler.handleNcCsz|j|\}}Wnty,d\}}Yn0|dur:|}|}|d|||j|t||d}||||d|j|dd||j dkr|d kr|d vr|j | d d dS) aSend and log an error reply. Arguments are the error code, and a detailed message. The detailed message defaults to the short entry matching the response code. This sends an error response (so it must be called before any output has been generated), logs the error, and finally sends a piece of HTML explaining the error to the user. )???raNzcode %d, message %s)codemessageexplainz Content-Typer/r1HEAD)0zUTF-8r) responsesKeyErrorr\error_message_formatr send_response send_headererror_content_type end_headersr3rYwriteencode)rrbrcZshortmsgZlongmsgrdcontentrrrr=s"    z!BaseHTTPRequestHandler.send_errorcCs:||||||d||d|dS)zAdd the response header to the headers buffer and log the response code. Also send two standard headers with the server software version and the current date. ServerDateN) log_requestrQrmversion_stringdate_time_stringrrbrcrrrrls  z$BaseHTTPRequestHandler.send_responsecCsd|dur&||jvr"|j|d}nd}|jdkr`t|ds@g|_|jd|j||fdddS) zSend the response header only.Nrr0r&_headers_bufferz %s %d %s latin-1strict)rir5rWryappendrArqrxrrrrQs    z)BaseHTTPRequestHandler.send_response_onlycCsl|jdkr6t|dsg|_|jd||fdd|dkrh|dkrVd|_n|d krhd |_d S) z)Send a MIME header to the headers buffer.r&ryz%s: %s rzr{ connectionr1rr2rN)r5rWryr|rqrJr6)rkeywordvaluerrrrms     z"BaseHTTPRequestHandler.send_headercCs"|jdkr|jd|dS)z,Send the blank line ending the MIME headers.r&s N)r5ryr|rRrSrrrros  z"BaseHTTPRequestHandler.end_headerscCs(t|dr$|jd|jg|_dS)Nry)rWrYrpjoinryrSrrrrRs z$BaseHTTPRequestHandler.flush_headers-cCs|d|jt|t|dS)zNLog an accepted request. This is called by send_response(). z "%s" %s %sN) log_messager:r7)rrbsizerrrrusz"BaseHTTPRequestHandler.log_requestcGs|j|g|RdS)zLog an error. This is called when a request cannot be fulfilled. By default it passes the message on to log_message(). Arguments are the same as for log_message(). XXX This should go to the separate error log. N)rrformatargsrrrr\s z BaseHTTPRequestHandler.log_errorcGs&tjd||||fdS)aLog an arbitrary message. This is used by all other logging functions. Override it if you have specific logging wishes. The first argument, FORMAT, is a format string for the message to be logged. If the format string contains any % escapes requiring parameters, they should be specified as subsequent arguments (it's just like printf!). The client ip and current date/time are prefixed to every message. z%s - - [%s] %s N)sysstderrrpaddress_stringlog_date_time_stringrrrrrs z"BaseHTTPRequestHandler.log_messagecCs|jd|jS)z*Return the server software version string. )server_version sys_versionrSrrrrvsz%BaseHTTPRequestHandler.version_stringc CsR|durt}t|\ }}}}}}}} } d|j|||j|||||f} | S)z@Return the current date and time formatted for a message header.Nz#%s, %02d %3s %4d %02d:%02d:%02d GMT)timegmtime weekdayname monthname) r timestampyearmonthdayhhmmsswdyzsrrrrws z'BaseHTTPRequestHandler.date_time_stringc CsBt}t|\ }}}}}}}} } d||j|||||f} | S)z.Return the current time formatted for logging.z%02d/%3s/%04d %02d:%02d:%02d)r localtimer) rnowrrrrrrxrrrrrrr*s z+BaseHTTPRequestHandler.log_date_time_string)MonTueWedThuFriSatSun) NJanFebMarAprMayJunJulAugSepOctNovDeccCs |jdS)zReturn the client address.r)client_addressrSrrrr8sz%BaseHTTPRequestHandler.address_stringHTTP/1.0)Continuez!Request received, please continue)zSwitching Protocolsz.Switching to new protocol; obey Upgrade header)OKz#Request fulfilled, document follows)CreatedzDocument created, URL follows)Acceptedz/Request accepted, processing continues off-line)zNon-Authoritative InformationzRequest fulfilled from cache)z No Contentz"Request fulfilled, nothing follows)z Reset Contentz#Clear input form for further input.)zPartial ContentzPartial content follows.)zMultiple Choicesz,Object has several resources -- see URI list)zMoved Permanentlyz(Object moved permanently -- see URI list)Found(Object moved temporarily -- see URI list)z See Otherz'Object moved -- see Method and URL list)z Not Modifiedz)Document has not changed since given time)z Use ProxyzAYou must use proxy specified in Location to access this resource.)zTemporary Redirectr)z Bad Requestz(Bad request syntax or unsupported method) Unauthorizedz*No permission -- see authorization schemes)zPayment Requiredz"No payment -- see charging schemes) Forbiddenz0Request forbidden -- authorization will not help)z Not FoundzNothing matches the given URI)zMethod Not Allowedz.Specified method is invalid for this resource.)zNot Acceptablez&URI not available in preferred format.)zProxy Authentication Requiredz8You must authenticate with this proxy before proceeding.)zRequest Timeoutz#Request timed out; try again later.)ConflictzRequest conflict.)Gonez6URI no longer exists and has been permanently removed.)zLength Requiredz#Client must specify Content-Length.)zPrecondition Failedz!Precondition in headers is false.)zRequest Entity Too LargezEntity is too large.)zRequest-URI Too LongzURI is too long.)zUnsupported Media Typez"Entity body in unsupported format.)zRequested Range Not SatisfiablezCannot satisfy request range.)zExpectation Failedz(Expect condition could not be satisfied.)zPrecondition Requiredz9The origin server requires the request to be conditional.)zToo Many RequestszPThe user has sent too many requests in a given amount of time ("rate limiting").)zRequest Header Fields Too LargezWThe server is unwilling to process the request because its header fields are too large.)zInternal Server ErrorzServer got itself in trouble)zNot Implementedz&Server does not support this operation)z Bad Gatewayz,Invalid responses from another server/proxy.)zService Unavailablez8The server cannot process the request due to a high load)zGateway Timeoutz4The gateway server did not receive a timely response)zHTTP Version Not SupportedzCannot fulfill request.)zNetwork Authentication Requiredz8The client needs to authenticate to gain network access.),rPerfrgi,-i.i/rhi1i3r)iiiiiiiiiiirTiiiiiiirUiiir,i)N)N)N)rr)N)'r"r#r$__doc__rrLr;r __version__rDEFAULT_ERROR_MESSAGErkDEFAULT_ERROR_CONTENT_TYPErnr4rOrKr_r`r=rlrQrmrorRrur\rrvrwrrrrrArC HTTPMessagerFrirrrrr sgQ#     c@s|eZdZdZdeZddZddZddZd d Z d d Z d dZ ddZ e jsZe e jZeddddddS)SimpleHTTPRequestHandleraWSimple HTTP request handler with GET and HEAD commands. This serves files from the current directory and any of its subdirectories. The MIME type for files is determined by calling the .guess_type() method. The GET and HEAD requests are identical except that the HEAD request omits the actual contents of the file. z SimpleHTTP/cCs&|}|r"|||j|dS)zServe a GET request.N) send_headcopyfilerYr1rfrrrdo_GETszSimpleHTTPRequestHandler.do_GETcCs|}|r|dS)zServe a HEAD request.N)rr1rrrrdo_HEADsz SimpleHTTPRequestHandler.do_HEADcCs||j}d}tj|r|jdsP|d|d|jd|dSdD]&}tj||}tj |rT|}qqT| |S| |}zt |d}Wn t y|ddYdS0|d |d |t|}|d t|d |d ||j||S)a{Common code for GET and HEAD commands. This sends the response code and MIME headers. Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do. Nr*rZLocation)z index.htmlz index.htmrbrzFile not foundrf Content-typeContent-Lengthz Last-Modified)translate_pathrBosisdirendswithrlrmrorexistslist_directory guess_typeopenIOErrorr=fstatfilenor7rwst_mtime)rrBrindexctypefsrrrrs6           z"SimpleHTTPRequestHandler.send_headc Cszt|}Wn"tjy0|ddYdS0|jdddg}tt|j }t }d|}| d| d | d || d || d || d |D]j}tj ||}|} } tj |r|d} |d} tj |r|d} | dt| t| fq| dd ||} t} | | | d|d|dd||dtt| || S)zHelper to produce a directory listing (absent index.html). Return value is either a file object, or None (indicating an error). In either case, the headers are sent, making the interface the same as for send_head(). rzNo permission to list directoryNcSs|S)N)rJ)arrrrz9SimpleHTTPRequestHandler.list_directory..)keyzDirectory listing for %szZz z@z%s z

%s

z
    r*@z
  • %s
  • z

 rrfrztext/html; charset=%sr)rlistdirerrorr=sortr escape urllib_parseunquoterBrgetfilesystemencodingr|rrislinkquoterqioBytesIOrpseekrlrmr7r<ro) rrBlistrZ displaypathenctitlenamefullnameZ displaynamelinknameencodedrrrrrsN         z'SimpleHTTPRequestHandler.list_directorycCs|ddd}|ddd}tt|}|d}td|}t}|D]D}tj |\}}tj|\}}|tj tj fvrqPtj ||}qP|S)zTranslate a /-separated PATH to the local filename syntax. Components that mean special things to the local file system (e.g. drive or directory names) are ignored. (XXX They should probably be diagnosed.) ?rr#r*N) r; posixpathnormpathrrfilterrgetcwdrB splitdrivecurdirpardirr)rrBrMworddriveheadrrrr s   z'SimpleHTTPRequestHandler.translate_pathcCst||dS)aCopy all data between two file objects. The SOURCE argument is a file object open for reading (or anything with a read() method) and the DESTINATION argument is a file object open for writing (or anything with a write() method). The only reason for overriding this would be to change the block size or perhaps to replace newlines by CRLF -- note however that this the default server uses this to copy binary data as well. N)shutil copyfileobj)rsourceZ outputfilerrrr#sz!SimpleHTTPRequestHandler.copyfilecCsLt|\}}||jvr"|j|S|}||jvr>|j|S|jdSdS)aGuess the type of a file. Argument is a PATH (a filename). Return value is a string of the form type/subtype, usable for a MIME Content-type header. The default implementation looks the file's extension up in the table self.extensions_map, using application/octet-stream as a default; however it would be permissible (if slow) to look inside the data to make a better guess. r0N)rsplitextextensions_maprJ)rrBbaseextrrrr3s    z#SimpleHTTPRequestHandler.guess_typezapplication/octet-streamz text/plain)r0.pyz.cz.hN)r"r#r$rrrrrrrrrr mimetypesinitedinit types_mapcopyrupdaterrrrrs$ )4 rcCs|d}g}|ddD],}|dkr0|q|r|dkr||q|r||}|r|dkrn|d}q|dkrd}nd}dd||f}d|}|S)a` Given a URL path, remove extra '/'s and '.' path elements and collapse any '..' references and returns a colllapsed path. Implements something akin to RFC-2396 5.2 step 6 to parse relative paths. The utility of this function is limited to is_cgi method and helps preventing some security attacks. Returns: A tuple of (head, tail) where tail is everything after the final / and head is everything before it. Head will always start with a '/' and, if it contains anything else, never have a trailing '/'. Raises: IndexError if too many '..' occur within the path. r*Nz..r+r0)r;popr|r)rB path_partsZ head_partspartZ tail_partZ splitpathcollapsed_pathrrr_url_collapse_pathXs&     r cCsntrtSz ddl}Wnty(YdS0z|ddaWn,tyhdtdd|DaYn0tS) z$Internal routine to get nobody's uidrNrnobodyrrcss|]}|dVqdS)rNr).0rrrr rznobody_uid..)r!pwd ImportErrorgetpwnamrjmaxgetpwall)r$rrr nobody_uids    r)cCst|tjS)zTest for executable file.)raccessX_OK)rBrrr executablesr,c@sVeZdZdZeedZdZddZddZ dd Z d d gZ d d Z ddZ ddZdS)CGIHTTPRequestHandlerzComplete HTTP server with GET, HEAD and POST commands. GET and HEAD also support running CGI scripts. The POST command is *only* implemented for CGI scripts. forkrcCs"|r|n |dddS)zRServe a POST request. This is only implemented for CGI scripts. rUzCan only POST to CGI scriptsN)is_cgirun_cgir=rSrrrdo_POSTs zCGIHTTPRequestHandler.do_POSTcCs|r|St|SdS)z-Version of send_head that support CGI scriptsN)r/r0rrrSrrrrszCGIHTTPRequestHandler.send_headcCsPt|j}|dd}|d|||dd}}||jvrL||f|_dSdS)a3Test whether self.path corresponds to a CGI script. Returns True and updates the cgi_info attribute to the tuple (dir, rest) if self.path requires running a CGI script. Returns False otherwise. If any exception is raised, the caller should assume that self.path was rejected as invalid and act accordingly. The default implementation tests whether the normalized url path begins with one of the strings in self.cgi_directories (and the next character is a '/' or the end of the string). r*rNTF)r rBfindcgi_directoriescgi_info)rrZdir_sepr tailrrrr/s    zCGIHTTPRequestHandler.is_cgiz/cgi-binz/htbincCst|S)z1Test whether argument path is an executable file.)r,)rrBrrr is_executablesz#CGIHTTPRequestHandler.is_executablecCstj|\}}|dvS)z.Test whether argument path is a Python script.)rz.pyw)rrBrrJ)rrBr r5rrr is_pythonszCGIHTTPRequestHandler.is_pythonc( Cs|j}|j\}}|dt|d}|dkr|d|}||dd}||}tj|r||}}|dt|d}q$qq$|d}|dkr|d|||dd}}nd}|d}|dkr|d|||d} }n |d} }|d| } || } tj| s(| dd| dStj | sJ| d d | dS| | } |j sb| s| | s| d d | dSttj} || d <|jj| d <d| d<|j| d<t|jj| d<|j| d<t|}|| d<||| d<| | d<|r|| d<|jd| d<|jd}|r|}t|dkrddl}ddl}|d| d<|d dkrz<|d!d}t"j#r|$|%d}n|&|%d}Wn|j't(fyYn&0|d}t|dkr|d| d<|jddur |j)| d <n|jd| d <|jd!}|r2|| d"<|jd#}|rL|| d$<g}|j*d%D]>}|ddd&vr|+|,n||d'dd(}q\d(-|| d)<|jd*}|r|| d+<t.d|j/d,g}d--|}|r|| d.<d/D]}| 0|dq|1d0d1|2|3d2d3}|j rL| g}d4|vrJ|+|t4}|j56t7}|dkrt8|d\}}t99|j:gggddr|j:;ds|qq||r|yYn0t?|j:@dt?|j5@dtA| || Wn(|jB|jC|jtDd6Yn0nddlE}| g} | | rtFjG}!|! Hd7r|!dd8|!d9d}!|!d:g| } d4|vr| +||Id;|J| z tK|}"WntLtMfyd}"Yn0|jN| |jO|jO|jO| d<}#|j d=kr2|"dkr2|j:;|"}$nd}$t99|j:jPgggddrj|j:jPQds6qjq6|#R|$\}%}&|j5S|%|&r||&|#jTU|#jVU|#jW}'|'r|PopenPIPE_sockrecv communicaterprr1rO returncode)(rrBdirrestiZnextdirZnextrestZ scriptdirqueryscriptZ scriptnameZ scriptfileZispyrPZuqrestr;rXrYlengthrArClineZuacoZ cookie_strkZ decoded_queryrr!pidstsrnZcmdlineZinterpnbytespdatarOrstatusrrrr0s@                                              zCGIHTTPRequestHandler.run_cgiN)r"r#r$rrWrrTrbufsizer1rr/r3r6r7r0rrrrr-s  r-ri@cCsxd|f}||_|||}|j}td|dd|ddz |Wn,tyrtd|tdYn0dS) zTest the HTTP request handler class. This runs an HTTP server on port 8000 (or the first command line argument). r0zServing HTTP onrr!rz...z& Keyboard interrupt received, exiting.N) rArrprint serve_foreverKeyboardInterrupt server_closerexit) HandlerClassZ ServerClassprotocolr!server_addressZhttpdsarrrtests    r__main__z--cgi store_truezRun as CGI Server)actionhelpr!storerz&Specify alternate port [default: 8000])rdefaulttypenargsr)rr!)6r __future__rrrrfuturerZfuture.builtinsr__all__Zfuture.backportsr Zfuture.backports.httpr rCZfuture.backports.urllibr rrrrrrrfr rrrrargparserrrrrStreamRequestHandlerr rr r!r)r,r-rr"ArgumentParserparser add_argumentr? parse_argsrcgir!rrrrsn# 3     E+