Details
-
Wish
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
-
Windows XP/Linux/FreeBSD
Description
The http provider classes don't test the header location before resolving a file. If the redirection is reported as invalid by commons-httpclient, then the HttpFileObject is not resolved. Here is how to fix it in all the http provider implementation classes.
int status = 0;//client.executeMethod(method);
try
catch(Exception e){
System.out.println("Exception co");
try{
HostConfiguration config = client.getHostConfiguration();
Header header = method.getResponseHeader("Location");
System.out.println("Checking header");
if (header != null)
}
catch(Exception err)
}
if ((status >= 300) && (status < 400)) {
try{
HostConfiguration config = client.getHostConfiguration();
Header header = method.getResponseHeader("Location");
if (header != null) { String redirectUrl = header.getValue(); method = new HeadMethod(); setupMethod(method); config.setHost(new java.net.URL(redirectUrl).getHost(), config.getPort(), config.getProtocol()); client.setHostConfiguration(config); status = client.executeMethod(method); }
}
catch(Exception err){ throw new Exception(err); }
}
method.releaseConnection();
if (status == HttpURLConnection.HTTP_OK)
else if (status == HttpURLConnection.HTTP_NOT_FOUND
status == HttpURLConnection.HTTP_GONE)
{
return FileType.IMAGINARY;
}
else { throw new FileSystemException("vfs.provider.http/head.error", getName()); } |
---|
Attachments
Attachments
Issue Links
- duplicates
-
VFS-432 [HTTP][WebDAV] Allow HTTP follow redirect
- Closed