Added support for 404 redirect.
ie. http://domain.com/bbc.co.uk/feed.xml will redirect to http://domain.com/morss.py/bbc.co.uk/feed.xml and work.master
parent
af8879049f
commit
7b1c32eac2
|
@ -1,2 +1,4 @@
|
|||
AddHandler cgi-script .py
|
||||
Options +ExecCGI
|
||||
|
||||
ErrorDocument 404 /morss.py
|
||||
|
|
10
morss.py
10
morss.py
|
@ -349,9 +349,17 @@ def Gather(data, cachePath):
|
|||
|
||||
if __name__ == "__main__":
|
||||
if SERVER:
|
||||
print 'Status: 200'
|
||||
print 'Content-Type: text/html\n'
|
||||
|
||||
if 'REDIRECT_URL' in os.environ:
|
||||
url = os.environ['REQUEST_URI'][1:]
|
||||
else:
|
||||
url = os.environ['REQUEST_URI'][len(os.environ['SCRIPT_NAME'])+1:]
|
||||
url = 'http://' + url.replace(' ', '%20')
|
||||
if not url.startswith('http://') and not url.startswith('https://'):
|
||||
url = "http://" + url
|
||||
url = url.replace(' ', '%20')
|
||||
|
||||
cache = os.getcwd() + '/cache'
|
||||
log(url)
|
||||
RSS = Gather(url, cache)
|
||||
|
|
Loading…
Reference in New Issue