I think its handled by StaticApp class in file httpserver.py class StaticApp(SimpleHTTPRequestHandler)
But I don't know how to hack into Content-Type. This class is based on http://docs.python.org/library/simplehttpserver.html#SimpleHTTPServer.SimpleHTTPRequestHandler And setting extensions_map (A dictionary mapping suffixes into MIME types) will probably work. On Sep 19, 12:26 am, alexander lind <[email protected]> wrote: > Thanks, but is there is no way to do this without a special controller > like that? After reading a couple of other threads about similar > questions I realize its probably just not possible to do it in webpy. > Not a big deal, just would be comfortable when developing. > > Alec > > On Sep 18, 2009, at Sep 18, 2009 - 3:34 PM, andrei wrote: > > > > > You can move them to separate folder and write a special controller > > method that will set the header and output the requested file. Do > > something like this. > > > web.header("Content-Encoding", "gzip") > > web.header("Content-Type", "text/html") > > return open(filename,"rb").read() > > > On Sep 18, 10:18 pm, alexander lind <[email protected]> wrote: > >> Hi > > >> I have a need to serve a couple of gzipped files out of my /static/ > >> directory, and I want the browser to decompress and render in the > >> browser, not trigger a save-file dialog. > >> When serving with lighttpd, I do this by adding these headers to any > >> url that ends in .gz: > >> "Content-Encoding" => "gzip", "Content-Type" => "text/html" > > >> Does anyone know how I can get web.py / cherrypy to do the same? > > >> Alec > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/webpy?hl=en -~----------~----~----~----~------~----~------~--~---
