【问题标题】:Content-length header lost during request (django)请求期间丢失的内容长度标头(django)
【发布时间】:2019-09-25 00:11:15
【问题描述】:

使用

    clen = os.path.getsize(the_file)
    response['content-disposition'] = "attachment; filename=%s" % filename
    response['content-length'] = clen
    return response

导致响应标头仅包含内容处置,但不包含内容长度 如果我添加一个无意义的标题,例如

    response['bla'] = 'some non-sense'

它完美地出现在响应中。是否有其他地方正在覆盖标题或其他东西。我正在使用带有 uwsgi 的 nginx。

【问题讨论】:

标签: django http nginx header uwsgi


【解决方案1】:

Content-Length 在使用 application/octet-stream 作为 Content-Type 时在标头中发送。

【讨论】:

    猜你喜欢
    • 2016-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多