Help needed with apache config for hackage

Hi folks, Does anyone have any experience with apache configuration, particularly mime types and handling browser quirks and would like to help us with an issue we have on hackage? http://hackage.haskell.org/trac/hackage/ticket/498 The problem is described in the ticket but basically IE6 gets confused by the Content-Type and Content-Encoding and ends up saving ".tar.gz" files with the wrong name ".tar.tar". We need help working out how to configure apache to use a workaround and with testing that the solution actually works. Thanks! Duncan

On Fri, 2009-02-13 at 10:58 +0000, Duncan Coutts wrote:
Hi folks,
Does anyone have any experience with apache configuration, particularly mime types and handling browser quirks and would like to help us with an issue we have on hackage?
http://hackage.haskell.org/trac/hackage/ticket/498
The problem is described in the ticket but basically IE6 gets confused by the Content-Type and Content-Encoding and ends up saving ".tar.gz" files with the wrong name ".tar.tar".
We need help working out how to configure apache to use a workaround and with testing that the solution actually works.
Thanks!
Duncan
Currently the browser receives:
HTTP/1.1 200 OK Date: Fri, 13 Feb 2009 11:15:22 GMT Server: Apache/2.2.3 (Debian) Last-Modified: Mon, 09 Feb 2009 07:55:57 GMT ETag: "38c010-46d-b361bd40" Accept-Ranges: bytes Content-Length: 1133 Content-Type: application/x-tar Content-Encoding: x-gzip
You could try adding a Content-Disposition header to specify a file name: Content-Disposition: attachment; filename=APackage.tar.gz In Apache you can (apparently [1],[2]) do it like this: RewriteRule "^packages/archive/[^/]+/[^/]+/(.+)$" - [env=pkgname:$1] Header set Content-Disposition "attachment; filename=\"%{pkgname}e\"" env=pkgname [1]: http://httpd.apache.org/docs/2.0/mod/core.html#files [2]: http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/... - George

On Fri, 2009-02-13 at 22:39 +1100, George Pollard wrote:
On Fri, 2009-02-13 at 10:58 +0000, Duncan Coutts wrote:
Hi folks,
Does anyone have any experience with apache configuration, particularly mime types and handling browser quirks and would like to help us with an issue we have on hackage?
http://hackage.haskell.org/trac/hackage/ticket/498
The problem is described in the ticket but basically IE6 gets confused by the Content-Type and Content-Encoding and ends up saving ".tar.gz" files with the wrong name ".tar.tar".
We need help working out how to configure apache to use a workaround and with testing that the solution actually works.
Thanks!
Duncan
Currently the browser receives:
HTTP/1.1 200 OK Date: Fri, 13 Feb 2009 11:15:22 GMT Server: Apache/2.2.3 (Debian) Last-Modified: Mon, 09 Feb 2009 07:55:57 GMT ETag: "38c010-46d-b361bd40" Accept-Ranges: bytes Content-Length: 1133 Content-Type: application/x-tar Content-Encoding: x-gzip
You could try adding a Content-Disposition header to specify a file name:
Content-Disposition: attachment; filename=APackage.tar.gz
In Apache you can (apparently [1],[2]) do it like this:
RewriteRule "^packages/archive/[^/]+/[^/]+/(.+)$" - [env=pkgname:$1] Header set Content-Disposition "attachment; filename=\"%{pkgname}e\"" env=pkgname
[1]: http://httpd.apache.org/docs/2.0/mod/core.html#files [2]: http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/...
Can we do that just for one user agent? I don't think we want to use non-standard stuff in general. Apparently Content-Disposition is not in the official HTTP spec, but IE is known to follow it. Duncan

On Fri, 2009-02-13 at 12:19 +0000, Duncan Coutts wrote:
Can we do that just for one user agent? I don't think we want to use non-standard stuff in general. Apparently Content-Disposition is not in the official HTTP spec, but IE is known to follow it.
It's not in the HTTP spec, but it's about as official as something that isn't can be :) [1] I believe all web browsers in common use support it. (And it shouldn't cause any problems for those that don't, who will just ignore it.) - George [1]: http://www.ietf.org/rfc/rfc2183.txt

* Duncan Coutts
Can we do that just for one user agent? I don't think we want to use non-standard stuff in general. Apparently Content-Disposition is not in the official HTTP spec, but IE is known to follow it.
Well, it's mentioned in RFC 2616[1], and I'd expect it to just have no effect in any user agent that doesn't implement it, so this doesn't seem like a huge concern. [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1 -- mithrandi, i Ainil en-Balandor, a faer Ambar

On Fri, 2009-02-13 at 22:39 +1100, George Pollard wrote:
RewriteRule "^packages/archive/[^/]+/[^/]+/(.+)$" - [env=pkgname:$1]
This should actually be more constrained since (as I've just noticed) more than just packages are under this path :) Perhaps:
RewriteRule "^packages/archive/[^/]+/[^/]+/([^/]+\\.tar\\.gz)$" - [env=pkgname:$1]
participants (3)
-
Duncan Coutts
-
George Pollard
-
Tristan Seligmann