英文:
AppEngine in Go not returning Content-Length from urlfetch.Head
问题
我正在尝试对一个URL执行HEAD
请求,以便获取Content-Length
头,并进行范围请求。
然而,我发现在使用urlfetch.Head
时,AppEngine不会返回Content-Length
头。文档对于响应是明确的,但对于请求则没有提到。
以下是使用Go库的net/http
时的正确工作示例:
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]
在我看来,没有Content-Length
的HEAD
请求有点无用。是否有任何解决方案?
谢谢。
英文:
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
得分: 0
出于我理解之外的原因,App Engine在任何请求方法的响应头中不包含内容长度。
英文:
For reasons beyond my understanding, App Engine does not include the content length in the response Header for any request method.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论