HTTP Get: Only download the header? (HEAD is not supported)

匆匆过客 提交于 2019-12-01 03:38:41

Instead of making a GET request, you might consider just making a HEAD request:

The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.

You might be able to use the Range header in your request to specify a range of bytes to include in the response entity. Possibly something like:

Range: bytes=0-0

If it does work, you should receive back a 206 Partial Content with the bytes specified in your Range header present in the response entity. However, I've not tried this, and it's also not guaranteed to work:

A server MAY ignore the Range header.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!