mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Reject non-HTTP URIs
git-svn-id: https://zxing.googlecode.com/svn/trunk@2990 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
da9d32846a
commit
4550d1d762
|
@ -57,6 +57,7 @@ import java.net.MalformedURLException;
|
|||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -177,6 +178,13 @@ public final class DecodeServlet extends HttpServlet {
|
|||
return;
|
||||
}
|
||||
|
||||
String protocol = imageURL.getProtocol();
|
||||
if (!"http".equalsIgnoreCase(protocol) && !"https".equalsIgnoreCase(protocol)) {
|
||||
log.info("URI was not valid: " + imageURIString);
|
||||
response.sendRedirect("badurl.jspx");
|
||||
return;
|
||||
}
|
||||
|
||||
HttpURLConnection connection;
|
||||
try {
|
||||
connection = (HttpURLConnection) imageURL.openConnection();
|
||||
|
|
Loading…
Reference in a new issue