Compare commits

..

No commits in common. "bbada0436a6230e577599b11b7099c3539af3f01" and "b290568e14c113457e0cea1b6f1efbb61af5e526" have entirely different histories.

2 changed files with 10 additions and 16 deletions

View File

@ -48,11 +48,6 @@ except NameError:
basestring = unicode = str
# uncomment the lines below to ignore SSL certs
#import ssl
#ssl._create_default_https_context = ssl._create_unverified_context
MIMETYPE = {
'xml': ['text/xml', 'application/xml', 'application/rss+xml', 'application/rdf+xml', 'application/atom+xml', 'application/xhtml+xml'],
'rss': ['application/rss+xml', 'application/rdf+xml', 'application/atom+xml'],

View File

@ -53,10 +53,12 @@ def parse_options(options):
return out
def get_path(environ):
def cgi_parse_environ(environ):
# get options
if 'REQUEST_URI' in environ:
# when running on Apache
url = unquote(environ['REQUEST_URI'][1:])
url = environ['REQUEST_URI'][1:]
else:
# when using internal server
@ -65,19 +67,12 @@ def get_path(environ):
if environ['QUERY_STRING']:
url += '?' + environ['QUERY_STRING']
return url
def cgi_parse_environ(environ):
# get options
url = get_path(environ)
url = re.sub(r'^/?(cgi/)?(morss.py|main.py)/', '', url)
if url.startswith(':'):
split = url.split('/', 1)
raw_options = split[0].replace('|', '/').replace('\\\'', '\'').split(':')[1:]
raw_options = unquote(split[0]).replace('|', '/').replace('\\\'', '\'').split(':')[1:]
if len(split) > 1:
url = split[1]
@ -159,7 +154,11 @@ def middleware(func):
def cgi_file_handler(environ, start_response, app):
" Simple HTTP server to serve static files (.html, .css, etc.) "
url = get_path(environ)
if 'REQUEST_URI' in environ:
url = environ['REQUEST_URI'][1:]
else:
url = environ['PATH_INFO'][1:]
if url == '':
url = 'index.html'