bgJdZddlmZddlmZmZdZdZdZ d dZ d Z d S) z This module implements WSGI related helpers adapted from ``werkzeug.wsgi`` :copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. )absolute_import) iteritems urllib_quotec#NKt|D]\}}t|}|dr9|dvr5|dddd|fVb|dvr,|dd|fVdS)z+ Returns only proper HTTP headers. HTTP_)HTTP_CONTENT_TYPEHTTP_CONTENT_LENGTHN_-) CONTENT_TYPECONTENT_LENGTH)rstr startswithreplacetitle)environkeyvalues a/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/raven/utils/wsgi.py get_headersr s ((77 U#hh >>' " " 7s 7(8(8abb'//#s++1133U: : : : : 6 6 6++c3''--//6 6 6 6 77c#4KdD]}||vr |||fVdS)z8 Returns our whitelisted environment variables. ) REMOTE_ADDR SERVER_NAME SERVER_PORTN)rrs r get_environrs@=$$ '>>ws|# # # #$$rcX|d}d|vr |d}n>> from werkzeug import create_environ >>> env = create_environ("/?param=foo", "http://localhost/script") >>> get_current_url(env) 'http://localhost/script/?param=foo' >>> get_current_url(env, root_only=True) 'http://localhost/script/' >>> get_current_url(env, host_only=True) 'http://localhost/' >>> get_current_url(env, strip_querystring=True) 'http://localhost/script/' :param environ: the WSGI environment to get the current URL from. :param root_only: set `True` if you only want the root URL. :param strip_querystring: set to `True` if you don't want the querystring. :param host_only: set to `True` if the host URL should be returned. r z:/// SCRIPT_NAME PATH_INFO QUERY_STRING?)r.appendjoinrr*rstriplstrip)r root_onlystrip_querystring host_onlytmpcatqss rget_current_urlr@<s* $ %uhw.?.? @C *C"wws||c!!C W[[33::3??@@AAA C Lw{{;;;BB3GGG H HIII  ^,,B C"H 773<<rc |dddS#ttf$r|dcYSwxYw)z Naively yank the first IP address in an X-Forwarded-For header and assume this is correct. Note: Don't use this in security sensitive situations since this value may be forged from a client. HTTP_X_FORWARDED_FOR,rr)splitstripKeyError IndexErrorr*)rs r get_client_iprHasj*-.44S99!<BBDDD j !***{{=)))))*s25&AAN)FFF) __doc__ __future__rraven.utils.compatrrrrr.r@rHrrrrLs '&&&&&66666666 7 7 7$$$0AF#""""J * * * * *r