Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBOR: Improve recognition of CBOR data format #7640

Closed
clintongormley opened this issue Sep 8, 2014 · 8 comments
Closed

CBOR: Improve recognition of CBOR data format #7640

clintongormley opened this issue Sep 8, 2014 · 8 comments
Assignees

Comments

@clintongormley
Copy link
Contributor

Currently we only check if the first byte of the body is a BYTE_OBJECT_INDEFINITE to determine whether the content is CBOR or not. However, what we should actually do is to check whether the "major type" is an object.

See:

Also, CBOR can be prefixed with a self-identifying tag, 0xd9d9f7, which we should check for as well. Currently Jackson doesn't recognise this tag, but it looks like that will change in the future: https://github.com/FasterXML/jackson-dataformat-cbor/issues/6

@clintongormley
Copy link
Contributor Author

Jackson 2.4.3 now contains the above fixes. We should upgrade and add the changes mentioned above.

@s1monw
Copy link
Contributor

s1monw commented Nov 21, 2014

if we get a fix for this I think it should go into 1.3.6

@s1monw
Copy link
Contributor

s1monw commented Nov 23, 2014

do we need to do anything else than upgrading jackson? @pickypg do you have a ETA for this?

@pickypg
Copy link
Member

pickypg commented Nov 24, 2014

I should have this up for review on Monday.

We need to change XContentFactory.xContentType(...) to support the new header. By default, the new CBORGenerator.Feature.WRITE_TYPE_HEADER feature is false, so just upgrading will do nothing (nothing breaks, but nothing improves).

@pickypg
Copy link
Member

pickypg commented Nov 25, 2014

Merged

@pickypg pickypg closed this as completed Nov 25, 2014
pickypg added a commit that referenced this issue Nov 25, 2014
- Update pom to 2.4.3 from 2.4.2
- Enable the CBOR data header (aka tag) from the CBOR Generator to provide binary identification like the Smile format
- Check for the CBOR header and ensure that the data sent in represents a "major type" that is an object
- Cleans up `JsonVsCborTests` unused imports

Closes #7640

Conflicts:
	pom.xml
pickypg added a commit that referenced this issue Nov 25, 2014
- Update pom to 2.4.3 from 2.4.2
- Enable the CBOR data header (aka tag) from the CBOR Generator to provide binary identification like the Smile format
- Check for the CBOR header and ensure that the data sent in represents a "major type" that is an object
- Cleans up `JsonVsCborTests` unused imports

Closes #7640

Conflicts:
	pom.xml
@clintongormley clintongormley changed the title Improve recognition of CBOR data format CBOR: Improve recognition of CBOR data format Nov 25, 2014
@pickypg
Copy link
Member

pickypg commented Nov 25, 2014

This was reverted because the JSON tokenizer was acting up in some of the randomized tests. I am looking at the root cause (my change or just incoming changes from 2.4.3).

@pickypg pickypg reopened this Nov 25, 2014
kimchy added a commit to kimchy/elasticsearch that referenced this issue Mar 6, 2015
CBOR has a special header that is optional, if exists, allows for exact detection. Also, since we know which formats we support in ES, we can support the object major type case.
closes elastic#7640
@kimchy kimchy closed this as completed in 31b63b1 Mar 20, 2015
kimchy added a commit that referenced this issue Mar 20, 2015
CBOR has a special header that is optional, if exists, allows for exact detection. Also, since we know which formats we support in ES, we can support the object major type case.
closes #7640
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
- Update pom to 2.4.3 from 2.4.2
- Enable the CBOR data header (aka tag) from the CBOR Generator to provide binary identification like the Smile format
- Check for the CBOR header and ensure that the data sent in represents a "major type" that is an object
- Cleans up `JsonVsCborTests` unused imports

Closes elastic#7640

Conflicts:
	pom.xml
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
- Update pom to 2.4.3 from 2.4.2
- Enable the CBOR data header (aka tag) from the CBOR Generator to provide binary identification like the Smile format
- Check for the CBOR header and ensure that the data sent in represents a "major type" that is an object
- Cleans up `JsonVsCborTests` unused imports

Closes elastic#7640

Conflicts:
	pom.xml
@johnrfrank
Copy link

@clintongormley it'd be great to have this feature. What are the chances this will get into an upcoming release of Elasticsearch?

@nik9000
Copy link
Member

nik9000 commented May 30, 2017

@johnrfrank this was merged into 2.0.0. We've since deprecated content detection in favor of providing a content-type header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants