Files
PowerToys/PythonHome/Lib/wsgiref/util.pyc

46 lines
5.7 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
<EFBFBD>W`Sc@s<>dZddlZddddddgZddd <00><00>YZd
<00>Zd <00>Zd d <00>Zd<00>Zd<00>Zid d6d d6d d6d d6d d6d d6d d6d d6j Z
d<00>Z dS(s$Miscellaneous WSGI-related Utilitiesi<73><69><EFBFBD><EFBFBD>Nt FileWrappert guess_schemetapplication_urit request_uritshift_path_infotsetup_testing_defaultscBs5eZdZdd<00>Zd<00>Zd<00>Zd<00>ZRS(s1Wrapper to convert file-like objects to iterablesi cCs4||_||_t|d<00>r0|j|_ndS(Ntclose(tfileliketblksizethasattrR(tselfRR((s.\Lib\wsgiref\util.pyt__init__s  cCs)|jj|j<00>}|r|St<00>dS(N(RtreadRt
IndexError(R
tkeytdata((s.\Lib\wsgiref\util.pyt __getitem__scCs|S(N((R
((s.\Lib\wsgiref\util.pyt__iter__scCs)|jj|j<00>}|r|St<00>dS(N(RR Rt StopIteration(R
R((s.\Lib\wsgiref\util.pytnexts(t__name__t
__module__t__doc__R RRR(((s.\Lib\wsgiref\util.pyR s
   cCs!|jd<00>dkrdSdSdS( sMReturn a guess for whether 'wsgi.url_scheme' should be 'http' or 'https'
tHTTPStyestont1thttpsthttpN(RRR(tget(tenviron((s.\Lib\wsgiref\util.pyR#scCs<>|dd}ddlm}|jd<00>r>||d7}nk||d7}|ddkr<>|dd kr<>|d
|d7}q<>n%|dd kr<>|d
|d7}n|||jd <00>p<>d <00>7}|S(s@Return the application's base URI (no PATH_INFO or QUERY_STRING)swsgi.url_schemes://i<><69><EFBFBD><EFBFBD>(tquotet HTTP_HOSTt SERVER_NAMERt SERVER_PORTt443t:t80t SCRIPT_NAMEt/(turllibRR(RturlR((s.\Lib\wsgiref\util.pyR+sicCs<>t|<00>}ddlm}||jdd<00>dd<00>}|jd<00>sZ||d7}n
||7}|r<>|jd <00>r<>|d
|d 7}n|S( sBReturn the full request URI, optionally including the query stringi<67><69><EFBFBD><EFBFBD>(Rt PATH_INFOttsafes/;=,R&it QUERY_STRINGt?(RR(RR(Rt include_queryR)Rt path_info((s.\Lib\wsgiref\util.pyR?s 
cCs|jdd<00>}|sdS|jd<00>}g|dd!D]}|r9|dkr9|^q9|dd+|d}|d=|jdd<00>}tj|d|<17>}|jd<00>r<>|d }n| r<>|jd<00> r<>|d7}n||d<dj|<00>|d<|dkrd}n|S( sZShift a name from PATH_INFO to SCRIPT_NAME, returning it
If there are no remaining path segments in PATH_INFO, return None.
Note: 'environ' is modified in-place; use a copy if you need to keep
the original PATH_INFO or SCRIPT_NAME.
Note: when PATH_INFO is just a '/', this returns '' and appends a trailing
'/' to SCRIPT_NAME, even though empty path segments are normally ignored,
and SCRIPT_NAME doesn't normally end in a '/'. This is intentional
behavior, to ensure that an application can tell the difference between
'/x' and '/x/' when traversing to objects.
R*R+R'ii<><69><EFBFBD><EFBFBD>t.R&N(RtNonetsplitt posixpathtnormpathtendswithtjoin(RR0t
path_partstptnamet script_name((s.\Lib\wsgiref\util.pyRLs$ 9
  
  cCsX|jdd<00>|jdd<00>|jd|d<19>|jdd<00>d|krd |kr|jdd
<00>|jd d <00>n|jd d<00>|jdd<00>|jdd<00>|jdd<00>ddlm}|jd|d
<00><00>|jd|<00><00>|jdt|<00><00>|ddkr1|jdd<00>n#|ddkrT|jdd<00>ndS(s:Update 'environ' with trivial defaults for testing purposes
This adds various parameters required for WSGI, including HTTP_HOST,
SERVER_NAME, SERVER_PORT, REQUEST_METHOD, SCRIPT_NAME, PATH_INFO,
and all of the wsgi.* variables. It only supplies default values,
and does not replace any existing settings for these variables.
This routine is intended to make it easier for unit tests of WSGI
servers and applications to set up dummy environments. It should *not*
be used by actual WSGI servers or applications, since the data is fake!
R!s 127.0.0.1tSERVER_PROTOCOLsHTTP/1.0R tREQUEST_METHODtGETR&R*R+R's wsgi.versioniis wsgi.run_onceswsgi.multithreadswsgi.multiprocessi<73><69><EFBFBD><EFBFBD>(tStringIOs
wsgi.inputs wsgi.errorsswsgi.url_schemeRR"R%RR#N(ii(t
setdefaultR?R(RR?((s.\Lib\wsgiref\util.pyRus& t
connections
keep-alivesproxy-authenticatesproxy-authorizationttettrailersstransfer-encodingtupgradecCst|j<00><00>S(s?Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header(t_hoppishtlower(t header_name((s.\Lib\wsgiref\util.pyt is_hop_by_hop<6F>s(( RR4t__all__RRRRRRt __contains__RERH(((s.\Lib\wsgiref\util.pyt<module>s      ) (