summaryrefslogtreecommitdiff
path: root/gnu/java/net/protocol/http/HTTPURLConnection.java
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/java/net/protocol/http/HTTPURLConnection.java')
-rw-r--r--gnu/java/net/protocol/http/HTTPURLConnection.java18
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
{