https://bz.apache.org/bugzilla/show_bug.cgi?id=69775

            Bug ID: 69775
           Summary: Content-Type seems to be required in type-map, but
                    that's not documented
           Product: Apache httpd-2
           Version: 2.4.65
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_negotiation
          Assignee: bugs@httpd.apache.org
          Reporter: da...@mandelberg.org
  Target Milestone: ---

I'm trying to use mod_negotiation type-map files to serve pre-compressed files.
>From the documentation, I'd expect to just use Content-Encoding to negotiate
which file to serve, but that doesn't work.

For the following minimal reproduction cases, I'm using this .htaccess file:

```
AddHandler type-map .var
AddEncoding gzip .gz
AddType text/plain .txt
```

With some text in foo.txt, that compressed in foo.txt.gz, and the code below in
foo.txt.var, a request for foo.txt.var returns 406 with only foo.txt.gz as an
option.

```
URI: foo.txt.var

URI: foo.txt

Content-Encoding: gzip
URI: foo.txt.gz
```

With this file, I get 406 with both foo.txt and foo.txt.gz listed:

```
URI: foo.txt.var

Content-Encoding: identity
URI: foo.txt

Content-Encoding: gzip
URI: foo.txt.gz
```

With this, 406 with just foo.txt.gz:

```
URI: foo.txt.var

Description: uncompressed
URI: foo.txt

Content-Encoding: gzip
URI: foo.txt.gz
```

By adding Content-Type, it looks like it works for normal requests.

```
URI: foo.txt.var

Content-Type: text/plain
URI: foo.txt

Content-Encoding: gzip
Content-Type: text/plain
URI: foo.txt.gz
```

However, if I send a request with `Accept: text/html`, I get a 406. On the one
hand, that makes sense since all of the variants have a Content-Type that does
not match text/html. But on the other hand, it really doesn't make sense when
all I'm trying to negotiate is the Content-Encoding, not the Content-Type.

Is it intentional that Content-Type is required to be negotiated? If so, could
https://httpd.apache.org/docs/current/mod/mod_negotiation.html#typemaps be
updated to document that? If not, then I think there's a bug, or maybe I just
can't figure out how to negotiate Content-Encoding without also negotiating
Content-Type.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscr...@httpd.apache.org
For additional commands, e-mail: bugs-h...@httpd.apache.org

Reply via email to