1

我构建了一个网络应用程序,该应用程序应该以下载的形式提供录制的电视(对于那些大喊这是非法的人,我可以告诉他们:在德国它不是,如果你做得对的话)。您可以在http://niklasfi.de:8080查看该项目。

现在关于我的问题:下载 + 恢复适用于普通的 Firefox。但是我遇到了一些下载管理器的问题。所以我想知道为什么。我认为这与我弄错 HTTP 或其他什么有关。

当客户端想要下载某些东西时,首先会给它一个 Ticket(在我们的例子中是 45729410)并重定向到实际的下载链接。

GET /createTicketFor/Matrix_Revolutions_11.02.13_22-30_pro7_155_TVOON_DE.mpg.avi.otrkey HTTP/1.1
Host: niklasfi.de:8080
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en;q=0.7,en-gb;q=0.5,en-au;q=0.3,en-us;q=0.2
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://niklasfi.de:8080/

HTTP/1.1 302 Moved Temporarily
location: /download/45729410
Connection: keep-alive
Transfer-Encoding: chunked

之后 firefox 向下载链接发送一个获取请求(这是在您提供下载选项时完成的(打开方式,下载,downThaOneClick)

GET /download/45729410 HTTP/1.1
Host: niklasfi.de:8080
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en;q=0.7,en-gb;q=0.5,en-au;q=0.3,en-us;q=0.2
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://niklasfi.de:8080/

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=Matrix_Revolutions_11.02.13_22-30_pro7_155_TVOON_DE.mpg.avi.otrkey
Content-Length: 1428013574
Connection: keep-alive

我选择了后者,所以 Down them All 开始 4 次下载:

=== DTA.1 ===
GET /download/45729410 HTTP/1.1
Host: niklasfi.de:8080
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, application/metalink4+xml;q=0.9,application/metalink+xml;q=0.8
Accept-Language: de-de,de;q=0.8,en;q=0.7,en-gb;q=0.5,en-au;q=0.3,en-us;q=0.2
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Referer: http://niklasfi.de:8080/
Want-Digest: SHA512;q=0.9, SHA256;q=0.7, SHA, SHA1;q=0.5, MD5;q=0.3
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=Matrix_Revolutions_11.02.13_22-30_pro7_155_TVOON_DE.mpg.avi.otrkey
Content-Length: 1428013574
Connection: close

=== DTA.2 ===
GET /download/45729410 HTTP/1.1
Host: niklasfi.de:8080
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en;q=0.7,en-gb;q=0.5,en-au;q=0.3,en-us;q=0.2
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Range: bytes=714610068-
Referer: http://niklasfi.de:8080/
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=Matrix_Revolutions_11.02.13_22-30_pro7_155_TVOON_DE.mpg.avi.otrkey
Content-Length: 1428013574
Content-Range: bytes 714610068-1428013573/1428013574
Connection: close

=== DTA.3 ===
GET /download/45729410 HTTP/1.1
Host: niklasfi.de:8080
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en;q=0.7,en-gb;q=0.5,en-au;q=0.3,en-us;q=0.2
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Range: bytes=357908315-
Referer: http://niklasfi.de:8080/
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=Matrix_Revolutions_11.02.13_22-30_pro7_155_TVOON_DE.mpg.avi.otrkey
Content-Length: 1428013574
Content-Range: bytes 357908315-1428013573/1428013574
Connection: close

=== DTA.4 ===
GET /download/45729410 HTTP/1.1
Host: niklasfi.de:8080
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en;q=0.7,en-gb;q=0.5,en-au;q=0.3,en-us;q=0.2
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Range: bytes=1071311822-
Referer: http://niklasfi.de:8080/
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=Matrix_Revolutions_11.02.13_22-30_pro7_155_TVOON_DE.mpg.avi.otrkey
Content-Length: 1428013574
Content-Range: bytes 1071311822-1428013573/1428013574
Connection: close

让我感到奇怪的是,所有请求的 Range 标头都没有给出终点。DTA 应该拥有所需的信息,因为它“知道”它必须在哪里启动其他三个请求。

到现在为止还挺好。一切正常。但不是!DTA 取消最后 3 个请求。这是为什么?

这还不错,因为仍然可以暂停我想要的下载。事实上,现在让我们这样做。我单击“暂停”按钮。在恢复时,将发送以下两个请求:

=== RESTART ===
GET /download/45729410 HTTP/1.1
Host: niklasfi.de:8080
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en;q=0.7,en-gb;q=0.5,en-au;q=0.3,en-us;q=0.2
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Range: bytes=10909760-
Referer: http://niklasfi.de:8080/
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=Matrix_Revolutions_11.02.13_22-30_pro7_155_TVOON_DE.mpg.avi.otrkey
Content-Length: 1428013574
Content-Range: bytes 10909760-1428013573/1428013574
Connection: close

=== RESTART +1 ===
GET /download/45729410 HTTP/1.1
Host: niklasfi.de:8080
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, application/metalink4+xml;q=0.9,application/metalink+xml;q=0.8
Accept-Language: de-de,de;q=0.8,en;q=0.7,en-gb;q=0.5,en-au;q=0.3,en-us;q=0.2
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Referer: http://niklasfi.de:8080/
Want-Digest: SHA512;q=0.9, SHA256;q=0.7, SHA, SHA1;q=0.5, MD5;q=0.3
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=Matrix_Revolutions_11.02.13_22-30_pro7_155_TVOON_DE.mpg.avi.otrkey
Content-Length: 1428013574
Connection: close

但不是!突然间,直到这里的整个下载都被截断了,我什至不能再暂停我的下载了。我唯一的选择就是取消它。而且我仍然只使用一个下载“线程”。

如果您发布任何解释此行为的想法,我会很高兴。(无论如何,感谢您阅读本文)

4

1 回答 1

1

如果提供了“部分内容”,则必须发送 206 而不是 200 作为响应

于 2011-02-21T14:55:09.237 回答