Hook content-disposition links passed in the header

Registered by Alon Swartz on 2009-08-26

Some links (namely torrents) aren't reaching our handler code.

TorrentServer Handler in its current form will download these links correctly
through its saveas function (right-click, download with torrentserver), but this
issue should be supported for ease-of-use (1 click downloads).

== explanation ==

=== so whats the problem? ===

in a nutshell: content-disposition

- user clicks on a link
    - GET request is sent to server

- server responds with 200 OK, and includes the header:
    - content-disposition: inline; filename="filename.torrect"

- firefox processes the headers, understands it needs to use
  "content-disposition" and "internally" performs the GET

=== why doesn't the handler work? ===

- the handler intercepts user requested urls (clicked or typed in the
  url bar), checks if the url matches certain checks, and if it does,
  passes the request to mldonkey and stops firefox from handling the
  request via nsIConentPolicy.REJECT

- because firefox is handling "content-disposition" internally, the user
  themselves never requests the torrect url, therefore it doesn't
  intercept the request

=== how firefox handles mime-types ===

For a full explanation, see:
https://developer.mozilla.org/en/How_Mozilla_determines_MIME_Types
https://developer.mozilla.org/en/Document_Loading_-_From_Load_Start_to_Finding_a_Handler

In a nutshell, the process goes like this:
    - content type "hints"
    - http
    - file uris
    - unknown decoder
    - external helper app service
    - helper applications

Content Disposition comes into play right at the end with helper
applications, when it asks the os for a handler of a given mime-type.
It gets the mime-type from the content-disposition header if present.

Once it knows what to do, it loads the uri directly, and uses what ever
handler is present "in the helper application list".

=== how to fix ===

- hook into the mime-type handling, and provide torrentserver-handler as a
  application/x-bittorrent handler. when we get the request we would pass
  it onto our existing code to get the url and tell firefox that we
  handled it.

Blueprint information

Status:
Started
Approver:
None
Priority:
Medium
Drafter:
None
Direction:
Needs approval
Assignee:
Alon Swartz
Definition:
Approved
Series goal:
None
Implementation:
Beta Available
Milestone target:
None
Started by
Alon Swartz on 2009-08-30

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.