Server IP : 209.38.156.173 / Your IP : 216.73.216.128 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains 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"