Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 \ Rã @sdZddlmZmZmZddlmZddlZddlZddl Z dddd d d gZ d d dddddgZ dddddddddddddg Z dd „Z d!d"d#d$d%d&d'd(d)d*h jZd+d,„Zd-d „ZGd.d„dƒZGd/d„deƒZGd0d„deƒZGd1d „d eƒZGd2d „d eƒZdS)3z/Base classes for server/gateway implementationsé)Ú FileWrapperÚ guess_schemeÚ is_hop_by_hop)ÚHeaderséNÚ BaseHandlerÚ SimpleHandlerÚBaseCGIHandlerÚ CGIHandlerÚ IISCGIHandlerÚ read_environZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecc Cs:tj|ƒ\ }}}}}}}}} dt||t|||||fS)Nz#%s, %02d %3s %4d %02d:%02d:%02d GMT)ÚtimeZgmtimeÚ _weekdaynameÚ _monthname) Z timestampZyearZmonthZdayZhhZmmZssZwdÚyÚz©rú(/usr/lib64/python3.6/wsgiref/handlers.pyÚformat_date_timesrÚ SCRIPT_NAMEÚ PATH_INFOZ QUERY_STRINGZREQUEST_METHODZ AUTH_TYPEZ CONTENT_TYPEZCONTENT_LENGTHZHTTPSZ REMOTE_USERZ REMOTE_IDENTcCs6t|ƒp4|jdƒp4|jdƒp4|jdƒo4t|dd…ƒS)NZHTTP_ZSSL_Z REDIRECT_é )Ú _is_requestÚ startswithÚ_needs_transcode)Úkrrrrsrc Csôtjƒ}d}ydjd|ƒWntk r4d}YnXi}x´tjjƒD]¦\}}t|ƒrätjdkrÒtjj ddƒj ƒ}|j dƒrŽ|jdƒj dƒ}qä|j d ƒršqä|j d ƒr¾d |kr¾|jdƒj dƒ}qä|j|dƒj dƒ}n|j||ƒj dƒ}|||<qFW|S) z'Read environment, fixing HTTP variablesÚsurrogateescapeÚzutf-8ÚreplaceZwin32ÚSERVER_SOFTWAREzmicrosoft-iis/z iso-8859-1zapache/z simplehttp/zpython/3) ÚsysÚgetfilesystemencodingÚencodeÚ LookupErrorÚosÚenvironÚitemsrÚplatformÚgetÚlowerrÚdecode)ÚencÚescr%rÚvZsoftwarerrrr "s,      c@s"eZdZdZddd„Z dd„Z!dd„Z"dd„Z#d d!„Z$d"d#„Z%d$d%„Z&d&d'„Z'd(d)„Z(d*d+„Z)d,d-„Z*d.d/„Z+d0d1„Z,d2d3„Z-d4d5„Z.d6d7„Z/d8d9„Z0d:d;„Z1dS)?rz+Manage the invocation of a WSGI applicationrrTFz1.0Nz500 Internal Server Errorú Content-Typeú text/plains;A server error occurred. Please contact the administrator.cCsZy$|jƒ||j|jƒ|_|jƒWn0y |jƒWn|jƒ‚YnXYnXdS)zInvoke the applicationN)Ú setup_environr%Ústart_responseÚresultÚfinish_responseÚ handle_errorÚclose)ÚselfZ applicationrrrÚrun€s  zBaseHandler.runcCs–|jjƒ}|_|jƒ|jƒ|d<|jƒ|d<|j|d<|j|d<|jƒ|d<|j |d<|j |d<|j dk rx|j |d <|j r’|j r’|jd |j ƒdS) z&Set up the environment for one requestz wsgi.inputz wsgi.errorsz wsgi.versionz wsgi.run_oncezwsgi.url_schemezwsgi.multithreadzwsgi.multiprocessNzwsgi.file_wrapperr)Ú os_environÚcopyr%Ú add_cgi_varsÚ get_stdinÚ get_stderrÚ wsgi_versionÚ wsgi_run_onceÚ get_schemeÚwsgi_multithreadÚwsgi_multiprocessÚwsgi_file_wrapperÚ origin_serverÚserver_softwareÚ setdefault)r6Úenvrrrr0”s          zBaseHandler.setup_environc CsJz:|jƒ s|jƒ r8x|jD]}|j|ƒqW|jƒWd|jƒXdS)a>Send any iterable data, then close self and the iterable Subclasses intended for use in asynchronous servers will want to redefine this method, such that it sets up callbacks in the event loop to iterate over the data, and to call 'self.close()' once the response is finished. N)Úresult_is_fileÚsendfiler2ÚwriteÚfinish_contentr5)r6Údatarrrr3©s   zBaseHandler.finish_responsecCs t|jƒS)z Return the URL scheme being used)rr%)r6rrrr?ºszBaseHandler.get_schemec CsJyt|jƒ}Wntttfk r(YnX|dkrFt|jƒ|jd<dSdS)z@Compute Content-Length or switch to chunked encoding if possiblerzContent-LengthN)Úlenr2Ú TypeErrorÚAttributeErrorÚNotImplementedErrorÚstrÚ bytes_sentÚheaders)r6ZblocksrrrÚset_content_length¿szBaseHandler.set_content_lengthcCsd|jkr|jƒdS)zqMake any necessary header changes or defaults Subclasses can extend this to add other defaults. zContent-LengthN)rRrS)r6rrrÚcleanup_headersÌs zBaseHandler.cleanup_headersc Csä|r2z$|jr&|d|dƒj|dƒ‚Wdd}Xn|jdk rDtdƒ‚||_|j|ƒ|_|j|dƒ}t|ƒdksvtdƒ‚|dd …jƒsŽtd ƒ‚|d d ks¢td ƒ‚x:|D]2\}}|j|d ƒ}|j|dƒ}t |ƒ s¨tdƒ‚q¨W|j S)z4'start_response()' callable as specified by PEP 3333rréNzHeaders already set!ZStatuséz$Status must be at least 4 characterséz(Status message must begin w/3-digit codeú z+Status message must have a space after codez Header namez Header valuezHop-by-hop headers not allowed) Ú headers_sentÚwith_tracebackrRÚAssertionErrorÚstatusÚ headers_classÚ_convert_string_typerLÚisdigitrrI)r6r\rRÚexc_infoÚnameÚvalrrrr1Ôs$     zBaseHandler.start_responsecCs(t|ƒtkr|Stdj|t|ƒƒƒ‚dS)zConvert/check value type.z!{0} must be of type str (got {1})N)ÚtyperPr[ÚformatÚrepr)r6ÚvalueÚtitlerrrr^ðs z BaseHandler._convert_string_typecCs’|jrx|jƒrŽ|jd|j|jfjdƒƒd|jkrP|jdttjƒƒjdƒƒ|j rŽd|jkrŽ|jd|j jdƒƒn|jd|jjdƒƒdS) z6Transmit version/status/date/server, via self._write()z HTTP/%s %s z iso-8859-1ZDatez Date: %s ZServerz Server: %s z Status: %s N) rCÚclient_is_modernÚ_writeÚ http_versionr\r"rRrr rD)r6rrrÚ send_preambleøs zBaseHandler.send_preamblecCsft|ƒtkstdƒ‚|js$tdƒ‚n,|js>t|ƒ|_|jƒn|jt|ƒ7_|j|ƒ|j ƒdS)z+'write()' callable as specified by PEP 3333z)write() argument must be a bytes instancezwrite() before start_response()N) rcÚbytesr[r\rYrLrQÚ send_headersriÚ_flush)r6rKrrrrIs    zBaseHandler.writecCsdS)aPlatform-specific file transmission Override this method in subclasses to support platform-specific file transmission. It is only called if the application's return iterable ('self.result') is an instance of 'self.wsgi_file_wrapper'. This method should return a true value if it was able to actually transmit the wrapped file-like object using a platform-specific approach. It should return a false value if normal iteration should be used instead. An exception can be raised to indicate that transmission was attempted, but failed. NOTE: this method should call 'self.send_headers()' if 'self.headers_sent' is false and it is going to attempt direct transmission of the file. Fr)r6rrrrHszBaseHandler.sendfilecCs"|js|jjddƒ|jƒndS)z.Ensure headers and content have both been sentzContent-LengthÚ0N)rYrRrErm)r6rrrrJ0s zBaseHandler.finish_contentc CsFzt|jdƒr|jjƒWdd|_|_|_|_d|_d|_XdS)z„Close the iterable (if needed) and reset all instance vars Subclasses may want to also drop the client connection. r5NrF)Úhasattrr2r5rRr\r%rQrY)r6rrrr5:s  zBaseHandler.closecCs:|jƒd|_|j s|jƒr6|jƒ|jt|jƒƒdS)z1Transmit headers to the client, via self._write()TN)rTrYrCrhrkrirlrR)r6rrrrmGs zBaseHandler.send_headerscCs|j}|dk ot|j|ƒS)z@True if 'self.result' is an instance of 'self.wsgi_file_wrapper'N)rBÚ isinstancer2)r6ÚwrapperrrrrGPszBaseHandler.result_is_filecCs|jdjƒdkS)z,True if client can accept status and headersZSERVER_PROTOCOLzHTTP/0.9)r%Úupper)r6rrrrhVszBaseHandler.client_is_modernc CsJz>ddlm}|jƒ}||d|d|d|j|ƒ|jƒWdd}XdS)z�Log the 'exc_info' tuple in the server log Subclasses may override to retarget the output or change its format. r)Úprint_exceptionrrUN)Ú tracebackrtr<Útraceback_limitÚflush)r6r`rtÚstderrrrrÚ log_exception[s   zBaseHandler.log_exceptioncCs2|jtjƒƒ|js.|j|j|jƒ|_|jƒdS)z>Log current error, and send error output to client if possibleN) ryr r`rYÚ error_outputr%r1r2r3)r6rrrr4kszBaseHandler.handle_errorcCs$||j|jdd…tjƒƒ|jgS)aZWSGI mini-app to create error output By default, this just uses the 'error_status', 'error_headers', and 'error_body' attributes to generate an output page. It can be overridden in a subclass to dynamically generate diagnostics, choose an appropriate message for the user's preferred language, etc. Note, however, that it's not recommended from a security perspective to spit out diagnostics to any old user; ideally, you should have to do something special to enable diagnostic output, which is why we don't include any here! N)Ú error_statusÚ error_headersr r`Ú error_body)r6r%r1rrrrzss zBaseHandler.error_outputcCst‚dS)aOverride in subclass to buffer data for send to client It's okay if this method actually transmits the data; BaseHandler just separates write and flush operations for greater efficiency when the underlying system actually has such a distinction. N)rO)r6rKrrrri†szBaseHandler._writecCst‚dS)z¬Override in subclass to force sending of recent '_write()' calls It's okay if this method is a no-op (i.e., if '_write()' actually sends the data. N)rO)r6rrrrn�szBaseHandler._flushcCst‚dS)z4Override in subclass to return suitable 'wsgi.input'N)rO)r6rrrr;—szBaseHandler.get_stdincCst‚dS)z5Override in subclass to return suitable 'wsgi.errors'N)rO)r6rrrr<›szBaseHandler.get_stderrcCst‚dS)z>Override in subclass to insert CGI variables in 'self.environ'N)rO)r6rrrr:ŸszBaseHandler.add_cgi_vars)rr)r.r/)N)2Ú__name__Ú __module__Ú __qualname__Ú__doc__r=r@rAr>rCrjrDr r8rrBrr]rvr{r|r}r\r2rYrRrQr7r0r3r?rSrTr1r^rkrIrHrJr5rmrGrhryr4rzrirnr;r<r:rrrrr^sV      c@sBeZdZdZddd„Zdd„Zdd „Zd d „Zd d „Zdd„Z dS)raqHandler that's just initialized with streams, environment, etc. This handler subclass is intended for synchronous HTTP/1.0 origin servers, and handles sending the entire response output, given the correct inputs. Usage:: handler = SimpleHandler( inp,out,err,env, multithread=False, multiprocess=True ) handler.run(app)TFcCs(||_||_||_||_||_||_dS)N)ÚstdinÚstdoutrxÚbase_envr@rA)r6r‚rƒrxr%Ú multithreadÚ multiprocessrrrÚ__init__±s zSimpleHandler.__init__cCs|jS)N)r‚)r6rrrr;»szSimpleHandler.get_stdincCs|jS)N)rx)r6rrrr<¾szSimpleHandler.get_stderrcCs|jj|jƒdS)N)r%Úupdater„)r6rrrr:ÁszSimpleHandler.add_cgi_varscCsb|jj|ƒ}|dks |t|ƒkr$dSddlm}|dtƒx"||d…}|sNP|jj|ƒ}qr8r‡rrrrr îsc@s eZdZdZdZiZdd„ZdS)r aCGI-based invocation with workaround for IIS path bug This handler should be used in preference to CGIHandler when deploying on Microsoft IIS without having set the config allowPathInfo option (IIS>=7) or metabase allowPathInfoForScriptMappings (IIS<7). Tc Csjtƒ}|jddƒ}|jddƒ}|dj|dƒrD|t|ƒd…|d<tj|tjjtj jtj |ddd�dS)Nrrrú/FT)r…r†) r r(rrLr r‡r r‚rŒrƒrx)r6r%ÚpathZscriptrrrr‡$s  zIISCGIHandler.__init__N)r~rr€r�r>r8r‡rrrrr s)r�ÚutilrrrrRrr r$r Ú__all__rrrÚ __contains__rrr rrr r r rrrrÚs*   <H2