| Server IP : 104.129.129.72 / Your IP : 216.73.216.229 Web Server : LiteSpeed System : Linux 123answers 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : answe8064 ( 1002) PHP Version : 8.2.28 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"