| Server IP : 195.114.193.97 / Your IP : 216.73.217.93 Web Server : LiteSpeed System : Linux host 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64 User : sembi4241 ( 1126) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/twisted/protocols/haproxy/__pycache__/ |
Upload File : |
o
�b] � @ s� d Z ddlmZmZ ddlmZ ddlmZ ddlm Z ddl
mZ ddlm
Z
dd lmZ dd
lmZ G dd� de j�ZG d
d� de j�Zdejdefdd�ZdS )z@
Protocol wrapper that provides HAProxy PROXY protocol support.
� )�Optional�Union)�
interfaces)�_WrapperServerEndpoint)�policies� )�_info)�InvalidProxyHeader)�V1Parser)�V2Parserc s` e Zd ZdZdejdejf� fdd�Zde ddfd d
�Z
dejfdd�Zdejfd
d�Z
� ZS )�HAProxyProtocolWrappera
A Protocol wrapper that provides HAProxy support.
This protocol reads the PROXY stream header, v1 or v2, parses the provided
connection data, and modifies the behavior of getPeer and getHost to return
the data provided by the PROXY header.
�factory�wrappedProtocolc s t � �||� d | _d | _d S �N)�super�__init__�
_proxyInfo�_parser)�selfr
r �� __class__� �D/usr/lib/python3/dist-packages/twisted/protocols/haproxy/_wrapper.pyr s
zHAProxyProtocolWrapper.__init__�data�returnNc C s� | j d ur| j�|�S | j}|d u rPt|�dkr4|d d� tjkr4t|dd� �d@ dkr4t� | _}nt|�dkrJ|d d� tj krJt� | _}n| �
� d S z|�|�\| _ }|rd| j�|� W d S W d S tyt | �
� Y d S w )N� � �
�� � � � )
r r �dataReceivedr �lenr �PREFIX�ordr
�PROXYSTR�loseConnection�feedr )r r �parser� remainingr r r r"