Files
pyGoEdge-UserPanel/.venv/Lib/site-packages/django/middleware/__pycache__/common.cpython-312.pyc

68 lines
8.2 KiB
Plaintext
Raw Normal View History

2025-11-18 03:36:49 +08:00
<EFBFBD>
j<> i<><00><00><><00>ddlZddlmZddlmZddlmZddlmZddl m
Z
ddl m Z ddl mZdd lmZGd
<EFBFBD>d e<0E>ZGd <0C>d e<0E>Zy)<0E>N)<01>urlsplit)<01>settings)<01>PermissionDenied)<01> mail_managers)<01>HttpResponsePermanentRedirect)<01> is_valid_path)<01>MiddlewareMixin)<01>escape_leading_slashesc<00>,<00>eZdZdZeZd<02>Zd<03>Zd<04>Zd<05>Z y)<07>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<00><><00>|jjd<01>}|<02>1tjD]}|j |<02>s<01>t d<03><00>|j <00>}tjrj|rg|jd<04>sU|j|<01>r|j|<01>}n|j<00>}|j|j<00>d|<04>|<05><00><04>Syyy)z<>
Check for denied User-Agents and rewrite the URL based on
settings.APPEND_SLASH and settings.PREPEND_WWW
<20>HTTP_USER_AGENTNzForbidden user agentzwww.z://www.)<0E>META<54>getr<00>DISALLOWED_USER_AGENTS<54>searchr<00>get_host<73> PREPEND_WWW<57>
startswith<EFBFBD>should_redirect_with_slash<73>get_full_path_with_slash<73> get_full_path<74>response_redirect_class<73>scheme)<06>self<6C>request<73>
user_agent<EFBFBD>user_agent_regex<65>host<73>paths <20>GE:\Project\pygoedge\.venv\Lib\site-packages\django/middleware/common.py<70>process_requestz CommonMiddleware.process_request"s<><00><00><1D>\<5C>\<5C>%<25>%<25>&7<>8<>
<EFBFBD> <15> !<21>$,<2C>$C<>$C<> <20>#<23>*<2A>*<2A>:<3A>6<>*<2A>+A<>B<>B<>%D<01>
<17><1F><1F>!<21><04> <13> <1F> <1F>D<EFBFBD><14><1F><1F><16>1H<31>
<14>.<2E>.<2E>w<EFBFBD>7<><1B>4<>4<>W<EFBFBD>=<3D><04><1E>,<2C>,<2C>.<2E><04><17>/<2F>/<2F>7<EFBFBD>><3E>><3E>2B<32>'<27>$<24><16>PT<50>v<EFBFBD>0V<30>W<> W<>2I<01>D<EFBFBD> <1F>c<00><00>tjrr|jjd<01>sWt |dd<03>}t |j|<02>s4t d|jz|<02>}|r|j }t |dd<06>Sy)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.
<20>/<2F>urlconfNz%s/<2F>should_append_slashTF)r<00> APPEND_SLASH<53> path_info<66>endswith<74>getattrr<00>func)rrr&<00>match<63>views r!rz+CommonMiddleware.should_redirect_with_slash>st<00><00>
<14> <20> <20><17>):<3A>):<3A>)C<>)C<>C<EFBFBD>)H<><1D>g<EFBFBD>y<EFBFBD>$<24>7<>G<EFBFBD> <20><17>!2<>!2<>G<EFBFBD><<3C>%<25>e<EFBFBD>g<EFBFBD>.?<3F>.?<3F>&?<3F><17>I<><05><18> <20>:<3A>:<3A>D<EFBFBD>"<22>4<EFBFBD>)><3E><04>E<>E<>r#c<00><><00>|jd<01><02>}t|<02>}tjr:|jdvr,t d|j|j <00>|zd<05>z<00><00>|S)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)<01>force_append_slash)<04>DELETE<54>POST<53>PUT<55>PATCHa"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.)<02>method<6F>url)rr
r<00>DEBUGr5<00> RuntimeErrorr)rr<00>new_paths r!rz)CommonMiddleware.get_full_path_with_slashLsr<00><00><1B>(<28>(<28>D<EFBFBD>(<28>A<><08>)<29>(<28>3<><08> <13>><3E>><3E>g<EFBFBD>n<EFBFBD>n<EFBFBD>0R<30>R<><1E>M<01> &<26>n<EFBFBD>n<EFBFBD>"<22>+<2B>+<2B>-<2D><08>8<><12> <12>
<0E>
<0E><18>r#c<00><00>|jdk(r1|j|<01>r |j|j|<01><00>S|js<|j d<02>s+t t|j<00><00>|jd<|S)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.
<20><>zContent-Length)
<EFBFBD> status_coderrr<00> streaming<6E>
has_header<EFBFBD>str<74>len<65>content<6E>headers)rr<00>responses r!<00>process_responsez!CommonMiddleware.process_responsedsz<00><00> <14> <1F> <1F>3<EFBFBD> &<26>4<EFBFBD>+J<>+J<>7<EFBFBD>+S<><17>/<2F>/<2F><04>0M<30>0M<30>g<EFBFBD>0V<30>W<> W<><18>!<21>!<21>(<28>*=<3D>*=<3D>>N<>*O<>14<31>S<EFBFBD><18>9I<39>9I<39>5J<35>1K<31>H<EFBFBD> <1C> <1C>-<2D> .<2E><17>r#N)
<EFBFBD>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rrr"rrrD<00>r#r!r r s$<00><00><08>$<<3C><1B>X<01>8 <15><18>0r#r c<00><00>eZdZd<01>Zd<02>Zd<03>Zy)<05>BrokenLinkEmailsMiddlewarec <00><><00>|jdk(r<>tjs<>|j<00>}|j <00>}|j
j dd<03>}|j||||<05>sm|j
j dd<05>}|j
j dd<05>}td|j||<05>rdnd<03>d |<03><01>d
|<05>d |<04>d |<06>d |<07>d<0E> d<0F><10>|S)z=Send broken link emails for relevant 404 NOT FOUND responses.r;<00> HTTP_REFERER<45>rz<none><3E> REMOTE_ADDRzBroken z INTERNAL zlink on z
Referrer: z
Requested URL: z
User agent: z
IP address: <20>
T)<01> fail_silently)
r<rr7rrrr<00>is_ignorable_requestr<00>is_internal_request)rrrC<00>domainr <00>referer<65>ua<75>ips r!rDz+BrokenLinkEmailsMiddleware.process_responsews<><00><00> <13> <1F> <1F>3<EFBFBD> &<26>x<EFBFBD>~<7E>~<7E><1C>%<25>%<25>'<27>F<EFBFBD><1A>(<28>(<28>*<2A>D<EFBFBD><1D>l<EFBFBD>l<EFBFBD>&<26>&<26>~<7E>r<EFBFBD>:<3A>G<EFBFBD><17>,<2C>,<2C>W<EFBFBD>d<EFBFBD>F<EFBFBD>G<EFBFBD>L<><1C>\<5C>\<5C>%<25>%<25>&7<><18>B<><02><1C>\<5C>\<5C>%<25>%<25>m<EFBFBD>X<EFBFBD>><3E><02><1D>
$<24>7<>7<><06><07>H<>(<28>!#<23>$<24><1F><16>+2<>4<EFBFBD><12>R<EFBFBD>A<01>"&<26> <12><18>r#c<00>l<00>ttjdtj|<01>z|<02><00>S)ze
Return True if the referring URL is the same domain as the current
request.
z ^https?://%s/)<04>bool<6F>rer-<00>escape)rrTrUs r!rSz.BrokenLinkEmailsMiddleware.is_internal_request<73>s(<00><00> <14>B<EFBFBD>H<EFBFBD>H<EFBFBD>_<EFBFBD>r<EFBFBD>y<EFBFBD>y<EFBFBD><16>/@<40>@<40>'<27>J<>K<>Kr#c<00>&<00><02>|sytjr<1A>jd<02>r |<04>ddk(ry|j||<04>sd|vryt |<04>}|j
d|fvr|j <00>k(ryt<00>fd<07>tjD<00><00>S)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<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?rNc3<00>@<00>K<00>|]}|j<00><02><00><01><00>y<00>w)N)r)<03>.0<EFBFBD>pattern<72>uris <20>r!<00> <genexpr>zBBrokenLinkEmailsMiddleware.is_ignorable_request.<locals>.<genexpr><3E>s<00><><00><><00>R<>6Q<36>7<EFBFBD>7<EFBFBD>><3E>><3E>#<23>&<26>6Q<36>s<00>) rr(r*rSr<00>netlocr <00>any<6E>IGNORABLE_404_URLS)rrrbrTrU<00>parsed_referers ` r!rRz/BrokenLinkEmailsMiddleware.is_ignorable_request<73>s<><00><><00><17><17> <14> <20> <20>S<EFBFBD>\<5C>\<5C>#<23>%6<>7<EFBFBD>c<EFBFBD>#<23>2<EFBFBD>h<EFBFBD>;N<><17><14>'<27>'<27><06><07>8<>S<EFBFBD>G<EFBFBD>^<5E><17>"<22>'<27>*<2A><0E> <19> <20> <20>R<EFBFBD><16>L<EFBFBD> 0<>^<5E>5H<35>5H<35>C<EFBFBD>5O<35><17><12>R<>h<EFBFBD>6Q<36>6Q<36>R<>R<>Rr#N)rErFrGrDrSrRrIr#r!rKrKvs<00><00><18>4L<01>Sr#rK)rZ<00> urllib.parser<00> django.confr<00>django.core.exceptionsr<00>django.core.mailr<00> django.httpr<00> django.urlsr<00>django.utils.deprecationr <00>django.utils.httpr
r rKrIr#r!<00><module>rps=<00><01> <09>!<21> <20>3<>*<2A>5<>%<25>4<>4<>f<18><EFBFBD>f<18>R<S<01><1F><Sr#