403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /tmp/calpy/weasyprint/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /tmp/calpy/weasyprint/__pycache__/urls.cpython-311.pyc
�

Х=j�F��:�dZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZmZddlmZddlmZddlmZmZmZmZd	d
lmZd	dlmZejd��Zejd
��Zej ��Z!de��ddd�Z"Gd�de��Z#d�Z$d�Z%d�Z&d)d�Z'd�Z(d�Z)d�Z*d�Z+		d*d�Z,ej-		d+d���Z.Gd �d!e/��Z0Gd"�d#e1��Z2Gd$�d%ej3��Z4Gd&�d'��Z5ej-d(���Z6dS),z9Various utility functions and classes for URL management.�N)�EmailMessage)�GzipFile)�BytesIO�StringIO)�Path)�request)�quote�unquote�urljoin�urlsplit�)�__version__)�LOGGERz^([a-zA-Z][a-zA-Z0-9.+-]+):s^([a-zA-Z][a-zA-Z0-9.+-]+):zWeasyPrint z*/*z
gzip, deflate)z
User-Agent�AcceptzAccept-Encodingc� �eZdZd�Zd�Zd�ZdS)�StreamingGzipFilec�@�tj||���||_dS)N��fileobj)r�__init__�fileobj_to_close)�selfrs  �B/tmp/claude-1015/pip-target-jmvfl800/lib/python/weasyprint/urls.pyrzStreamingGzipFile.__init__$s&����$��0�0�0�0� '�����c�`�tj|��|j���dS�N)r�closer�rs rrzStreamingGzipFile.close(s-����t������#�#�%�%�%�%�%rc��dS)NF�rs r�seekablezStreamingGzipFile.seekable,s���urN)�__name__�
__module__�__qualname__rrr!r rrrr#sA������(�(�(�&�&�&�����rrc��|�d��r|S|�|�d��rtnd��}t|d���S)zDTurn a Unicode IRI into an ASCII-only URI that conforms to RFC 3986.zdata:�file:�utf-8s/:?#[]@!$&'()*+,;=~%)�safe)�
startswith�encode�FILESYSTEM_ENCODINGr	��urls r�
iri_to_urir.0sY��
�~�~�g�����
�

�*�*�C�N�N�7�,C�,C�P�(�(��
Q�
Q�C���2�3�3�3�3rc�@�t|t��rt|��}n/t|t��r|�t
��}|�tjj	df��}tj�
|��}|stj�|��r|tjj	z
}d}tj
|��}|r|�d��s|dz
}|�d��rd|��Sd|��S)zVReturn file URL of `path`.

    Accepts 'str', 'bytes' or 'Path', returns 'str'.

    �/Tz///r&zfile://)�
