OSDN Git Service

Handle the different definitions of 'connected' in HttpURLConnection.
authorJesse Wilson <jessewilson@google.com>
Fri, 17 Sep 2010 23:26:57 +0000 (16:26 -0700)
committerJesse Wilson <jessewilson@google.com>
Fri, 17 Sep 2010 23:32:21 +0000 (16:32 -0700)
commitac277be6a146ade8f150236edf730431a7e12482
treef61b081c519494043e380a3aafc09b0e89207215
parentd4bddd7d1fb7b1b7f0836648228235c6e4b56a18
Handle the different definitions of 'connected' in HttpURLConnection.

Previously we were failing with a NullPointerException when
HTTP redirects required connecting to a different server.

The connected field means 'we can't change request parameters'.
The connection being non-null means 'we're currently connected'.

Internally, multiple connections are permitted in order to support
HTTP redirects. But in the public API only one connect() call is
permitted.

I've added a new method, makeConnection() to make the magic work.

Change-Id: Ic644d5d192ec2b1de781dc271ae149bcd1655de4
luni/src/main/java/java/net/URLConnection.java
luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java