snichol 2002/11/19 22:33:57
Modified: java/src/org/apache/soap/util/net HTTPUtils.java
Log:
Correctly handle HTTP headers with no value (just a header name).
Revision Changes Path
1.39 +9 -5 xml-soap/java/src/org/apache/soap/util/net/HTTPUtils.java
Index: HTTPUtils.java
===================================================================
RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/net/HTTPUtils.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- HTTPUtils.java 19 Nov 2002 02:47:38 -0000 1.38
+++ HTTPUtils.java 20 Nov 2002 06:33:57 -0000 1.39
@@ -577,14 +577,18 @@
throw new Exception("Reached end of stream while reading HTTP
response header");
if (count == 0) // Read the header/entity separator
break;
- if (nameEnd == -1 || valStart == -1)
+ if (nameEnd == -1)
throw new Exception("Incorrectly formed HTTP response header");
String name = new String(linebuf, 0, nameEnd, ISO_8859_1);
- // Remove trailing ; to prevent ContentType from throwing exception
- if (linebuf[count - 1] == ';')
- --count;
- String value = new String(linebuf, valStart, count - valStart,
ISO_8859_1);
+ String value = null;
+ if (valStart != -1) {
+ // Remove trailing ; to prevent ContentType from throwing
exception
+ if (linebuf[count - 1] == ';')
+ --count;
+ value = new String(linebuf, valStart, count - valStart,
ISO_8859_1);
+ } else
+ value = "";
if (name.equalsIgnoreCase(Constants.HEADER_CONTENT_LENGTH))
respContentLength = Integer.parseInt(value);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>