markt 2004/08/12 12:48:06 Modified: coyote/src/java/org/apache/coyote Request.java util/java/org/apache/tomcat/util/buf Ascii.java Log: Housekeeping before making some changes - Convert tabs to 8 spaces - Remove unused field Revision Changes Path 1.29 +26 -32 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java Index: Request.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- Request.java 7 Jul 2004 16:29:34 -0000 1.28 +++ Request.java 12 Aug 2004 19:48:05 -0000 1.29 @@ -135,9 +135,6 @@ * HTTP specific fields. (remove them ?) */ private int contentLength = -1; - // how much body we still have to read. - // Apparently nobody uses this field... - private int available = -1; private MessageBytes contentTypeMB = null; private String charEncoding = null; private Cookies cookies = new Cookies(headers); @@ -222,7 +219,7 @@ * Host: header. */ public MessageBytes serverName() { - return serverNameMB; + return serverNameMB; } public int getServerPort() { @@ -230,31 +227,31 @@ } public void setServerPort(int serverPort ) { - this.serverPort=serverPort; + this.serverPort=serverPort; } public MessageBytes remoteAddr() { - return remoteAddrMB; + return remoteAddrMB; } public MessageBytes remoteHost() { - return remoteHostMB; + return remoteHostMB; } public MessageBytes localName() { - return localNameMB; + return localNameMB; } public MessageBytes localAddr() { - return localAddrMB; + return localAddrMB; } public String getLocalHost() { - return localHost; + return localHost; } public void setLocalHost(String host) { - this.localHost = host; + this.localHost = host; } public int getRemotePort(){ @@ -291,24 +288,22 @@ public void setCharacterEncoding(String enc) { - this.charEncoding = enc; + this.charEncoding = enc; } public void setContentLength(int len) { - this.contentLength = len; - available = len; + this.contentLength = len; } public int getContentLength() { if( contentLength > -1 ) return contentLength; - MessageBytes clB = headers.getValue("content-length"); + MessageBytes clB = headers.getValue("content-length"); contentLength = (clB == null || clB.isNull()) ? -1 : clB.getInt(); - available = contentLength; - return contentLength; + return contentLength; } @@ -369,7 +364,7 @@ public Cookies getCookies() { - return cookies; + return cookies; } @@ -377,7 +372,7 @@ public Parameters getParameters() { - return parameters; + return parameters; } @@ -424,7 +419,6 @@ throws IOException { int n = inputBuffer.doRead(chunk, this); if (n > 0) { - available -= n; bytesRead+=n; } return n; @@ -434,7 +428,7 @@ // -------------------- debug -------------------- public String toString() { - return "R( " + requestURI().toString() + ")"; + return "R( " + requestURI().toString() + ")"; } public long getStartTime() { @@ -449,12 +443,12 @@ public final void setNote(int pos, Object value) { - notes[pos] = value; + notes[pos] = value; } public final Object getNote(int pos) { - return notes[pos]; + return notes[pos]; } @@ -464,7 +458,7 @@ public void recycle() { bytesRead=0; - contentLength = -1; + contentLength = -1; contentTypeMB = null; charEncoding = null; headers.recycle(); @@ -473,21 +467,21 @@ localPort = -1; remotePort = -1; - cookies.recycle(); + cookies.recycle(); parameters.recycle(); unparsedURIMB.recycle(); uriMB.recycle(); decodedUriMB.recycle(); - queryMB.recycle(); - methodMB.recycle(); - protoMB.recycle(); - //remoteAddrMB.recycle(); - //remoteHostMB.recycle(); + queryMB.recycle(); + methodMB.recycle(); + protoMB.recycle(); + //remoteAddrMB.recycle(); + //remoteHostMB.recycle(); - // XXX Do we need such defaults ? + // XXX Do we need such defaults ? schemeMB.recycle(); - methodMB.setString("GET"); + methodMB.setString("GET"); uriMB.setString("/"); queryMB.setString(""); protoMB.setString("HTTP/1.0"); 1.3 +61 -61 jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/Ascii.java Index: Ascii.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/Ascii.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Ascii.java 24 Feb 2004 08:50:06 -0000 1.2 +++ Ascii.java 12 Aug 2004 19:48:06 -0000 1.3 @@ -45,32 +45,32 @@ */ static { - for (int i = 0; i < 256; i++) { - toUpper[i] = (byte)i; - toLower[i] = (byte)i; - } - - for (int lc = 'a'; lc <= 'z'; lc++) { - int uc = lc + 'A' - 'a'; - - toUpper[lc] = (byte)uc; - toLower[uc] = (byte)lc; - isAlpha[lc] = true; - isAlpha[uc] = true; - isLower[lc] = true; - isUpper[uc] = true; - } - - isWhite[ ' '] = true; - isWhite['\t'] = true; - isWhite['\r'] = true; - isWhite['\n'] = true; - isWhite['\f'] = true; - isWhite['\b'] = true; - - for (int d = '0'; d <= '9'; d++) { - isDigit[d] = true; - } + for (int i = 0; i < 256; i++) { + toUpper[i] = (byte)i; + toLower[i] = (byte)i; + } + + for (int lc = 'a'; lc <= 'z'; lc++) { + int uc = lc + 'A' - 'a'; + + toUpper[lc] = (byte)uc; + toLower[uc] = (byte)lc; + isAlpha[lc] = true; + isAlpha[uc] = true; + isLower[lc] = true; + isUpper[uc] = true; + } + + isWhite[ ' '] = true; + isWhite['\t'] = true; + isWhite['\r'] = true; + isWhite['\n'] = true; + isWhite['\f'] = true; + isWhite['\b'] = true; + + for (int d = '0'; d <= '9'; d++) { + isDigit[d] = true; + } } /** @@ -78,7 +78,7 @@ */ public static int toUpper(int c) { - return toUpper[c & 0xff] & 0xff; + return toUpper[c & 0xff] & 0xff; } /** @@ -86,7 +86,7 @@ */ public static int toLower(int c) { - return toLower[c & 0xff] & 0xff; + return toLower[c & 0xff] & 0xff; } /** @@ -94,7 +94,7 @@ */ public static boolean isAlpha(int c) { - return isAlpha[c & 0xff]; + return isAlpha[c & 0xff]; } /** @@ -102,7 +102,7 @@ */ public static boolean isUpper(int c) { - return isUpper[c & 0xff]; + return isUpper[c & 0xff]; } /** @@ -110,7 +110,7 @@ */ public static boolean isLower(int c) { - return isLower[c & 0xff]; + return isLower[c & 0xff]; } /** @@ -118,7 +118,7 @@ */ public static boolean isWhite(int c) { - return isWhite[c & 0xff]; + return isWhite[c & 0xff]; } /** @@ -126,7 +126,7 @@ */ public static boolean isDigit(int c) { - return isDigit[c & 0xff]; + return isDigit[c & 0xff]; } /** @@ -137,45 +137,45 @@ * @exception NumberFormatException if the integer format was invalid */ public static int parseInt(byte[] b, int off, int len) - throws NumberFormatException + throws NumberFormatException { int c; - if (b == null || len <= 0 || !isDigit(c = b[off++])) { - throw new NumberFormatException(); - } - - int n = c - '0'; - - while (--len > 0) { - if (!isDigit(c = b[off++])) { - throw new NumberFormatException(); - } - n = n * 10 + c - '0'; - } + if (b == null || len <= 0 || !isDigit(c = b[off++])) { + throw new NumberFormatException(); + } + + int n = c - '0'; + + while (--len > 0) { + if (!isDigit(c = b[off++])) { + throw new NumberFormatException(); + } + n = n * 10 + c - '0'; + } - return n; + return n; } public static int parseInt(char[] b, int off, int len) - throws NumberFormatException + throws NumberFormatException { int c; - if (b == null || len <= 0 || !isDigit(c = b[off++])) { - throw new NumberFormatException(); - } - - int n = c - '0'; - - while (--len > 0) { - if (!isDigit(c = b[off++])) { - throw new NumberFormatException(); - } - n = n * 10 + c - '0'; - } + if (b == null || len <= 0 || !isDigit(c = b[off++])) { + throw new NumberFormatException(); + } + + int n = c - '0'; + + while (--len > 0) { + if (!isDigit(c = b[off++])) { + throw new NumberFormatException(); + } + n = n * 10 + c - '0'; + } - return n; + return n; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]