File: //lib/python3/dist-packages/twisted/web/__pycache__/twcgi.cpython-310.pyc
o
�b�. � @ s� d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZm
Z
mZmZ G dd � d e
jej�ZG d
d� de
j�ZG dd
� d
e�ZG dd� deje
j�ZdS )zH
I hold resource classes and helper classes that deal with CGI scripts.
� N)�protocol)�Logger)�filepath)�pb)�http�resource�server�staticc @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�CGIDirectoryc C s t j�| � tj�| |� d S �N)r �Resource�__init__r �FilePath)�self�pathname� r �3/usr/lib/python3/dist-packages/twisted/web/twcgi.pyr
s zCGIDirectory.__init__c C s6 | � |�}|�� s
tjjS |�� rt|j�S t|j�S r ) �child�existsr �File�
childNotFound�isdirr
�path� CGIScript)r r �request�fnpr r r �getChild s
zCGIDirectory.getChildc C s t �d�}|�|�S )Nz1CGI directories do not support directory listing.)r �
NoResource�render)r r �notFoundr r r r $ s �
zCGIDirectory.renderN)�__name__�
__module__�__qualname__r
r r r r r r r
s r
c @ s2 e Zd ZdZdZd
dd�Zdd� Zg fdd �ZdS )r z�
L{CGIScript} is a resource which runs child processes according to the CGI
specification.
The implementation is complex due to the fact that it requires asynchronous
IPC with an external process with an unpleasant protocol.
� Nc C s$ || _ |du r
ddlm} || _dS )zA
Initialize, with the name of a CGI script file.
Nr )�reactor)�filename�twisted.internetr$ �_reactor)r r% �registryr$ r r r r
6 s
zCGIScript.__init__c
C s� dd� |j� }|�� �d�d }tj|d|jt|�� j �|j
|| j|jd� }|�
� j}|dur4||d<