Last active
January 8, 2016 04:41
-
-
Save 6londe/28a900c7bebb21f61a5e to your computer and use it in GitHub Desktop.
url: bypass.jsp?http://some.url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@page session="false"%> | |
<%@page import="java.net.*,java.io.*"%> | |
<% | |
try { | |
String reqUrl = request.getQueryString(); | |
URL url = new URL(reqUrl); | |
HttpURLConnection con = (HttpURLConnection) url.openConnection(); | |
con.setDoOutput(true); | |
con.setRequestMethod(request.getMethod()); | |
int clength = request.getContentLength(); | |
if (clength > 0) { | |
con.setDoInput(true); | |
byte[] idata = new byte[clength]; | |
request.getInputStream().read(idata, 0, clength); | |
con.getOutputStream().write(idata, 0, clength); | |
} | |
response.setContentType(con.getContentType()); | |
BufferedReader rd = new BufferedReader(new InputStreamReader( | |
con.getInputStream())); | |
String line; | |
while ((line = rd.readLine()) != null) { | |
out.println(line); | |
} | |
rd.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
response.setStatus(500); | |
} | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment