summaryrefslogtreecommitdiff
path: root/gnu/java/net/protocol/http/Connection.java
diff options
context:
space:
mode:
authorGuilhem Lavaux <guilhem@kaffe.org>2003-12-27 16:29:52 +0000
committerGuilhem Lavaux <guilhem@kaffe.org>2003-12-27 16:29:52 +0000
commit61c28649d91525226dfa8dcbf8efefc6ce3b69af (patch)
tree0c678070b0be4479ac33eb83665407a3c84a6e79 /gnu/java/net/protocol/http/Connection.java
parent8e3bd9420af6dc8e2328c56e75a8b6790be54969 (diff)
downloadclasspath-61c28649d91525226dfa8dcbf8efefc6ce3b69af.tar.gz
* gnu/java/net/protocol/http/Connection.java
(receiveReply): Add the null header containing the reply of the server. (getHeaderField, getHeaderFieldKey): Check whether the connection has already been established.
Diffstat (limited to 'gnu/java/net/protocol/http/Connection.java')
-rw-r--r--gnu/java/net/protocol/http/Connection.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/gnu/java/net/protocol/http/Connection.java b/gnu/java/net/protocol/http/Connection.java
index d4d10b260..66a2f7510 100644
--- a/gnu/java/net/protocol/http/Connection.java
+++ b/gnu/java/net/protocol/http/Connection.java
@@ -255,6 +255,8 @@ public final class Connection extends HttpURLConnection
|| (line.length() < (idx + 6)))
throw new IOException ("Server reply was unparseable: " + saveline);
+ headers.addHeaderField (null, line);
+
line = line.substring (idx + 1);
String code = line.substring (0, 3);
@@ -420,6 +422,16 @@ public final class Connection extends HttpURLConnection
*/
public String getHeaderField(int n)
{
+ if (!connected)
+ try
+ {
+ connect();
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+
return headers.getHeaderFieldValueByIndex (n);
}
@@ -434,6 +446,16 @@ public final class Connection extends HttpURLConnection
*/
public String getHeaderFieldKey(int n)
{
+ if (!connected)
+ try
+ {
+ connect();
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+
return headers.getHeaderFieldKeyByIndex (n);
}
}