Skip to content

Requests should be gzipped when Accept-Encoding explicitly rejects identity #1855

@colega

Description

@colega

Describe the bug

When Accept-Encoding: gzip;q=1, *;q=0 request is received, we should encode the response as gzip even if it's smaller than the default min size (1500B). However, we don't.

To Reproduce

Steps to reproduce the behavior:

  1. Build Mimir @ 93dbb1fc6197e381e3265f72d9c1b399afe570e3
  2. Build it make ./cmd/mimir/.uptodate
  3. Run the tutorial cd tutorials/play-with-grafana-mimir && docker-compose up
  4. Run curl:
$ curl -v -H'X-Scope-OrgId: demo' -H'Accept-Encoding: gzip=1; *;q=0' 'http://localhost:9009/prometheus/api/v1/query?query=1'
*   Trying 127.0.0.1:9009...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9009 (#0)
> GET /prometheus/api/v1/query?query=1 HTTP/1.1
> Host: localhost:9009
> User-Agent: curl/7.68.0
> Accept: */*
> X-Scope-OrgId: demo
> Accept-Encoding: gzip=1; *;q=0
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.21.6
< Date: Mon, 16 May 2022 15:57:07 GMT
< Content-Type: application/json
< Content-Length: 77
< Connection: keep-alive
< Server-Timing: querier_wall_time;dur=0.290327, response_time;dur=0.74459
< Vary: Accept-Encoding
< 
* Connection #0 to host localhost left intact
{"status":"success","data":{"resultType":"scalar","result":[1652716627,"1"]}}

Expected behavior

Response should be gzip-encoded (or 406 Not Acceptable status should be returned)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions