Re: Simple Proposal for setting HTTP headers

On Jul 18, 2013, at 4:08 AM, Tobie Langel wrote:

> Hi all, 
> 
> I've received a number of requests for .htaccess support or the ability to write server-side code in order to be able to set HTTP headers.
> 
> Supporting .htaccess ties us to Apache, which makes our test suite less portable. And although there are valid use cases for writing server-side code (which will of course be supported), setting HTTP headers hardly seems to be one of them.
> 
> Instead I suggest we agree on the following convention to set HTTP headers for specific files: just add those headers in a file with the same filename and a .headers extensions.
> 
> So for example, specifying a specific charset for the `the-input-byte-stream-001.html` file would consist in adding a file named `the-input-byte-stream-001.headers` in the same directory with the following content:
> 
>    Content-Type: text/html; charset=iso-8859-15
> 
> These directives would be picked up by the server whenever a file was requested and would override any defaults.
> 
> Thoughts?
> 
> --tobie
> 

We've been allowing .htaccess files in the csswg repo for some time, so there's definitely a need. Given that we have to pre-process the .htaccess files anyhow (to merge them when we move files during our build process) I don't have a problem with switching to a more generic file.

A few concerns with this proposal though:

1) we need the ability to remove headers as well as add them (as is prevent default server behavior), at least for charset based on current use [1]. So we need some syntax to specify that.
2) we have a lot of cases where the same header is set for a large number of files in a directory. Having one header file per test file will cause a lot of extra files to be generated. Not a show stopper, but it might be nice to have the ability to specify a set of headers for multiple files in one place, especially for tests that have a set of related files
3) having information necessary to execute a test properly in a separate file is generally a recipe for breakage. Another option might be to embed the header data inside the test file like we do for other metadata? Though this could be problematic for other file types like CSS and images…


Peter

[1] http://test.csswg.org/shepherd/search/name/.htacces/

Received on Thursday, 18 July 2013 16:59:23 UTC