OpenSearch/distribution
Jay Modi 7520a107be Optionally require a valid content type for all rest requests with content (#22691)
This change adds a strict mode for xcontent parsing on the rest layer. The strict mode will be off by default for 5.x and in a separate commit will be enabled by default for 6.0. The strict mode, which can be enabled by setting `http.content_type.required: true` in 5.x, will require that all incoming rest requests have a valid and supported content type header before the request is dispatched. In the non-strict mode, the Content-Type header will be inspected and if it is not present or not valid, we will continue with auto detection of content like we have done previously.

The content type header is parsed to the matching XContentType value with the only exception being for plain text requests. This value is then passed on with the content bytes so that we can reduce the number of places where we need to auto-detect the content type.

As part of this, many transport requests and builders were updated to provide methods that
accepted the XContentType along with the bytes and the methods that would rely on auto-detection have been deprecated.

In the non-strict mode, deprecation warnings are issued whenever a request with body doesn't provide the Content-Type header.

See #19388
2017-02-02 14:07:13 -05:00
..
deb Remove much ceremony from parsing client yaml test suites (#22311) 2016-12-22 11:00:34 -05:00
integ-test-zip Optionally require a valid content type for all rest requests with content (#22691) 2017-02-02 14:07:13 -05:00
rpm Remove much ceremony from parsing client yaml test suites (#22311) 2016-12-22 11:00:34 -05:00
src/main Add example configuration for rotating GC log (#22715) 2017-01-20 13:23:04 +01:00
tar Remove much ceremony from parsing client yaml test suites (#22311) 2016-12-22 11:00:34 -05:00
zip Remove much ceremony from parsing client yaml test suites (#22311) 2016-12-22 11:00:34 -05:00
build.gradle remove double slash from license header 2017-01-05 17:15:34 +01:00