carterkozak commented on a change in pull request #284: URL: https://github.com/apache/httpcomponents-core/pull/284#discussion_r617747480
########## File path: httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/StringAsyncEntityProducer.java ########## @@ -54,6 +55,7 @@ public StringAsyncEntityProducer( super(bufferSize, fragmentSizeHint, contentType); Args.notNull(content, "Content"); this.content = CharBuffer.wrap(content); + this.length = content.toString().getBytes(contentType.getCharset()).length; Review comment: This is potentially very expensive in the case a large constant string is reused across many requests. Can we take some shortcuts, perhaps by validating the string is ascii, and using the input length in that case? -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org