Fix up downloads URI and status handling.

This adds a pending status file ASAP after the request is accepted. It
also checks for the existence of such a file with status "PENDING"
before accepting another request for the same entity. If a request
exists it returns a 303 referring the caller to the in progress request.