HTTP Header 是否告诉我们文件是否已下载、上传或访问?
does HTTP Header tell us if a file was downloaded, uploaded, or accessed?
我正在使用 HTTP Headers,如下所示。
GET /success.txt HTTP/1.1
Host: detectportal.firefox.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0)
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cache-Control: no-cache
Pragma: no-cache
Connection: keep-alive
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 8
Last-Modified: Mon, 15 May 2017 18:04:40 GMT
ETag: "ae780585fb7d28906123"
Accept-Ranges: bytes
Server: AmazonS3
X-Amz-Cf-Id: iMjet-5hLAEAf8HyvtHWnotG4mkD7VeN7A==
Cache-Control: no-cache, no-store, must-revalidate
Date: Mon, 24 Jul 2017 18:24:08 GMT
Connection: keep-alive
从上面的握手可以看出,这是一次成功的2次握手。我只是想知道这种类型的握手是否可以告诉我们文件是否已下载、上传或访问?如果不是,我们怎么知道 Header 文件中发生了哪些操作?
谢谢!
is there anyways to know that the pdf file was downloaded from [captured network packets containing these] HTTP header[s]?
没有。 headers 描述了一个资源,以及可选的资源内容。
没有人阻止您在阅读 header 后关闭连接,导致内容无法下载。
因此,仅仅看到这些 header 在网络上飞过并不能证明有人确实查看了该响应的内容,即使有任何内容也是如此。
但一般来说,如果请求有负载,你可以说 "something" 已上传,如果响应有负载,你可以说 "something" 已下载。可以通过检查请求的 content-type headers 来获得上传的确切内容。请注意,"file" 的概念在通过网络传输时会变得模糊。响应请求的 Web 服务器可能会生成 PDF 文档 in-memory,并使用 header 来提供该文档,从而在您的浏览器中提示另存为...对话框。然后你能说下载了 "file" 吗?如果站点提供服务器磁盘上存在的 CSS 文件,您的浏览器呈现该文件,但不存储在磁盘上(禁止缓存)怎么办?那是"file""downloaded"吗?
请参阅 HTTP response headers valid with no Transfer-Encoding and Content-Length? 如何确定消息的长度。
如果您想通过查看 header 了解 HTTP 响应是否针对 HTML 文档以外的文件,请检查 Content-Type
header.它包含 MIME type of the content being sent e.g text/html
for a HTML file, text/css
for a CSS file, application/pdf
or application/x-pdf
for a PDF file, video/mp4
for an MP4 video, etc. The official list is at http://www.iana.org/assignments/media-types/media-types.xhtml
我正在使用 HTTP Headers,如下所示。
GET /success.txt HTTP/1.1
Host: detectportal.firefox.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0)
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cache-Control: no-cache
Pragma: no-cache
Connection: keep-alive
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 8
Last-Modified: Mon, 15 May 2017 18:04:40 GMT
ETag: "ae780585fb7d28906123"
Accept-Ranges: bytes
Server: AmazonS3
X-Amz-Cf-Id: iMjet-5hLAEAf8HyvtHWnotG4mkD7VeN7A==
Cache-Control: no-cache, no-store, must-revalidate
Date: Mon, 24 Jul 2017 18:24:08 GMT
Connection: keep-alive
从上面的握手可以看出,这是一次成功的2次握手。我只是想知道这种类型的握手是否可以告诉我们文件是否已下载、上传或访问?如果不是,我们怎么知道 Header 文件中发生了哪些操作? 谢谢!
is there anyways to know that the pdf file was downloaded from [captured network packets containing these] HTTP header[s]?
没有。 headers 描述了一个资源,以及可选的资源内容。
没有人阻止您在阅读 header 后关闭连接,导致内容无法下载。
因此,仅仅看到这些 header 在网络上飞过并不能证明有人确实查看了该响应的内容,即使有任何内容也是如此。
但一般来说,如果请求有负载,你可以说 "something" 已上传,如果响应有负载,你可以说 "something" 已下载。可以通过检查请求的 content-type headers 来获得上传的确切内容。请注意,"file" 的概念在通过网络传输时会变得模糊。响应请求的 Web 服务器可能会生成 PDF 文档 in-memory,并使用 header 来提供该文档,从而在您的浏览器中提示另存为...对话框。然后你能说下载了 "file" 吗?如果站点提供服务器磁盘上存在的 CSS 文件,您的浏览器呈现该文件,但不存储在磁盘上(禁止缓存)怎么办?那是"file""downloaded"吗?
请参阅 HTTP response headers valid with no Transfer-Encoding and Content-Length? 如何确定消息的长度。
如果您想通过查看 header 了解 HTTP 响应是否针对 HTML 文档以外的文件,请检查 Content-Type
header.它包含 MIME type of the content being sent e.g text/html
for a HTML file, text/css
for a CSS file, application/pdf
or application/x-pdf
for a PDF file, video/mp4
for an MP4 video, etc. The official list is at http://www.iana.org/assignments/media-types/media-types.xhtml