[kaffe] HttpURLConnection CVS regression from 1.0.7
robilad at yahoo.com
Wed May 7 01:11:02 PDT 2003
In-Reply-To: <1051444889.6017.26.camel at elsschot>
Content-Type: text/plain; charset=us-ascii
since you wrote the last HTTP proxy handling patch, could you take a look at
--- Mark Wielaard <mark at klomp.org> wrote:
> I have a little snippet of code (adapted to work standalone) that works
> with kaffe 1.0.7 but not with the CVS version:
> import java.io.*;
> import java.net.*;
> public class TC
> public static void main(String args) throws Exception
> URL u = new URL("http://www.gnu.org/");
> URLConnection c = u.openConnection();
> InputStream in = c.getInputStream();
> if (c instanceof HttpURLConnection)
> // Check whether the page exists
> int code = ((HttpURLConnection)c).getResponseCode();
> if (code/100 != 2) // We can only handle 200 OK
> System.err.println("Loading page gave error code "
> + code + ", it probably doesn't exists");
> // Do something with the inputstream
> With kaffe from CVS it always gives reponse code -1.
> This seems to be caused by a combination of the new proxy activation
> code in
> which precents creation of a new socket everytime which the old code did
> on a connect (since the socket == null check was missing) and the fact
> that connect is called from both URL.openConnection() and the above
> URLConnection.connect() in my code.
> It seems a good idea to not call connect() in openConnection() as done
> in this patch, but I have not thought this through completely.
> diff -u -r1.29 URL.java
> --- libraries/javalib/java/net/URL.java 15 Apr 2002 15:10:01 -0000 1.29
> +++ libraries/javalib/java/net/URL.java 27 Apr 2003 11:52:55 -0000
> @@ -229,7 +229,6 @@
> // We *ALWAYS* open a new connection even if we already have
> // one open.
> conn = handler.openConnection(this);
> - conn.connect();
> return (conn);
> kaffe mailing list
> kaffe at kaffe.org
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
More information about the kaffe