[development] Proxying Files Downloads Through Drupal

Rob Thorne rob at torenware.com
Tue Jun 20 22:26:57 UTC 2006

Darrel O'Pry wrote:
> Can you describe you application in a bit more detail?
I have a small server that delivers a dynamically generated file via HTTP.

I need to:

   1. Get input from the end user describing what kind of output the
      user wants.
   2. Process the form and determine what kind of output the user wants
      and is entitled to.
   3. Generate the URL that points to the resource that best satisfies
      the request.
   4. Fetch the stream somehow, perhaps with the PHP curl module.
   5. Do any munging I need to do on the headers (if I even need to do
   6. Send the bytes back to the user.

This probably is similar to some of the audio or image modules in terms 
of how they might be fetching their input and passing them on to the 
user's browser.


> >From what you've said I would suggest taking advantage of php's stream
> support and merging it with something like file_download(...). that
> sends the headers and an associated data stream. 
> Imagecache does something sort of similar where it generates a
> derivative image on the fly and delivers it to the browser the first
> time the image is created.
> On Tue, 2006-06-20 at 15:26 -0600, Rob Thorne wrote:
>> I have a Java web application that creates PDFs and other generated 
>> data.  I'd like to control it through Drupal, and return the output from 
>> the web app as if it were served from Drupal.
>> What are some suggestions how best to proxy this kind of data stream 
>> through Drupal?  Since the original data stream will likely have the 
>> relevant HTTP headers to set the MIME type and content disposition, I'd 
>> also like to be able to preserve those during the operation.
>> Thanks,
>> Rob
>> Rob Thorne
>> Torenware Networks
>> http://www.torenware.com

More information about the development mailing list