remm 02/03/10 16:35:25 Modified: http11/src/java/org/apache/coyote/http11 Constants.java Http11Processor.java InternalInputBuffer.java Log: - Remove the URL i18n flag. Instead, provide a way to do a memory efficient URL decoding. This should allow clean i18n support for the URL. - Not optimal for TC 4.0.x performance wise (although the performance hit isn't very severe). I will make a (simple) proposal to refactor the HEAD branch to take advantage of this (this will also allow fixing bug 6286). Revision Changes Path 1.7 +6 -0 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Constants.java Index: Constants.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Constants.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Constants.java 10 Jan 2002 16:58:17 -0000 1.6 +++ Constants.java 11 Mar 2002 00:35:25 -0000 1.7 @@ -133,6 +133,12 @@ /** + * '?'. + */ + public static final byte QUESTION = (byte) '?'; + + + /** * Lower case offset. */ public static final byte LC_OFFSET = A - a; 1.7 +8 -32 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java Index: Http11Processor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Http11Processor.java 9 Mar 2002 19:05:35 -0000 1.6 +++ Http11Processor.java 11 Mar 2002 00:35:25 -0000 1.7 @@ -249,26 +249,6 @@ /** - * Get the value of the internationalized URI flag. - * - * @return the value of the internationalized URI flag - */ - public boolean isInternationalizedURIAllowed() { - return inputBuffer.isInternationalizedURIAllowed(); - } - - - /** - * Set the value of the internationalized URI flag. - * - * @param flag New value of the internationalized URI flag - */ - public void setInternationalizedURIAllowed(boolean flag) { - inputBuffer.setInternationalizedURIAllowed(flag); - } - - - /** * Process pipelined HTTP requests using the specified input and output * streams. * @@ -294,8 +274,6 @@ try { inputBuffer.parseRequestLine(); - // Check for HTTP/0.9 - inputBuffer.parseHeaders(); } catch (IOException e) { error = true; @@ -510,18 +488,16 @@ } } - // URI parsing - String unparsedURI = request.unparsedURI().toString(); - int questionPos = unparsedURI.indexOf('?'); - if (questionPos >= 0) { - request.queryString().setString - (unparsedURI.substring(questionPos + 1)); - request.requestURI().setString - (unparsedURI.substring(0, questionPos)); - } else { - request.requestURI().setString(unparsedURI); + // URI decoding + try { + request.decodedURI().duplicate(request.requestURI()); + request.getURLDecoder().convert(request.decodedURI(), true); + } catch (IOException e) { + // URL decoding failed + e.printStackTrace(); } + // Input filter setup InputFilter[] inputFilters = inputBuffer.getFilters(); // Parse content-length header 1.13 +20 -47 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java Index: InternalInputBuffer.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- InternalInputBuffer.java 9 Mar 2002 19:18:39 -0000 1.12 +++ InternalInputBuffer.java 11 Mar 2002 00:35:25 -0000 1.13 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java,v 1.12 2002/03/09 19:18:39 remm Exp $ - * $Revision: 1.12 $ - * $Date: 2002/03/09 19:18:39 $ + * $Header: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java,v 1.13 2002/03/11 00:35:25 remm Exp $ + * $Revision: 1.13 $ + * $Date: 2002/03/11 00:35:25 $ * * ==================================================================== * @@ -206,13 +206,6 @@ /** - * Allow i18n URLs (non-standard URLs conatining non %xx encoded - * bytes >127). - */ - protected boolean internationalizedURIAllowed = false; - - - /** * Underlying input stream. */ protected InputStream inputStream; @@ -330,28 +323,6 @@ } - /** - * Get the value of the internationalized URI flag. - * - * @return the value of the internationalized URI flag - */ - public boolean isInternationalizedURIAllowed() { - return (internationalizedURIAllowed); - } - - - /** - * Set the value of the internationalized URI flag. - * - * @param internationalizedURIAllowed New value of the internationalized - * URI flag - */ - public void setInternationalizedURIAllowed - (boolean internationalizedURIAllowed) { - this.internationalizedURIAllowed = internationalizedURIAllowed; - } - - // --------------------------------------------------------- Public Methods @@ -494,11 +465,11 @@ // Mark the current buffer position start = pos; + int end = 0; + int questionPos = -1; // // Reading the URI - // URI is considered US-ASCII unless the 'internationalizedURIAllowed' - // is set to 'true' // space = false; @@ -512,34 +483,36 @@ throw new EOFException(sm.getString("iib.eof.error")); } - ascbuf[pos] = (char) buf[pos]; - if (buf[pos] == Constants.SP) { space = true; - if (internationalizedURIAllowed) { - request.unparsedURI().setBytes(buf, start, pos - start); - } else { - request.unparsedURI().setChars(ascbuf, start, pos - start); - } + end = pos; } else if ((buf[pos] == Constants.CR) || (buf[pos] == Constants.LF)) { // HTTP/0.9 style request eol = true; space = true; - if (internationalizedURIAllowed) { - request.unparsedURI().setBytes(buf, start, pos - start); - } else { - request.unparsedURI().setChars(ascbuf, start, pos - start); - } + end = pos; + } else if ((buf[pos] == Constants.QUESTION) + && (questionPos == -1)) { + questionPos = pos; } pos++; } + request.unparsedURI().setBytes(buf, start, end - start); + if (questionPos >= 0) { + request.queryString().setBytes(buf, questionPos + 1, + end - questionPos - 1); + request.requestURI().setBytes(buf, start, questionPos - start); + } else { + request.requestURI().setBytes(buf, start, end - start); + } + // Mark the current buffer position start = pos; - int end = 0; + end = 0; // // Reading the protocol
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>