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

Support "Content-Type: application/json; charset=utf-8" #35

Closed
maximpashuk opened this issue Nov 18, 2015 · 4 comments
Closed

Support "Content-Type: application/json; charset=utf-8" #35

maximpashuk opened this issue Nov 18, 2015 · 4 comments

Comments

@maximpashuk
Copy link

I am using logstash 1.5.4.

If I post log message with content-type "application/json" everything works fine.
Hovever, if I use content-type "application/json; charset=utf-8" json message is not processed by logstash (probably because of fallback to plain codec).

Content type with charset specified is standard thing, I think it should be supported by logstash.

My pain is that .NET HttpClient class by default add charset to content-type, so I should explicitly customize HttpClient not to add charset to content-type.

@porcobravo
Copy link

Faced same issue, but there is an easy workaround to overcome it. In logstash configuration file specify codec=> json and it should work smoothly.

@hackery
Copy link

hackery commented Jan 18, 2018

Encountered the same bug this week - not easy to chase down and broke my QA environment for a day.

https://github.com/logstash-plugins/logstash-input-http/blob/master/lib/logstash/inputs/http.rb#L154

Is this not easily addressed by parsing out the Content-Type into type/subtype and removing any subsequent parameters? Perhaps the correct fallback sequence with regard to the entries in additional_codecs should be

  • exact match on "type/subtype; parameter[; parameter]*"
  • match on "type/subtype"
  • default to "plain"

@ebuildy
Copy link
Contributor

ebuildy commented May 9, 2018

yes this should be possible with https://netty.io/4.1/api/io/netty/handler/codec/http/HttpUtil.html#getMimeType-io.netty.handler.codec.http.HttpMessage-:

"content-type: text/html; charset=utf-8" - "text/html" will be returned 
"content-type: text/html" - "text/html" will be returned 
"content-type: empty header - null we be returned

Something like master...ebuildy:patch-1

@jsvd
Copy link
Member

jsvd commented May 11, 2018

solved by #87

@jsvd jsvd closed this as completed May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants