java.net/170: HTTP client code treats headers as body
Bryce McKinlay
bryce@albatross.co.nz
Thu Mar 9 18:30:00 GMT 2000
The following reply was made to PR java.net/170; it has been noted by GNATS.
From: Bryce McKinlay <bryce@albatross.co.nz>
To: francis@ecal.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: java.net/170: HTTP client code treats headers as body
Date: Fri, 10 Mar 2000 15:21:09 +1300
Actually, the second part of the 170 patch is wrong, I think. The http status
line is what is returned by getHeaderField(0), so it shouldn't be skipped.
regards
[ bryce ]
@@ -247,6 +246,9 @@
boolean gotnl = false;
byte[] ch = new byte[1];
ch[0] = (byte) '\n';
+
+ boolean isFirst=true;
+
while (true)
{
// Check for leftover byte from non-'\n' after a '\r'.
@@ -266,6 +268,13 @@
}
}
line = line + new String(buf, 0, i);
+
+ if (isFirst) // skip the status line
+ {
+ isFirst=false;
+ line="";
+ continue;
+ }
More information about the Java-prs
mailing list