V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Tornado Documentation
http://www.v2ex.com/tornado/
Tornado on GitHub
https://github.com/facebook/tornado/
Tornado Gists
http://tornadogists.org/
zeyexe
V2EX  ›  Tornado

Tornado怎么实现head方法?

  •  
  •   zeyexe · 2013-08-05 10:35:32 +08:00 · 4741 次点击
    这是一个创建于 3915 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我想要的效果是head方法能正确显示get方法的Content-Length,而不是Content-Length为0。

    正确的实现方式是什么?
    3 条回复    1970-01-01 08:00:00 +08:00
    GTim
        1
    GTim  
       2013-08-06 09:56:52 +08:00
    head 方法返回值是没有body的...
    GTim
        2
    GTim  
       2013-08-06 09:58:10 +08:00
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html 中的 head:

    The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response.
    zeyexe
        3
    zeyexe  
    OP
       2013-08-06 10:28:20 +08:00
    @GTim 其实我想要的head就是get去掉body的那些东西(headers),但是在tornado下面,除非把head方法用get的方法的方式实现一次,否则head返回的值和get返回的headers有差异。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   981 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 21:12 · PVG 05:12 · LAX 14:12 · JFK 17:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.