2003/09/30 21:36:31
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:38:48 +0000 (07:38 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:38:48 +0000 (07:38 +0000)
darcs-hash:20040130073848-2ba56-5a18c3106d2d350c14b9822baf1e0b0f8215beb9.gz

src/org/xwt/Box.java.pp
src/org/xwt/HTTP.java

index 7a4fc72..362f033 100644 (file)
@@ -137,6 +137,7 @@ public final class Box extends JS.Scope {
     private VectorGraphics.VectorPath path = null;
     //private SVG.Paint fill = null;
     //private SVG.Paint stroke = null;
+    int strokewidth = 1;
 
     public Picture image;                        // will disappear
     private int fillcolor = 0x00000000;          // will become SVG.Paint
@@ -982,7 +983,7 @@ public final class Box extends JS.Scope {
                     } });
         
             specialBoxProperties.put("strokewidth", new SpecialBoxProperty() {
-                    public Object get(Box b) { return b.strokewidth; }
+                    public Object get(Box b) { return new Integer(b.strokewidth); }
                     public void put(Box b, Object value) {
                         if (b.strokewidth == stoi(value)) return;
                         b.strokewidth = stoi(value);
index cc476cb..ec46105 100644 (file)
@@ -51,6 +51,9 @@ public class HTTP {
      */
     Semaphore okToRecieve = null;
 
+    /** true iff this is the first request to be made on this socket */
+    boolean firstRequest = true;
+
     /** cache for resolveAndCheckIfFirewalled() */
     static Hashtable resolvedHosts = new Hashtable();
 
@@ -89,8 +92,7 @@ public class HTTP {
                 connect();
                 sendRequest(contentType, content);
             } catch (IOException e) {
-                sock = null;
-                in = null;
+                reset();
                 throw e;
             }
             blockOn = okToRecieve;
@@ -110,8 +112,9 @@ public class HTTP {
             
             Hashtable h = in == null ? null : parseHeaders(in);
             if (h == null) {
+                if (firstRequest) throw new HTTPException("server closed the socket with no response");
                 // sometimes the server chooses to close the stream between requests
-                in = null; sock = null;
+                reset();
                 releaseMe.release();
                 return makeRequest(contentType, content);
             }
@@ -125,7 +128,7 @@ public class HTTP {
                 
                 if (h.get("HTTP").equals("1.0") && h.get("content-length") == null) {
                     if (Log.on) Log.log(this, "proxy returned an HTTP/1.0 reply with no content-length...");
-                    in = null; sock = null;
+                    reset();
                 } else {
                     int cl = h.get("content-length") == null ? -1 : Integer.parseInt(h.get("content-length").toString());
                     new HTTPInputStream(in, cl, releaseMe).close();
@@ -147,7 +150,7 @@ public class HTTP {
                 
             }
             
-        } catch (IOException e) { sock = null; in = null; throw e;
+        } catch (IOException e) { reset(); throw e;
         } finally { if (doRelease) releaseMe.release();
         }
     }
@@ -550,7 +553,7 @@ public class HTTP {
                 }
                 return ret;
             } finally {
-                if (!good) { HTTP.this.sock = null; HTTP.this.in = null; }
+                if (!good) reset();
             }
         }
 
@@ -568,6 +571,12 @@ public class HTTP {
         }
     }
 
+    void reset() {
+        firstRequest = true;
+        in = null;
+        sock = null;
+    }
+
 
     // Misc Helpers ///////////////////////////////////////////////////////////////////////////////////