问题
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