isinstancer�str�bytes�decoder+�endswith�os�path�sep�abspath�isdirr�pathname2urlr))r7�wants_trailing_slashs  r�path2urlr=@s���$����0��4�y�y���	�D�%�	 �	 �0��{�{�.�/�/���=�=�"�'�+�s�);�<�<��
�7�?�?�4� � �D��$�r�w�}�}�T�2�2�$�	
������#�����%�%�D���D�M�M�#�$6�$6���������u��� ��t�~�~������rc��t|t��rtnt}t	|�|����S)z4Return whether an URL (bytes or string) is absolute.)r1r2�UNICODE_SCHEME_RE�BYTES_SCHEME_RE�bool�match)r-�schemes  r�url_is_absoluterD_s6��",�S�#�"6�"6�
K�
�
�O�F�����S�!�!�"�"�"rFc	��|�|d�����}|rt|pd||d|j||f��SdS)a'Get the URI corresponding to the ``attr_name`` attribute.

    Return ``None`` if:

    * the attribute is empty or missing or,
    * the value is a relative URI but the document has no base URI and
      ``allow_relative`` is ``False``.

    Otherwise return an URI, absolute if possible.

    �z<%s %s="%s">N)�get�strip�url_join�tag)�element�	attr_name�base_url�allow_relative�values     r�get_url_attributerPes`��
�K�K�	�2�&�&�,�,�.�.�E��-���N��E�>�>�
�[�)�U�+�-�-�	-�-�-rc���|�d��rdt|dd���fSt|��rdt|��fS|rdtt	||����fSdS)z.Get tuple describing internal or external URI.�#�internalr
N�external)r)r
rDr.r)r-rMs  r�
get_url_tuplerUxs���
�~�~�c���@��G�C����G�,�,�-�-�	��	�	�@��J�s�O�O�,�,�	�@��J�w�x��'=�'=�>�>�?�?�@�@rc���t|��rt|��S|rtt||����S|rt|��Stjd|��g|�R�dS)zBLike urllib.urljoin, but warn if base_url is required but missing.z+Relative URI reference without a base URI: N)rDr.rr�error)rMr-rN�context�context_argss     rrIrI�s����s���
��#����	���'�(�C�0�0�1�1�1�	���#������C�'�C�C�	�
�	�	�	�	��trc�V�|�|d�����}|�d��r.t|��dkrddt	|dd���ffSt|||d���}|r�|r�	t
|��}	t
|��}|jr.|dd	�|dd	�krddt	|j��ffSnJ#t$rtj
d
|��Yn)wxYw#t$rtj
d|��YnwxYwdd|ffSdS)
z�Get the URL value of an element attribute.

    Return ``('external', absolute_uri)``, or ``('internal',
    unquoted_fragment_id)``, or ``None``.

    rFrRr
r-rSNT)rN���zMalformed base URL: %szMalformed URL: %srT)rGrHr)�lenr
rPr�fragment�
ValueErrorr�warning)rKrLrM�
attr_value�uri�parsed�parsed_bases       r�get_link_attributerd�s������Y��+�+�1�1�3�3�J����S�!�!�>�c�*�o�o��&9�&9��
�G�J�q�r�r�N�$;�$;�<�=�=�
�G�Y���
N�
N�
N�C�
�*��
	O�
O�!�#����O�"*�8�"4�"4�K�
��O�6�#�2�#�;�+�c�r�c�:J�+J�+J� %�
�G�F�O�4L�4L�'M�N�N���"�G�G�G��N�#;�X�F�F�F�F�F�G������
9�
9�
9���2�C�8�8�8�8�8�
9�����
�C�(�)�)�*�*s$�C>�C�C;�:C;�>D �D c�B�t|��r|nt|��S)z�Get a ``scheme://path`` URL from ``string``.

    If ``string`` looks like an URL, return it unchanged. Otherwise assume a
    filename and convert it to a ``file://`` URL.

    )rDr=)�strings r�
ensure_urlrg�s#��%�V�,�,�B�6�6�(�6�2B�2B�Br�
c��tjdt���t||||d���}|�|��S)z~Fetch an external resource such as an image or stylesheet.

    This function is deprecated, use ``URLFetcher`` instead.

    a-default_url_fetcher is deprecated and will be removed in WeasyPrint 69.0, please use URLFetcher instead. For security reasons, HTTP redirects are not supported anymore with default_url_fetcher, but are with URLFetcher.

See https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#url-fetchers��categoryF)�allow_redirects)�warnings�warn�DeprecationWarning�
URLFetcher�fetch)r-�timeout�ssl_context�http_headers�allowed_protocols�fetchers      r�default_url_fetcherrw�s_��
�M�	X�$�%�%�%�%����l�,=�u�V�V�V�G��=�=����rc#�K�|�t|��}|�t��}d�|||||fD��}t|��dkr)d�|��pd}	t	d|	�����|�~|||d�}
t|d��r||
d	<n5t
|t��r||
d
<nt|��r||
d<n||
d
<tdi|
��}|5}|V�ddd��dS#1swxYwYdS|�D|�t|��}t|d��5}||ddfV�ddd��dS#1swxYwYdS|��t||��5}|rE|j
d
kr:tjd|j
�d|j����t#d��|ddfV�n|�|j}|||j|j
fV�ddd��dS#1swxYwYdS|�C|�7t'|dd��}
|
r$|
�d��st|
��}||ddfV�dSt
|t*��rt#|��|ddfV�dSt-|��|ddfV�dS)z�If only one input is given, return it.

    Yield a file object, the base url, the protocol encoding and the protocol mime-type.

    Nc��g|]}|�|��Srr )�.0�params  r�
<listcomp>z!select_source.<locals>.<listcomp>�s(������
��	���rr
z, �nothingz!Expected exactly one source, got )rM�url_fetcher�check_css_mime_type�read�file_obj�filenamer-�rbztext/csszUnsupported stylesheet type z for rF�name�<r )rgrpr\�join�	TypeError�hasattrr1rrD�
select_sourcer=�openrq�content_typerrWr-r�charset�getattrr)r2r)�guessr�r-r�rfrMr~r�selected_params�source�kwargs�result�responser�s              rr�r��s
�������h�'�'���� �l�l����!�8�S�(�F�C����O��?���q� � ����?�+�+�8�y���D�F�D�D�E�E�E�	�	� �&�#6�
�
��
�5�&�!�!�	'�!&�F�:���
��t�
$�
$�	'�!&�F�:���
�U�
#�
#�	'�!�F�5�M�M�!&�F�:���(�(��(�(��
�	�v��L�L�L�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	�	�	�����)�)�H�
�(�D�
!�
!�	1�X��H�d�D�0�0�0�0�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1�	��
�;��
$�
$�		R��"�
R�x�'<�
�'J�'J���*�8�3H�*�*�#�<�*�*�+�+�+��r�l�l�H�d�D�8�8�8�8�8��#�'�|�H���(�*:�H�<Q�Q�Q�Q�Q�		R�		R�		R�		R�		R�		R�		R�		R�		R�		R�		R�		R����		R�		R�		R�		R�		R�		R�
�	����8�V�T�2�2�D��
,�D�O�O�C�0�0�
,�%�d�+�+����$��,�,�,�,�,�,��f�c�"�"�	8��6�"�"�H�d�D�8�8�8�8�8�8��&�/�/�8�T�4�7�7�7�7�7�7s7�C$�$C(�+C(�	D*�*D.�1D.�	A#F9�9F=�F=c��eZdZdZdS)�URLFetchingErrorz)Some error happened when fetching an URL.N�r"r#r$�__doc__r rrr�r�s������3�3�3�3rr�c��eZdZdZdS)�FatalURLFetchingErrorzESome error happened when fetching an URL and must stop the rendering.Nr�r rrr�r�s������O�O�O�Orr�c�B��eZdZdZ		d
�fd�	Zd�fd�	Zdd�Zd	�Z�xZS)
rpa`Fetcher of external resources such as images or stylesheets.

    :param int timeout: The number of seconds before HTTP requests are dropped.
    :param ssl.SSLContext ssl_context: An SSL context used for HTTPS requests.
    :param dict http_headers: Additional HTTP headers used for HTTP requests.
    :type allowed_protocols: :term:`sequence`
    :param allowed_protocols: A set of authorized protocols, :obj:`None` means all.
    :param bool allow_redirects: Whether HTTP redirects must be followed.
    :param bool fail_on_errors: Whether HTTP errors should stop the rendering.

    Another class inheriting from this class, with a ``fetch`` method that has a
    compatible signature, can be given as the ``url_fetcher`` argument to
    :class:`weasyprint.HTML` or :class:`weasyprint.CSS`.

    See :ref:`URL Fetchers` for more information and examples.

    rhNTFc�t��t�����tj��tj��tj��tj��tj��tj��tj	��tj
