@@ -32,36 +32,9 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
32
32
try {
33
33
34
34
String sink = request .getParameter ("uri" );
35
- // URI(String str)
36
35
URI uri = new URI (sink );
37
-
38
- // URI(String scheme, String ssp, String fragment)
39
36
URI uri2 = new URI ("http" , sink , "fragement" );
40
-
41
- // URI(String scheme, String userInfo, String host, int port, String path,
42
- // String query, String fragment)
43
- URI uri3 = new URI ("http" , "userinfo" , "host" , 1 , "path" , "query" , "fragment" );
44
- // URI(String scheme, String host, String path, String fragment)
45
- URI uri4 = new URI ("http" , "host" , "path" , "fragment" );
46
- // URI(String scheme, String authority, String path, String query, String
47
- // fragment)
48
- URI uri5 = new URI ("http" , "authority" , "path" , "query" , "fragment" );
49
- URI uri6 = URI .create ("http://foo.com/" );
50
-
51
- // URL(String spec)
52
37
URL url1 = new URL (sink );
53
- // URL(String protocol, String host, int port, String file)
54
- URL url2 = new URL ("http" , "host" , 1 , "file" );
55
- // URL(String protocol, String host, String file)
56
- URL url3 = new URL ("http" , "host" , "file" );
57
- // URL(URL context, String spec)
58
- URL url4 = new URL (url3 , "http" );
59
- // URL(String protocol, String host, int port, String file, URLStreamHandler
60
- // handler)
61
- URL url5 = new URL ("http" , "host" , 1 , "file" , new Helper2 ());
62
-
63
- // URL(URL context, String spec, URLStreamHandler handler)
64
- URL url6 = new URL (url3 , "spec" , new Helper2 ());
65
38
66
39
URLConnection c1 = url1 .openConnection (); // $ SSRF
67
40
SocketAddress sa = new SocketAddress () {
@@ -110,13 +83,3 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
110
83
}
111
84
}
112
85
}
113
-
114
-
115
- class Helper2 extends URLStreamHandler {
116
- Helper2 () {
117
- }
118
-
119
- protected URLConnection openConnection (URL u ) throws IOException {
120
- return null ;
121
- }
122
- }
0 commit comments