durusmail: quixote-users: SCGI util.
Overlaying a static directory
2005-04-11
2005-04-12
2005-04-12
2005-04-12
2005-04-13
2005-04-13
2005-04-14
2005-04-14
2005-04-14
2005-04-14
2005-04-14
2005-04-14
2005-04-14
2005-04-14
2005-04-14
2005-04-14
David Binger (3 parts)
2005-04-14
2005-04-14
2005-04-13
2005-04-14
2005-04-14
2005-04-13
SCGI util.
2005-04-12
2005-04-13
2005-04-13
2005-04-13
2005-04-13
SCGI util.
David Binger
2005-04-12
Here's a function that might be helpful if you want to
talk directly to an SCGI server.

import socket

def scgi_request(content, **kwargs):
     headers = '\0'.join(
         ['%s\0%s' % item for item in
          [('CONTENT_LENGTH', len(content)), ('SCGI', 1)] +
kwargs.items()])
     return "%s:%s\0,%s" % (len(headers)+1, headers, content)

def send_scgi(port, host='localhost', content='',
               PATH_INFO='/', SCRIPT_NAME='', **kwargs):
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.connect((host, port))
     s.send(scgi_request(content,
                         PATH_INFO=PATH_INFO,
                         SCRIPT_NAME=SCRIPT_NAME,
                         **kwargs))
     return s.recv(1000)


print send_scgi(11001)


reply