Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

router.add_static() support customize gzip file #4546

Closed
cole-dda opened this issue Jan 30, 2020 · 2 comments
Closed

router.add_static() support customize gzip file #4546

cole-dda opened this issue Jan 30, 2020 · 2 comments

Comments

@cole-dda
Copy link

cole-dda commented Jan 30, 2020

🐣 Is your feature request related to a problem? Please describe.

for static files, maybe store gz file on other location or dynamic generate

💡 Describe the solution you'd like

web_fileresponse.py

def my_gz_handler(request):
    filename = request.match_info['filename']
    return '/mygz/a.txt.gz'

app.router.add_static(prefix,path,gz_handler=my_gz_handler)

class FileResponse:
       def __init__(filepath,chunk_size,gz_handler=None):
               pass
       async def prepare(self,request):
                 ...
                if self.gz_handler:
                     gz_filename = self.gz_handler(request)

Describe alternatives you've considered

Now,I must copy web_fileresponse.py,and rewrite gzip part code

@socketpair
Copy link
Contributor

I vote against. Serving static files is a nginx task.

@Dreamsorcerer
Copy link
Member

It's not clear precisely what you're asking for, but maybe the changes in #8063 or similar do what you're looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants