diff options
| author | Mark Wielaard <mark@klomp.org> | 2005-04-27 08:55:56 +0000 |
|---|---|---|
| committer | Mark Wielaard <mark@klomp.org> | 2005-04-27 08:55:56 +0000 |
| commit | 28cc78040f84736317bdaedafed9a6f23b75032d (patch) | |
| tree | f30876e345c6d5f63660a9aadd3352170a181213 /gnu/java/net/protocol | |
| parent | a3172bf077192b76aa31ed73b41b730fd945ce58 (diff) | |
| download | classpath-28cc78040f84736317bdaedafed9a6f23b75032d.tar.gz | |
2005-04-27 Chris Burdess <dog@gnu.org>
* java/net/protocol/http/HTTPURLConnection.java (connect): Accept
absolute and relative paths in Location header.
Diffstat (limited to 'gnu/java/net/protocol')
| -rw-r--r-- | gnu/java/net/protocol/http/HTTPURLConnection.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gnu/java/net/protocol/http/HTTPURLConnection.java b/gnu/java/net/protocol/http/HTTPURLConnection.java index 78505b788..50a6ed12e 100644 --- a/gnu/java/net/protocol/http/HTTPURLConnection.java +++ b/gnu/java/net/protocol/http/HTTPURLConnection.java @@ -283,7 +283,23 @@ public class HTTPURLConnection file = location.substring(end); retry = true; } - // Otherwise this is not an HTTP redirect, can't follow + else if (location.length() > 0) + { + // Malformed absolute URI, treat as file part of URI + if (location.charAt(0) == '/') + { + // Absolute path + file = location; + } + else + { + // Relative path + int lsi = file.lastIndexOf('/'); + file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); + file += location; + } + retry = true; + } } else { |
