dongxian0320 2014-10-09 20:47
浏览 29
已采纳

Go中的AppEngine不会从urlfetch.Head返回Content-Length

I am trying to perform a HEAD request to a URL so I can get the Content-Length header and then do Range requests.

However I found out AppEngine doesn't return the Content-Length header when doing urlfetch.Head. The documentation is explicit about it for responses, but not for requests.

Etag:["359670651"]
Expires:[Thu, 16 Oct 2014 20:41:52 GMT]
Server:[ECS (mdw/1275)]
X-Cache:[HIT]
X-Ec-Custom-Error:[1]
X-Google-Cache-Control:[remote-fetch]
Accept-Ranges:[bytes]
Cache-Control:[max-age=604800]
Content-Type:[text/html]
Date:[Thu, 09 Oct 2014 20:41:52 GMT]
Last-Modified:[Fri, 09 Aug 2013 23:54:35 GMT]

It works correctly when using net/http of the Go library.

Last-Modified:[Fri, 09 Aug 2013 23:54:35 GMT]
Server:[ECS (iad/182A)]
Content-Length:[1270]
Accept-Ranges:[bytes]
Cache-Control:[max-age=604800]
Date:[Thu, 09 Oct 2014 20:38:01 GMT]
X-Cache:[HIT]
X-Ec-Custom-Error:[1]
Content-Type:[text/html]
Etag:["359670651"]
Expires:[Thu, 16 Oct 2014 20:38:01 GMT]

Is there any solution to this? A HEAD request without the Content-Length is kind of useless in my opinion.

Thanks.

  • 写回答

1条回答 默认 最新

  • douzhang5199 2014-10-10 05:34
    关注

    For reasons beyond my understanding, App Engine does not include the content length in the response Header for any request method.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line