wsproxy.py: add web serving capability.

- Added ability to respond to normal web requests. This is basically
  integrating web.py functionality into wsproxy. This is only in the
  python version and it is off by default when calling wsproxy. Turn
  it on with --web DIR where DIR is the web root directory.

Next task is to clean up wsproxy.py. It's gotten unwieldy and it
really no longer needs to be parallel to the C version.
This commit is contained in:
Joel Martin
2011-01-06 18:26:54 -06:00
parent 58dc1947de
commit 96bc3d3088
4 changed files with 125 additions and 77 deletions

View File

@@ -143,6 +143,8 @@ if __name__ == '__main__':
help="SSL key file (if separate from cert)")
parser.add_option("--ssl-only", action="store_true",
help="disallow non-encrypted connections")
parser.add_option("--web", default=None, metavar="DIR",
help="run webserver on same port. Serve files from DIR.")
(options, args) = parser.parse_args()
if len(args) > 2: parser.error("Too many arguments")
@@ -176,4 +178,7 @@ if __name__ == '__main__':
settings['daemon'] = options.daemon
if options.record:
settings['record'] = os.path.abspath(options.record)
if options.web:
os.chdir = options.web
settings['web'] = options.web
start_server()