← Back
Editing: test_http.cpython-38.pyc
U s�@gv � @ s d Z ddlmZmZ ddlZddlZddlZddlZzddlmZm Z m Z W n( ek rt ddlmZm Z m Z Y nX ddl mZ ddlmZ ddlmZ ddlmZmZmZmZmZmZ dd lmZ dd lmZ ddlmZ ddl m!Z! dd l"m#Z#m$Z$m%Z% ddl&m'Z'm(Z( ddl&m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2 ddl3m4Z4m5Z5m6Z6 ddl7m8Z8 ddl9m:Z: ddlm;Z;m<Z< ddl=m>Z> G dd� dee#j?��Z@dd� ZAG dd� de#jB�ZCeAeC�ZDG dd � d ej!�ZEG d!d"� d"e#jB�ZFeAeF�ZGee%jH�G d#d$� d$eF��ZIeAeI�ZJG d%d&� d&eF�ZKeAeK�ZLG d'd(� d(e#jM�ZNd)d*� ZOG d+d,� d,eP�ZQG d-d.� d.ej!eQ�ZRG d/d0� d0eR�ZSG d1d2� d2eR�ZTG d3d4� d4eR�ZUG d5d6� d6ej!eQ�ZVG d7d8� d8ej!�ZWG d9d:� d:ej!�ZXG d;d<� d<ej!�ZYG d=d>� d>ej!�ZZd?d@� Z[G dAdB� dBej!�Z\G dCdD� dDe!�Z]G dEdF� dFej!�Z^G dGdH� dHej!eQ�Z_G dIdJ� dJej!�Z`G dKdL� dLej!�ZaG dMdN� dNe#jM�ZbG dOdP� dPej!�ZcG dQdR� dRej!eQ�ZdG dSdT� dTej!�ZeG dUdV� dVej!eQ�ZfdWdX� ZgG dYdZ� dZej!�ZhG d[d\� d\ej!�ZidS )]z Test HTTP support. � )�absolute_import�divisionN)�urlparse� urlunsplit�clear_cache)�BytesIO)�provider)�verifyObject)�_PY3� iterbytes�long� networkString�unicode� intToBytes)�proxyForInterface)�Failure)�unittest)�TestCase)�http�http_headers�iweb)�PotentialDataLoss� _DataLoss)�_IdentityTransferDecoder)�address)�Clock)�ConnectionLost�ConnectionDone)�loopback)�StringTransport�NonStreamingProducer�EventLoggingObserver)� DummyProducer)�DummyChannel��directlyProvides� providedBy)�globalLogPublisherc @ s e Zd ZdZdS )�._IDeprecatedHTTPChannelToRequestInterfaceProxyz� Proxy L{_IDeprecatedHTTPChannelToRequestInterface}. Used to assert that the interface matches what L{HTTPChannel} expects. N)�__name__� __module__�__qualname__�__doc__� r- r- �</usr/lib/python3/dist-packages/twisted/web/test/test_http.pyr( , s r( c s � fdd�}t |t� �� |S )a� Return a callable that proxies instances of C{clsToWrap} via L{_IDeprecatedHTTPChannelToRequestInterface}. @param clsToWrap: The class whose instances will be proxied. @type cls: L{_IDeprecatedHTTPChannelToRequestInterface} implementer. @return: A factory that returns L{_IDeprecatedHTTPChannelToRequestInterface} proxies. @rtype: L{callable} whose interface matches C{clsToWrap}'s constructor. c s � | |�}t |�S �N)r( )�args�kwargs�instance�� clsToWrapr- r. �_makeRequestProxyC s z3_makeRequestProxyFactory.<locals>._makeRequestProxyr$ )r4 r5 r- r3 r. �_makeRequestProxyFactory5 s r6 c @ s e Zd ZdZdd� ZdS )�DummyPullProducerHandlerz� An HTTP request handler that registers a dummy pull producer to serve the body. The owner must call C{finish} to complete the response. c C s&