Add :cors for cross-domain XHR (with README update)
parent
230659a34b
commit
226441d821
|
@ -50,6 +50,7 @@ The arguments are:
|
||||||
- `theforce`: force download the rss feed
|
- `theforce`: force download the rss feed
|
||||||
- `silent`: don't output the final RSS (useless on its own, but can be nice when debugging)
|
- `silent`: don't output the final RSS (useless on its own, but can be nice when debugging)
|
||||||
- http server only
|
- http server only
|
||||||
|
- `cors`: allow Cross-origin resource sharing (allows XHR calls from other servers)
|
||||||
- `html`: changes the http content-type to html, so that python cgi erros (written in html) are readable in a web browser
|
- `html`: changes the http content-type to html, so that python cgi erros (written in html) are readable in a web browser
|
||||||
- `txt`: changes the http content-type to txt (for faster "`view-source:`")
|
- `txt`: changes the http content-type to txt (for faster "`view-source:`")
|
||||||
- `force`: avoid using your browser cache (do not support 304 errors)
|
- `force`: avoid using your browser cache (do not support 304 errors)
|
||||||
|
|
|
@ -757,6 +757,9 @@ def cgi_app(environ, start_response):
|
||||||
headers['status'] = '200 OK'
|
headers['status'] = '200 OK'
|
||||||
headers['etag'] = '"%s"' % int(time.time())
|
headers['etag'] = '"%s"' % int(time.time())
|
||||||
|
|
||||||
|
if options.cors:
|
||||||
|
headers['access-control-allow-origin'] = '*'
|
||||||
|
|
||||||
if options.html or options.reader:
|
if options.html or options.reader:
|
||||||
headers['content-type'] = 'text/html'
|
headers['content-type'] = 'text/html'
|
||||||
elif options.debug or options.txt:
|
elif options.debug or options.txt:
|
||||||
|
|
Loading…
Reference in New Issue