Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Read Activity Data directly from InputStream - #137

Merged
tracyboehrer (tracyboehrer) merged 1 commit into
microsoft:masterfrom
matthiasblaesing:utf8-stream
Oct 28, 2019
Merged

Read Activity Data directly from InputStream#137
tracyboehrer (tracyboehrer) merged 1 commit into
microsoft:masterfrom
matthiasblaesing:utf8-stream

Conversation

@matthiasblaesing

Copy link
Copy Markdown
Contributor

The input from the bot is marked as content-type "appliation/json; charset=utf-8"
even if the charset would not be explicitly stated, RFC8259 requires the
encoding to be UTF-8.

The approach to read individual bytes from the inputstream and treat
each byte as a character (ControllerBase.java) or even as url encoded
data (app.java) are just invalid and work by plain luck. If only ascii
input is tested, it most probably mostly works, but fails for all inputs
with high bytes set.

Jackson can decode JSON directly from an inputstream and then does the
right thing, there is no need to manually read the stream.

The input from the bot is marked as content-type "appliation/json; charset=utf-8"
even if the charset would not be explicitly stated, RFC8259 requires the
encoding to be UTF-8.

The approach to read individual bytes from the inputstream and treat
each byte as a character (ControllerBase.java) or even as url encoded
data (app.java) are just invalid and work by plain luck. If only ascii
input is tested, it most probably mostly works, but fails for all inputs
with high bytes set.

Jackson can decode JSON directly from an inputstream and then does the
right thing, there is no need to manually read the stream.
@msftclas

Microsoft Contribution License Agreements (msftclas) commented Oct 27, 2019

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tracyboehrer
tracyboehrer (tracyboehrer) merged commit ad8eb63 into microsoft:master Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants