| Server IP : 167.99.254.82 / Your IP : 216.73.216.188 Web Server : Apache System : Linux host.techisquad.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : pawluxera ( 1011) PHP Version : 8.1.34 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/test/__pycache__/ |
Upload File : |
o
�b�6 � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZm Z ddl
mZ ddlmZ dd l
mZ G d
d� de �ZG dd
� d
ej�ZG dd� dej�ZdS )z>
Test cases for L{twisted.protocols.haproxy.HAProxyProtocol}.
� )�Optional)�mock)�address)�Factory�Protocol)� StringTransportWithDisconnection)�unittest� )�HAProxyWrappingFactoryc @ s, e Zd ZdZd dd�Zdeddfdd�ZdS )
�StaticProtocolz6
Protocol stand-in that maintains test state.
�returnNc C s d | _ d | _d| _d| _d S )N� F)�source�destination�data�disconnected)�self� r �M/usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/test_wrapper.py�__init__ s
zStaticProtocol.__init__r c C s4 | j sJ �| j �� | _| j �� | _| j|7 _d S )N)� transport�getPeerr �getHostr r )r r r r r �dataReceived s
zStaticProtocol.dataReceived�r N)�__name__�
__module__�__qualname__�__doc__r �bytesr r r r r r s
r c @ s` e Zd ZdZddd�Zddd�Zddd �Zdd
d�Zddd
�Zddd�Z ddd�Z
ddd�ZdS )�HAProxyWrappingFactoryV1Testsz]
Test L{twisted.protocols.haproxy.HAProxyWrappingFactory} with v1 PROXY
headers.
r Nc C sR t t�t��}|�t�ddd��}t� }||_|� |� |�
d� | �|j� dS )�J
Test if invalid headers result in connectionLost events.
�TCP� 127.1.1.1� s NOTPROXY anything can go here
N�
r
r �forProtocolr �
buildProtocolr �IPv4Addressr �protocol�makeConnectionr �assertFalse� connected�r �factory�protor r r r �test_invalidHeaderDisconnects) s �
z;HAProxyWrappingFactoryV1Tests.test_invalidHeaderDisconnectsc C s\ t t�t��}|�t�ddd��}t� }||_|� |� |�
d� |�
d� | �|j� dS )r! r"