| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/flup/server/__pycache__/ |
Upload File : |
�
#H\a � �� � d Z dZdZddlZddlZddlmZmZ ddlm Z dgZ
G d� dee � � Zed k rAd
� Z
ddlmZ ej e
� � Z
ee
ddej �
� � � � � dS dS )a�
ajp - an AJP 1.3/WSGI gateway.
For more information about AJP and AJP connectors for your web server, see
<http://jakarta.apache.org/tomcat/connectors-doc/>.
For more information about the Web Server Gateway Interface, see
<http://www.python.org/peps/pep-0333.html>.
Example usage:
#!/usr/bin/env python
import sys
from myapplication import app # Assume app is your WSGI application object
from ajp import WSGIServer
ret = WSGIServer(app).run()
sys.exit(ret and 42 or 0)
See the documentation for WSGIServer for more information.
About the bit of logic at the end:
Upon receiving SIGHUP, the python script will exit with status code 42. This
can be used by a wrapper script to determine if the python script should be
re-run. When a SIGINT or SIGTERM is received, the script exits with status
code 0, possibly indicating a normal exit.
Example wrapper script:
#!/bin/sh
STATUS=42
while test $STATUS -eq 42; do
python "$@" that_script_above.py
STATUS=$?
done
Example workers.properties (for mod_jk):
worker.list=foo
worker.foo.port=8009
worker.foo.host=localhost
worker.foo.type=ajp13
Example httpd.conf (for mod_jk):
JkWorkersFile /path/to/workers.properties
JkMount /* foo
Note that if you mount your ajp application anywhere but the root ("/"), you
SHOULD specifiy scriptName to the WSGIServer constructor. This will ensure
that SCRIPT_NAME/PATH_INFO are correctly deduced.
zAllan Saddi <allan@saddi.com>z
$Revision$� N)�
BaseAJPServer�
Connection)�
PreforkServer�
WSGIServerc �6 � e Zd ZdZddddej dfd�Zd� ZdS )r a�
AJP1.3/WSGI server. Runs your WSGI application as a persistant program
that understands AJP1.3. Opens up a TCP socket, binds it, and then
waits for forwarded requests from your webserver.
Why AJP? Two good reasons are that AJP provides load-balancing and
fail-over support. Personally, I just wanted something new to
implement. :)
Of course you will need an AJP1.3 connector for your webserver (e.g.
mod_jk) - see <http://jakarta.apache.org/tomcat/connectors-doc/>.
� N)� localhost�I Tc � � t j | |||dd||||��
�
dD ] } | |v r|| = �
t j | ft | fd�|�� dS )a�
scriptName is the initial portion of the URL path that "belongs"
to your application. It is used to determine PATH_INFO (which doesn't
seem to be passed in). An empty scriptName means your application
is mounted at the root of your virtual host.
environ, which must be a dictionary, can contain any additional
environment variables you want to pass to your application.
bindAddress is the address to bind to, which must be a tuple of
length 2. The first element is a string, which is the host name
or IPv4 address of a local interface. The 2nd element is the port
number.
allowedServers must be None or a list of strings representing the
IPv4 addresses of servers allowed to connect. None means accept
connections from anywhere.
loggingLevel sets the logging level of the module-level logger.
FT)�
scriptName�environ�
multithreaded�multiprocess�bindAddress�allowedServers�loggingLevel�debug)r r �jobClass�jobArgs)r r N)r �__init__r r )
�self�applicationr r
r r r r �kw�keys
�6/usr/lib/python3/dist-packages/flup/server/ajp_fork.pyr zWSGIServer.__init__g s� � �. ��t�[�*4�'.�-2�,0�+6�.<�,8�%*� ,� ,� ,� ,� L� � �C��b�y�y��s�G����t�P�j�4�'�P�P�R�P�P�P�P�P� c � � | j � d| j j � � | � � � }nE# t
j $ r3}| j � dt |� � � � Y d}~dS d}~ww xY wt j | |� � }| �
|� � | j � d| j j | j rdpd� � |S )z�
Main loop. Call this after instantiating WSGIServer. SIGHUP, SIGINT,
SIGQUIT, SIGTERM cause it to cleanup and return. (If a SIGHUP
is caught, this method returns True. Returns False otherwise.)
z%s starting upz#Failed to bind socket (%s), exitingNFz%s shutting down%sz (reload requested)r )�logger�info� __class__�__name__�_setupSocket�socket�error�strr �run�_cleanupSocket�_hupReceived)r �sock�e�rets r r&