Revathy Ramalingam created HTTPCORE-800:
-------------------------------------------
Summary: HttpException.clean() incorrectly handles/escapes control
characters like newline
Key: HTTPCORE-800
URL: https://issues.apache.org/jira/browse/HTTPCORE-800
Project: HttpComponents HttpCore
Issue Type: Bug
Components: HttpCore
Affects Versions: 5.5-beta2
Environment: windows/ubuntu
Reporter: Revathy Ramalingam
Fix For: Future
{{HttpException.clean()}} in Apache HttpCore incorrectly handles newline
characters when sanitizing an exception message.
When the exception message contains a newline ({{{}\n{}}}), {{clean()}}
replaces the control character with a hexadecimal representation. However, the
implementation uses the *character's index in the string* instead of the
character's actual code point:
{{final String hexString = Integer.toHexString(i);}}
Here, {{i}} is the index of the character in the message. It should use the
character itself:
{{final String hexString = Integer.toHexString(ch);}}
For example, a newline character is ASCII {{10}} ({{{}0x0A{}}}). If the newline
occurs at index {{54}} in the message, the current implementation produces:
{{[0x36]}}
because {{54}} in hexadecimal is {{{}36{}}}.
The expected representation should be:
{{[0xA]}}
or an equivalent representation of the actual character code.
This causes Kestra HTTP request failure messages containing multiline response
bodies to display incorrect values such as {{[0x36]}} instead of correctly
representing the newline character.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]