ricellis opened a new issue #3300:
URL: https://github.com/apache/couchdb/issues/3300
[NOTE]: # ( ^^ Provide a general summary of the issue in the title above. ^^
)
## Description
[NOTE]: # ( Describe the problem you're encountering. )
[TIP]: # ( Do NOT give us access or passwords to your actual CouchDB! )
Posting a gzipped body to `_session` with `Content-Encoding: gzip` results
in:
`{"error":"bad_request","reason":"invalid UTF-8 JSON"}`
## Steps to Reproduce
[NOTE]: # ( Include commands to reproduce, if possible. curl is preferred. )
1. `echo '{"username":"user123","password":"123password"}' | gzip >
session.json.gz`
1. `curl -H 'Content-Encoding: gzip' -H 'Content-Type: application/json' -d
@session.json.gz http://localhost:5984/_session`
1. `{"error":"bad_request","reason":"invalid UTF-8 JSON"}`
## Expected Behaviour
[NOTE]: # ( Tell us what you expected to happen. )
As far as I can tell every endpoint in CouchDB supports `gzip` or `deflate`
encoded bodies so I would expect this request to be accepted and suceed the
same way it does if the body is not compressed.
Alternatively, if `gzip` encoding is really not acceptable here then the
server should respond with the [correct status
code](https://tools.ietf.org/html/rfc7231#section-6.5.13) `415`. The current
`400` and error message is incorrect - the JSON is completely valid (ofc I can
see why the server thinks it's bad JSON when it reads a bunch of compressed
bytes instead, but it shouldn't do that).
## Your Environment
[TIP]: # ( Include as many relevant details about your environment as
possible. )
[TIP]: # ( You can paste the output of curl http://YOUR-COUCHDB:5984/ here.
)
* CouchDB version used: 3.1.1
* Browser name and version: N/A
* Operating system and version: macOS
## Additional Context
[TIP]: # ( Add any other context about the problem here. )
It would be preferable to accept the compressed bodies for this endpoint in
the same way as all the others do because it is far easier in clients and
proxies to enable request body compression for all requests than it is to have
to control it per endpoint.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]