How to set response Content-Length to infinite

二次信任 提交于 2019-12-11 23:55:48

问题


I try to create an application in web2py framework. By default web2py server has Transfer-Encoding: Chunked header for response, but in that case when target remote web application sends GET request to my app it could get only first string of text from requested page (from file's content that displayed on page). If to use Content-Length instead, for example, with value of 1000 it will get 1000 bytes of data from page... But if I expect to response with huge range of data, how to set Content-Length parameter to infinity or by file (like here but with web2py syntax instead of php )?


回答1:


If you are serving web2py via the built-in development server and serving files via the Expose functionality, then the files will be served via chunked transfer encoding.

However, if you instead use response.stream to serve files, the Content-Length header will be set automatically.



来源:https://stackoverflow.com/questions/31871772/how-to-set-response-content-length-to-infinite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!