You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by og...@apache.org on 2005/01/11 14:57:06 UTC
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpParser.java
oglueck 2005/01/11 05:57:06
Modified: httpclient/src/java/org/apache/commons/httpclient
HttpParser.java
Log:
doc (as a result of bug #33041)
Revision Changes Path
1.13 +9 -7 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpParser.java
Index: HttpParser.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpParser.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HttpParser.java 13 May 2004 04:03:25 -0000 1.12
+++ HttpParser.java 11 Jan 2005 13:57:06 -0000 1.13
@@ -39,7 +39,8 @@
import org.apache.commons.logging.LogFactory;
/**
- * A utility class for parsing http header values.
+ * A utility class for parsing http header values according to
+ * RFC-2616 Section 4 and 19.3.
*
* @author Michael Becke
* @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
@@ -61,7 +62,7 @@
* Stop reading when <tt>"\n"</tt> terminator encountered
* If the stream ends before the line terminator is found,
* the last part of the string will still be returned.
- * If no input data available, <code>null</code> is returned
+ * If no input data available, <code>null</code> is returned.
*
* @param inputStream the stream to read from
*
@@ -75,7 +76,7 @@
int ch;
while ((ch = inputStream.read()) >= 0) {
buf.write(ch);
- if (ch == '\n') {
+ if (ch == '\n') { // be tolerant (RFC-2616 Section 19.3)
break;
}
}
@@ -89,7 +90,7 @@
* Read up to <tt>"\n"</tt> from an (unchunked) input stream.
* If the stream ends before the line terminator is found,
* the last part of the string will still be returned.
- * If no input data available, <code>null</code> is returned
+ * If no input data available, <code>null</code> is returned.
*
* @param inputStream the stream to read from
* @param charset charset of HTTP protocol elements
@@ -105,6 +106,7 @@
if (rawdata == null) {
return null;
}
+ // strip CR and LF from the end
int len = rawdata.length;
int offset = 0;
if (len > 0) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org