|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /lib64/python2.7/site-packages/django/middleware/ |
Upload File : |
�
r�\c @ s� d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l
m Z d d l m
Z
d d l m Z d d l m Z e j d � Z d
e f d � � YZ d e f d
� � YZ d S( i����N( t settings( t
mail_managers( t urlresolvers( t http( t
force_text( t urlquote( t sixs django.requestt CommonMiddlewarec B s e Z d Z d � Z d � Z RS( sh
"Common" middleware for taking care of some basic operations:
- Forbids access to User-Agents in settings.DISALLOWED_USER_AGENTS
- URL rewriting: Based on the APPEND_SLASH and PREPEND_WWW settings,
this middleware appends missing slashes and/or prepends missing
"www."s.
- If APPEND_SLASH is set and the initial URL doesn't end with a
slash, and it is not found in urlpatterns, a new URL is formed by
appending a slash at the end. If this new URL is found in
urlpatterns, then an HTTP-redirect is returned to this new URL;
otherwise the initial URL is processed as usual.
- ETags: If the USE_ETAGS setting is set, ETags will be calculated from
the entire page content and Not Modified responses will be returned
appropriately.
c C sV d | j k rp x^ t j D]P } | j | j d � r t j d | j d i d d 6| d 6�t j d � Sq Wn | j � } | | j g } | } t j
r� | d r� | d j d � r� d | d | d <n t j r}| d
j
d � r}t | d d � } t j | j | � r}t j d
| j | � r}| d
d | d
<t j rz| j d k rzt d | d | d
f � � qzq}n | | k r�d S| d r�d | j � r�d n d | d t | d
� f } n t | d
� } | j j d d � rIt j r| d | j d 7} qIy | d | j d j � 7} WqIt k
rEqIXn t j | � S( s�
Check for denied User-Agents and rewrite the URL based on
settings.APPEND_SLASH and settings.PREPEND_WWW
t HTTP_USER_AGENTs Forbidden (User agent): %st extrai� t status_codet requests <h1>Forbidden</h1>i s www.i t /t urlconfs %s/t POSTs You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to %s%s (note the trailing slash), or set APPEND_SLASH=False in your Django settings.Ns %s://%s%st httpsR t QUERY_STRINGt t ?( t METAR t DISALLOWED_USER_AGENTSt searcht loggert warningt pathR t HttpResponseForbiddent get_hostt PREPEND_WWWt
startswitht APPEND_SLASHt endswitht getattrt NoneR t
is_valid_patht path_infot DEBUGt methodt RuntimeErrort is_secureR t getR t PY3t decodet UnicodeDecodeErrort HttpResponsePermanentRedirect( t selfR t user_agent_regext hostt old_urlt new_urlR
t newurl( ( s: /tmp/pip-install-XxeQeY/django/django/middleware/common.pyt process_request'