Closed pmo-sdr closed 5 years ago
Thank you for so detailed analysis. The bug reports that include solution hints are the best ones! :)
We haven't detected this bug in our e2e CI system after upgrading Flume to 1.9 but probably we are not covering this specific case.
Maybe you could do a PR with the fix? Or prefer us to do so?
We are launching local tests right now, we will do a PR when finished.
We haven't detected this bug in our e2e CI system after upgrading Flume to 1.9 but probably we are not covering this specific case.
This explain why we haven't seen fails in e2e CI after the change in pom.xml files: https://github.com/telefonicaid/fiware-cygnus/pull/1604#issuecomment-476571136
When Apache Flume is updated to v1.9 unexpected "400 Bad request" was returned while sending data to Cygnus.
How to
Sending like (working ok with v1.4)
You get:
Why
Tip: Sending:
You get (notice "UTF-8" uppercase received)
Sending whitout space before "application":
You get: (notice "utf-8" received as is)
It looks like version 3.1 of javax.servlet, introduced by Flume 1.9, formats header values and causes wrongContentType() method to fail validating value.
https://github.com/telefonicaid/fiware-cygnus/blob/c43bdf845a6ea890b5ed856370b314abf199fc9b/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/handlers/NGSIRestHandler.java#L395-L397
Solution
We think toLowerCase is needed at NGSIRestHandler line 396 (or 184) to solve this issue.
https://github.com/telefonicaid/fiware-cygnus/blob/c43bdf845a6ea890b5ed856370b314abf199fc9b/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/handlers/NGSIRestHandler.java#L183-L194