Hi,

Here are two fixes concerning HTTP. Briefly:
* receiveReply() must also add the reponse to the header list (maybe some doc should be added about it)
* getHeaderField() and getHeaderFieldKey() must check the state of the connection and
try to open it if it's closed.


Guilhem.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.1723
diff -u -r1.1723 ChangeLog
--- ChangeLog   27 Dec 2003 13:38:17 -0000      1.1723
+++ ChangeLog   27 Dec 2003 16:21:36 -0000
@@ -1,5 +1,12 @@
 2003-12-27  Guilhem Lavaux <[EMAIL PROTECTED]>
 
+       * 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.
+
+2003-12-27  Guilhem Lavaux <[EMAIL PROTECTED]>
+
        * java/io/CharArrayReader.java (read): It should throw
        IndexOutOfBoundsException and not ArrayIndexOutOfBoundsException (see
        mauve).
Index: gnu/java/net/protocol/http/Connection.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/http/Connection.java,v
retrieving revision 1.7
diff -u -r1.7 Connection.java
--- gnu/java/net/protocol/http/Connection.java  27 Dec 2003 12:58:35 -0000      1.7
+++ gnu/java/net/protocol/http/Connection.java  27 Dec 2003 16:21:36 -0000
@@ -255,6 +255,8 @@
         || (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 String getHeaderField(int n)
   {
+    if (!connected)
+      try
+       {
+         connect();
+       }
+      catch (IOException e)
+       {
+         return null;
+       }
+
     return headers.getHeaderFieldValueByIndex (n);
   }
 
@@ -434,6 +446,16 @@
    */
   public String getHeaderFieldKey(int n)
   {
+    if (!connected)
+      try
+       {
+         connect();
+       }
+      catch (IOException e)
+       {
+         return null;
+       }
+
     return headers.getHeaderFieldKeyByIndex (n);
   }
 }
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to