��tj|���g	}|r&|�tj
����|D]}	|�|	���||_it �|pi�|_||_||_d|_dS)N)rX)�superrr�ProxyHandler�UnknownHandler�HTTPHandler�HTTPDefaultErrorHandler�
FTPHandler�FileHandler�HTTPErrorProcessor�DataHandler�HTTPSHandler�append�HTTPRedirectHandler�add_handler�_timeout�HTTP_HEADERS�
_http_headers�_allowed_protocols�_fail_on_errors�_request)rrrrsrtrurl�fail_on_errorsr��handlers�handler�	__class__s          �rrzURLFetcher.__init__)s���	��������� �"�"�G�$:�$<�$<�g�>Q�>S�>S��+�-�-�w�/A�/C�/C���!�!�7�#=�#?�#?��AT�AV�AV�� ��5�5�5�	7��
�	;��O�O�G�7�9�9�:�:�:��	&�	&�G����W�%�%�%�%���
�E��E��1C��E���"3���-�����
�
�
rc�N��t�|��x}std|�����|d���}|j�||jvrtd|�����|dkr|�d��d}t
|��}i|j�|pi�}|jptj
||���}d|_t���||j
�	��}|}d
|jvr�|jd
}|jd
=|dkrt|���}nZ|d
krT|���}		t#j|	��}n*#t"j$rt#j|	d��}YnwxYwt)|j||j|j��S)aEFetch a given URL.

        :returns: A :obj:`URLFetcherResponse` instance.
        :raises: An exception indicating failure, e.g. :obj:`ValueError` on
            syntactically invalid URL. All exceptions are catched internally by
            WeasyPrint, except when they inherit from :obj:`FatalURLFetchingError`.

        zNot an absolute URI: r
NzURI uses disallowed protocol: �file�?r��headers)rrzContent-Encoding�gzipr�deflatei�)r?rBr^�lowerr��splitr.r�r�r�Requestr�r�r�r�rr��zlib�
decompressrW�URLFetcherResponser-�status)rr-r�rBrC�http_requestr��body�content_encoding�datar�s          �rrqzURLFetcher.fetch=s����+�0�0��5�5�5��	<��:�S�:�:�;�;�;��q����!�!���"�.��T�4�4�4� �!G�#�!G�!G�H�H�H��V����)�)�C�.�.��#�C���o�o��<�T�'�;�G�M�r�;���}�M����W�(M�(M�(M����
��7�7�<�<��d�m�<�D�D������!1�1�1�'�/�0B�C��� �!3�4��6�)�)�(��:�:�:���!�Y�.�.��}�}����6��?�4�0�0�D�D���z�6�6�6��?�4��5�5�D�D�D�6����"�(�,��h�6F���X�X�Xs�E�$F�Fc��t|tj��r'||_|�|j|j��S|�|��Sr)r1rr�r�rq�full_urlr�)rr-r�rrs    rr�zURLFetcher.openosE���c�7�?�+�+�	9��D�M��:�:�c�l�C�K�8�8�8��z�z�#���rc�,�|�|��Sr)rq)rr-s  r�__call__zURLFetcher.__call__us���z�z�#���r)rhNNNTFr)NN)	r"r#r$r�rrqr�r��
__classcell__)r�s@rrprps����������$CG�NS�������(0Y�0Y�0Y�0Y�0Y�0Y�d����������rrpc��eZdZdZdd�Zd�Zd�Zed���Zed���Z	ed	���Z
d
�Zd�Zed���Z
d
�ZdS)r�uThe HTTP response of an URL fetcher.

    :param str url: The URL of the HTTP response.
    :type body: :class:`str`, :class:`bytes` or :term:`file object`
    :param body: The body of the HTTP response.
    :type headers: dict or email.message.EmailMessage
    :param headers: The headers of the HTTP response.
    :param int status: The status of the HTTP response.

    Has the same interface as :class:`urllib.response.addinfourl`.

    If a :term:`file object` is given for the body, it is the caller’s responsibility to
    call ``close()`` on it. The default function used internally to fetch data in
    WeasyPrint tries to close the file object after retreiving; but if this URL fetcher
    is used elsewhere, the file object has to be closed manually.

    N��c��||_||_t|t��r||_nJt��|_|pi���D] \}}	||j|<�#t$rY�wxYwt|d��r	||_dSt|t��rD|j�
dd��t|�d����|_dSt|��|_dS)Nr�r�r')
r-r�r1rr��itemsr^r��	_file_objr2�	set_paramrr*)rr-r�r�r�r��keyrOs        rrzURLFetcherResponse.__init__�s���������g�|�,�,�	�"�D�L�L�'�>�>�D�L�&�}�"�3�3�5�5�
�
�
��U��(-�D�L��%�%��!�����D������4�� � �	+�!�D�N�N�N�
��c�
"�
"�	+��L�"�"�9�g�6�6�6�$�T�[�[��%9�%9�:�:�D�N�N�N�$�T�]�]�D�N�N�Ns�
A&�&
A3�2A3c�&�|jj|i|��Sr)r�r�)r�argsr�s   rr�zURLFetcherResponse.read�s��"�t�~�"�D�3�F�3�3�3rc��	|j���dS#t$r0tjd|jt
j����YdSwxYw)Nz$Error when closing stream for %s:
%s)r�r�	Exceptionrr_r-�	traceback�
format_excrs rrzURLFetcherResponse.close�st��	2��N� � �"�"�"�"�"���	2�	2�	2�
�N�7���)�.�0�0�
2�
2�
2�
2�
2�
2�	2���s��6A�Ac���|j�d��rEtj|j�d��d�d����SdS)Nr&r�r)r-r)r�url2pathnamer��removeprefixrs rr7zURLFetcherResponse.path�sY���8���w�'�'�	V��'�����s�(;�(;�A�(>�(K�(K�G�(T�(T�U�U�U�	V�	Vrc�4�|j���Sr)r��get_content_typers rr�zURLFetcherResponse.content_type�s���|�,�,�.�.�.rc�6�|j�d��S)Nr�)r��	get_paramrs rr�zURLFetcherResponse.charset�s���|�%�%�i�0�0�0rc��|jSrr,rs r�geturlzURLFetcherResponse.geturl�s	���x�rc��|jSrr�rs r�infozURLFetcherResponse.info�s
���|�rc��|jSr�r�rs r�codezURLFetcherResponse.code�s
���{�rc��|jSrr�rs r�getcodezURLFetcherResponse.getcode�s
���{�r)NNr�)r"r#r$r�rr�r�propertyr7r�r�r�r�r�r�r rrr�r�ys���������"+�+�+�+�,4�4�4�2�2�2��V�V��X�V��/�/��X�/��1�1��X�1�����������X������rr�c#�K�	||��}n]#t$rP}t|dd��rtd|�d���|�tt	|��j�d|�����d}~wwxYwt
|t��r�tj	dt���d	|vr|�d
|��|d	<|�d|�d����|d
<|�dd��}|�d��x}r|d|��z
}d|i|d<tdi|��}t
|t��s
Jd���	|V�|�
��dS#|�
��wxYw)aDFetch an ``url`` with ```url_fetcher``, fill in optional data, and clean up.

    Fatal errors must raise a ``FatalURLFetchingError`` that stops the rendering. All
    other exceptions are catched and raise an ``URLFetchingError``, that is usually
    catched by the code that fetches the resource and emits a warning.

    r�FzError fetching "�"z: NzReturning dicts in URL fetchers is deprecated and will be removed in WeasyPrint 69.0, please return URLFetcherResponse instead.rjr-�redirected_urlr�rfr��	mime_typezapplication/octet-stream�encodingz
; charset=zContent-Typer�zFURL fetcher must return either a dict or a URLFetcherResponse instancer )r�r�r�r��typer"r1�dictrmrnrorGr�r)r~r-�resource�	exceptionr�r�s      rrqrq�s�����K��;�s�#�#�����K�K�K��;� 1�5�9�9�	R�'�(A�3�(A�(A�(A�B�B�	�Q��$�y�/�/�":�I�I�i�I�I�J�J�J�����K����
�(�D�!�!�2��
�
L�'�	)�	)�	)�	)��� � �&�l�l�+;�S�A�A�H�U�O�#�<�<�
�H�L�L��4J�4J�K�K�����|�|�K�1K�L�L���l�l�:�.�.�.�7�	3��2��2�2�2�L�-�|�<����%�1�1��1�1���h� 2�3�3�R�R�P�R�R�R������������������������s!��
A*�AA%�%A*�E(�(E>)F)rhNNN)NNNNNNNF)7r��
contextlib�os.pathr6�re�sysr�rmr��
email.messagerr�r�iorr�pathlibr�urllibr�urllib.parser	r
rrrFr�loggerr�compiler?r@�getfilesystemencodingr+r�rr.r=rDrPrUrIrdrgrw�contextmanagerr��IOErrorr��
BaseExceptionr��OpenerDirectorrpr�rqr rr�<module>rs1��?�?���������	�	�	�	�
�
�
�
�������������&�&�&�&�&�&������� � � � � � � � �������������:�:�:�:�:�:�:�:�:�:�:�:�������������
�B�J�<�=�=���"�*�;�<�<��/�c�/�1�1��.��-�-��&����
�
�
�
�
��
�
�
�
4�
4�
4�  � � �>#�#�#�-�-�-�-�&@�@�@����*�*�*�<C�C�C�IM�*.�����$��MQ�GL�?8�?8�?8���?8�D4�4�4�4�4�w�4�4�4�P�P�P�P�P�M�P�P�P�`�`�`�`�`��'�`�`�`�FM�M�M�M�M�M�M�M�`��#�#���#�#�#r

Youez - 2016 - github.com/yon3zu
LinuXploit