jira-importer opened a new issue, #1501:
URL: https://github.com/apache/httpcomponents-core/issues/1501

   **[Revathy 
Ramalingam](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER314715)**
 opened 
**[HTTPCORE-800](https://issues.apache.org/jira/browse/HTTPCORE-800?redirect=false)**
 and commented
   
   `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.
   
   
   ---
   
   **Affects:** 5.5-beta2
   
   **Backported to:** 
[5.4.4](https://github.com/apache/httpcomponents-core/milestone/107?closed=1)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to