File: //usr/lib/python3/dist-packages/trac/web/__pycache__/_fcgi.cpython-310.pyc
o
�k�`� � @ sL d Z dZdZddlZddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZzddlZddl
Z
dZW n eyI ddlZddlZ
dZY nw ee d�sRde _d gZdZd
ZdZdZdZdZd
ZdZdZdZd
ZdZ dZ!dZ"e"Z#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3e�4e2�Z5e�4e3�Z6 ddl7Z7dZ8dZ9dd� Z:G dd� de;�Z<G d d!� d!e<�Z=G d"d#� d#e;�Z>G d$d%� d%e;�Z?G d&d'� d'e;�Z@d<d(d)�ZAd*d+� ZBG d,d-� d-e;�ZCG d.d/� d/e;�ZDG d0d1� d1eD�ZEG d2d3� d3e;�ZFG d4d5� d5eF�ZGG d6d7� d7e;�ZHG d8d � d eH�ZIeJd9k�r$d:d;� ZKeIeK��L� dS dS )=a�
fcgi - a FastCGI/WSGI gateway.
For more information about FastCGI, see <http://www.fastcgi.com/>.
For more information about the Web Server Gateway Interface, see
<http://www.python.org/peps/pep-0333.html>.
Example usage:
#!/usr/bin/env python
from myapplication import app # Assume app is your WSGI application object
from fcgi import WSGIServer
WSGIServer(app).run()
See the documentation for WSGIServer/Server for more information.
On most platforms, fcgi will fallback to regular CGI behavior if run in a
non-FastCGI context. If you want to force CGI behavior, set the environment
variable FCGI_FORCE_CGI to "Y" or "y".
zAllan Saddi <allan@saddi.com>z$Revision: 2025 $� NTF�SHUT_WR� �
WSGIServer� � � � � � � � �
� �FCGI_MAX_CONNS�
FCGI_MAX_REQS�FCGI_MPXS_CONNSz!BBHHBxz!HB5xz!LB3xz!B7xz
/tmp/fcgi.logc C sp t | k rd S z+ttddd��}|�dt�� dd� |f � W d � W d S 1 s*w Y W d S Y d S )N�azutf-8)�encodingz%sfcgi: %s
r ���)�DEBUG�open�DEBUGLOG�write�time�ctime)�level�msg�f� r �0/usr/lib/python3/dist-packages/trac/web/_fcgi.py�_debugw s &�r c @ sb e Zd ZdZdd� Zdd� Zdd� Zdd d
�Zddd
�Zddd�Z dd� Z
dd� ZeZdd� Z
dS )�InputStreamz�
File-like object representing FastCGI input streams (FCGI_STDIN and
FCGI_DATA). Supports the minimum methods required by WSGI spec.
c C s2 || _ |jj| _d| _g | _d| _d| _d| _d S )N� r F) �_conn�server�inputStreamShrinkThreshold�_shrinkThreshold�_buf�_bufList�_pos�_avail�_eof)�self�connr r r �__init__� s
zInputStream.__init__c C sJ | j | jkr!| j| j d� | _| j| j 8 _d| _ | jdks#J �dS dS )z6Gets rid of already read data (since we can't rewind).Nr )r) r&