Your IP : 3.12.153.240
�
��Yc @@ sf d Z d d l m Z d d l m Z m Z d � Z d � Z d � Z e e e d � Z
d � Z d S(
s�
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.
i ( t absolute_import( t iteritemst urllib_quotec c@ s� x� t | � D]� \ } } t | � } | j d � rd | d
k rd | d j d d � j � | f Vq
| d k r
| j d d � j � | f Vq
q
Wd S( s+
Returns only proper HTTP headers.
t HTTP_t HTTP_CONTENT_TYPEt HTTP_CONTENT_LENGTHi t _t -t CONTENT_TYPEt CONTENT_LENGTHN( R R ( R R ( R t strt
startswitht replacet title( t environt keyt value( ( sA /opt/alt/python27/lib/python2.7/site-packages/raven/utils/wsgi.pyt get_headers
s $c c@ s3 x, d D]$ } | | k r | | | f Vq q Wd S( s8
Returns our whitelisted environment variables.
t REMOTE_ADDRt SERVER_NAMEt SERVER_PORTN( R R R ( ( R R ( ( sA /opt/alt/python27/lib/python2.7/site-packages/raven/utils/wsgi.pyt get_environ s
c C@ s� | j d � } d | k r( | d } nZ d | k rA | d } nA | d } | t | d � f d d f k r� | d
| d 7} n | j d � r� | d k r� | d } n( | j d
� r� | d k r� | d } n | S( s� Return the real host for the given WSGI environment. This takes care
of the `X-Forwarded-Host` header.
:param environ: the WSGI environment to get the host of.
s wsgi.url_schemet HTTP_X_FORWARDED_HOSTt HTTP_HOSTR R t httpst 443t httpt 80t :s :80i����s :443i����( R R ( R R ( t getR
t endswith( R t schemet result( ( sA /opt/alt/python27/lib/python2.7/site-packages/raven/utils/wsgi.pyt get_host$ s
c C@ s� | d d t | � g } | j } | r9 d j | � d S| t | j d d � j d � � � | rq | d � nX | t d | j d d � j d � � � | s� | j d � } | r� | d | � q� n d j | � S( s3 A handy helper function that recreates the full URL for the current
request or parts of it. Here an example:
>>> 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.
s wsgi.url_schemes ://t t /t SCRIPT_NAMEt PATH_INFOt QUERY_STRINGt ?( R! t appendt joinR R t rstript lstrip( R t root_onlyt strip_querystringt host_onlyt tmpt catt qs( ( sA /opt/alt/python27/lib/python2.7/site-packages/raven/utils/wsgi.pyt get_current_url<