httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Mearns <mearn...@gmail.com>
Subject Re: [users@httpd] Application design
Date Fri, 20 Mar 2009 15:17:13 GMT
On Fri, Mar 20, 2009 at 10:46 AM, André Warnier <aw@ice-sa.com> wrote:
> Hi.
>
> For once, I'd like to pump the collective knowledge and accumulated wisdom
> of the gurus on the list.
>
> I run a document management application, from which users can retrieve
> documents (ms-office, pdf, etc..) through a web application.  From the user
> point of view, documents are accessed via a "logical id", such as
> "12345678", via a link like "http://servername/getdoc/1234567".
> An active module on the server processes these requests, determines for
> example that "12345678" corresponds to some document "doc0001.pdf",
> retrieves this document, and returns it to the user with the appropriate
> HTTP headers, for example in this case :
> Content-Type : text/pdf
> Content-Length: 200000
> Content-Disposition: attachment; filename="doc0001.pdf"
>
> So far, so good, it works.
>
> Now, I would like to save space on the server, and compress the original
> documents. So I would for example take "doc0001.pdf", and compress it into
> "doc0001.pdf.zip". (I mean really on the disk of the server, stored in
> compressed form, not just compressed "in transit".)
> I would still want the user to use the same link to retrieve the document,
> and I would of course want that this is still seen as a pdf document by
> their browser, and not as a zip file.
> I imagine that what I need to do then in my active module, is to return the
> zipped version of the document to the browser with the following headers :
> Content-Type : text/pdf
> Content-Disposition: attachment; filename="doc0001.pdf"
> Content-transfer-encoding: zip
> Content-Length: (size of the zipped version)
>
> and that the browser will automatically uncompress it and present it to the
> user as an uncompressed pdf document.
>
> Is that true, and is it all there is to it, or am I missing something ?
>

I'm not sure content-transfer-encoding is the right header, I think
just Content-encoding is what you want. Otherwise, that should work I
think, but it requires that people's browsers support zip encoding,
which mine, for instance (FF3 on Linux) does not.

If you're going to do this and you don't want to lock anybody out
because of browser in-compatibilities, I think you're going to have to
parse the request headers, find out if they support the specified
encoding, and if not, have your server decompress on the fly before
sending.

That's my $0.02.

-Brian

-- 
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://pgp.mit.edu/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message