New submission from Jake <so...@kth.se>:

I would find it useful to have more options to http.server 
SimpleHTTPRequestHandler:

1) The option to get the current directory in not only HTML, but represented in 
JSON for example. This could be an added --json flag in the main method of 
http.server, and an added corresponding method in SimpleHTTPRequestHandler much 
like list_directory but for JSON. 


2) Options to add more headers. For example I would find it useful to be able 
to add the header 'Access-Control-Allow-Origin'. This could be achieved by 
send_head in SimpleHTTPRequestHandler taking more arguments for specifying any 
additional headers to be added. 

This way a custom class can inherit SimpleHTTPRequestHandler, and in its own 
send_head method call e.g. 
super().send_head(extra_headers={'Access-Control-Allow-Origin','*'}).

----------
components: Library (Lib)
messages: 378823
nosy: jacobsorme
priority: normal
severity: normal
status: open
title: More options to http.server & SimpleHTTPRequestHandler
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42063>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to