wonyongChoi05 commented on code in PR #662: URL: https://github.com/apache/tomcat/pull/662#discussion_r1317009172
########## java/org/apache/coyote/Request.java: ########## @@ -853,24 +846,22 @@ public boolean isProcessing() { * @param contentType a content type header */ private static String getCharsetFromContentType(String contentType) { - if (contentType == null) { return null; } int start = contentType.indexOf("charset="); if (start < 0) { return null; } - String encoding = contentType.substring(start + 8); - int end = encoding.indexOf(';'); + start += 8; + int end = contentType.indexOf(';', start); + String encoding; if (end >= 0) { - encoding = encoding.substring(0, end); + encoding = contentType.substring(start, end).trim(); + } else { + encoding = contentType.substring(start).trim(); } - encoding = encoding.trim(); - if ((encoding.length() > 2) && (encoding.startsWith("\"")) && (encoding.endsWith("\""))) { - encoding = encoding.substring(1, encoding.length() - 1); - } - - return encoding.trim(); + return encoding.replaceAll("\"", ""); Review Comment: I'm curious whether there are any performance advantages when using MediaType to comply with the specification compared to the existing code. Additionally, I'm interested in knowing whether the existing code already adhered to the specification as well as MediaType does. -- 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: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org