ok2c commented on code in PR #725:
URL:
https://github.com/apache/httpcomponents-core/pull/725#discussion_r4337036105
##########
httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionOutputBufferImpl.java:
##########
@@ -198,7 +198,16 @@ public void writeLine(final CharArrayBuffer lineBuffer)
throws CharacterCodingEx
// terminate the encoding process
eol = true;
}
+ // Filter controls while copying into the encoder's
staging buffer.
+ final int start = this.charbuffer.position();
this.charbuffer.put(lineBuffer.array(), offset, l);
Review Comment:
@arturobernalg I would do the input sanitization here while coping from
`lineBuffer` to `charbuffer`.
##########
httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionOutputBufferImpl.java:
##########
@@ -198,7 +198,16 @@ public void writeLine(final CharArrayBuffer lineBuffer)
throws CharacterCodingEx
// terminate the encoding process
eol = true;
}
+ // Filter controls while copying into the encoder's
staging buffer.
+ final int start = this.charbuffer.position();
this.charbuffer.put(lineBuffer.array(), offset, l);
+ final int end = this.charbuffer.position();
+ for (int i = start; i < end; i++) {
+ final char ch = this.charbuffer.get(i);
+ if (ch < 0x20 && ch != '\t' || ch >= 0x7f && ch <=
0x9f) {
Review Comment:
@arturobernalg Ideally this logic should provided by `TextUtils` and shared
with `castAsByte`
--
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]