+
    Tj                         ^ RI t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ R	IHt  ! R
 R]4      t ! R R]4      tR# )    N)urlsplit)settings)PermissionDenied)mail_managers)HttpResponsePermanentRedirect)is_valid_path)MiddlewareMixin)escape_leading_slashesc                   @   a  ] tR t^t o Rt]tR tR tR t	R t
RtV tR# )CommonMiddlewarea  
"Common" middleware for taking care of some basic operations:

    - Forbid access to User-Agents in settings.DISALLOWED_USER_AGENTS

    - URL rewriting: Based on the APPEND_SLASH and PREPEND_WWW settings,
      append 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, form a new URL by
          appending a slash at the end. If this new URL is found in
          urlpatterns, return an HTTP redirect to this new URL; otherwise
          process the initial URL as usual.

      This behavior can be customized by subclassing CommonMiddleware and
      overriding the response_redirect_class attribute.
c                   VP                   P                  R4      pVe:   \        P                   F%  pVP	                  V4      '       g   K  \        R4      h	  VP                  4       p\        P                  '       d   V'       du   VP                  R4      '       g\   V P                  V4      '       d   V P                  V4      pMVP                  4       pV P                  VP                   RV V 24      # R# R# R# )zj
Check for denied User-Agents and rewrite the URL based on
settings.APPEND_SLASH and settings.PREPEND_WWW
HTTP_USER_AGENTNzForbidden user agentzwww.z://www.)METAgetr   DISALLOWED_USER_AGENTSsearchr   get_hostPREPEND_WWW
startswithshould_redirect_with_slashget_full_path_with_slashget_full_pathresponse_redirect_classscheme)selfrequest
user_agentuser_agent_regexhostpaths   &&    M/var/www/idalgo/venv/lib/python3.14/site-packages/django/middleware/common.pyprocess_request CommonMiddleware.process_request"   s     \\%%&78
!$,$C$C #**:66*+ABB %D
 !D1H1H
 ..w7744W=,,.//7>>2B'$PTv0VWW 2ID    c                B   \         P                  '       d   VP                  P                  R4      '       gh   \	        VRR4      p\        VP                  V4      '       g?   \        RVP                  ,          V4      pV'       d   VP                  p\	        VRR4      # R# )z
Return True if settings.APPEND_SLASH is True and appending a slash to
the request path turns an invalid path into a valid one.
/urlconfNz%s/should_append_slashTF)r   APPEND_SLASH	path_infoendswithgetattrr   func)r   r   r'   matchviews   &&   r!   r   +CommonMiddleware.should_redirect_with_slash>   s}    
    ):):)C)CC)H)Hgy$7G !2!2G<<%eg.?.?&?I ::D"4)>EEr$   c                    VP                  RR7      p\        V4      p\        P                  '       dG   VP                  R9   d6   \        RRVP                  RVP                  4       V,           /,          4      hV# )z
Return the full path of the request with a trailing slash appended.

Raise a RuntimeError if settings.DEBUG is True and request.method is
DELETE, POST, PUT, or PATCH.
T)force_append_slasha"  You called this URL via %(method)s, 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 %(method)s data. Change your form to point to %(url)s (note the trailing slash), or set APPEND_SLASH=False in your Django settings.methodurl)DELETEPOSTPUTPATCH)r   r
   r   DEBUGr3   RuntimeErrorr   )r   r   new_paths   && r!   r   )CommonMiddleware.get_full_path_with_slashL   sx     ((D(A)(3>>>gnn0RRM gnn7++-8
 
 r$   c                >   VP                   R8X  d8   V P                  V4      '       d!   V P                  V P                  V4      4      pVP                  '       gC   VP                  R4      '       g,   \        \        VP                  4      4      VP                  R&   V# )z
When the status code of the response is 404, it may redirect to a path
with an appended slash if should_redirect_with_slash() returns True.
  zContent-Length)
status_coder   r   r   	streaming
has_headerstrlencontentheaders)r   r   responses   &&&r!   process_response!CommonMiddleware.process_responsed   s     3&4+J+J7+S+S33--g6H !!!(*=*=>N*O*O14S9I9I5J1KH-.r$    N)__name__
__module____qualname____firstlineno____doc__r   r   r"   r   r   rG   __static_attributes____classdictcell____classdict__s   @r!   r   r      s,     $ <X80 r$   r   c                   2   a  ] tR t^xt o R tR tR tRtV tR# )BrokenLinkEmailsMiddlewarec                   VP                   R8X  d   \        P                  '       g   VP                  4       pVP	                  4       pVP
                  P                  RR4      pV P                  WW54      '       gy   VP
                  P                  RR4      pVP
                  P                  RR4      p\        RV P                  W54      '       d   RMR: R	V: 2R
V: RV: RV: RV: R2	RR7       V# )z=Send broken link emails for relevant 404 NOT FOUND responses.r>   HTTP_REFERER r   z<none>REMOTE_ADDRzBroken z	INTERNAL zlink on z
Referrer: z
Requested URL: z
User agent: z
IP address: 
T)fail_silently)
r?   r   r9   r   r   r   r   is_ignorable_requestr   is_internal_request)r   r   rF   domainr    refereruaips   &&&     r!   rG   +BrokenLinkEmailsMiddleware.process_responsey   s    3&x~~~%%'F((*Dll&&~r:G,,WFLL\\%%&7B\\%%mX>
  $77HH (!#$  +24RA"& r$   c                x    \        \        P                  ! R\        P                  ! V4      ,          V4      4      # )zM
Return True if the referring URL is the same domain as the current
request.
z^https?://%s/)boolrer.   escape)r   r]   r^   s   &&&r!   r\   .BrokenLinkEmailsMiddleware.is_internal_request   s(     BHH_ryy/@@'JKKr$   c                  a V'       g   R# \         P                  '       d$   SP                  R4      '       d   VSRR 8X  d   R# V P                  W44      '       g
   RV9   d   R# \	        V4      pVP
                  RV39   d   VP                  S8X  d   R# \        ;QJ d-    V3R l\         P                   4       F  '       g   K   R# 	  R# ! V3R l\         P                   4       4      # )	z
Return True if the given request *shouldn't* notify the site managers
according to project settings or in situations outlined by the inline
comments.
Tr&   N?rW   c              3   D   <"   T F  qP                  S4      x  K  	  R # 5i)N)r   ).0patternuris   & r!   	<genexpr>BBrokenLinkEmailsMiddleware.is_ignorable_request.<locals>.<genexpr>   s     R6Q7>>#&&6Qs    F)	r   r)   r+   r\   r   netlocr    anyIGNORABLE_404_URLS)r   r   rl   r]   r^   parsed_referers   &&f&& r!   r[   /BrokenLinkEmailsMiddleware.is_ignorable_request   s         S\\#%6%67c#2h;N ''88SG^ "'*  RL0^5H5HC5OsRh6Q6QRssRsRsRh6Q6QRRRr$   rI   N)	rJ   rK   rL   rM   rG   r\   r[   rO   rP   rQ   s   @r!   rT   rT   x   s     4LS Sr$   rT   )rd   urllib.parser   django.confr   django.core.exceptionsr   django.core.mailr   django.httpr   django.urlsr   django.utils.deprecationr	   django.utils.httpr
   r   rT   rI   r$   r!   <module>r}      s=    	 !   3 * 5 % 4 4h hV<S <Sr$   