influxdata / influxdata/influxdb
Incorrect Content-Type when serving MessagePack
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
I'd like to report a bug in influxdb2. There seems to be a problem in the way that influxdb2 handles MessagePack responses (on the v1 interface)
This bug triggers problems (crashes) in influxdb clients. See: https://github.com/influxdata/influxdb-python/issues/915
This seems to be a regression. influxdb 1.8 works fine.
### Steps to reproduce
Issue a web request to the influxdb server, and specifically request data to be returned in MessagePack format (by passing the 'Accept: application/x-msgpack' header)
curl -i "http://localhost:8086/query?q=show+measurements&db=mydb" -H "Authorization: Basic *******************" -H "Content-Type: application/json" -H "Accept: application/x-msgpack" --output -
### Result
The influxdb server replies, but it has the incorrect Content-Type in the reply.
```
HTTP/1.1 200 OK
Date: Wed, 23 Feb 2022 13:09:22 GMT
Content-Length: 83
Content-Type: application/octet-stream
??results???statement_id?series???name?measurements?columns??name?values???sensors(
```
The reply has the (incorrect) Content-Type: application/octet-stream
The actual response is fine. Its in MessagePack format, as requested. But the Content-Type header is wrong.
### Expected result
influxdb should responds with header:
`Content-Type: application/x-msgpack`
### version info
`influxdb2 2.0.3 amd64 Distributed time-series database.`
on `Ubuntu 20.04.4 LTS`
Older influxdb works fine (eg 1.8.3 does not have this problem, it responds with "Content-Type: application/x-msgpack"
### Notes
I'm not 100% sure this is a bug in influxdb (merely 95% :) ), if its not, then its a bug in influxdb-python. As that crashes on such responses.
Anyway its an omission in the documentation too. The return Content-Type seems not properly specified. see: https://docs.influxdata.com/influxdb/v2.1/api/v1-compatibility/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the v1 compatibility query with the provided curl command and the Accept: application/x-msgpack header. Trace how the response Content-Type is selected for MessagePack responses; done means the response remains MessagePack and returns Content-Type: application/x-msgpack instead of application/octet-stream.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100